new changes admin,member controller

This commit is contained in:
venkateswaran ubuntu 2023-08-22 18:02:10 +05:30
parent 5a07f82bff
commit 52c237d2fd
6 changed files with 353 additions and 155 deletions

View File

@ -290,7 +290,7 @@ class Admin_controller extends BaseController
$check_if_email_exist = $this->UserModel->where('email',$this->request->getVar('email'))->find();
if($check_if_email_exist)
{
return redirect()->to(base_url()."members_list");
return redirect()->to(base_url()."users_list");
}else{
@ -312,9 +312,9 @@ class Admin_controller extends BaseController
unset($UserData['state_canada']);
$UserData['state'] = $state;
$userData['password'] = $password;
$UserData['password'] = $password;
$userdata = $this->UserModel->save($userData);
$userdata = $this->UserModel->save($UserData);
if ($userdata)
@ -1104,11 +1104,12 @@ class Admin_controller extends BaseController
public function update_creditsModel($con)
{
$data['total'] = $this->request->getVar('total');
$reason = $this->request->getVar('reason');
$id = $this->request->getVar('id');
if($con == 'del')
$upt_data = $this->creditsModel->where('id', $id )->set(array( 'is_active' => 0 ))->update();
$upt_data = $this->creditsModel->where('id', $id )->set(array( 'is_active' => 0, 'reason'=> $reason ))->update();
else
$upt_data = $this->creditsModel->where('id', $id )->set(array( 'is_active' => 1 ))->update();
$upt_data = $this->creditsModel->where('id', $id )->set(array( 'is_active' => 1, 'reason'=> $reason ))->update();
echo $upt_data ? true : false;
}
@ -1126,7 +1127,8 @@ class Admin_controller extends BaseController
for ($i=0; $i < $count ; $i++)
{
$data['running_balance'] = $temp_data[0]['credit'];;
$data['order_id'] = $orderId = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'A';
$data['running_balance'] = $temp_data[0]['credit'];
$data['updated_by'] = session()->get('logged_admin_user');
$data['credit_points'] = $temp_data[0]['credit'];
$data['package_name'] = $temp_data[0]['package_name'];
@ -1143,7 +1145,10 @@ class Admin_controller extends BaseController
else
{
$data2 = $this->request->getVar();
// print_r($data2); die();
$data2['order_id'] = $orderId = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'A';
$data2['running_balance'] = $this->request->getVar('credit_points');
$data2['remark'] = $this->request->getVar('remarks');
$data2['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
$data2['updated_by'] = session()->get('logged_admin_user');
$this->creditsModel->save($data2);
@ -1182,7 +1187,15 @@ class Admin_controller extends BaseController
}
}
$output = '<input id="empName" type="hidden" value="'.$fname.' '.$lname.'"><input id="empId" type="hidden" value="'.$id.'"><h4 style="margin-top: -44px !important;position:absolute;">Member Name : '.$fname.' '.$lname.'</h4><div class="table-responsive"><table class="table mb-0"><thead class="thead-light"><tr> <th>Order Id</th><th>Order Date</th><th>Expiry Date</th><th>Credit Transactions</th><th>Credit Balance</th></th><th>Action</th></tr></thead><tbody>';
$output = '<input id="empName" type="hidden" value="'.$fname.' '.$lname.'"><input id="empId" type="hidden" value="'.$id.'"><h4 style="margin-top: -44px !important;position:absolute;">Member Name : '.$fname.' '.$lname.'</h4><div class="table-responsive">
<table class="table mb-0"><thead class="thead-light"><tr>
<th style="text-align: center;">Order Id</th>
<th style="text-align: center;">Order Date</th>
<th style="text-align: center;">Expiry Date</th>
<th style="text-align: center;">Credit Transactions</th>
<th style="text-align: center;">Credit Balance</th></th>
<th style="text-align: center;">Action</th></tr>
</thead><tbody>';
for( $i = count($data['credit_data']) - 1; $i >= 0 ; $i--) {
$date = new DateTime($data['credit_data'][$i]['created_at']);
$expirydate = new DateTime($data['credit_data'][$i]['expiring_date']);
@ -1190,11 +1203,25 @@ class Admin_controller extends BaseController
{$balance = "+ ".$data['credit_data'][$i]['running_balance'];}else{$balance = "- ".$data['credit_data'][$i]['used_points'];}
// if($data['credit_data'][$i]['is_active'] == 0) $balance = 0;
if($data['credit_data'][$i]['is_active'] == 1)
$output .='<tr><td>'.$data['credit_data'][$i]['order_id'].'</td><td>'.$date->format('M d , Y').'</td><td>'.$expirydate->format('M d , Y').'</td><td style="text-align: center;">'.$balance.'</td><td class="balance" style="text-align: center;">'.$data['credit_data'][$i]['avaiable_credit'].'</td><td style="text-align: center;" title="delete"><i id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'" class="mdi mdi-delete del-balance" style="font-size:20px;"></i></td></tr>';
$output .='<tr>
<td style="text-align: center;">'.$data['credit_data'][$i]['order_id'].'</td>
<td style="text-align: center;">'.$date->format('M d , Y').'</td>
<td style="text-align: center;">'.$expirydate->format('M d , Y').'</td>
<td style="text-align: center;">'.$balance.'</td>
<td class="balance" style="text-align: center;">'.$data['credit_data'][$i]['avaiable_credit'].'</td>
<td style="text-align: center;" title="delete"><i id="'.$data['credit_data'][$i]['id'].'" class="mdi mdi-delete del-balance" style="font-size:20px;"></i><div id="'.$data['credit_data'][$i]['id'].'text" style="display:none;" ><div class="d-flex"><input type="text" id="'.$data['credit_data'][$i]['id'].'right" class="del-balance-confirmation form-control">&nbsp;<i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'"></i>&nbsp;<i class="mdi mdi-close-circle mdi-24px" id="'.$data['credit_data'][$i]['id'].'hide" ></i></div></div></td></tr>';
else
$output .='<tr ><td style="text-decoration:line-through;">'.$data['credit_data'][$i]['order_id'].'</td><td style="text-decoration:line-through;" >'.$date->format('M d , Y').'</td><td style="text-decoration:line-through;" >'.$expirydate->format('M d , Y').'</td><td style="text-align: center; text-decoration:line-through;">'.$balance.'</td><td class="balance" style="text-align: center;">'.$data['credit_data'][$i]['avaiable_credit'].'</td><td style="text-align: center;" title="Retrieve"><i id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'" class="mdi mdi-file-plus add-balance" style="font-size:20px;"></i></td></tr>';
$output .='<tr >
<td style="text-decoration:line-through; text-align: center;">'.$data['credit_data'][$i]['order_id'].'</td>
<td style="text-decoration:line-through; text-align: center;" >'.$date->format('M d , Y').'</td>
<td style="text-decoration:line-through; text-align: center;" >'.$expirydate->format('M d , Y').'</td>
<td style="text-align: center; text-decoration:line-through; text-align: center;">'.$balance.'</td>
<td class="balance" style="text-align: center;">'.$data['credit_data'][$i]['reason'].
'</td>
<td style="text-align: center;" title="Retrieve"><i id="'.$data['credit_data'][$i]['id'].'" class="mdi mdi-file-plus add-balance" style="font-size:20px;"></i><div id="'.$data['credit_data'][$i]['id'].'text" style="display:none;"><div class="d-flex"><input id="'.$data['credit_data'][$i]['id'].'right" type="text" class="add-balance-confirmation form-control">&nbsp;<i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'" ></i>&nbsp;<i class="mdi mdi-close-circle mdi-24px" id="'.$data['credit_data'][$i]['id'].'hide" ></i></div></div></td></tr>';
}
echo $output .= '</tbody></table></div> ';
echo $output .= '</tbody></table></div>';
}

View File

@ -1252,27 +1252,31 @@ class Member_controller extends BaseController
$credit_data = $this->creditsModel->where('member_id', session()->get('logged_user'))
->select('package_name')
->select('package_name')
->select('cost')
->select('cost')
->select('credit_points')
->select('credit_points')
->select('expiring_date')
->select('expiring_date')
->selectSum('credit_points', 'creditPointsSum')
->select('remark')
->select('method')
->selectSum('cost', 'costSum')
->selectSum('credit_points', 'creditPointsSum')
->selectCount('package_name', 'pack_count')
->selectSum('cost', 'costSum')
->groupBy('package_name')
->selectCount('package_name', 'pack_count')
->where('order_id',$TransactionDatavalue['order_id'])
->groupBy('package_name')
->where('is_active',1)
->where('order_id',$TransactionDatavalue['order_id'])
->findAll();
->where('is_active',1)
->findAll();
$TransactionDatavalue['credit_data'] = $credit_data;

View File

@ -7,7 +7,7 @@ class Member_credits_model extends Model
protected $table = 'member_credits';
protected $primaryKey = 'id';
protected $allowedFields = ['member_id','pack_id','package_name','package_type','credit_points','running_balance','used_points', 'expired_points','expiring_date', 'cost' ,'is_active', 'order_id','transaction_id' ,'cost_with_tax','method','created_by', 'remark' ];
protected $allowedFields = ['member_id','pack_id','package_name','package_type','credit_points','running_balance','used_points', 'expired_points','expiring_date', 'cost' ,'is_active', 'order_id','transaction_id' ,'cost_with_tax','method','created_by', 'remark', 'reason' ];
}

View File

@ -110,12 +110,27 @@
if($credit_data[$i]['expiring_date'] < date('m-d-Y', time()))
echo '<p>Credit Expiry</p>';
else
echo '<p>'.$credit_data[$i]['package_name'].'</p>';
echo '<p>'.$credit_data[$i]['package_name'].'</p>' ;
if(empty($credit_data[$i]['remark']))
echo " ";
else
echo '<p class="remark">Remark : ' . $credit_data[$i]['remark'] .'</p>' ;
?>
<!-- <p class="mb-0">Expiry Date : <?php $date = new DateTime($credit_data[$i]['expiring_date']); echo $date->format('M d , Y'); ?></p> -->
<p class="mb-0">Validity : One year from the date of opening</p>
<p>Order Id : <?php echo $credit_data[$i]['order_id'] ?></p></td>
<!-- <p class="mb-0">Expiry Date : <?php $date = new DateTime($credit_data[$i]['expiring_date']); echo $date->format('M d , Y'); ?></p> -->
<p class="mb-0 validity">Validity : One year from the date of opening</p>
<p class="payment">Order Id : <?php echo $credit_data[$i]['order_id'] ?></p>
<p class="payment"><?php if(empty($credit_data[$i]['method'])) {
echo "";
}else{
echo 'Payment : ' . $credit_data[$i]['method'];
}
?></p></td>
<?php
if($credit_data[$i]['running_balance'] > 0)
echo '<td><div class="credit-trans"><i class="fa fa-caret-up" aria-hidden="true"></i> '.$credit_data[$i]['running_balance'].'</div></td>';
@ -123,6 +138,7 @@
echo '<td class="red-content"><div class="credit-trans"><i class="fa fa-sort-desc" aria-hidden="true"></i>'.$credit_data[$i]['used_points'].'</div> </td>';
?>
<td><div class="credit-trans"><?= $credit_data[$i]['avaiable_credit'] ?></div> </td>
</tr>
<?php } ?>
</tbody>

View File

@ -1,129 +1,145 @@
<style>
.dataTables_filter{
margin-top: -35px;
<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 -->
.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">
<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> -->
<!-- <h4 class="header-title">Buttons example</h4>
<p class="text-muted font-13 mb-4">
<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-->
</p> -->
<!-- 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>
<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 id="plus" 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> -->
<!-- Full width modal content -->
<div id="full-width-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
<div class="modal-dialog modal-full-width">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="fullWidthModalLabel"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id="plus" class="plus-ico" style="font-size:25px;text-align: end;padding-right: 40px;"></div>
<div class="modal-body" id="model-table">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(document).on('click','.mdi-plus-box',function(){
var rule_key = '14';
@ -150,7 +166,7 @@ $(document).on('click','.mdi-plus-box',function(){
<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="number" class="form-control" name="credit_points" id="credit" required onKeyDown="return false" value="1">
<input type="number" class="form-control" name="credit_points" id="credit" required value="1" onkeypress = "return matchnum(event)">
</div>
<div class="mb-1 mt-2 col-md-4">
<label class="form-label">Cost<span style="color: red;margin-left: 4px;">*</label>
@ -165,27 +181,63 @@ $(document).on('click','.mdi-plus-box',function(){
</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">
<label class="form-label">Remarks<span style="color: red;margin-left: 4px;">*</label>
<input type="text" class="form-control" name="remarks" maxlength="30">
<span style="color: red;margin-left: 4px;"><i>Remarks only allowed 30 Characters</i></span>
</div>
</div>
<div style="text-align:center;margin-top:30px;"><button type="submit" class="btn btn-primary waves-effect waves-light">Add</button></div>
<div style="text-align:center;margin-top:30px;"><button type="submit" class="btn btn-primary waves-effect waves-light" id="button">Add</button></div>
</form>
</div>`
$('.plus-ico').html('');
$('#myLargeModalLabel').html("Add Credits For "+$('#empName').val()+" ")
$('#fullWidthModalLabel').html("Add Credits For "+$('#empName').val()+" ")
$('#model-table').html(addForm);
$('#bs-example-modal-lg').modal('show');
$('#full-width-modal').modal('show');
$('#credit').on('click', function(){
$('#credit').on('keyup', function(){
var CrieditCount = $(this).val();
var cost = res.OnePackValue[0]['value'];
var costcount = cost * CrieditCount;
$('#cost').val(costcount);
if (CrieditCount == 0)
{
$('#button').prop('disabled', true);
}
else
{
$('#button').prop('disabled', false);
}
});
$('#credit').on('click', function(){
var CrieditCount = $(this).val();
var cost = res.OnePackValue[0]['value'];
var costcount = cost * CrieditCount;
$('#cost').val(costcount);
if (CrieditCount == 0 || CrieditCount == "")
{
$('#button').prop('disabled', true);
}
else
{
$('#button').prop('disabled', false);
}
});
if ($('#credit').val() == 0)
{
$('#button').hide();
}
else
{
$('#button').show();
}
},
error: function(xhr, status, error) {
@ -260,10 +312,11 @@ $(document).on('click','.credit_usage',function(){
success: function(response) {
console.log(response)
// $("#modalname").removeClass("modal-sm").addClass("modal-lg");
$('#myLargeModalLabel').html("Credits Details")
$('#fullWidthModalLabel').html("Credits Details")
$('#model-table').html(response);
$('#plus').show();
$('.plus-ico').html('<i class="mdi mdi-plus-box" title="add"></i>');
$('#bs-example-modal-lg').modal('show');
$('#full-width-modal').modal('show');
},
error: function(xhr, status, error) {
// Handle the error here
@ -275,6 +328,7 @@ $(document).on('click','.credit_usage',function(){
<script>
$(document).on('click','.transaction',function(){
var member_id = $(this).closest('i').attr('id');
@ -283,10 +337,11 @@ $(document).on('click','.transaction',function(){
method: 'GET',
success: function(response) {
// $("#modalname").removeClass("modal-sm").addClass("modal-lg");
$('#myLargeModalLabel').html('Transaction Details')
$('#fullWidthModalLabel').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');
$('#plus').hide();
$('#full-width-modal').modal('show');
},
error: function(xhr, status, error) {
// Handle the error here
@ -298,15 +353,29 @@ $(document).on('click','.transaction',function(){
<script>
$(document).on('click','.del-balance',function(){
del_balance_hide = $(this).attr('id');
del_balance_text = $(this).attr('id')+'text';
hide_text = $(this).attr('id')+'hide';
text = $(this).attr('id')+'right';
$('#'+del_balance_text).show();
$('#'+del_balance_hide).hide();
$('.right').on('click', function() {
if(!$('#'+text).val() == "")
{
bal = $('.balance').html();
reason = $('#'+text).val();
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 },
data: { 'id' : $(this).attr('id').split('|')[1] , 'total' : tot , 'reason' : reason},
success: function(response) {
location.reload();
@ -315,30 +384,96 @@ $(document).on('click','.del-balance',function(){
// Handle the error here
console.error(error);
}
});
}
else
{
alert('this field is required');
}
});
$('#'+hide_text).on('click', function() {
text_hide = $(this).attr('id');
parts = text_hide.match(/[a-zA-Z]+|[0-9]+/g);
hide_input = parts[0] + 'text';
$('#'+hide_input).hide();
$('#'+parts[0] ).show();
});
});
</script>
<script>
$(document).on('click','.add-balance',function(){
add_balance_hide = $(this).attr('id');
add_balance_text = $(this).attr('id')+'text';
hide_text = $(this).attr('id')+'hide';
text = $(this).attr('id')+'right';
$('#'+add_balance_text).show();
$('#'+add_balance_hide).hide();
$('.right').on('click', function() {
if(!$('#'+text).val() == "")
{
bal = $('.balance').html();
reason2 = $('#'+text).val();
cer_trans = $(this).attr('id').split('|')[0];
tot = bal + cer_trans;
mem_id = $(this).attr('id').split('|')[0]
$.ajax({
url:"<?= base_url(); ?>/update_creditsModel/add",
method: 'POST',
data: { 'id' : $(this).attr('id').split('|')[1] , 'total' : tot },
data: { 'id' : $(this).attr('id').split('|')[1] , 'total' : tot, 'reason' : reason2 },
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {
// Handle the error here
console.error(error);
}
});
}
else
{
alert('this field is required');
}
});
$('#'+hide_text).on('click', function() {
text_hide = $(this).attr('id');
parts = text_hide.match(/[a-zA-Z]+|[0-9]+/g);
hide_input = parts[0] + 'text';
$('#'+hide_input).hide();
$('#'+parts[0] ).show();
});
});
</script>
<script>
@ -352,6 +487,15 @@ $(document).on('click','.add-balance',function(){
// }
});
});
function matchnum(event)
{
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true; //only numbers
return false;
}
</script>

View File

@ -1589,6 +1589,13 @@ body.checkout .select2-container--default .select2-selection--single .select2-s
font-size: 15px;
color: #475569;
}
.table-design p.remark, .table-design p.validity{
color: #475569;
margin-bottom:0;
}
.table-design p.payment, .table-design p.validity{
margin-bottom:0;
}
.table-white .order-total div{
line-height: 40px;
}