Merge branch 'dev' of http://103.248.30.24:3000/kent-logistics/Kent-logistics-Laravel into dev
This commit is contained in:
@@ -497,18 +497,18 @@ class AdminOrderController extends Controller
|
|||||||
->with('success', 'Order reset successfully.');
|
->with('success', 'Order reset successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function orderShow()
|
public function orderShow()
|
||||||
{
|
{
|
||||||
$orders = Order::with([
|
$orders = Order::with([
|
||||||
'markList', // company, customer, origin, destination, date
|
'markList', // company, customer, origin, destination, date
|
||||||
'shipments', // shipment_id, shipment_date, status
|
'shipments', // shipment_id, shipment_date, status
|
||||||
'invoice' // invoice number, dates, amounts, status
|
'invoice' // invoice number, dates, amounts, status
|
||||||
])
|
])
|
||||||
->latest('id') // show latest orders first
|
->latest('id') // show latest orders first
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('admin.orders', compact('orders'));
|
return view('admin.orders', compact('orders'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// inside AdminOrderController
|
// inside AdminOrderController
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,30 @@
|
|||||||
@extends('admin.layouts.app')
|
@extends('admin.layouts.app')
|
||||||
|
|
||||||
@section('page-title', 'Dashboard')
|
@section('page-title', 'Dashboard')
|
||||||
|
@php
|
||||||
|
use App\Models\Order;
|
||||||
|
use App\Models\OrderItem;
|
||||||
|
use App\Models\Shipment;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Admin;
|
||||||
|
|
||||||
|
$totalOrders = Order::count();
|
||||||
|
$pendingOrders = Order::where('status', 'pending')->count();
|
||||||
|
$totalShipments = Shipment::count();
|
||||||
|
$totalItems = OrderItem::count();
|
||||||
|
|
||||||
|
$totalRevenue = Invoice::sum('final_amount_with_gst');
|
||||||
|
|
||||||
|
// USERS (CUSTOMERS)
|
||||||
|
$activeCustomers = User::where('status', 'active')->count();
|
||||||
|
$inactiveCustomers = User::where('status', 'inactive')->count();
|
||||||
|
|
||||||
|
// STAFF (FROM ADMINS TABLE)
|
||||||
|
$totalStaff = Admin::where('type', 'staff')->count();
|
||||||
|
|
||||||
|
$orders = Order::latest()->get();
|
||||||
|
@endphp
|
||||||
@section('content')
|
@section('content')
|
||||||
<style>
|
<style>
|
||||||
/* ===== GLOBAL RESPONSIVE STYLES ===== */
|
/* ===== GLOBAL RESPONSIVE STYLES ===== */
|
||||||
@@ -1122,16 +1145,16 @@ body, .container-fluid {
|
|||||||
<!-- STATS CARDS -->
|
<!-- STATS CARDS -->
|
||||||
<div class="stats-row-wrap">
|
<div class="stats-row-wrap">
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Shipments</div><div class="stats-value">1,247</div></div>
|
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Shipments</div><div class="stats-value">{{ $totalShipments }}</div></div>
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">👥</span><div class="stats-label">Active Customers</div><div class="stats-value">342</div></div>
|
<div class="stats-card stats-card-blue"><span class="stats-icon">👥</span><div class="stats-label">Active Customers</div><div class="stats-value">{{ $activeCustomers }}</div></div>
|
||||||
<div class="stats-card stats-card-green"><span class="stats-icon">💰</span><div class="stats-label">Total Revenue</div><div class="stats-value">₹123</div></div>
|
<div class="stats-card stats-card-green"><span class="stats-icon">💰</span><div class="stats-label">Total Revenue</div><div class="stats-value">₹{{ number_format($totalRevenue, 2) }}</div></div>
|
||||||
<div class="stats-card stats-card-red"><span class="stats-icon">⏳</span><div class="stats-label">Pending Order</div><div class="stats-value">23</div></div>
|
<div class="stats-card stats-card-red"><span class="stats-icon">⏳</span><div class="stats-label">Pending Order</div><div class="stats-value">{{ $pendingOrders }}</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Orders</div><div class="stats-value">453</div></div>
|
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Orders</div><div class="stats-value">{{ $totalOrders }}</div></div>
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">🧑💼</span><div class="stats-label">Total Staff</div><div class="stats-value">125</div></div>
|
<div class="stats-card stats-card-blue"><span class="stats-icon">🧑💼</span><div class="stats-label">Total Staff</div><div class="stats-value">{{ $totalStaff }}</div></div>
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Items</div><div class="stats-value">321</div></div>
|
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div class="stats-label">Total Items</div><div class="stats-value">{{ $totalItems }}</div></div>
|
||||||
<div class="stats-card stats-card-orng"><span class="stats-icon">⛔</span><div class="stats-label">Inactive Customers</div><div class="stats-value">10</div></div>
|
<div class="stats-card stats-card-orng"><span class="stats-icon">⛔</span><div class="stats-label">Inactive Customers</div><div class="stats-value">{{ $inactiveCustomers }}</div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -799,7 +799,7 @@
|
|||||||
// Pagination state
|
// Pagination state
|
||||||
let currentPage = 1;
|
let currentPage = 1;
|
||||||
const itemsPerPage = 10;
|
const itemsPerPage = 10;
|
||||||
let allOrders = @json($orders);
|
let allOrders = {!! $orders->toJson() !!};
|
||||||
let filteredOrders = [...allOrders];
|
let filteredOrders = [...allOrders];
|
||||||
|
|
||||||
// Status icon helper functions
|
// Status icon helper functions
|
||||||
@@ -874,11 +874,11 @@
|
|||||||
const searchFields = [
|
const searchFields = [
|
||||||
order.order_id?.toString().toLowerCase(),
|
order.order_id?.toString().toLowerCase(),
|
||||||
order.shipments?.[0]?.shipment_id?.toString().toLowerCase(),
|
order.shipments?.[0]?.shipment_id?.toString().toLowerCase(),
|
||||||
order.markList?.customer_id?.toString().toLowerCase(),
|
order.mark_list?.customer_id?.toString().toLowerCase(),
|
||||||
order.markList?.company_name?.toString().toLowerCase(),
|
order.mark_list?.company_name?.toString().toLowerCase(),
|
||||||
order.invoice?.invoice_number?.toString().toLowerCase(),
|
order.invoice?.invoice_number?.toString().toLowerCase(),
|
||||||
order.markList?.origin?.toString().toLowerCase(),
|
order.mark_list?.origin?.toString().toLowerCase(),
|
||||||
order.markList?.destination?.toString().toLowerCase()
|
order.mark_list?.destination?.toString().toLowerCase()
|
||||||
];
|
];
|
||||||
matchesSearch = searchFields.some(field => field && field.includes(searchTerm.toLowerCase()));
|
matchesSearch = searchFields.some(field => field && field.includes(searchTerm.toLowerCase()));
|
||||||
}
|
}
|
||||||
@@ -901,7 +901,7 @@
|
|||||||
// Initialize pagination and filters
|
// Initialize pagination and filters
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Set today as default "to" date
|
// Set today as default "to" date
|
||||||
renderTable();
|
renderTable();
|
||||||
updatePaginationControls();
|
updatePaginationControls();
|
||||||
|
|
||||||
// Pagination events
|
// Pagination events
|
||||||
@@ -1099,7 +1099,7 @@
|
|||||||
const paginatedItems = filteredOrders.slice(startIndex, endIndex);
|
const paginatedItems = filteredOrders.slice(startIndex, endIndex);
|
||||||
|
|
||||||
paginatedItems.forEach(order => {
|
paginatedItems.forEach(order => {
|
||||||
const mark = order.markList || null;
|
const mark = order.mark_list || null;
|
||||||
const invoice = order.invoice || null;
|
const invoice = order.invoice || null;
|
||||||
const shipment = order.shipments?.[0] || null;
|
const shipment = order.shipments?.[0] || null;
|
||||||
|
|
||||||
|
|||||||
@@ -912,10 +912,6 @@
|
|||||||
</label>
|
</label>
|
||||||
<select class="filter-control" id="companyFilter">
|
<select class="filter-control" id="companyFilter">
|
||||||
<option value="" selected>All Companies</option>
|
<option value="" selected>All Companies</option>
|
||||||
<option value="ABC Corporation">ABC Corporation</option>
|
|
||||||
<option value="XYZ Enterprises">XYZ Enterprises</option>
|
|
||||||
<option value="Global Traders">Global Traders</option>
|
|
||||||
<option value="Tech Solutions Ltd">Tech Solutions Ltd</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="filter-group">
|
<div class="filter-group">
|
||||||
@@ -1101,6 +1097,7 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Initialize statistics and pagination
|
// Initialize statistics and pagination
|
||||||
|
populateCompanyFilter(allReports);
|
||||||
updateStatistics();
|
updateStatistics();
|
||||||
renderTable();
|
renderTable();
|
||||||
updatePaginationControls();
|
updatePaginationControls();
|
||||||
@@ -1403,5 +1400,33 @@
|
|||||||
// Initial filter application
|
// Initial filter application
|
||||||
filterTable();
|
filterTable();
|
||||||
});
|
});
|
||||||
|
function populateCompanyFilter(reports) {
|
||||||
|
const companySelect = document.getElementById('companyFilter');
|
||||||
|
if (!companySelect) return;
|
||||||
|
|
||||||
|
// Collect unique company names
|
||||||
|
const companies = new Set();
|
||||||
|
|
||||||
|
reports.forEach(r => {
|
||||||
|
if (r.company_name && r.company_name.trim() !== '') {
|
||||||
|
companies.add(r.company_name.trim());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort alphabetically
|
||||||
|
const sortedCompanies = Array.from(companies).sort();
|
||||||
|
|
||||||
|
// Remove existing options except "All Companies"
|
||||||
|
companySelect.innerHTML = '<option value="">All Companies</option>';
|
||||||
|
|
||||||
|
// Append options
|
||||||
|
sortedCompanies.forEach(company => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = company;
|
||||||
|
option.textContent = company;
|
||||||
|
companySelect.appendChild(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1074,10 +1074,9 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Order ID</th>
|
<th>Description</th>
|
||||||
<th>Origin</th>
|
<th>Origin</th>
|
||||||
<th>Destination</th>
|
<th>Destination</th>
|
||||||
<th>Description</th>
|
|
||||||
<th>CTN</th>
|
<th>CTN</th>
|
||||||
<th>QTY</th>
|
<th>QTY</th>
|
||||||
<th>TTL/QTY</th>
|
<th>TTL/QTY</th>
|
||||||
@@ -1090,20 +1089,22 @@
|
|||||||
<tr class="{{ $orderItem['order_id'] == $orderData['order_id'] ? 'current-order' : '' }}">
|
<tr class="{{ $orderItem['order_id'] == $orderData['order_id'] ? 'current-order' : '' }}">
|
||||||
<td>{{ $index + 1 }}</td>
|
<td>{{ $index + 1 }}</td>
|
||||||
<td>
|
<td>
|
||||||
<strong>{{ $orderItem['order_id'] ?? '-' }}</strong>
|
<strong>{{ $orderItem['description'] ?? '-' }}</strong>
|
||||||
@if($orderItem['order_id'] == $orderData['order_id'])
|
|
||||||
<span class="badge bg-primary ms-1">Current</span>
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $orderItem['origin'] ?? '-' }}</td>
|
<td>{{ $orderItem['origin'] ?? '-' }}</td>
|
||||||
<td>{{ $orderItem['destination'] ?? '-' }}</td>
|
<td>{{ $orderItem['destination'] ?? '-' }}</td>
|
||||||
<td>{{ $orderItem['description'] ?? '-' }}</td>
|
|
||||||
<td>{{ $orderItem['ctn'] ?? '-' }}</td>
|
<td>{{ $orderItem['ctn'] ?? '-' }}</td>
|
||||||
<td>{{ $orderItem['qty'] ?? '-' }}</td>
|
<td>{{ $orderItem['qty'] ?? '-' }}</td>
|
||||||
<td>{{ $orderItem['ttl_qty'] ?? '-' }}</td>
|
<td>{{ $orderItem['ttl_qty'] ?? '-' }}</td>
|
||||||
<td><strong>₹{{ number_format($orderItem['amount'] ?? 0, 2) }}</strong></td>
|
<td><strong>₹{{ number_format($orderItem['amount'] ?? 0, 2) }}</strong></td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge bg-info">In Shipment</span>
|
@php
|
||||||
|
$status = strtolower(str_replace(' ', '-', $orderItem['status'] ?? 'pending'));
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<span class="status-badge status-{{ $status }}">
|
||||||
|
{{ ucfirst($shipment['status']) }}
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
@@ -1162,6 +1163,22 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@php
|
||||||
|
$derivedShipmentId = null;
|
||||||
|
|
||||||
|
foreach ($shipmentsData as $shipment) {
|
||||||
|
foreach ($shipment['orders'] as $orderItem) {
|
||||||
|
if ($orderItem['order_id'] == $orderData['order_id']) {
|
||||||
|
$derivedShipmentId = $shipment['shipment_id'];
|
||||||
|
break 2; // exit both loops
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@php
|
||||||
|
$gstAmount = $invoiceData['summary']['total'] - $invoiceData['summary']['amount'];
|
||||||
|
@endphp
|
||||||
|
|
||||||
{{-- =====================================================
|
{{-- =====================================================
|
||||||
INVOICE DETAILS TAB
|
INVOICE DETAILS TAB
|
||||||
@@ -1209,7 +1226,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="invoice-meta-item">
|
<div class="invoice-meta-item">
|
||||||
<div class="invoice-meta-label">Belongs to Shipment</div>
|
<div class="invoice-meta-label">Belongs to Shipment</div>
|
||||||
<div class="invoice-meta-value">{{ $order->invoice->shipment_id ?? 'N/A' }}</div>
|
<div class="invoice-meta-value">
|
||||||
|
{{ $invoiceData['shipment_id'] ?? $derivedShipmentId ?? 'N/A' }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invoice-meta-item">
|
<div class="invoice-meta-item">
|
||||||
<div class="invoice-meta-label">Order ID</div>
|
<div class="invoice-meta-label">Order ID</div>
|
||||||
@@ -1271,8 +1290,8 @@
|
|||||||
<td>{{ $item->qty }}</td>
|
<td>{{ $item->qty }}</td>
|
||||||
<td>{{ $item->qty }}</td>
|
<td>{{ $item->qty }}</td>
|
||||||
<td>{{ $item->unit ?? '-' }}</td>
|
<td>{{ $item->unit ?? '-' }}</td>
|
||||||
<td>₹{{ number_format($item->rate, 2) }}</td>
|
<td>₹{{ number_format($item->price ?? 0, 2) }}</td>
|
||||||
<td><strong>₹{{ number_format($item->amount, 2) }}</strong></td>
|
<td><strong>₹{{ number_format($item->ttl_amount ?? 0, 2) }}</strong></td>
|
||||||
<td>{{ number_format($item->cbm ?? 0, 3) }}</td>
|
<td>{{ number_format($item->cbm ?? 0, 3) }}</td>
|
||||||
<td>{{ number_format(($item->cbm ?? 0) * $item->qty, 3) }}</td>
|
<td>{{ number_format(($item->cbm ?? 0) * $item->qty, 3) }}</td>
|
||||||
<td>{{ number_format($item->kg ?? 0, 3) }}</td>
|
<td>{{ number_format($item->kg ?? 0, 3) }}</td>
|
||||||
@@ -1293,13 +1312,12 @@
|
|||||||
<div class="invoice-total-value">₹{{ number_format($invoiceData['summary']['amount'], 2) }}</div>
|
<div class="invoice-total-value">₹{{ number_format($invoiceData['summary']['amount'], 2) }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invoice-total-item">
|
<div class="invoice-total-item">
|
||||||
<div class="invoice-total-label">CGST (0%):</div>
|
<div class="invoice-total-label">GST:</div>
|
||||||
<div class="invoice-total-value">₹{{ number_format($invoiceData['summary']['cgst'], 2) }}</div>
|
<div class="invoice-total-value">
|
||||||
</div>
|
₹{{ number_format($gstAmount, 2) }}
|
||||||
<div class="invoice-total-item">
|
</div>
|
||||||
<div class="invoice-total-label">SGST (0%):</div>
|
|
||||||
<div class="invoice-total-value">₹{{ number_format($invoiceData['summary']['sgst'], 2) }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="invoice-grand-total">
|
<div class="invoice-grand-total">
|
||||||
|
|||||||
Reference in New Issue
Block a user