This commit is contained in:
2022-06-01 20:57:49 -04:00
parent 9ea25c81c4
commit a9380d73e9
3 changed files with 60 additions and 3 deletions
+7 -1
View File
@@ -17,7 +17,13 @@ class Coupons extends Users_Controller {
$this->load->model('coupon_model');
$activeCouponResult = $this->coupon_model->loadMemberActiveCoupons($_SESSION['member_id'] ,$fliters=[]);
$_SESSION['coupon'] = $activeCouponResult->num_rows();
$data['coupon_table_row'] = $activeCouponResult->result();
$data['coupon_table_row'] = $activeCouponResult->result();
$redeemCouponResult = $this->coupon_model->loadMemberRedeemCoupons($_SESSION['member_id'] ,$fliters=[]);
$data['coupon_redeem_row'] = $redeemCouponResult->result();
$data['page_title'] ="Coupons";
$this->renderSecurePage('users/view_coupon', $data);
}
+9 -1
View File
@@ -9,8 +9,16 @@ function __construct() {
public function loadMemberActiveCoupons($member_id,$fliters=[]){
$sql="SELECT id, ca.code, ca.amount, ca.added::date,ca.status
FROM coupons_allocation ca WHERE ca.member_id = $member_id ORDER BY ca.id DESC";
FROM coupons_allocation ca WHERE ca.member_id = $member_id AND ca.active IS NULL ORDER BY ca.id DESC";
$q = $this->db->query($sql);
return $q;
}
public function loadMemberRedeemCoupons($member_id,$fliters=[]){
$sql="SELECT id, ca.code, ca.amount, ca.added::date,ca.status ,ca.active
FROM coupons_allocation ca WHERE ca.member_id = $member_id AND ca.active IS NOT NULL ORDER BY ca.id DESC";
$q = $this->db->query($sql);
return $q;
}
}
+44 -1
View File
@@ -108,7 +108,50 @@
<!--begin::Table container-->
<div class="table-responsive">
<!--begin::Table-->
<table class="table table-row-dashed table-row-gray-200 align-middle gs-0 gy-4">
<!--begin::Table head-->
<thead>
<tr class="border-0">
<th class="p-0 w-100px">Added</th>
<th class="p-0 min-w-125px">Coupon</th>
<th class="p-0 min-w-105px">Amount</th>
<th class="p-0 w-90px">Status</th>
<th class="p-0 min-w-50px"></th>
</tr>
</thead>
<!--end::Table head-->
<!--begin::Table body-->
<tbody>
<?php
foreach ($coupon_redeem_row as $row)
{
?>
<tr>
<td>
<div class="symbol symbol-45px me-2">
<?= $row->added ?>
</div>
</td>
<td>
<a href="#" class="text-dark fw-bolder text-hover-primary mb-1 fs-6"> <?= $row->code ?></a>
<span class="text-muted fw-bold d-block">Free credit</span>
</td>
<td class="text-end text-muted fw-bold"><?= $row->amount*0.01 ?> Naira</td>
<td class="text-end">
<span class="badge badge-light-success"><?= $row->status ?></span>
</td>
<td class="text-end">
<span class="badge badge-light-success"><?= $row->active ?></span>
</td>
</tr>
<?php
}
?>
</div>
<!--end::Table-->
</div>