@if($vouchers->count()>0) @foreach($vouchers as $record)
@php if($record->image && Storage::disk('public')->exists('voucher-image/'.$record->image)){ $featuredImage = asset('storage/voucher-image/'.$record->image); }else{ $featuredImage = asset('front/image/default-voucher-image.jpg'); } $validity_dates = explode('-',$record->validity); $redemmedCount = $record->getRewardRedeemedCount(); $totalRedeemedCount = $record->getRewardRedeemedCountOfUser(auth()->user()->id); $userRedeemedStatus = $record->getRewardRedeemedStatus(auth()->user()->id); $voucherRedemmedCount = 0; if($record->type==0){ $voucherRedemmedCount = $record->getVoucherRewardRedeemedCount(); } $badgeHtml = '
'; @endphp

{{ $record->title ?? "" }}

{{--

Reso

--}} {{--

{{ date('d-M-Y',strtotime(str_replace('/','-',$validity_dates[0]))) ?? "" }} to {{ date('d-M-Y',strtotime(str_replace('/','-',$validity_dates[1]))) ?? "" }}

--}}
{{ $record->points_to_pay??"0" }} {{--5,500--}} {{ config('constants.points_name') }}
@if($record->type == 1) @if($redemmedCount >= $record->quantity) {!! $badgeHtml !!} @endif @elseif($record->type == 2) @php $discountCoupon = $record->discountCoupon; @endphp @if($discountCoupon->discount_apply_allowed == 0 && $userRedeemedStatus) {!! $badgeHtml !!} @elseif($discountCoupon->discount_apply_allowed == 1 && $totalRedeemedCount >= $discountCoupon->apply_limit) {!! $badgeHtml !!} @endif @elseif($record->type == 0 && $voucherRedemmedCount <= 0) {!! $badgeHtml !!} @endif @if($redemmedCount >= $record->quantity && $record->quantity > 0 && (in_array($record->type,[2,1])) || ($record->type == 0 && $voucherRedemmedCount <= 0)) {{--
--}} @endif
@endforeach @else
No voucher here!
@endif