feat: Implement order management with datatable display and updated forms

This commit is contained in:
pbao9
2026-02-14 18:00:15 +07:00
parent d683afc901
commit 5252f9142c
21 changed files with 490 additions and 541 deletions
@@ -0,0 +1,47 @@
<div class="dt-action-dropdown dropdown">
<button class="btn btn-sm btn-light d-flex align-items-center gap-1" type="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i data-lucide="more-vertical" width="14" height="14"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<a class="dropdown-item" href="{{ route('administrator.pages.order.edit', ['id' => $row->id]) }}">
<i data-lucide="pencil" width="14" height="14" class="me-2"></i>
View
</a>
</li>
@if(auth()->guard('admins')->user()->can("delete order"))
<li>
<hr class="dropdown-divider">
<button type="button" class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#deleteModal{{ $row->id }}">
<i data-lucide="trash-2" width="14" height="14" class="me-2 text-danger"></i>
Delete
</button>
</li>
@endif
</ul>
</div>
<div class="modal fade" id="deleteModal{{ $row->id }}" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<form action="{{ route('administrator.pages.order.destroy') }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<input type="hidden" name="order" value="{{ $row->id }}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Xoá đơn hàng</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Bạn có chắc chắn muốn xoá đơn hàng này?
<strong>{{ $row->order_num }}</strong>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Huỷ</button>
<button type="submit" class="btn btn-danger">Xoá</button>
</div>
</div>
</form>
</div>
</div>
@@ -0,0 +1 @@
{{ number_format($row->amount, 0, ',', '.') }}đ
@@ -0,0 +1 @@
{{ $row->customer->firstname . ' ' . $row->customer->lastname }}
@@ -0,0 +1 @@
@time($row->date)
@@ -0,0 +1,3 @@
@if ($row->invoice_id !== 0)
{!! $row->invoice->getStatus() !!}
@endif
@@ -0,0 +1,3 @@
<a href="{{ route('administrator.pages.order.edit', ['id' => $row->id]) }}" title="View Order">
{{ $row->order_num }}
</a>
@@ -0,0 +1 @@
{{ $row->payment->name ?? 'VN Pay' }}
@@ -0,0 +1 @@
{!! \App\Http\Helpers\Helper::OrderStatus($row->status) !!}