197 lines
7.6 KiB
PHP
197 lines
7.6 KiB
PHP
<!-- ============================================================== -->
|
||
<!-- Start Page Content here -->
|
||
<!-- ============================================================== -->
|
||
|
||
<div class="content-page">
|
||
<!-- Start Content-->
|
||
<div class="container-fluid">
|
||
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4 class="page-title">Business List</h4>
|
||
<div class="page-title-right">
|
||
<a href="#" id="add_branch_model_open" data-toggle="modal" data-target="#bike_make_login-modal" class="btn btn-primary waves-effect">
|
||
|
||
<!-- <a href="<?= base_url('new_business/0'); ?>" class="btn btn-primary waves-effect waves-light"> -->
|
||
Create Business
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end page title -->
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
|
||
|
||
<table id="datatable-buttonss" class="table table-striped dt-responsive nowrap w-100">
|
||
<thead>
|
||
<tr>
|
||
<th>#</th>
|
||
<th>Business Name</th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
|
||
|
||
<tbody>
|
||
|
||
<?php foreach ($business as $value) :
|
||
if ($value['isactive'] == 1) : ?>
|
||
<tr>
|
||
<td><?= $value['business_id']; ?></td>
|
||
<td><?= $value['business_name']; ?></td>
|
||
|
||
<!-- Call the model method -->
|
||
<td>
|
||
<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['business_id']; ?>" onclick="editbusiness(this)" class="edit-button dropdown-item"><i
|
||
class="ri-pencil-line" style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||
<!-- <a href="<?= "new_business/" . $value['business_id']; ?>" class="edit-button" style="margin-right: 5px;"><i
|
||
class="ri-pencil-line"></i></a> -->
|
||
|
||
<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>
|
||
</td>
|
||
|
||
<?php endif?>
|
||
<?php endforeach; ?>
|
||
</tr>
|
||
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
</div> <!-- end card body-->
|
||
</div> <!-- end card -->
|
||
</div><!-- end col-->
|
||
</div>
|
||
|
||
|
||
|
||
</div> <!-- container -->
|
||
|
||
</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 class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 id="business_type">Add Business</h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="text-center mt-2 mb-4">
|
||
|
||
</div>
|
||
<form id="model_form_data" action="<?= base_url() . "add_business"; ?>" method="post" class="px-4">
|
||
|
||
<input type="text" id="business_id" name="business_id" hidden>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="form-group">
|
||
<label for="branchname">Business Name</label>
|
||
<input type="text" class="form-control" id="business_name" name="businessname" placeholder="Name" required>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-group text-right">
|
||
<button class="btn btn-info waves-effect waves-light" type="submit" >Submit</button>
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
|
||
|
||
<!-- ============================================================== -->
|
||
<!-- End Page content -->
|
||
<!-- ============================================================== -->
|
||
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
$('#datatable-buttonss').DataTable({
|
||
|
||
|
||
"ordering": false
|
||
});
|
||
});
|
||
|
||
function statusChange(params) {
|
||
console.log(params);
|
||
var status = params.getAttribute('data-isactive');
|
||
var client_id = params.getAttribute('data-id');
|
||
if(status == 1){
|
||
var is_active= 0;
|
||
}else{
|
||
var is_active= 1;
|
||
}
|
||
|
||
var formData = {
|
||
client_id: client_id,
|
||
is_active: is_active
|
||
};
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: '<?php echo base_url()."status_client"?>',
|
||
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 editbusiness(params) {
|
||
$('#business_type').html('Edit Business');
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: '<?= base_url("get_business/"); ?>' +params.getAttribute('value'),
|
||
dataType: 'json',
|
||
success: function(response) {
|
||
$('#business_name').val(response.business_name);
|
||
$('#business_id').val(response.business_id);
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle error response here
|
||
console.error(xhr.responseText);
|
||
}
|
||
});
|
||
}
|
||
|
||
$('#add_branch_model_open').click(function () {
|
||
$('#business_type').html('Add Business');
|
||
})
|
||
|
||
|
||
|
||
</script>
|