269 lines
12 KiB
PHP
269 lines
12 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Orders Management')
|
|
|
|
@section('content')
|
|
<div class="container-fluid">
|
|
<!-- Page Header -->
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3 mb-0 text-gray-800">Orders Management</h1>
|
|
<div>
|
|
<a href="{{ route('admin.transaksis.export') }}" class="btn btn-success">
|
|
<i class="fas fa-file-excel"></i> Export Excel
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Statistics Cards -->
|
|
<div class="row mb-4">
|
|
<div class="col-xl-3 col-md-6 mb-4">
|
|
<div class="card border-left-primary shadow h-100 py-2">
|
|
<div class="card-body">
|
|
<div class="row no-gutters align-items-center">
|
|
<div class="col mr-2">
|
|
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
|
|
Total Orders
|
|
</div>
|
|
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
|
{{ $orders->total() }}
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<i class="fas fa-shopping-cart fa-2x text-gray-300"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-3 col-md-6 mb-4">
|
|
<div class="card border-left-warning shadow h-100 py-2">
|
|
<div class="card-body">
|
|
<div class="row no-gutters align-items-center">
|
|
<div class="col mr-2">
|
|
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1">
|
|
Pending Orders
|
|
</div>
|
|
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
|
{{ \App\Models\Transaksi::where('order_status', 'pending')->count() }}
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<i class="fas fa-clock fa-2x text-gray-300"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-3 col-md-6 mb-4">
|
|
<div class="card border-left-info shadow h-100 py-2">
|
|
<div class="card-body">
|
|
<div class="row no-gutters align-items-center">
|
|
<div class="col mr-2">
|
|
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
|
|
Processing Orders
|
|
</div>
|
|
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
|
{{ \App\Models\Transaksi::where('order_status', 'processing')->count() }}
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<i class="fas fa-box fa-2x text-gray-300"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-3 col-md-6 mb-4">
|
|
<div class="card border-left-success shadow h-100 py-2">
|
|
<div class="card-body">
|
|
<div class="row no-gutters align-items-center">
|
|
<div class="col mr-2">
|
|
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">
|
|
Delivered Orders
|
|
</div>
|
|
<div class="h5 mb-0 font-weight-bold text-gray-800">
|
|
{{ \App\Models\Transaksi::where('order_status', 'delivered')->count() }}
|
|
</div>
|
|
</div>
|
|
<div class="col-auto">
|
|
<i class="fas fa-check-circle fa-2x text-gray-300"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Orders Table -->
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3 d-flex justify-content-between align-items-center">
|
|
<h6 class="m-0 font-weight-bold text-primary">Orders List</h6>
|
|
<div class="d-flex gap-2">
|
|
<!-- Filter by Status -->
|
|
<select class="form-control form-control-sm" id="filterStatus" onchange="filterOrders()">
|
|
<option value="">All Status</option>
|
|
<option value="pending">Pending</option>
|
|
<option value="processing">Processing</option>
|
|
<option value="shipped">Shipped</option>
|
|
<option value="delivered">Delivered</option>
|
|
<option value="cancelled">Cancelled</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover" id="ordersTable" width="100%" cellspacing="0">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th>Invoice Number</th>
|
|
<th>Customer</th>
|
|
<th>Phone</th>
|
|
<th>Shipping Address</th>
|
|
<th>City</th>
|
|
<th>Province</th>
|
|
<th>Postal Code</th>
|
|
<th>Order Status</th>
|
|
<th>Payment Status</th>
|
|
<th>Total</th>
|
|
<th>Order Date</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($orders as $order)
|
|
<tr data-status="{{ $order->order_status }}">
|
|
<td>
|
|
<strong>{{ $order->invoice_number }}</strong>
|
|
</td>
|
|
<td>{{ $order->customer_name }}</td>
|
|
<td>{{ $order->customer_phone }}</td>
|
|
<td>
|
|
<small>{{ \Illuminate\Support\Str::limit($order->shipping_address, 30) }}</small>
|
|
</td>
|
|
<td>{{ $order->city }}</td>
|
|
<td>{{ $order->province }}</td>
|
|
<td>{{ $order->postal_code }}</td>
|
|
<td>
|
|
@php
|
|
$statusClass = [
|
|
'pending' => 'warning',
|
|
'processing' => 'info',
|
|
'shipped' => 'primary',
|
|
'delivered' => 'success',
|
|
'cancelled' => 'danger'
|
|
][$order->order_status] ?? 'secondary';
|
|
@endphp
|
|
<span class="badge badge-{{ $statusClass }}">
|
|
{{ ucfirst($order->order_status) }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
@php
|
|
$paymentClass = [
|
|
'pending' => 'warning',
|
|
'paid' => 'success',
|
|
'failed' => 'danger'
|
|
][$order->payment_status] ?? 'secondary';
|
|
@endphp
|
|
<span class="badge badge-{{ $paymentClass }}">
|
|
{{ ucfirst($order->payment_status) }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<strong>Rp {{ number_format($order->total_amount, 0, ',', '.') }}</strong>
|
|
</td>
|
|
<td>
|
|
<small>{{ $order->created_at->format('d M Y H:i') }}</small>
|
|
</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group">
|
|
<a href="{{ route('admin.transaksis.show', $order->id) }}"
|
|
class="btn btn-info btn-sm"
|
|
title="View Details">
|
|
<i class="fas fa-eye"></i>
|
|
</a>
|
|
<a href="{{ route('admin.transaksis.edit', $order->id) }}"
|
|
class="btn btn-warning btn-sm"
|
|
title="Edit">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="{{ route('admin.transaksis.print', $order->id) }}"
|
|
class="btn btn-secondary btn-sm"
|
|
title="Print Invoice"
|
|
target="_blank">
|
|
<i class="fas fa-print"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="12" class="text-center py-4">
|
|
<i class="fas fa-inbox fa-3x text-gray-300 mb-3"></i>
|
|
<p class="text-gray-500">No orders found</p>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="d-flex justify-content-between align-items-center mt-3">
|
|
<div>
|
|
Showing {{ $orders->firstItem() ?? 0 }} to {{ $orders->lastItem() ?? 0 }}
|
|
of {{ $orders->total() }} orders
|
|
</div>
|
|
<div>
|
|
{{ $orders->links() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@push('styles')
|
|
<style>
|
|
.gap-2 {
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.table-hover tbody tr:hover {
|
|
background-color: #f8f9fc;
|
|
}
|
|
|
|
.btn-group-sm .btn {
|
|
padding: 0.25rem 0.5rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.badge {
|
|
font-size: 0.75rem;
|
|
padding: 0.35em 0.65em;
|
|
}
|
|
</style>
|
|
@endpush
|
|
|
|
@push('scripts')
|
|
<script>
|
|
function filterOrders() {
|
|
const filterValue = document.getElementById('filterStatus').value.toLowerCase();
|
|
const table = document.getElementById('ordersTable');
|
|
const rows = table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
const status = rows[i].getAttribute('data-status');
|
|
|
|
if (filterValue === '' || status === filterValue) {
|
|
rows[i].style.display = '';
|
|
} else {
|
|
rows[i].style.display = 'none';
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
@endpush
|
|
@endsection |