add,reduse_credit:GWM
This commit is contained in:
parent
c918c0d5ef
commit
246c3b1451
@ -1116,114 +1116,245 @@ class Admin_controller extends BaseController
|
||||
public function add_creditsModel()
|
||||
{
|
||||
$requet_data = $this->request->getVar();
|
||||
$temp_data = $this->PackagesModel->where('id' , $requet_data['package_name'])->find();
|
||||
$credit_pack_expiry_duration = $this->RuleModel->select('value')->where('rule_key', 1 )->get()->getRow()->value;
|
||||
$today = date("Y-m-d");
|
||||
$days = "+".$credit_pack_expiry_duration." days";
|
||||
//print_r($requet_data);die;
|
||||
$temp_data = $this->PackagesModel->where('id' , $requet_data['package_name'])->find();
|
||||
$credit_pack_expiry_duration = $this->RuleModel->select('value')->where('rule_key', 1 )->get()->getRow()->value;
|
||||
$today = date("Y-m-d");
|
||||
$days = "+".$credit_pack_expiry_duration." days";
|
||||
$count = $this->request->getVar('count');
|
||||
|
||||
if(isset($count))
|
||||
{
|
||||
if($requet_data['add_or_sub'] == 'sub')
|
||||
{
|
||||
$data['order_id'] = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'R';
|
||||
}else{
|
||||
$data['order_id'] = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'A';
|
||||
}
|
||||
|
||||
for ($i=0; $i < $count ; $i++)
|
||||
{
|
||||
$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'];
|
||||
$data['package_type'] = $temp_data[0]['package_type'];
|
||||
$data['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
|
||||
$data['cost'] = $temp_data[0]['cost'];
|
||||
$data['member_id'] = $requet_data['member_id'];
|
||||
$data['method'] = $requet_data['method'];
|
||||
$data['remark'] = $requet_data['remarks'];
|
||||
for ($i=0; $i < $count ; $i++)
|
||||
{
|
||||
|
||||
$data['updated_by'] = session()->get('logged_admin_user');
|
||||
$data['credit_points'] = $temp_data[0]['credit'];
|
||||
$data['package_name'] = $temp_data[0]['package_name'];
|
||||
$data['package_type'] = $temp_data[0]['package_type'];
|
||||
$data['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
|
||||
$data['cost'] = $temp_data[0]['cost'];
|
||||
$data['member_id'] = $requet_data['member_id'];
|
||||
$data['method'] = $requet_data['method'];
|
||||
$data['remark'] = $requet_data['remarks'];
|
||||
if($requet_data['add_or_sub'] == 'sub')
|
||||
{
|
||||
$data['running_balance'] = 0;
|
||||
$reduse_points = $this->RedusePoints($requet_data['member_id'],$temp_data[0]['credit']);
|
||||
if($reduse_points)
|
||||
{
|
||||
$this->creditsModel->save($data);
|
||||
}
|
||||
}else{
|
||||
$data['running_balance'] = $temp_data[0]['credit'];
|
||||
$this->creditsModel->save($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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');
|
||||
//$data2 = $this->request->getVar();
|
||||
if($requet_data['add_or_sub'] == 'sub')
|
||||
{
|
||||
$data2['order_id'] = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'R';
|
||||
}else{
|
||||
$data2['order_id'] = 'EGF'.rand(10,100).rand(10,100).rand(10,100) . 'A';
|
||||
}
|
||||
$data2['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
|
||||
$data2['member_id'] = $requet_data['member_id'];
|
||||
$data2['method'] = $requet_data['method'];
|
||||
$data2['remark'] = $requet_data['remarks'];
|
||||
$data2['credit_points'] = $requet_data['credit_points'];
|
||||
$data2['cost'] = $requet_data['cost'];
|
||||
$data2['package_name'] = $requet_data['package_name'];
|
||||
$data2['updated_by'] = session()->get('logged_admin_user');
|
||||
if($requet_data['add_or_sub'] == 'sub')
|
||||
{
|
||||
|
||||
$data2['running_balance'] = 0;
|
||||
$reduse_points = $this->RedusePoints($requet_data['member_id'],$requet_data['credit_points']);
|
||||
if($reduse_points)
|
||||
{
|
||||
$this->creditsModel->save($data2);
|
||||
}
|
||||
}else{
|
||||
$data2['running_balance'] = $requet_data['credit_points'];
|
||||
$this->creditsModel->save($data2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return redirect()->to(base_url()."members_list");
|
||||
return redirect()->to(base_url()."view_credit_details/".md5((int)$requet_data['member_id']));
|
||||
}
|
||||
|
||||
public function view_credit_details($member_id)
|
||||
|
||||
function RedusePoints($member_id,$needed_points)
|
||||
{
|
||||
|
||||
|
||||
$CreditBalanceSum = $this->creditsModel->selectSum('running_balance')
|
||||
->where('member_id',$member_id)
|
||||
->where('is_active',1)
|
||||
->get()->getRow()->running_balance;
|
||||
|
||||
if($CreditBalanceSum > $needed_points)
|
||||
{
|
||||
|
||||
$creditsData = $this->creditsModel->where('member_id',$member_id)->where('is_active',1)->findAll();
|
||||
|
||||
foreach ($creditsData as $creditsDataindex => $creditsDataValue) {
|
||||
|
||||
if($creditsDataValue['expiring_date'] > date("Y-m-d"))
|
||||
{
|
||||
$temp_needed_points = $needed_points;
|
||||
if($creditsDataValue['running_balance'] != 0 && $needed_points > 0)
|
||||
{
|
||||
|
||||
$needed_points = ($needed_points - $creditsDataValue['running_balance']);
|
||||
if($needed_points < 0 ){
|
||||
|
||||
$running_balance = $creditsDataValue['running_balance'] - $temp_needed_points;
|
||||
$this->update_credit_package_data($creditsDataValue['id'] , array( 'running_balance'=>$running_balance , 'used_points'=> $creditsDataValue['used_points'] + $creditsDataValue['running_balance'] - $running_balance));
|
||||
|
||||
}else { $running_balance = 0;
|
||||
|
||||
$this->update_credit_package_data($creditsDataValue['id'] , array( 'running_balance'=>$running_balance , 'used_points'=> $creditsDataValue['used_points'] + $creditsDataValue['running_balance'] - $running_balance));
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function update_credit_package_data($id , $array)
|
||||
{
|
||||
$this->creditsModel->where('id', $id )->set($array)->update();
|
||||
}
|
||||
|
||||
|
||||
public function view_credit_details($member_id)
|
||||
{
|
||||
$userdata['userdata'] = $this->dModel->getLoggedInUserData(session()->get('logged_admin_user'));
|
||||
$fname = $this->MemberModel->select('name')->where('md5(id)', $member_id )->get()->getRow()->name;
|
||||
$lname = $this->MemberModel->select('last_name')->where('md5(id)', $member_id )->get()->getRow()->last_name;
|
||||
$id = $this->MemberModel->select('id')->where('md5(id)', $member_id )->get()->getRow()->id;
|
||||
$creditsData = $this->creditsModel->where('md5(member_id)',$member_id)->orderBy('id' , 'ASC')->findAll();
|
||||
$data['id'] = $id;
|
||||
$data['fname'] = $fname;
|
||||
$data['lname'] = $lname;
|
||||
$data['credit_data'] = [];
|
||||
$data['avaiable_credit'] = 0;
|
||||
$data['country'] = $this->CountryModel->findAll();
|
||||
|
||||
foreach ($creditsData as $creditsDataindex => $creditsDataValue)
|
||||
{
|
||||
if($creditsDataValue['is_active'] == 1)
|
||||
if($creditsDataValue['running_balance'] + $creditsDataValue['used_points'] == 0)
|
||||
{
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] + $creditsDataValue['running_balance'];
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] - $creditsDataValue['credit_points'];
|
||||
$creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
array_push($data['credit_data'] , $creditsDataValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'];
|
||||
$creditsDataValue['avaiable_credit'] = 0;
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] + $creditsDataValue['credit_points'];
|
||||
$creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
array_push($data['credit_data'] , $creditsDataValue);
|
||||
}
|
||||
}
|
||||
|
||||
$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']);
|
||||
if($data['credit_data'][$i]['running_balance'] > 0)
|
||||
{$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 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"> <i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'"></i> <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; 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" title="'.$data['credit_data'][$i]['reason'].'" style="text-align: center;">'.$data['credit_data'][$i]['avaiable_credit'].
|
||||
'</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"> <i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'" ></i> <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 '<pre>';
|
||||
// print_r($data);
|
||||
// echo '</pre>';die;
|
||||
echo view('layout/header',$userdata);
|
||||
echo view('credit_points_list.php',$data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
// public function view_credit_details($member_id)
|
||||
// {
|
||||
|
||||
// $fname = $this->MemberModel->select('name')->where('md5(id)', $member_id )->get()->getRow()->name;
|
||||
// $lname = $this->MemberModel->select('last_name')->where('md5(id)', $member_id )->get()->getRow()->last_name;
|
||||
// $id = $this->MemberModel->select('id')->where('md5(id)', $member_id )->get()->getRow()->id;
|
||||
// $creditsData = $this->creditsModel->where('md5(member_id)',$member_id)->orderBy('id' , 'ASC')->findAll();
|
||||
// $data['credit_data'] = [];
|
||||
// $data['avaiable_credit'] = 0;
|
||||
// $data['country'] = $this->CountryModel->findAll();
|
||||
// foreach ($creditsData as $creditsDataindex => $creditsDataValue)
|
||||
// {
|
||||
// if($creditsDataValue['is_active'] == 1)
|
||||
// {
|
||||
// $data['avaiable_credit'] = $data['avaiable_credit'] + $creditsDataValue['running_balance'];
|
||||
// $creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
// array_push($data['credit_data'] , $creditsDataValue);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $data['avaiable_credit'] = $data['avaiable_credit'];
|
||||
// $creditsDataValue['avaiable_credit'] = 0;
|
||||
// array_push($data['credit_data'] , $creditsDataValue);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // echo view('layout/header',$userdata);
|
||||
// // echo view('credit_points_list.php');
|
||||
// // echo view('layout/footer');
|
||||
|
||||
// $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']);
|
||||
// if($data['credit_data'][$i]['running_balance'] > 0)
|
||||
// {$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 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"> <i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'"></i> <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; 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" title="'.$data['credit_data'][$i]['reason'].'" style="text-align: center;">'.$data['credit_data'][$i]['avaiable_credit'].
|
||||
// '</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"> <i class="mdi mdi-check-circle mdi-24px right" id="'.$balance.'|'.$data['credit_data'][$i]['id'].'|'.$member_id.'" ></i> <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>';
|
||||
|
||||
// }
|
||||
|
||||
// public function add_to_cart_package()
|
||||
|
||||
|
||||
@ -325,7 +325,6 @@ class Member_controller extends BaseController
|
||||
|
||||
|
||||
public function members_list()
|
||||
|
||||
{
|
||||
$id = session()->get('logged_admin_user');
|
||||
$userdata['userdata']=$this->dModel->getLoggedInUserData($id);
|
||||
@ -1232,11 +1231,18 @@ class Member_controller extends BaseController
|
||||
|
||||
|
||||
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] + $creditsDataValue['running_balance'];
|
||||
|
||||
$creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
|
||||
array_push($data['credit_data'] , $creditsDataValue);
|
||||
if($creditsDataValue['running_balance'] + $creditsDataValue['used_points'] == 0)
|
||||
{
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] - $creditsDataValue['credit_points'];
|
||||
$creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
array_push($data['credit_data'] , $creditsDataValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['avaiable_credit'] = $data['avaiable_credit'] + $creditsDataValue['credit_points'];
|
||||
$creditsDataValue['avaiable_credit'] = $data['avaiable_credit'];
|
||||
array_push($data['credit_data'] , $creditsDataValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
358
app/Views/credit_points_list.php
Normal file
358
app/Views/credit_points_list.php
Normal file
@ -0,0 +1,358 @@
|
||||
<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 -->
|
||||
<input id="empName" type="hidden" value="<?php echo $fname." ".$lname; ?> "><input id="empId" type="hidden" value=" <?php echo $id; ?>">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Member Name : <?php echo $fname." ".$lname; ?></h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item manage-credits" >
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light">Manage Credits</button>
|
||||
</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>Order Id</th>
|
||||
<th>Order Date</th>
|
||||
<th>Expiry Date</th>
|
||||
<th>Credit Transactions</th>
|
||||
<th>Credit Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($credit_data as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row['id'];?></td>
|
||||
<td><?php echo $row['order_id'];?></td>
|
||||
<td style="text-align: center;"><?php $date = new DateTime($row['created_at']); echo $date->format('M d , Y'); ?></td>
|
||||
<td style="text-align: center;"><?php $expirydate = new DateTime($row['expiring_date']); echo $expirydate->format('M d , Y'); ?></td>
|
||||
<td style="text-align: center;">
|
||||
<?php
|
||||
if($row['running_balance'] + $row['used_points'] == 0)
|
||||
{
|
||||
$balance = "- ".$row['credit_points'];
|
||||
}else{
|
||||
$balance = "+ ".$row['credit_points'];
|
||||
}
|
||||
echo $balance;
|
||||
?>
|
||||
</td>
|
||||
<td style="text-align: center;"> <?php echo $row['avaiable_credit'];?> </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> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 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="modal-body" id="model-table" ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).on('click','.manage-credits',function(){
|
||||
var rule_key = '14';
|
||||
$.ajax({
|
||||
url:"<?= base_url(); ?>get_pack_list",
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
pack=[];
|
||||
res = JSON.parse(response);
|
||||
res.data.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-4 ">
|
||||
<label >Add Credit points</label>
|
||||
<input type="radio" class="add_or_sub" id="add" name="add_or_sub" value="add" checked>
|
||||
</div>
|
||||
<div class="mb-1 mt-2 col-md-4 ">
|
||||
<label >Reduse Credit Points</label>
|
||||
<input type="radio" class="add_or_sub" id="sub" name="add_or_sub" value="sub">
|
||||
</div>
|
||||
|
||||
|
||||
<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="CreditPoints">Custom credit points</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="number" class="form-control" min="1" 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>
|
||||
<input type="text" class="form-control" name="cost" id="cost" readonly required value="${res.OnePackValue[0]['value']}">
|
||||
</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>
|
||||
<option value="cash">Others</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" maxlength="30">
|
||||
<span style="color: red;margin-left: 4px;"><i>Remarks must be 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" id="button">Add</button></div>
|
||||
</form>
|
||||
</div>`
|
||||
$('#myLargeModalLabel').html("Add Credits For "+$('#empName').val()+" ")
|
||||
$('#model-table').html(addForm);
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
|
||||
$('#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(){
|
||||
if($('#packs').val() == 'CreditPoints')
|
||||
{
|
||||
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) {
|
||||
// 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) {
|
||||
res = JSON.parse(response);
|
||||
console.log(res)
|
||||
if( res.data.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" id="count">`;
|
||||
|
||||
$("#count_hide_show").addClass("col-md-4");
|
||||
$('#count_hide_show').html(count_hide_show);
|
||||
$('#credit').val(res.data[0]['credit']);
|
||||
$('#credit').attr('readonly', true);
|
||||
$('#cost').val(Number(res.data[0]['cost']).toFixed(2));
|
||||
$('#cost').attr('readonly', true);
|
||||
|
||||
$('#count').on('input', function() {
|
||||
var countValue = $(this).val();
|
||||
var calculatedCredit = res.data[0]['credit'] * countValue;
|
||||
$('#credit').val(calculatedCredit);
|
||||
var calculatedCost = Number(res.data[0]['cost']).toFixed(2) * countValue
|
||||
$('#cost').val(calculatedCost);
|
||||
});
|
||||
|
||||
}
|
||||
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('1');
|
||||
$('#cost').val(res.OnePackValue[0]['value']);
|
||||
$('#cost').removeAttr('readonly');
|
||||
}
|
||||
|
||||
},
|
||||
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
|
||||
// }
|
||||
});
|
||||
});
|
||||
|
||||
function matchnum(event)
|
||||
{
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true; //only numbers
|
||||
return false;
|
||||
}
|
||||
$(document).on('change','.add_or_sub',function(){
|
||||
if($(this).val() == 'sub')
|
||||
{
|
||||
$('#button').html('Reduse');
|
||||
}else{
|
||||
$('#button').html('Add');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -59,9 +59,16 @@
|
||||
<input type="hidden" name="country_code" id="country_code_post"/>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<label for="inputEmail3" class="col-4 col-form-label">First Name<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="text" required class="form-control" name="name" value="<?php if(isset($Memberdata)){echo $Memberdata[0]['name'];} ?>" placeholder="Member Name">
|
||||
<input type="text" required class="form-control" name="name" value="<?php if(isset($Memberdata)){echo $Memberdata[0]['name'];} ?>" placeholder="First Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-4 col-form-label">Last Name<span class="text-danger">*</span></label>
|
||||
<div class="col-7">
|
||||
<input type="text" required class="form-control" name="last_name" value="<?php if(isset($Memberdata)){echo $Memberdata[0]['last_name'];} ?>" placeholder="Last Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -132,10 +132,10 @@
|
||||
|
||||
?></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>';
|
||||
if($credit_data[$i]['running_balance'] + $credit_data[$i]['used_points'] == 0)
|
||||
echo '<td class="red-content"><div class="credit-trans"><i class="fa fa-sort-desc" aria-hidden="true"></i> '.$credit_data[$i]['credit_points'].'</div></td>';
|
||||
else
|
||||
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 ><div class="credit-trans"><i class="fa fa-caret-up" aria-hidden="true"></i>'.$credit_data[$i]['credit_points'].'</div> </td>';
|
||||
?>
|
||||
<td><div class="credit-trans"><?= $credit_data[$i]['avaiable_credit'] ?></div> </td>
|
||||
|
||||
|
||||
@ -53,10 +53,6 @@ text-align: center;
|
||||
<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>
|
||||
@ -80,7 +76,9 @@ text-align: center;
|
||||
<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 style="text-align: center;" ">
|
||||
<a href="<?= base_url() ?>view_credit_details/<?php echo md5($row['id']);?>"><span class="test"><?php echo $row['credits'];?></span>
|
||||
</a></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) { ?>
|
||||
@ -105,243 +103,34 @@ text-align: center;
|
||||
</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 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 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="modal-body" id="model-table" ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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';
|
||||
$.ajax({
|
||||
url:"<?= base_url(); ?>get_pack_list",
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
pack=[];
|
||||
res = JSON.parse(response);
|
||||
res.data.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="CreditPoints">Credit Points</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="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>
|
||||
<input type="text" class="form-control" name="cost" id="cost" readonly required value="${res.OnePackValue[0]['value']}">
|
||||
</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<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 must be 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" id="button">Add</button></div>
|
||||
</form>
|
||||
</div>`
|
||||
$('.plus-ico').html('');
|
||||
$('#fullWidthModalLabel').html("Add Credits For "+$('#empName').val()+" ")
|
||||
$('#model-table').html(addForm);
|
||||
$('#full-width-modal').modal('show');
|
||||
|
||||
$('#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) {
|
||||
// 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) {
|
||||
res = JSON.parse(response);
|
||||
console.log(res)
|
||||
if( res.data.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" id="count">`;
|
||||
|
||||
$("#count_hide_show").addClass("col-md-4");
|
||||
$('#count_hide_show').html(count_hide_show);
|
||||
$('#credit').val(res.data[0]['credit']);
|
||||
$('#credit').attr('readonly', true);
|
||||
$('#cost').val(Number(res.data[0]['cost']).toFixed(2));
|
||||
$('#cost').attr('readonly', true);
|
||||
|
||||
$('#count').on('input', function() {
|
||||
var countValue = $(this).val();
|
||||
var calculatedCredit = res.data[0]['credit'] * countValue;
|
||||
$('#credit').val(calculatedCredit);
|
||||
var calculatedCost = Number(res.data[0]['cost']).toFixed(2) * countValue
|
||||
$('#cost').val(calculatedCost);
|
||||
});
|
||||
|
||||
}
|
||||
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('1');
|
||||
$('#cost').val(res.OnePackValue[0]['value']);
|
||||
$('#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) {
|
||||
console.log(response)
|
||||
// $("#modalname").removeClass("modal-sm").addClass("modal-lg");
|
||||
$('#fullWidthModalLabel').html("Credits Details")
|
||||
$('#model-table').html(response);
|
||||
$('#plus').show();
|
||||
$('.plus-ico').html('<i class="mdi mdi-plus-box" title="add"></i>');
|
||||
$('#full-width-modal').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");
|
||||
$('#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>');
|
||||
|
||||
$('#myLargeModalLabel').html('Transaction Details')
|
||||
$('#model-table').html(response);
|
||||
$('#plus').hide();
|
||||
$('#full-width-modal').modal('show');
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle the error here
|
||||
@ -351,130 +140,6 @@ $(document).on('click','.transaction',function(){
|
||||
});
|
||||
</script>
|
||||
|
||||
<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 , 'reason' : reason},
|
||||
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>
|
||||
|
||||
$(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, '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>
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -1603,7 +1603,7 @@ body.checkout .select2-container--default .select2-selection--single .select2-s
|
||||
font-size: 15px!important;
|
||||
line-height: 40px!important;
|
||||
}
|
||||
.table-design .credit-trans .red-content {
|
||||
.table-design .red-content .credit-trans {
|
||||
background: #FFE9EB;
|
||||
color: #EC4C5B;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user