331 lines
14 KiB
PHP
331 lines
14 KiB
PHP
<style>
|
||
.dataTables_filter{
|
||
margin-top: -35px;
|
||
|
||
}
|
||
.buttons-csv{
|
||
background-color: white;
|
||
color: #002B60;
|
||
border-color: #000;
|
||
}
|
||
.test {
|
||
box-shadow: 0 2px 6px 0 rgba(0,86,193,.5);
|
||
cursor: pointer;
|
||
color: #fff;
|
||
font-size: 15px;
|
||
padding: 10px;
|
||
width: 55px;
|
||
height: 25px;
|
||
line-height: 8px;
|
||
background: #00B4D5;
|
||
border-radius: 5px;
|
||
font-weight: 500;
|
||
display: block;
|
||
}
|
||
/* th{
|
||
text-align: center;
|
||
} */
|
||
</style>
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4 class="page-title">Members</h4>
|
||
<div class="page-title-right">
|
||
<ol class="breadcrumb m-0">
|
||
<li class="breadcrumb-item"><a href="<?= base_url() ?>member_add">
|
||
<button type="button" class="btn btn-primary waves-effect waves-light">Add</button>
|
||
</a></li>
|
||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
||
<li class="breadcrumb-item active">Datatables</li> -->
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end page title -->
|
||
|
||
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
|
||
<!-- <h4 class="header-title">Buttons example</h4>
|
||
<p class="text-muted font-13 mb-4">
|
||
|
||
</p> -->
|
||
|
||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||
<thead>
|
||
<tr>
|
||
<th hidden>id</th>
|
||
<th>Name</th>
|
||
<th>Mobile</th>
|
||
<th>Email</th>
|
||
<th>Credits</th>
|
||
<th>Status</th>
|
||
<th>Action</th>
|
||
</tr>
|
||
</thead>
|
||
|
||
|
||
<tbody>
|
||
<?php foreach ($Membersdata as $row)
|
||
{ ?>
|
||
<tr>
|
||
<td hidden><?php echo $row['id'];?></td>
|
||
<td><?php echo $row['name']." ".$row['last_name'];?></td>
|
||
<td style="text-align: center;"><?php echo $row['mobile'];?></td>
|
||
<td><?php echo $row['email'];?></td>
|
||
<td class="credit_usage" style="text-align: center;" id="<?php echo md5($row['id']);?>"><span class="test"><?php echo $row['credits'];?></span></td>
|
||
<td><?php if($row['is_active'] == 1){ echo "Active"; }else{ echo "Deactive"; }?></td>
|
||
<td><a href="<?= base_url() ?>member_edit/<?php echo md5($row['id']);?>"><i class="mdi mdi-lead-pencil" style="font-size:18px;"></i></a>
|
||
<?php if ($row['is_active'] == 1) { ?>
|
||
<a href="<?= base_url() ?>member_deactivate/<?php echo md5($row['id']);?>"><i class="mdi mdi-account-check-outline" title="Deactivate" style="font-size:18px;"></i></a>
|
||
<?php } else { ?>
|
||
<a href="<?= base_url() ?>member_activate/<?php echo md5($row['id']);?>"><i class="mdi mdi-account-cancel-outline" title="Activate" style="font-size:18px;"></i></a>
|
||
<?php } ?>
|
||
|
||
<i class="mdi mdi-eye-outline transaction" id="<?php echo md5($row['id']);?>" style="font-size:18px;" title="Transactions"></i>
|
||
</td>
|
||
|
||
|
||
</tr>
|
||
<?php } ?>
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
</div> <!-- end card body-->
|
||
</div> <!-- end card -->
|
||
</div><!-- end col-->
|
||
</div>
|
||
<!-- end row-->
|
||
|
||
<!-- Modal content for the Large example -->
|
||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog modal-lg" id="modalname">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myLargeModalLabel"></h4>
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
<div class="plus-ico" style="font-size:25px;text-align: end;padding-right: 40px;"></div>
|
||
<div class="modal-body" id="model-table" ></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
$(document).on('click','.mdi-plus-box',function(){
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>get_pack_list",
|
||
method: 'GET',
|
||
success: function(response) {
|
||
pack=[];
|
||
JSON.parse(response).forEach((val,index) => {
|
||
pack[index] = `<option value="${val.id}">${val.package_name}</option>`;
|
||
});
|
||
addForm = `<div class="myform">
|
||
<form id="myform" method="POST" action="<?= base_url(); ?>add_creditsModel">
|
||
<input id="member_id" type="hidden" name="member_id" value="${ $('#empId').val() }">
|
||
<div class="row" style="width:80%;margin:auto;">
|
||
<div class="mb-1 mt-2 col-md-12 changeClass">
|
||
<label class="form-label">Pack</label>
|
||
<select name="package_name" id="packs" class="form-control">
|
||
<option value="">--SELECT--</option>
|
||
${pack}
|
||
</select>
|
||
</div>
|
||
<div id="count_hide_show" class="mb-1 mt-2"></div>
|
||
<div class="mb-1 mt-2 col-md-4">
|
||
<label class="form-label">Credit<span style="color: red;margin-left: 4px;">*</label>
|
||
<input type="text" class="form-control" name="credit_points" id="credit" required>
|
||
</div>
|
||
<div class="mb-1 mt-2 col-md-4">
|
||
<label class="form-label">Cost<span style="color: red;margin-left: 4px;">*</label>
|
||
<input type="text" class="form-control" name="cost" id="cost" required>
|
||
</div>
|
||
<div class="mb-1 mt-2 col-md-4">
|
||
<label class="form-label">Method<span style="color: red;margin-left: 4px;">*</label>
|
||
<select name="method" id="method" class="form-control" required>
|
||
<option value="">--SELECT--</option>
|
||
<option value="card">Card</option>
|
||
<option value="cash">Cash</option>
|
||
</select>
|
||
</div>
|
||
<div class="mb-1 mt-2 col-md-12">
|
||
<label class="form-label">Remarks</label>
|
||
<input type="text" class="form-control" name="remarks">
|
||
</div>
|
||
</div>
|
||
<div style="text-align:center;margin-top:30px;"><button type="submit" class="btn btn-primary waves-effect waves-light">Add</button></div>
|
||
</form>
|
||
</div>`
|
||
$('.plus-ico').html('');
|
||
$('#myLargeModalLabel').html("Add Credits ("+$('#empName').val()+" )")
|
||
$('#model-table').html(addForm);
|
||
$('#bs-example-modal-lg').modal('show');
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).on('change','#packs',function(){
|
||
id = $(this).val();
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>get_pack_list",
|
||
method: 'POST',
|
||
data: { 'id' : id },
|
||
success: function(response) {
|
||
if(JSON.parse(response).length > 0)
|
||
{
|
||
$('.changeClass').removeClass('col-md-12').addClass('col-md-8');
|
||
count_hide_show = `<label class="form-label">Count</label><input type="number" class="form-control" name="count" min="1" value="1" onKeyDown="return false">`;
|
||
$("#count_hide_show").addClass("col-md-4");
|
||
$('#count_hide_show').html(count_hide_show);
|
||
$('#credit').val(JSON.parse(response)[0].credit);
|
||
$('#credit').attr('readonly', true);
|
||
$('#cost').val(Number(JSON.parse(response)[0].cost).toFixed(2));
|
||
$('#cost').attr('readonly', true);
|
||
}
|
||
else
|
||
{
|
||
$('.changeClass').removeClass('col-md-8').addClass('col-md-12');
|
||
$('#count_hide_show').removeClass('col-md-4');
|
||
$('#count_hide_show').html('');
|
||
$('#credit').removeAttr('readonly');
|
||
$('#credit').val('');
|
||
$('#cost').val('');
|
||
$('#cost').removeAttr('readonly');
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).on('click','.credit_usage',function(){
|
||
|
||
var member_id = $(this).closest('td').attr('id');
|
||
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>view_credit_details/"+member_id,
|
||
method: 'GET',
|
||
success: function(response) {
|
||
// $("#modalname").removeClass("modal-sm").addClass("modal-lg");
|
||
$('#myLargeModalLabel').html('Credits Details')
|
||
$('#model-table').html(response);
|
||
$('.plus-ico').html('<i class="mdi mdi-plus-box" title="add"></i>');
|
||
$('#bs-example-modal-lg').modal('show');
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).on('click','.transaction',function(){
|
||
|
||
var member_id = $(this).closest('i').attr('id');
|
||
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>/transactions_list/"+member_id,
|
||
method: 'GET',
|
||
success: function(response) {
|
||
// $("#modalname").removeClass("modal-sm").addClass("modal-lg");
|
||
$('#myLargeModalLabel').html('Transaction Details')
|
||
// $('.plus-ico').html('<i class="mdi mdi-plus-box" title="add" style="font-size:25px;text-align: end;padding-right: 40px;"></i>');
|
||
$('#model-table').html(response);
|
||
$('#bs-example-modal-lg').modal('show');
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).on('click','.del-balance',function(){
|
||
// alert($(this).attr('id').split('|')[2])
|
||
alert($(this).attr('id').split('|')[1])
|
||
bal = $('.balance').html();
|
||
cer_trans = $(this).attr('id').split('|')[0];
|
||
tot = bal - cer_trans;
|
||
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>/update_creditsModel/del",
|
||
method: 'POST',
|
||
data: { 'id' : $(this).attr('id').split('|')[1] , 'total' : tot },
|
||
success: function(response) {
|
||
location.reload();
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).on('click','.add-balance',function(){
|
||
// alert($(this).attr('id').split('|')[2])
|
||
alert($(this).attr('id').split('|')[1])
|
||
bal = $('.balance').html();
|
||
cer_trans = $(this).attr('id').split('|')[0];
|
||
tot = bal + cer_trans;
|
||
|
||
$.ajax({
|
||
url:"<?= base_url(); ?>/update_creditsModel/add",
|
||
method: 'POST',
|
||
data: { 'id' : $(this).attr('id').split('|')[1] , 'total' : tot },
|
||
success: function(response) {
|
||
location.reload();
|
||
},
|
||
error: function(xhr, status, error) {
|
||
// Handle the error here
|
||
console.error(error);
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
$('#datatable-buttons').DataTable({
|
||
"order": [[0, 'desc']], // Set initial sorting to descending on the first column
|
||
"dom": 'Bfrtip', // Show export buttons
|
||
// "buttons": ['copy', 'csv', 'excel', 'pdf'], // Enable export options
|
||
// "language": {
|
||
// "search": "Search: " // Customize search label
|
||
// }
|
||
});
|
||
});
|
||
</script>
|
||
|
||
|
||
|