197 lines
7.2 KiB
PHP
197 lines
7.2 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>Email</th> -->
|
|
<!-- <th>Mobile</th> -->
|
|
<!-- <th style="width:10% !important">Address</th> -->
|
|
<!-- <th>City</th> -->
|
|
<!-- <th>State</th> -->
|
|
<!-- <th>Postal Code</th> -->
|
|
<!-- <th>Country</th> -->
|
|
<th>Branch List</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> <a href="<?= base_url("branch_index/" . $value['business_id']) ?>" style="margin-left: 20px;">View</a></td>
|
|
<td>
|
|
|
|
<a data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['business_id']; ?>" onclick="editbusiness(this)" class="edit-button"><i
|
|
class="ri-pencil-line" style="margin-right: 5px;"></i></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"><i class="ri-delete-bin-line"></i></a>
|
|
</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" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-body">
|
|
<div class="text-center mt-2 mb-4">
|
|
<h4>Add Business</h4>
|
|
</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-6">
|
|
<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-center">
|
|
<button class="btn btn-rounded btn-primary" 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) {
|
|
console.log(params.getAttribute('value'));
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: '<?= base_url("get_business/"); ?>' +params.getAttribute('value'),
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
console.log(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);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|