Files
portal-api/resources/views/admin/coupon/index.blade.php
T
2025-07-24 16:18:27 +07:00

91 lines
4.3 KiB
PHP

@php use App\Http\Helpers\Helper; @endphp
@extends("admin.main")
@section("content")
@if(auth()->guard('admins')->user()->can('manager coupon'))
<div class="card card-primary card-outline">
<div class="card-header">
<a href="{{ route('coupon.create') }}" class="btn btn-outline-secondary">
<i class="fas fa-plus"></i> Add New Coupon
</a>
</div>
<div class="card-body">
<table class="table table-invoice table-bordered">
<thead>
<tr>
<th style="width: 10px">
<label for=""></label><input type="checkbox" name="check" class="check-all" id="">
</th>
<th>CODE</th>
<th>Type</th>
<th>Value</th>
<th>Uses</th>
<th>Start Date</th>
<th>Expiry Date</th>
<th style="width: 40px"></th>
<th style="width: 40px"></th>
</tr>
</thead>
<tbody>
@if(count($coupons) > 0)
@foreach($coupons->all() as $item)
<tr>
<td class="text-center">
<input type="checkbox" name="id[]" id="" value="{{ $item->id }}">
</td>
<td class="text-center">
{{ $item->code }}
</td>
<td class="text-center">
{{ (int) $item->type === 1 ? "Percentage" : "Fix Amount" }}
</td>
<td class="text-center">
{{ $item->discount }}
</td>
<td class="text-center">
{{ $item->use }}/{{ $item->count }}
</td>
<td class="text-center">
{{ \Illuminate\Support\Carbon::parse($item->start)->format('d/m/Y') }}
</td>
<td class="text-center">
{{ \Illuminate\Support\Carbon::parse($item->end)->format('d/m/Y') }}
</td>
<td>
<a class="btn btn-warning btn-sm"
href="{{ route('coupon.edit',['id' => $item->id]) }}">
<i class="fas fa-user-edit"></i>
</a>
</td>
<td>
@if(auth()->guard('admins')->user()->can("delete coupon"))
<form method="post" class="d-inline"
action="{{ route('coupon.destroy',['id' => $item->id]) }}">
@csrf
@method('delete')
<button type="submit" data-toggle="tooltip" data-placement="top" title=""
class="btn btn-sm btn-danger" data-original-title="Xoá">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
@endforeach
@endif
</tbody>
</table>
</div>
<div class="card-footer">
{{ $coupons->withQueryString()->links() }}
</div>
</div>
@else
<div class="alert alert-danger alert-dismissible">
<h5 class="mb-0"><i class="icon fas fa-ban"></i> Access Denied - You are not assigned to any Coupon
management department</h5>
</div>
@endif
@endsection