@extends('admin.layout') @section('content')
{{ __('Coupons') }}
@if (count($coupons) == 0)

{{ __('NO COUPON FOUND') . '!' }}

@else
@foreach ($coupons as $coupon) @php $todayDate = Carbon\Carbon::now(); $startDate = Carbon\Carbon::parse($coupon->start_date); $endDate = Carbon\Carbon::parse($coupon->end_date); @endphp @endforeach
# {{ __('Name') }} {{ __('Code') }} {{ __('Discount') }} {{ __('Created') }} {{ __('Status') }} {{ __('Actions') }}
{{ $loop->iteration }} {{ strlen($coupon->name) > 30 ? mb_substr($coupon->name, 0, 30, 'UTF-8') . '...' : $coupon->name }} {{ $coupon->code }} @if ($coupon->type == 'fixed') {{ $currencyInfo->base_currency_symbol_position == 'left' ? $currencyInfo->base_currency_symbol : '' }}{{ $coupon->value }}{{ $currencyInfo->base_currency_symbol_position == 'right' ? $currencyInfo->base_currency_symbol : '' }} @else {{ $coupon->value . '%' }} @endif @php $createDate = $coupon->created_at; // first, get the difference of create-date & today-date $diff = $createDate->diffInDays($todayDate); @endphp {{-- then, get the human read-able value from those dates --}} {{ $createDate->subDays($diff)->diffForHumans() }} @if ($startDate->greaterThan($todayDate))

{{ __('Pending') }}

@elseif ($todayDate->between($startDate, $endDate))

{{ __('Active') }}

@elseif ($endDate->lessThan($todayDate))

{{ __('Expired') }}

@endif
@csrf
@endif
{{-- create modal --}} @include('admin.shop.coupon.create') {{-- edit modal --}} @include('admin.shop.coupon.edit') @endsection