CHANGE_CORRECT_FULL_PAGE : AADHAVAN
This commit is contained in:
parent
68e7cf9b96
commit
de372c6f96
@ -40,7 +40,7 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
$routes->match(['get','post'],'/client_branch_list','ClientController::client_branch_list');
|
$routes->match(['get','post'],'/client_branch_list','ClientController::client_branch_list');
|
||||||
$routes->post('add_client_branch','ClientController::add_client_branch');
|
$routes->post('add_client_branch','ClientController::add_client_branch');
|
||||||
$routes->get('get_client_branch/(:any)','ClientController::get_client_branch/$1');
|
$routes->get('get_client_branch/(:any)','ClientController::get_client_branch/$1');
|
||||||
$routes->get('delete_client_branch/(:any)','ClientController::delete_client_branch/$1');
|
$routes->post('status_client_branch','ClientController::status_client_branch');
|
||||||
$routes->post('client_upload','ClientController::client_upload');
|
$routes->post('client_upload','ClientController::client_upload');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class BusinessController extends BaseController
|
|||||||
|
|
||||||
if ($business_id === '0') {
|
if ($business_id === '0') {
|
||||||
$data['business'] = [];
|
$data['business'] = [];
|
||||||
$data['page_name']="Add Business";
|
$data['page_name']="Create Business";
|
||||||
} else if ($business_id !== '0') {
|
} else if ($business_id !== '0') {
|
||||||
|
|
||||||
$BusinessModel = new BusinessModel();
|
$BusinessModel = new BusinessModel();
|
||||||
|
|||||||
@ -323,22 +323,26 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function delete_client_branch($branch_id)
|
public function status_client_branch()
|
||||||
{
|
{
|
||||||
$where = ['id' => $branch_id]; // Assuming 'isactive' is a column in your database
|
try {
|
||||||
$existingBranch = $this->ClientBranchModel->where($where)->first();
|
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||||
|
$is_active = $this->request->getPost('is_active');
|
||||||
|
$data = [
|
||||||
|
'is_active' => $is_active
|
||||||
|
];
|
||||||
|
|
||||||
if ($existingBranch) {
|
$updated = $this->ClientBranchModel->update($client_branch_id, $data);
|
||||||
$data['is_active'] = 0;
|
|
||||||
|
|
||||||
if ($this->ClientBranchModel->update($branch_id, $data)) {
|
if ($updated) {
|
||||||
session()->setFlashdata('success', 'Deleted successfully.');
|
return $this->respond(['status' => 'success','code' => 200,'data' => true],200);
|
||||||
$this->logger->info("Branch: has been Inactivated successfully. Inactivated ID = ".$branch_id);
|
} else {
|
||||||
|
$result = "No Match's";
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||||
}
|
}
|
||||||
}
|
} catch (\Exception $exception) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $exception],500);
|
||||||
|
}
|
||||||
return redirect()->to('client_branch_list');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class BranchModel extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'branches';
|
protected $table = 'branches';
|
||||||
protected $primaryKey = 'branch_id';
|
protected $primaryKey = 'branch_id';
|
||||||
protected $allowedFields = ['business_id','branch_id','branch_name','gstno','email','contact_1','contact_2','address','city','state','country','postal_code','state_code','isactive'];
|
protected $allowedFields = ['business_id','branch_id','branch_name','gstno','email','contact','address','city','state','country','postal_code','state_code','isactive'];
|
||||||
|
|
||||||
public function getBranchesByBusinessId($business_id)
|
public function getBranchesByBusinessId($business_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,7 +57,7 @@
|
|||||||
<td><?= $value['city']; ?></td>
|
<td><?= $value['city']; ?></td>
|
||||||
<td><?= $value['state']; ?></td>
|
<td><?= $value['state']; ?></td>
|
||||||
<td><?= $value['postal_code']; ?></td>
|
<td><?= $value['postal_code']; ?></td>
|
||||||
<td><?= $value['contact_1']; ?></td>
|
<td><?= $value['contact']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($value['isactive'] == 0): ?>
|
<?php if ($value['isactive'] == 0): ?>
|
||||||
<span style="color: red;">Inactive</span>
|
<span style="color: red;">Inactive</span>
|
||||||
@ -149,14 +149,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="contact1">Contact 1</label>
|
<label for="contact">Contact</label>
|
||||||
<input class="form-control" name="contact_1" type="text" id="contact_1" required="" minlength="6" maxlength="16" placeholder="Contact 1">
|
<input class="form-control" name="contact" type="text" id="contact" required="" minlength="6" maxlength="16" placeholder="Contact">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="contact2">Contact 2</label>
|
|
||||||
<input class="form-control" name="contact_2" type="text" id="contact_2" required="" minlength="6" maxlength="16" placeholder="Contact 2">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -227,8 +221,7 @@
|
|||||||
business_id: $('#business').val(),
|
business_id: $('#business').val(),
|
||||||
gstno: $('#gst_no').val(),
|
gstno: $('#gst_no').val(),
|
||||||
email: $('#email').val(),
|
email: $('#email').val(),
|
||||||
contact_1: $('#contact_1').val(),
|
contact: $('#contact').val(),
|
||||||
contact_2: $('#contact_2').val(),
|
|
||||||
country: $('#country').val(),
|
country: $('#country').val(),
|
||||||
state_code: $('#state_code').val(),
|
state_code: $('#state_code').val(),
|
||||||
branch_name: $('#branch_name').val(),
|
branch_name: $('#branch_name').val(),
|
||||||
@ -283,8 +276,7 @@
|
|||||||
$('#branch_name').val(response.branch_name);
|
$('#branch_name').val(response.branch_name);
|
||||||
$('#gst_no').val(response.gstno);
|
$('#gst_no').val(response.gstno);
|
||||||
$('#email').val(response.email);
|
$('#email').val(response.email);
|
||||||
$('#contact_1').val(response.contact_1);
|
$('#contact').val(response.contact);
|
||||||
$('#contact_2').val(response.contact_2);
|
|
||||||
$('#address').val(response.address);
|
$('#address').val(response.address);
|
||||||
$('#branch_id').val(response.branch_id);
|
$('#branch_id').val(response.branch_id);
|
||||||
$('#city').val(response.city);
|
$('#city').val(response.city);
|
||||||
|
|||||||
@ -68,18 +68,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="old_password">Contact 1</label>
|
<label for="old_password">Contact 1</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="contact_1" name="contact_1" value="<?php echo $branch['contact_1']; ?>" required>
|
<input type="text" class="form-control" id="contact_1" name="contact_1" value="<?php echo $branch['contact']; ?>" required>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="old_password">Contact 2</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="contact_2" name="contact_2" value="<?php echo $branch['contact_2']; ?>" required>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="old_password">Email</label>
|
<label for="old_password">Email</label>
|
||||||
|
|||||||
@ -8,10 +8,14 @@
|
|||||||
|
|
||||||
<!-- start page title -->
|
<!-- start page title -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-2">
|
||||||
|
</div>
|
||||||
|
<div class="col-8">
|
||||||
<div class="page-title-box page-title-box-alt">
|
<div class="page-title-box page-title-box-alt">
|
||||||
<h4 class="page-title">Create Business</h4>
|
<h4 class="page-title"><?php echo $page_name; ?></h4>
|
||||||
<div class="page-title-right">
|
<div class="page-title-right">
|
||||||
|
<a onclick="window.history.back()" class="btn btn-secondary waves-effect waves-light"> Back </a>
|
||||||
|
|
||||||
<ol class="breadcrumb m-0">
|
<ol class="breadcrumb m-0">
|
||||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Minton</a></li>
|
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Minton</a></li>
|
||||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Pages</a></li>
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Pages</a></li>
|
||||||
|
|||||||
@ -60,8 +60,9 @@
|
|||||||
<div class="btn-group dropdown">
|
<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>
|
<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">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a data-toggle="modal" data-target="#business-create-modal" value="<?= $value['business_id']; ?>" onclick="editbusiness(this)" class="edit-button dropdown-item"><i
|
<a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button dropdown-item" >
|
||||||
class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
<i class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit
|
||||||
|
</a>
|
||||||
|
|
||||||
<?php if($value['isactive'] == 1): ?>
|
<?php if($value['isactive'] == 1): ?>
|
||||||
<a class="dropdown-item" data-id="<?php echo $value['business_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" 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>
|
<a class="dropdown-item" data-id="<?php echo $value['business_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" 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>
|
||||||
@ -69,8 +70,6 @@
|
|||||||
<a class="dropdown-item" data-id="<?php echo $value['business_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this)"><i class="fas fa-building" style="margin-right:10px"></i>Activate</a>
|
<a class="dropdown-item" data-id="<?php echo $value['business_id']; ?>" data-isactive="<?php echo $value['isactive']; ?>" title="Activate" onclick="statusChange(this)"><i class="fas fa-building" style="margin-right:10px"></i>Activate</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<a href="<?= "delete_business/" . $value['business_id']; ?>"
|
|
||||||
class="delete-button dropdown-item"><i style="margin-right: 16px !important;margin-left: 5px;" class="ri-delete-bin-line"></i>Delete</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -69,8 +69,11 @@
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<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="#bike_make_login-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>
|
class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||||||
<a href="<?= base_url("delete_client_branch/".$value['id']); ?>"
|
<?php if($value['is_active'] == 1): ?>
|
||||||
class="delete-button dropdown-item"><i style="margin-right: 16px !important;margin-left: 5px;" class="ri-delete-bin-line"></i>Delete</a>
|
<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>
|
||||||
|
<?php else: ?>
|
||||||
|
<a class="dropdown-item" data-id="<?php echo $value['id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Activate" onclick="statusChange(this)"><i class="fas fa-building" style="margin-right:10px"></i>Activate</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -194,6 +197,41 @@
|
|||||||
$('#client').select2();
|
$('#client').select2();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function statusChange(params) {
|
||||||
|
var status = params.getAttribute('data-isactive');
|
||||||
|
var client_branch_id = params.getAttribute('data-id');
|
||||||
|
if(status == 1){
|
||||||
|
var is_active= 0;
|
||||||
|
}else{
|
||||||
|
var is_active= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var formData = {
|
||||||
|
client_branch_id: client_branch_id,
|
||||||
|
is_active: is_active
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '<?php echo base_url()."status_client_branch"?>',
|
||||||
|
data: formData,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.data) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
// Handle error response here
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function submitBranch(params) {
|
function submitBranch(params) {
|
||||||
|
|
||||||
if ($('#branch_id').val()) {
|
if ($('#branch_id').val()) {
|
||||||
|
|||||||
@ -61,9 +61,9 @@
|
|||||||
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" onclick="getServiceData(this)" > <i class='mdi mdi-pencil-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" onclick="getServiceData(this)" > <i class='mdi mdi-pencil-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||||||
|
|
||||||
<?php if($value['is_active'] == 1): ?>
|
<?php if($value['is_active'] == 1): ?>
|
||||||
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="ri-shield-user-line"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
|
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="ri-service-line"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Activate" onclick="statusChange(this)"><i class="ri-shield-user-line" style="margin-right:10px"></i>Activate</a>
|
<a class="dropdown-item" data-id="<?php echo $value['service_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Activate" onclick="statusChange(this)"><i class="ri-service-line" style="margin-right:10px"></i>Activate</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user