Merge branch 'dillon/57.1-second-voucher-first-milestone' into development

This commit is contained in:
Dillon Ngo
2024-08-21 22:13:58 +08:00
8 changed files with 8 additions and 9 deletions
@@ -6,7 +6,7 @@ use App\Classes\ValueObjects\Constants\RoleTypes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth;
class HasVouchersAll implements Filter
class HasVouchersAllWithUser implements Filter
{
/**
+1 -2
View File
@@ -17,8 +17,7 @@ class VoucherResource extends JsonResource
public function toArray($request)
{
$filteredRedemptions = new ArrayObject([]);
if ($request->has('filters') && (str_contains($request->input('filters'), "has_active_reward_with_user") )) {
//|| str_contains($request->input('filters'), "has_active_reward_with_company")
if ($request->has('filters') && str_contains($request->input('filters'), "has_vouchers_all_with_user")) {
$filteredRedemptions = new ArrayObject([]);
}
else{
@@ -16,7 +16,7 @@
}
},
created(){
this.submit(this.route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all': true, order_by:{ column:'id', DESC:true }} ), 'get', 'voucherNavigationSection', false, false);
this.submit(this.route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all_with_user': true, order_by:{ column:'id', DESC:true }} ), 'get', 'voucherNavigationSection', false, false);
},
methods: {
successHandler(response){
@@ -98,7 +98,7 @@
fetchVouchers(){
this.isLoading = true;
if(this.employee){
this.submit(route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_active_reward_with_company': this.employee.id} ), 'get', this.section, false, false);
this.submit(route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all_with_user': this.employee.id} ), 'get', this.section, false, false);
}
},
successHandler(response){
@@ -79,7 +79,7 @@
fetchVouchers(){
this.isLoading = true;
if(this.employee){
this.submit(route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_active_reward_with_company': this.employee.id} ), 'get', this.section, false, false);
this.submit(route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all_with_user': this.employee.id} ), 'get', this.section, false, false);
}
},
successHandler(response){
@@ -57,7 +57,7 @@
<div class="col">
<div class="row">
<div class="col" v-if="this.$store.getters.getUserId">
<list-component section="customerVouchersListSection" :endpoint="route('api.voucher.user.list')" :options="{ 'has_active_reward_with_user': id }">
<list-component section="customerVouchersListSection" :endpoint="route('api.voucher.user.list')" :options="{ 'has_vouchers_all_with_user': id }">
<template slot="list" slot-scope="{data}">
<single-user-reward-item-component :data="data"></single-user-reward-item-component>
</template>
@@ -52,7 +52,7 @@
<div class="col">
<div class="row">
<div class="col" v-if="this.$store.getters.getUserId">
<list-component section="customerVouchersListSection" :endpoint="route('api.voucher.user.list')" :options="{ 'has_active_reward_with_user': true }">
<list-component section="customerVouchersListSection" :endpoint="route('api.voucher.user.list')" :options="{ 'has_vouchers_all_with_user': true }">
<template slot="list" slot-scope="{data}">
<single-user-reward-item-component :data="data"></single-user-reward-item-component>
</template>
@@ -30,7 +30,7 @@
}
},
created(){
this.submit(this.route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all': this.company.employee.id, order_by:{ column:'id', DESC:true }} ), 'get', this.section, false, false);
this.submit(this.route('api.voucher.user.list') + '?filters=' + JSON.stringify( { 'has_vouchers_all_with_user': this.company.employee.id, order_by:{ column:'id', DESC:true }} ), 'get', this.section, false, false);
},
methods: {
successHandler(response){