GWM
This commit is contained in:
parent
1d7eb8f54f
commit
e4af932350
@ -70,6 +70,9 @@ $routes->match(['get','post'],'/credits_pack_add','Admin_controller::credits_pac
|
||||
$routes->match(['get','post'],'/user_password_change','Admin_controller::user_password_change');
|
||||
$routes->match(['get','post'],'/user_deactivate/(:any)','Admin_controller::user_deactivate/$1');
|
||||
$routes->match(['get','post'],'/user_activate/(:any)','Admin_controller::user_activate/$1');
|
||||
$routes->match(['get'],'/transactions_list/(:any)','Admin_controller::transactions_list/$1');
|
||||
$routes->match(['get'],'/transactions_list','Admin_controller::transactions_list');
|
||||
|
||||
|
||||
$routes->match(['get'],'/admin_home','Dashboard::admin_home');
|
||||
$routes->match(['get'],'/member_home','Dashboard::member_home');
|
||||
|
||||
@ -6,6 +6,7 @@ use App\Models\Dashboard_model;
|
||||
use App\Models\Common_model;
|
||||
use App\Models\Member_credits_model;
|
||||
use App\Models\Packages_and_pricing_model;
|
||||
use App\Models\Credits_usage_tracking_model;
|
||||
class Admin_controller extends BaseController
|
||||
{
|
||||
public $session;
|
||||
@ -17,6 +18,7 @@ class Admin_controller extends BaseController
|
||||
$this->cModel = new Common_model();
|
||||
$this->creditsModel = new Member_credits_model();
|
||||
$this->PackagesModel = new Packages_and_pricing_model();
|
||||
$this->CreditsUsageTrackingModel = new Credits_usage_tracking_model();
|
||||
helper(['form', 'url']);
|
||||
}
|
||||
public function index()
|
||||
@ -299,6 +301,36 @@ class Admin_controller extends BaseController
|
||||
echo view('users_password');
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
public function transactions_list($member_id =null)
|
||||
{
|
||||
if($member_id == 'null')
|
||||
{
|
||||
$userdata['userdata'] = $this->dModel->getLoggedInUserData(session()->get('logged_user'));
|
||||
$data['creditsData'] = $this->creditsModel->select('member_credits.* , member.name as member_name ')
|
||||
->join('member', 'member_credits.member_id = member.id', 'left')
|
||||
->where('md5(member_credits.member_id)', $member_id )
|
||||
->findAll();
|
||||
echo view('layout/header',$userdata);
|
||||
echo view('transactions_list',$data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}else{
|
||||
|
||||
$userdata['userdata'] = $this->dModel->getLoggedInUserData(session()->get('logged_user'));
|
||||
$data['creditsData'] = $this->creditsModel->select('member_credits.* , member.name as member_name ')
|
||||
->join('member', 'member_credits.member_id = member.id', 'left')
|
||||
->findAll();
|
||||
echo view('layout/header',$userdata);
|
||||
echo view('transactions_list',$data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
// -----------------------------------------------
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Models\Common_model;
|
||||
use App\Models\Member_credits_model;
|
||||
use App\Models\Packages_and_pricing_model;
|
||||
use App\Models\Cart_model;
|
||||
use App\Models\Credits_usage_tracking_model;
|
||||
|
||||
class Member_controller extends BaseController
|
||||
{
|
||||
@ -21,6 +22,7 @@ class Member_controller extends BaseController
|
||||
$this->creditsModel = new Member_credits_model();
|
||||
$this->PackagesModel = new Packages_and_pricing_model();
|
||||
$this->cartModel = new Cart_model();
|
||||
$this->CreditsUsageTrackingModel = new Credits_usage_tracking_model();
|
||||
helper('form');
|
||||
}
|
||||
public function index()
|
||||
@ -328,8 +330,6 @@ class Member_controller extends BaseController
|
||||
$count = $this->creditsModel->selectSum($columnName)->where('member_id',$FormData['member_id'])->get()->getRow()->$columnName;
|
||||
if($count > $needed_points)
|
||||
{
|
||||
|
||||
|
||||
$creditsData = $this->creditsModel->where('member_id',$FormData['member_id'])->findAll();
|
||||
//$newArray = array();
|
||||
foreach ($creditsData as $creditsDataindex => $creditsDataValue) {
|
||||
@ -343,8 +343,10 @@ class Member_controller extends BaseController
|
||||
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));
|
||||
$this->CreditsUsageTrackingModel->save(array('member_id'=>$FormData['member_id'],'member_credits_id'=>$creditsDataValue['id'], 'used_points'=>($creditsDataValue['running_balance'] - $running_balance),'slot_date_time'=>date("Y-m-d")));
|
||||
}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));
|
||||
$this->CreditsUsageTrackingModel->save(array('member_id'=>$FormData['member_id'],'member_credits_id'=>$creditsDataValue['id'], 'used_points'=>($creditsDataValue['running_balance'] - $running_balance),'slot_date_time'=>date("Y-m-d")));
|
||||
}
|
||||
//$newArray[$creditsDataValue['running_balance']] = array('needed_points'=>$needed_points , 'running_balance'=>$running_balance , 'used_points'=> $creditsDataValue['running_balance'] - $running_balance);
|
||||
|
||||
|
||||
13
app/Models/Credits_usage_tracking_model.php
Normal file
13
app/Models/Credits_usage_tracking_model.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Credits_usage_tracking_model extends Model
|
||||
{
|
||||
protected $table = 'credit_points_tracking';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['member_id','member_credits_id', 'used_points','slot_date_time'];
|
||||
|
||||
|
||||
}
|
||||
@ -148,6 +148,12 @@ $(document).ready(function(){
|
||||
<span> Credit Packs </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."transactions_list"; ?>">
|
||||
<i class="mdi mdi-currency-usd"></i>
|
||||
<span> Transactions </span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } elseif($userdata->role == 'Coach' ) { ?>
|
||||
|
||||
@ -160,6 +166,12 @@ $(document).ready(function(){
|
||||
<span> Members </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."transactions_list"; ?>">
|
||||
<i class="mdi mdi-currency-usd"></i>
|
||||
<span> Transactions </span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<a href="#sidebarTables" data-toggle="collapse">
|
||||
<i class="mdi mdi-account-multiple"></i>
|
||||
|
||||
@ -55,11 +55,10 @@
|
||||
<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 { ?>
|
||||
<?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 }
|
||||
?>
|
||||
<?php } ?>
|
||||
<a href="<?= base_url() ?>transactions_list/<?php echo md5($row['id']);?>"><i class="mdi mdi-eye-outline" title="Activate" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
68
app/Views/transactions_list.php
Normal file
68
app/Views/transactions_list.php
Normal file
@ -0,0 +1,68 @@
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title">Credit points purchase and Transaction Details</h4>
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<!-- <li class="breadcrumb-item">
|
||||
<a href="<?= base_url() ?>credits_pack_add">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light">Add</button>
|
||||
</a>
|
||||
</li> -->
|
||||
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Tables</a></li>
|
||||
<li class="breadcrumb-item active">Datatables</li> -->
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<!-- <h4 class="header-title">Buttons example</h4>
|
||||
<p class="text-muted font-13 mb-4">
|
||||
|
||||
</p> -->
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Purchased by</th>
|
||||
<th>Points</th>
|
||||
<th>Cost</th>
|
||||
<th>Pack / Indidual</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($creditsData as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['created_at'];?></td>
|
||||
<td><?php echo $row['member_name'];?></td>
|
||||
<td><?php echo $row['credit_points'];?></td>
|
||||
<td><?php echo $row['cost'];?></td>
|
||||
<td><?php echo $row['package_name'];?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
Loading…
Reference in New Issue
Block a user