Merge branch 'main' of bitbucket.org:venbainformationtechnology/bb_sign

This commit is contained in:
bitbucket 2024-06-15 12:02:38 +05:30
commit 0ee352a6ad
7 changed files with 108 additions and 73 deletions

View File

@ -39,6 +39,7 @@ use CodeIgniter\Router\RouteCollection;
$routes->post('doc_rejection','ClientController::doc_rejection');
$routes->match(['get','post'],'/client_branch_list','ClientController::client_branch_list');
$routes->post('add_client_branch','ClientController::add_client_branch');
$routes->post('edit_client_branch','ClientController::edit_client_branch');
$routes->get('get_client_branch/(:any)','ClientController::get_client_branch/$1');
$routes->post('status_client_branch','ClientController::status_client_branch');
$routes->post('client_upload','ClientController::client_upload');

View File

@ -305,13 +305,32 @@ class ClientController extends BaseController
public function add_client_branch()
{
$data = $this->request->getPost();
$gst = $this->request->getPost('gst_no');
$client_branch = $this->ClientBranchModel->where('gst_no', $gst)->first();
if($client_branch){
return json_encode(false);
}else{
$data = $this->request->getPost();
$this->ClientBranchModel->insert($data);
return;
$this->ClientBranchModel->insert($data);
return json_encode(true);
}
}
public function edit_client_branch()
{
$id = $this->request->getPost('id');
$data = $this->request->getPost();
$this->ClientBranchModel->update($id, $data);
return json_encode('update');
}
public function get_client_branch($branch_id)
{
if ($branch_id) {

View File

@ -56,7 +56,7 @@
<td><?= $value['address']; ?></td>
<td><?= $value['city']; ?></td>
<td><?= $value['state']; ?></td>
<td><?= $value['postal_code']; ?></td>
<td><?= $value['pin_code']; ?></td>
<td><?= $value['contact']; ?></td>
<td>
<?php if ($value['isactive'] == 0): ?>
@ -182,7 +182,7 @@
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" required="" placeholder="PIN Code">
<input class="form-control" name="pin_code" type="text" id="pin_code" required="" placeholder="PIN Code">
</div>
</div>
</div>
@ -228,7 +228,7 @@
address: $('#address').val(),
city: $('#city').val(),
state: $('#state').val(),
postal_code: $('#postal_code').val(),
pin_code: $('#pin_code').val(),
mobile_no: $('#mobile_no').val()
};
@ -280,7 +280,7 @@
$('#address').val(response.address);
$('#branch_id').val(response.branch_id);
$('#city').val(response.city);
$('#postal_code').val(response.postal_code);
$('#pin_code').val(response.pin_code);
$('#state').val(response.state);
$('#country').val(response.country);
$('#state_code').val(response.state_code);

View File

@ -114,7 +114,7 @@
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" value="<?php echo $branch['postal_code']; ?>" required="" placeholder="Postal Code">
<input class="form-control" name="pin_code" type="text" id="pin_code" value="<?php echo $branch['pin_code']; ?>" required="" placeholder="Pin Code">
</div>
</div>
<div class="col-md-6">

View File

@ -13,7 +13,7 @@
<h4 class="page-title">Client Branch List</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class=""> <a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
<li class=""> <a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#client_branch_modal" class="btn btn-primary waves-effect">
Add Branch
</a>
</ol>
@ -39,7 +39,7 @@
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Postal Code</th>
<th>Pin Code</th>
<th>Mobile No</th>
<th>Active</th>
<th>Action</th>
@ -67,7 +67,7 @@
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['id']; ?>" onclick="editBranch(this)" class="edit-button dropdown-item"><i
<a data-toggle="modal" data-target="#client_branch_modal" value="<?= $value['id']; ?>" onclick="editBranch(this)" class="edit-button dropdown-item"><i
class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
<?php if($value['is_active'] == 1): ?>
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="fas fa-building"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
@ -94,7 +94,7 @@
</div> <!-- content -->
<div id="bike_make_login-modal" aria-hidden="true" aria-modal="true" data-backdrop="static" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div id="client_branch_modal" aria-hidden="true" aria-modal="true" data-backdrop="static" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
@ -105,14 +105,13 @@
</div>
<form id="model_form_data" class="px-4">
<input type="text" id="business_id" value="" hidden>
<input type="text" id="branch_id" hidden>
<input type="text" id="id" hidden>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="client">Client</label>
<select name="client" id="client" class="form-control" style="width: auto;">
<select name="client" id="client" class="form-control select2" style="width: auto;" required="true">
<option value="0">Select Client</option>
<?php foreach ($client_list as $key => $value) { ?>
<option value="<?php echo $value['client_id']; ?>"><?php echo $value['name']; ?></option>
@ -174,15 +173,15 @@
</div>
<div class="col-md-6">
<div class="form-group">
<label for="pincode">Pin Code</label>
<input class="form-control" name="postal_code" type="text" id="postal_code" required="" placeholder="Postal Code">
<label for="postalcode">Pin Code</label>
<input class="form-control" name="pin_code" type="text" id="pin_code" required="" placeholder="Pin Code">
</div>
</div>
</div>
<div class="form-group text-right">
<button class="btn btn-info waves-effect waves-light" type="submit" onclick="submitBranch(this)">Submit</button>
<button class="btn btn-info waves-effect waves-light" type="submit" onclick="submitBranch(event,this)">Submit</button>
</div>
</form>
@ -195,7 +194,7 @@
<script>
$(document).ready(function() {
$('#client').select2();
$('.select2').select2();
});
function statusChange(params) {
@ -235,14 +234,15 @@
$('#branch_type').html('Create Branch');
})
function submitBranch(params) {
function submitBranch(event,params) {
event.preventDefault();
if ($('#branch_id').val()) {
var url = '<?= base_url("edit_client_branch/"); ?>'+$('#branch_id').val();
}else{
var url = '<?= base_url("add_client_branch"); ?>';
console.log($('#client').val());
if ($('#client').val() == 0) {
toastr.warning('Select Client');
return;
}
var formData = {
client_id: $('#client').val(),
gst_no: $('#gst_no').val(),
@ -254,12 +254,19 @@
address: $('#address').val(),
city: $('#city').val(),
state: $('#state').val(),
postal_code: $('#postal_code').val(),
pin_code: $('#pin_code').val(),
mobile_no: $('#mobile_no').val()
};
if ($('#id').val()) {
var url = '<?= base_url("edit_client_branch"); ?>';
formData['id'] = $('#id').val();
}else{
var url = '<?= base_url("add_client_branch"); ?>';
}
var form = $(params).parent().parent();
// console.log(form);
var isValid = true;
form[0].querySelectorAll('[required]').forEach(function(element) {
if (!element.value.trim()) {
@ -270,7 +277,6 @@
if (!isValid) {
return;
}
var business_id = $('#business_id').val();
$.ajax({
type: 'POST',
@ -279,9 +285,19 @@
dataType: 'json',
success: function(response) {
console.log(response);
$('#bike_model_login-modal').modal('hide');
window.location.reload();
if(response == true){
toastr.success('Branch Added Successfully');
$('#client_branch_modal').modal('hide');
window.location.reload();
}else if(response == 'update'){
toastr.success('Branch Updated Successfully');
$('#client_branch_modal').modal('hide');
window.location.reload();
}else{
toastr.warning('GST Number Already Exists');
event.preventDefault();
}
},
error: function(xhr, status, error) {
// Handle error response here
@ -299,18 +315,17 @@
dataType: 'json',
success: function(response) {
console.log(response);
$('#client').val(response.client_id);
$('#client').val(response.client_id).trigger('change');
$('#branch_name').val(response.name);
$('#gst_no').val(response.gst_no);
$('#email').val(response.email);
$('#mobile_no').val(response.mobile_no);
$('#address').val(response.address);
$('#branch_id').val(response.branch_id);
$('#id').val(response.id);
$('#city').val(response.city);
$('#postal_code').val(response.pin_code);
$('#pin_code').val(response.pin_code);
$('#state').val(response.state);
$('#country').val(response.country);
$('#state_code').val(response.state_code);
},
error: function(xhr, status, error) {

View File

@ -37,7 +37,7 @@
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="mdi mdi-account-circle mr-1"></i> Personal Info</h5>
<form method="post"
<form method="post" id="staff_form"
<?php if(isset($staffData)){ ?> action="<?= base_url()."staff_edit"; ?>"
<?php } else { ?> action="<?= base_url()."staff_create"; ?>" <?php } ?>
class="parsley-examples">
@ -51,8 +51,8 @@
<div class="form-group col-md-4">
<label for="business">Business<span class="text-danger">*</span></label>
<select class="form-control business select2-dropdown" id="business_id" name="business_id" parsley-trigger="change" required >
<option >Select Business</option>
<select class="form-control slect2-dropdown" id="business_id" name="business_id" parsley-trigger="change" required >
<option value="0">Select Business</option>
<?php foreach ($business as $key => $value) { ?>
<option value="<?php echo $value['business_id']; ?>" <?php if(isset($staffData)){ echo ($staffData->business_id == $value['business_id']) ? 'selected' : '';} ?>>
<?php echo $value['business_name']; ?>
@ -62,8 +62,8 @@
</div>
<div class="form-group col-md-4">
<label for="branch">Branch<span class="text-danger">*</span></label>
<select class="form-control branch select2-dropdown" id="branch_id" name="branch_id" parsley-trigger="change" required >
<option >Select Branch</option>
<select class="form-control slect2-dropdown" id="branch_id" name="branch_id" parsley-trigger="change" required >
<option value="0">Select Branch</option>
<?php if(isset($staffData)){ foreach ($branch as $key => $value) { ?>
<option value="<?php echo $value['branch_id']; ?>" <?php echo ($staffData->branch_id == $value['branch_id']) ? 'selected' : ''; ?>>
<?php echo $value['branch_name']; ?>
@ -115,16 +115,8 @@
</div>
<div class="form-group text-right m-b-0">
<button class="btn btn-primary waves-effect waves-light mr-1" type="submit">
<button class="btn btn-primary waves-effect waves-light mr-1" id="staff_data_form_submit" type="submit">
Submit
</button>
@ -183,43 +175,51 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.19.0/js/md5.min.js"></script>
<script>
$('#staff_data_form_submit').click(function (event) {
event.preventDefault();
if($('#business_id').val() == 0){
toastr.warning('Select Business');
return;
}
if($('#branch_id').val() == 0){
console.log("branch");
toastr.warning('Select Branch');
return;
}
$('#staff_form').submit();
})
$(document).ready(function() {
$('.select2-dropdown').select2();
$('.slect2-dropdown').select2();
$('#business_id').change(function (params) {
var business_id = $(params.target).val();
$("#business_id").on("change", function() {
var business_id = $(this).val();
if (business_id) {
var branch_list = <?php echo json_encode($branch); ?>;
// Filter branch_list based on business_id
var filteredBranches = branch_list.filter(function(element) {
return element.business_id == business_id;
});
$('#branch_id').empty();
$('#branch_id option:not(:first)').remove();
$('#branch_id option:not(:first)').remove();
$('#branch_id').append($('<option>', {
value: 0,
text: "Select Branch"
}));
$.each(filteredBranches, function(index, item) {
$('#branch_id').append($('<option>', {
text: "Select Branch"
}));
$.each(filteredBranches, function(index, item) {
console.log(item);
$('#branch_id').append($('<option>', {
value: item.branch_id,
text: item.branch_name
}));
});
}));
});
}
});
});
});
</script>

View File

@ -3,7 +3,7 @@
'name' => 'codeigniter4/framework',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'b5cb4a5de15965151f25bc2688ec1a2bac8fa319',
'reference' => '5e2b80c08689c74422d2cbd8cdc949108768d74a',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -31,7 +31,7 @@
'codeigniter4/framework' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'b5cb4a5de15965151f25bc2688ec1a2bac8fa319',
'reference' => '5e2b80c08689c74422d2cbd8cdc949108768d74a',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),