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

91 lines
5.1 KiB
PHP

@extends('admin.main')
@section('content')
@if (auth()->guard('admins')->user()->can('manager product'))
<div class="card card-primary card-outline">
<div class="card-header">
@include('admin.block.btn')
</div>
<div class="card-body">
<table class="table table-invoice table-bordered">
<thead>
<tr>
<th>Product Name</th>
<th>Type</th>
<th style="width:40px"></th>
<th style="width: 40px"></th>
</tr>
</thead>
<tbody>
@if (count($groups) > 0)
@foreach ($groups->all() as $item)
<tr class="bg-secondary">
<td colspan="2">
<strong>Group Name: </strong>{{ $item->name }}
</td>
<td>
<a class="btn btn-warning btn-sm"
href="{{ route('group.information', ['grid' => $item->id]) }}">
<i class="fas fa-user-edit"></i>
</a>
</td>
<td>
<form method="post" class="d-inline" action="{{ route('group.remove') }}">
@method('delete')
@csrf
<input type="hidden" name="group_id" value="{{ $item->id }}">
<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>
</td>
</tr>
@if (!empty($item->products) && $item->products->count())
@foreach ($item->products->all() as $_item)
<tr>
<td>
{{ $_item->name }}
</td>
<td class="text-center">
{{ $_item->Type->name }}
</td>
<td>
<a class="btn btn-warning btn-sm"
href="{{ route('product.edit', ['product_id' => $_item->id, 'type_id' => $item->type_id]) }}">
<i class="fas fa-user-edit"></i>
</a>
</td>
<td>
@if (auth()->guard('admins')->user()->can('delete product'))
<form method="post" class="d-inline"
action="{{ route('product.destroy', ['type' => $_item->Type->id, 'product_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>
</tr>
@endforeach
@endif
@endforeach
@endif
</tbody>
</table>
</div>
<div class="card-footer">
{{ $groups->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 Product
management department</h5>
</div>
@endif
@endsection