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(); $check_if_email_exist = $this->UserModel->where('email',$this->request->getVar('email'))->find();
if($check_if_email_exist) if($check_if_email_exist)
{ {
return redirect()->to(base_url()."members_list"); return redirect()->to(base_url()."users_list");
}else{ }else{
@ -312,9 +312,9 @@ class Admin_controller extends BaseController
unset($UserData['state_canada']); unset($UserData['state_canada']);
$UserData['state'] = $state; $UserData['state'] = $state;
$userData['password'] = $password; $UserData['password'] = $password;
$userdata = $this->UserModel->save($userData); $userdata = $this->UserModel->save($UserData);
if ($userdata) if ($userdata)
@ -1104,11 +1104,12 @@ class Admin_controller extends BaseController
public function update_creditsModel($con) public function update_creditsModel($con)
{ {
$data['total'] = $this->request->getVar('total'); $data['total'] = $this->request->getVar('total');
$reason = $this->request->getVar('reason');
$id = $this->request->getVar('id'); $id = $this->request->getVar('id');
if($con == 'del') 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 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; echo $upt_data ? true : false;
} }
@ -1126,7 +1127,8 @@ class Admin_controller extends BaseController
for ($i=0; $i < $count ; $i++) 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['updated_by'] = session()->get('logged_admin_user');
$data['credit_points'] = $temp_data[0]['credit']; $data['credit_points'] = $temp_data[0]['credit'];
$data['package_name'] = $temp_data[0]['package_name']; $data['package_name'] = $temp_data[0]['package_name'];
@ -1143,7 +1145,10 @@ class Admin_controller extends BaseController
else else
{ {
$data2 = $this->request->getVar(); $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['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['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
$data2['updated_by'] = session()->get('logged_admin_user'); $data2['updated_by'] = session()->get('logged_admin_user');
$this->creditsModel->save($data2); $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--) { for( $i = count($data['credit_data']) - 1; $i >= 0 ; $i--) {
$date = new DateTime($data['credit_data'][$i]['created_at']); $date = new DateTime($data['credit_data'][$i]['created_at']);
$expirydate = new DateTime($data['credit_data'][$i]['expiring_date']); $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'];} {$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'] == 0) $balance = 0;
if($data['credit_data'][$i]['is_active'] == 1) 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 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')) $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')
->selectSum('cost', 'costSum') ->select('method')
->selectCount('package_name', 'pack_count') ->selectSum('credit_points', 'creditPointsSum')
->groupBy('package_name') ->selectSum('cost', 'costSum')
->where('order_id',$TransactionDatavalue['order_id']) ->selectCount('package_name', 'pack_count')
->where('is_active',1) ->groupBy('package_name')
->findAll(); ->where('order_id',$TransactionDatavalue['order_id'])
->where('is_active',1)
->findAll();
$TransactionDatavalue['credit_data'] = $credit_data; $TransactionDatavalue['credit_data'] = $credit_data;

View File

@ -7,7 +7,7 @@ class Member_credits_model extends Model
protected $table = 'member_credits'; protected $table = 'member_credits';
protected $primaryKey = 'id'; 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())) if($credit_data[$i]['expiring_date'] < date('m-d-Y', time()))
echo '<p>Credit Expiry</p>'; echo '<p>Credit Expiry</p>';
else 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 <?php
if($credit_data[$i]['running_balance'] > 0) 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>'; 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>'; 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> <td><div class="credit-trans"><?= $credit_data[$i]['avaiable_credit'] ?></div> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>

View File

@ -1,127 +1,143 @@
<style> <style>
.dataTables_filter{ .dataTables_filter{
margin-top: -35px; 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{ .buttons-csv{
text-align: center; background-color: white;
} */ color: #002B60;
</style> border-color: #000;
<!-- start page title --> }
<div class="row"> .test {
<div class="col-12"> box-shadow: 0 2px 6px 0 rgba(0,86,193,.5);
<div class="page-title-box page-title-box-alt"> cursor: pointer;
<h4 class="page-title">Members</h4> color: #fff;
<div class="page-title-right"> font-size: 15px;
<ol class="breadcrumb m-0"> padding: 10px;
<li class="breadcrumb-item"><a href="<?= base_url() ?>member_add"> width: 55px;
<button type="button" class="btn btn-primary waves-effect waves-light">Add</button> height: 25px;
</a></li> line-height: 8px;
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li> background: #00B4D5;
<li class="breadcrumb-item active">Datatables</li> --> border-radius: 5px;
</ol> font-weight: 500;
</div> display: block;
</div> }
</div> /* th{
</div> text-align: center;
<!-- end page title --> } */
</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="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<!-- <h4 class="header-title">Buttons example</h4> <!-- <h4 class="header-title">Buttons example</h4>
<p class="text-muted font-13 mb-4"> <p class="text-muted font-13 mb-4">
</p> --> </p> -->
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100"> <table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
<thead> <thead>
<tr> <tr>
<th hidden>id</th> <th hidden>id</th>
<th>Name</th> <th>Name</th>
<th>Mobile</th> <th>Mobile</th>
<th>Email</th> <th>Email</th>
<th>Credits</th> <th>Credits</th>
<th>Status</th> <th>Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($Membersdata as $row) <?php foreach ($Membersdata as $row)
{ ?> { ?>
<tr> <tr>
<td hidden><?php echo $row['id'];?></td> <td hidden><?php echo $row['id'];?></td>
<td><?php echo $row['name']." ".$row['last_name'];?></td> <td><?php echo $row['name']." ".$row['last_name'];?></td>
<td style="text-align: center;"><?php echo $row['mobile'];?></td> <td style="text-align: center;"><?php echo $row['mobile'];?></td>
<td><?php echo $row['email'];?></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 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><?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> <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) { ?> <?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> <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 { ?> <?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> <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 } ?> <?php } ?>
<i class="mdi mdi-eye-outline transaction" id="<?php echo md5($row['id']);?>" style="font-size:18px;" title="Transactions"></i> <i class="mdi mdi-eye-outline transaction" id="<?php echo md5($row['id']);?>" style="font-size:18px;" title="Transactions"></i>
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body--> </div> <!-- end card body-->
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
</div> </div>
<!-- end row--> <!-- end row-->
<!-- Modal content for the Large example --> <!-- 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 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-dialog modal-lg" id="modalname">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel"></h4> <h4 class="modal-title" id="myLargeModalLabel"></h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div> </div>
<div class="plus-ico" style="font-size:25px;text-align: end;padding-right: 40px;"></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 class="modal-body" id="model-table" ></div>
</div> </div>
</div> </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> <script>
@ -150,7 +166,7 @@ $(document).on('click','.mdi-plus-box',function(){
<div id="count_hide_show" class="mb-1 mt-2"></div> <div id="count_hide_show" class="mb-1 mt-2"></div>
<div class="mb-1 mt-2 col-md-4"> <div class="mb-1 mt-2 col-md-4">
<label class="form-label">Credit<span style="color: red;margin-left: 4px;">*</label> <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>
<div class="mb-1 mt-2 col-md-4"> <div class="mb-1 mt-2 col-md-4">
<label class="form-label">Cost<span style="color: red;margin-left: 4px;">*</label> <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> </select>
</div> </div>
<div class="mb-1 mt-2 col-md-12"> <div class="mb-1 mt-2 col-md-12">
<label class="form-label">Remarks</label> <label class="form-label">Remarks<span style="color: red;margin-left: 4px;">*</label>
<input type="text" class="form-control" name="remarks"> <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> </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> </form>
</div>` </div>`
$('.plus-ico').html(''); $('.plus-ico').html('');
$('#myLargeModalLabel').html("Add Credits For "+$('#empName').val()+" ") $('#fullWidthModalLabel').html("Add Credits For "+$('#empName').val()+" ")
$('#model-table').html(addForm); $('#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 CrieditCount = $(this).val();
var cost = res.OnePackValue[0]['value']; var cost = res.OnePackValue[0]['value'];
var costcount = cost * CrieditCount; var costcount = cost * CrieditCount;
$('#cost').val(costcount); $('#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) { error: function(xhr, status, error) {
@ -260,10 +312,11 @@ $(document).on('click','.credit_usage',function(){
success: function(response) { success: function(response) {
console.log(response) console.log(response)
// $("#modalname").removeClass("modal-sm").addClass("modal-lg"); // $("#modalname").removeClass("modal-sm").addClass("modal-lg");
$('#myLargeModalLabel').html("Credits Details") $('#fullWidthModalLabel').html("Credits Details")
$('#model-table').html(response); $('#model-table').html(response);
$('#plus').show();
$('.plus-ico').html('<i class="mdi mdi-plus-box" title="add"></i>'); $('.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) { error: function(xhr, status, error) {
// Handle the error here // Handle the error here
@ -276,6 +329,7 @@ $(document).on('click','.credit_usage',function(){
<script> <script>
$(document).on('click','.transaction',function(){ $(document).on('click','.transaction',function(){
var member_id = $(this).closest('i').attr('id'); var member_id = $(this).closest('i').attr('id');
$.ajax({ $.ajax({
@ -283,10 +337,11 @@ $(document).on('click','.transaction',function(){
method: 'GET', method: 'GET',
success: function(response) { success: function(response) {
// $("#modalname").removeClass("modal-sm").addClass("modal-lg"); // $("#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>'); // $('.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); $('#model-table').html(response);
$('#bs-example-modal-lg').modal('show'); $('#plus').hide();
$('#full-width-modal').modal('show');
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
// Handle the error here // Handle the error here
@ -298,15 +353,29 @@ $(document).on('click','.transaction',function(){
<script> <script>
$(document).on('click','.del-balance',function(){ $(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(); bal = $('.balance').html();
reason = $('#'+text).val();
cer_trans = $(this).attr('id').split('|')[0]; cer_trans = $(this).attr('id').split('|')[0];
tot = bal - cer_trans; tot = bal - cer_trans;
$.ajax({ $.ajax({
url:"<?= base_url(); ?>/update_creditsModel/del", url:"<?= base_url(); ?>/update_creditsModel/del",
method: 'POST', 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) { success: function(response) {
location.reload(); location.reload();
@ -315,30 +384,96 @@ $(document).on('click','.del-balance',function(){
// Handle the error here // Handle the error here
console.error(error); 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>
<script> <script>
$(document).on('click','.add-balance',function(){ $(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(); bal = $('.balance').html();
reason2 = $('#'+text).val();
cer_trans = $(this).attr('id').split('|')[0]; cer_trans = $(this).attr('id').split('|')[0];
tot = bal + cer_trans; tot = bal + cer_trans;
mem_id = $(this).attr('id').split('|')[0]
$.ajax({ $.ajax({
url:"<?= base_url(); ?>/update_creditsModel/add", url:"<?= base_url(); ?>/update_creditsModel/add",
method: 'POST', 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) { success: function(response) {
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
// Handle the error here // Handle the error here
console.error(error); 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>
<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> </script>

View File

@ -1589,6 +1589,13 @@ body.checkout .select2-container--default .select2-selection--single .select2-s
font-size: 15px; font-size: 15px;
color: #475569; 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{ .table-white .order-total div{
line-height: 40px; line-height: 40px;
} }