status update
This commit is contained in:
@@ -36,43 +36,43 @@ class AdminOrderController extends Controller
|
|||||||
return view('admin.orders_create', compact('markList'));
|
return view('admin.orders_create', compact('markList'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
// public function store(Request $request)
|
||||||
{
|
// {
|
||||||
$data = $request->validate([
|
// $data = $request->validate([
|
||||||
'mark_no' => 'required|string',
|
// 'mark_no' => 'required|string',
|
||||||
'origin' => 'nullable|string',
|
// 'origin' => 'nullable|string',
|
||||||
'destination' => 'nullable|string',
|
// 'destination' => 'nullable|string',
|
||||||
'ctn' => 'nullable|numeric',
|
// 'ctn' => 'nullable|numeric',
|
||||||
'qty' => 'nullable|numeric',
|
// 'qty' => 'nullable|numeric',
|
||||||
'ttl_qty' => 'nullable|numeric',
|
// 'ttl_qty' => 'nullable|numeric',
|
||||||
'ttl_amount' => 'nullable|numeric',
|
// 'ttl_amount' => 'nullable|numeric',
|
||||||
'cbm' => 'nullable|numeric',
|
// 'cbm' => 'nullable|numeric',
|
||||||
'ttl_cbm' => 'nullable|numeric',
|
// 'ttl_cbm' => 'nullable|numeric',
|
||||||
'kg' => 'nullable|numeric',
|
// 'kg' => 'nullable|numeric',
|
||||||
'ttl_kg' => 'nullable|numeric',
|
// 'ttl_kg' => 'nullable|numeric',
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
$order = Order::create([
|
// $order = Order::create([
|
||||||
'order_id' => $this->generateOrderId(),
|
// 'order_id' => $this->generateOrderId(),
|
||||||
'mark_no' => $data['mark_no'],
|
// 'mark_no' => $data['mark_no'],
|
||||||
'origin' => $data['origin'] ?? null,
|
// 'origin' => $data['origin'] ?? null,
|
||||||
'destination'=> $data['destination'] ?? null,
|
// 'destination'=> $data['destination'] ?? null,
|
||||||
'ctn' => $data['ctn'] ?? 0,
|
// 'ctn' => $data['ctn'] ?? 0,
|
||||||
'qty' => $data['qty'] ?? 0,
|
// 'qty' => $data['qty'] ?? 0,
|
||||||
'ttl_qty' => $data['ttl_qty'] ?? 0,
|
// 'ttl_qty' => $data['ttl_qty'] ?? 0,
|
||||||
'ttl_amount' => $data['ttl_amount'] ?? 0,
|
// 'ttl_amount' => $data['ttl_amount'] ?? 0,
|
||||||
'cbm' => $data['cbm'] ?? 0,
|
// 'cbm' => $data['cbm'] ?? 0,
|
||||||
'ttl_cbm' => $data['ttl_cbm'] ?? 0,
|
// 'ttl_cbm' => $data['ttl_cbm'] ?? 0,
|
||||||
'kg' => $data['kg'] ?? 0,
|
// 'kg' => $data['kg'] ?? 0,
|
||||||
'ttl_kg' => $data['ttl_kg'] ?? 0,
|
// 'ttl_kg' => $data['ttl_kg'] ?? 0,
|
||||||
'status' => 'pending',
|
// 'status' => 'pending',
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
$this->createInvoice($order);
|
// $this->createInvoice($order);
|
||||||
|
|
||||||
return redirect()->route('admin.orders.show', $order->id)
|
// return redirect()->route('admin.orders.show', $order->id)
|
||||||
->with('success', 'Order created successfully.');
|
// ->with('success', 'Order created successfully.');
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* ---------------------------
|
/* ---------------------------
|
||||||
* SHOW / POPUP
|
* SHOW / POPUP
|
||||||
@@ -580,7 +580,7 @@ class AdminOrderController extends Controller
|
|||||||
'ttl_cbm' => $total_ttl_cbm,
|
'ttl_cbm' => $total_ttl_cbm,
|
||||||
'kg' => $total_kg,
|
'kg' => $total_kg,
|
||||||
'ttl_kg' => $total_ttl_kg,
|
'ttl_kg' => $total_ttl_kg,
|
||||||
'status' => 'pending',
|
'status' => 'order_placed',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 6) order items
|
// 6) order items
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ class ShipmentController extends Controller
|
|||||||
$usedOrderIds = ShipmentItem::pluck('order_id')->toArray();
|
$usedOrderIds = ShipmentItem::pluck('order_id')->toArray();
|
||||||
|
|
||||||
// 2) Load available orders (not used in any shipment)
|
// 2) Load available orders (not used in any shipment)
|
||||||
$availableOrders = Order::whereNotIn('id', $usedOrderIds)->get();
|
$availableOrders = Order::whereNotIn('id', $usedOrderIds)
|
||||||
|
->where('status', '!=', 'order_placed')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3) Load all shipments for listing
|
// 3) Load all shipments for listing
|
||||||
$shipments = Shipment::latest()->get();
|
$shipments = Shipment::latest()->get();
|
||||||
@@ -65,6 +69,16 @@ class ShipmentController extends Controller
|
|||||||
// CALCULATE TOTALS
|
// CALCULATE TOTALS
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
$orders = Order::whereIn('id', $request->order_ids)->get();
|
$orders = Order::whereIn('id', $request->order_ids)->get();
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
if ($order->status === 'order_placed') {
|
||||||
|
return back()->with(
|
||||||
|
'error',
|
||||||
|
"Order {$order->order_id} is not ready for shipment"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$total_ctn = $orders->sum('ctn');
|
$total_ctn = $orders->sum('ctn');
|
||||||
$total_qty = $orders->sum('qty');
|
$total_qty = $orders->sum('qty');
|
||||||
@@ -82,7 +96,7 @@ class ShipmentController extends Controller
|
|||||||
'shipment_id' => $newShipmentId,
|
'shipment_id' => $newShipmentId,
|
||||||
'origin' => $request->origin,
|
'origin' => $request->origin,
|
||||||
'destination' => $request->destination,
|
'destination' => $request->destination,
|
||||||
'status' => Shipment::STATUS_PENDING,
|
'status' => Shipment::STATUS_SHIPMENT_READY,
|
||||||
'shipment_date' => $request->shipment_date,
|
'shipment_date' => $request->shipment_date,
|
||||||
|
|
||||||
'total_ctn' => $total_ctn,
|
'total_ctn' => $total_ctn,
|
||||||
@@ -135,29 +149,35 @@ class ShipmentController extends Controller
|
|||||||
* Update Shipment status from action button
|
* Update Shipment status from action button
|
||||||
*/
|
*/
|
||||||
public function updateStatus(Request $request)
|
public function updateStatus(Request $request)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'shipment_id' => 'required|exists:shipments,id',
|
'shipment_id' => 'required|exists:shipments,id',
|
||||||
'status' => 'required|string'
|
'status' => 'required|string'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 1) Update shipment status
|
$shipment = Shipment::findOrFail($request->shipment_id);
|
||||||
$shipment = Shipment::findOrFail($request->shipment_id);
|
$shipment->status = $request->status;
|
||||||
$shipment->status = $request->status;
|
$shipment->save();
|
||||||
$shipment->save();
|
|
||||||
|
|
||||||
// 2) Update ALL related orders' status
|
// ✅ Sync shipment status to orders ONLY after shipment exists
|
||||||
foreach ($shipment->orders as $order) {
|
foreach ($shipment->orders as $order) {
|
||||||
$order->status = $shipment->status; // status is string: pending, in_transit, dispatched, delivered
|
|
||||||
$order->save();
|
// Prevent rollback or overwrite
|
||||||
|
if ($order->status === 'delivered') {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with(
|
$order->status = $shipment->status;
|
||||||
'success',
|
$order->save();
|
||||||
"Shipment status updated to {$shipment->statusLabel()} and related orders updated."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with(
|
||||||
|
'success',
|
||||||
|
"Shipment status updated to {$shipment->statusLabel()}."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update shipment details
|
* Update shipment details
|
||||||
*/
|
*/
|
||||||
@@ -266,11 +286,23 @@ public function addOrders(Request $request, Shipment $shipment)
|
|||||||
'order_ids' => 'required|array|min:1',
|
'order_ids' => 'required|array|min:1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// फक्त न वापरलेले orders घ्या
|
|
||||||
$orders = Order::whereIn('id', $request->order_ids)->get();
|
$orders = Order::whereIn('id', $request->order_ids)->get();
|
||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
// pivot मध्ये insert
|
|
||||||
|
if ($order->status === 'order_placed') {
|
||||||
|
return back()->with(
|
||||||
|
'error',
|
||||||
|
"Order {$order->order_id} is not ready for shipment"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Prevent duplicates
|
||||||
|
if (ShipmentItem::where('order_id', $order->id)->exists()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ShipmentItem::create([
|
ShipmentItem::create([
|
||||||
'shipment_id' => $shipment->id,
|
'shipment_id' => $shipment->id,
|
||||||
'order_id' => $order->id,
|
'order_id' => $order->id,
|
||||||
@@ -282,23 +314,25 @@ public function addOrders(Request $request, Shipment $shipment)
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// totals
|
// Recalculate totals
|
||||||
$orderIds = ShipmentItem::where('shipment_id', $shipment->id)->pluck('order_id');
|
$orderIds = ShipmentItem::where('shipment_id', $shipment->id)->pluck('order_id');
|
||||||
$allOrders = Order::whereIn('id', $orderIds)->get();
|
$allOrders = Order::whereIn('id', $orderIds)->get();
|
||||||
|
|
||||||
$shipment->total_ctn = $allOrders->sum('ctn');
|
$shipment->update([
|
||||||
$shipment->total_qty = $allOrders->sum('qty');
|
'total_ctn' => $allOrders->sum('ctn'),
|
||||||
$shipment->total_ttl_qty = $allOrders->sum('ttl_qty');
|
'total_qty' => $allOrders->sum('qty'),
|
||||||
$shipment->total_cbm = $allOrders->sum('cbm');
|
'total_ttl_qty' => $allOrders->sum('ttl_qty'),
|
||||||
$shipment->total_ttl_cbm = $allOrders->sum('ttl_cbm');
|
'total_cbm' => $allOrders->sum('cbm'),
|
||||||
$shipment->total_kg = $allOrders->sum('kg');
|
'total_ttl_cbm' => $allOrders->sum('ttl_cbm'),
|
||||||
$shipment->total_ttl_kg = $allOrders->sum('ttl_kg');
|
'total_kg' => $allOrders->sum('kg'),
|
||||||
$shipment->total_amount = $allOrders->sum('ttl_amount');
|
'total_ttl_kg' => $allOrders->sum('ttl_kg'),
|
||||||
$shipment->save();
|
'total_amount' => $allOrders->sum('ttl_amount'),
|
||||||
|
]);
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('admin.shipments.dummy', $shipment->id)
|
->route('admin.shipments.dummy', $shipment->id)
|
||||||
->with('success', 'Orders added to shipment successfully.');
|
->with('success', 'Orders added to shipment successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -289,6 +289,44 @@ public function invoiceDetails($invoice_id)
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function confirmOrder($order_id)
|
||||||
|
{
|
||||||
|
$user = JWTAuth::parseToken()->authenticate();
|
||||||
|
|
||||||
|
if (! $user) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Unauthorized'
|
||||||
|
], 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = $user->orders()
|
||||||
|
->where('order_id', $order_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (! $order) {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Order not found'
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🚫 Only allow confirm from order_placed
|
||||||
|
if ($order->status !== 'order_placed') {
|
||||||
|
return response()->json([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Order cannot be confirmed'
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$order->status = 'order_confirmed';
|
||||||
|
$order->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Order confirmed successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,5 +64,25 @@ class Order extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const STATUS_LABELS = [
|
||||||
|
'order_placed' => 'Order Placed',
|
||||||
|
'order_confirmed' => 'Order Confirmed',
|
||||||
|
'supplier_warehouse' => 'Supplier Warehouse',
|
||||||
|
'consolidate_warehouse'=> 'Consolidate Warehouse',
|
||||||
|
'export_custom' => 'Export Custom',
|
||||||
|
'international_transit'=> 'International Transit',
|
||||||
|
'arrived_india' => 'Arrived at India',
|
||||||
|
'import_custom' => 'Import Custom',
|
||||||
|
'warehouse' => 'Warehouse',
|
||||||
|
'domestic_distribution'=> 'Domestic Distribution',
|
||||||
|
'out_for_delivery' => 'Out for Delivery',
|
||||||
|
'delivered' => 'Delivered',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function getStatusLabelAttribute()
|
||||||
|
{
|
||||||
|
return self::STATUS_LABELS[$this->status]
|
||||||
|
?? ucfirst(str_replace('_', ' ', $this->status));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,25 +45,6 @@ class Shipment extends Model
|
|||||||
return $this->belongsToMany(Order::class, 'shipment_items', 'shipment_id', 'order_id');
|
return $this->belongsToMany(Order::class, 'shipment_items', 'shipment_id', 'order_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------
|
|
||||||
// STATUS CONSTANTS
|
|
||||||
// ---------------------------
|
|
||||||
|
|
||||||
const STATUS_PENDING = 'pending';
|
|
||||||
const STATUS_IN_TRANSIT = 'in_transit';
|
|
||||||
const STATUS_DISPATCHED = 'dispatched';
|
|
||||||
const STATUS_DELIVERED = 'delivered';
|
|
||||||
|
|
||||||
public static function statusOptions()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
self::STATUS_PENDING => 'Pending',
|
|
||||||
self::STATUS_IN_TRANSIT => 'In Transit',
|
|
||||||
self::STATUS_DISPATCHED => 'Dispatched',
|
|
||||||
self::STATUS_DELIVERED => 'Delivered',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
// HELPERS
|
// HELPERS
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
@@ -73,8 +54,38 @@ class Shipment extends Model
|
|||||||
return $this->items()->count();
|
return $this->items()->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// STATUS CONSTANTS (LOGISTICS FLOW)
|
||||||
|
// ---------------------------
|
||||||
|
const STATUS_SHIPMENT_READY = 'shipment_ready';
|
||||||
|
const STATUS_EXPORT_CUSTOM = 'export_custom';
|
||||||
|
const STATUS_INTERNATIONAL_TRANSIT= 'international_transit';
|
||||||
|
const STATUS_ARRIVED_INDIA = 'arrived_india';
|
||||||
|
const STATUS_IMPORT_CUSTOM = 'import_custom';
|
||||||
|
const STATUS_WAREHOUSE = 'warehouse';
|
||||||
|
const STATUS_DOMESTIC_DISTRIBUTION= 'domestic_distribution';
|
||||||
|
const STATUS_OUT_FOR_DELIVERY = 'out_for_delivery';
|
||||||
|
const STATUS_DELIVERED = 'delivered';
|
||||||
|
|
||||||
|
public static function statusOptions()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
self::STATUS_SHIPMENT_READY => 'Shipment Ready',
|
||||||
|
self::STATUS_EXPORT_CUSTOM => 'Export Custom',
|
||||||
|
self::STATUS_INTERNATIONAL_TRANSIT => 'International Transit',
|
||||||
|
self::STATUS_ARRIVED_INDIA => 'Arrived at India',
|
||||||
|
self::STATUS_IMPORT_CUSTOM => 'Import Custom',
|
||||||
|
self::STATUS_WAREHOUSE => 'Warehouse',
|
||||||
|
self::STATUS_DOMESTIC_DISTRIBUTION => 'Domestic Distribution',
|
||||||
|
self::STATUS_OUT_FOR_DELIVERY => 'Out for Delivery',
|
||||||
|
self::STATUS_DELIVERED => 'Delivered',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function statusLabel()
|
public function statusLabel()
|
||||||
{
|
{
|
||||||
return self::statusOptions()[$this->status] ?? ucfirst($this->status);
|
return self::statusOptions()[$this->status]
|
||||||
|
?? ucfirst(str_replace('_', ' ', $this->status));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1253,19 +1253,49 @@ body, .container-fluid {
|
|||||||
<td>{{ $order->kg }}</td>
|
<td>{{ $order->kg }}</td>
|
||||||
<td>{{ $order->ttl_kg }}</td>
|
<td>{{ $order->ttl_kg }}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge badge-{{ $order->status }}">
|
@php
|
||||||
@if($order->status == 'pending')
|
// Badge color mapping
|
||||||
<i class="bi bi-clock-fill status-icon"></i>
|
$badgeMap = [
|
||||||
@elseif($order->status == 'in_transit')
|
'order_placed' => 'secondary',
|
||||||
<i class="bi bi-truck status-icon"></i>
|
'order_confirmed' => 'info',
|
||||||
@elseif($order->status == 'dispatched')
|
'supplier_warehouse' => 'warning',
|
||||||
<i class="bi bi-box-seam status-icon"></i>
|
'consolidate_warehouse' => 'warning',
|
||||||
@elseif($order->status == 'delivered')
|
'export_custom' => 'primary',
|
||||||
<i class="bi bi-check-circle-fill status-icon"></i>
|
'international_transit' => 'primary',
|
||||||
@endif
|
'arrived_india' => 'info',
|
||||||
{{ ucfirst(str_replace('_', ' ', $order->status)) }}
|
'import_custom' => 'info',
|
||||||
|
'warehouse' => 'dark',
|
||||||
|
'domestic_distribution' => 'primary',
|
||||||
|
'out_for_delivery' => 'success',
|
||||||
|
'delivered' => 'success',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Icon mapping
|
||||||
|
$iconMap = [
|
||||||
|
'order_placed' => 'bi-clock-fill',
|
||||||
|
'order_confirmed' => 'bi-check-circle',
|
||||||
|
'supplier_warehouse' => 'bi-box-seam',
|
||||||
|
'consolidate_warehouse' => 'bi-boxes',
|
||||||
|
'export_custom' => 'bi-upload',
|
||||||
|
'international_transit' => 'bi-truck',
|
||||||
|
'arrived_india' => 'bi-geo-alt',
|
||||||
|
'import_custom' => 'bi-download',
|
||||||
|
'warehouse' => 'bi-building',
|
||||||
|
'domestic_distribution' => 'bi-diagram-3',
|
||||||
|
'out_for_delivery' => 'bi-truck-flatbed',
|
||||||
|
'delivered' => 'bi-check-circle-fill',
|
||||||
|
];
|
||||||
|
|
||||||
|
$badgeClass = $badgeMap[$order->status] ?? 'secondary';
|
||||||
|
$iconClass = $iconMap[$order->status] ?? 'bi-info-circle';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<span class="badge bg-{{ $badgeClass }}">
|
||||||
|
<i class="bi {{ $iconClass }} status-icon"></i>
|
||||||
|
{{ $order->status_label }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
||||||
|
|||||||
@@ -1093,11 +1093,16 @@
|
|||||||
<div class="status-filter-container">
|
<div class="status-filter-container">
|
||||||
<select id="statusFilter" class="status-filter-select">
|
<select id="statusFilter" class="status-filter-select">
|
||||||
<option value="all">All Status</option>
|
<option value="all">All Status</option>
|
||||||
<option value="loading">Loading</option>
|
<option value="shipment_ready">Shipment Ready</option>
|
||||||
<option value="pending">Pending</option>
|
<option value="export_custom">Export Custom</option>
|
||||||
<option value="in_transit">In Transit</option>
|
<option value="international_transit">International Transit</option>
|
||||||
<option value="dispatched">Dispatched</option>
|
<option value="arrived_india">Arrived at India</option>
|
||||||
|
<option value="import_custom">Import Custom</option>
|
||||||
|
<option value="warehouse">Warehouse</option>
|
||||||
|
<option value="domestic_distribution">Domestic Distribution</option>
|
||||||
|
<option value="out_for_delivery">Out for Delivery</option>
|
||||||
<option value="delivered">Delivered</option>
|
<option value="delivered">Delivered</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<select id="carrierFilter">
|
<select id="carrierFilter">
|
||||||
@@ -1293,26 +1298,42 @@
|
|||||||
<form action="{{ route('admin.shipments.updateStatus') }}" method="POST" class="status-form">
|
<form action="{{ route('admin.shipments.updateStatus') }}" method="POST" class="status-form">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="hidden" name="shipment_id" value="{{ $ship->id }}">
|
<input type="hidden" name="shipment_id" value="{{ $ship->id }}">
|
||||||
<button type="submit" name="status" value="loading" class="status-option loading">
|
<button type="submit" name="status" value="shipment_ready" class="status-option shipment_ready">
|
||||||
<span class="status-indicator loading"></span>
|
Shipment Ready
|
||||||
Loading
|
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" name="status" value="pending" class="status-option pending">
|
|
||||||
<span class="status-indicator pending"></span>
|
<button type="submit" name="status" value="export_custom" class="status-option export_custom">
|
||||||
Pending
|
Export Custom
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" name="status" value="in_transit" class="status-option in_transit">
|
|
||||||
<span class="status-indicator in_transit"></span>
|
<button type="submit" name="status" value="international_transit" class="status-option international_transit">
|
||||||
In Transit
|
International Transit
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" name="status" value="dispatched" class="status-option dispatched">
|
|
||||||
<span class="status-indicator dispatched"></span>
|
<button type="submit" name="status" value="arrived_india" class="status-option arrived_india">
|
||||||
Dispatched
|
Arrived at India
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="import_custom" class="status-option import_custom">
|
||||||
|
Import Custom
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="warehouse" class="status-option warehouse">
|
||||||
|
Warehouse
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="domestic_distribution" class="status-option domestic_distribution">
|
||||||
|
Domestic Distribution
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="out_for_delivery" class="status-option out_for_delivery">
|
||||||
|
Out for Delivery
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="submit" name="status" value="delivered" class="status-option delivered">
|
<button type="submit" name="status" value="delivered" class="status-option delivered">
|
||||||
<span class="status-indicator delivered"></span>
|
|
||||||
Delivered
|
Delivered
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1716,38 +1737,68 @@ function renderTable() {
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="action-container">
|
<div class="action-container">
|
||||||
<button type="button" class="btn-edit-status" onclick="toggleStatusDropdown(this, ${shipment.id})" title="Edit Status">
|
<button type="button"
|
||||||
<i class="bi bi-pencil"></i>
|
class="btn-edit-status"
|
||||||
</button>
|
onclick="toggleStatusDropdown(this, ${shipment.id})"
|
||||||
<div class="status-dropdown" id="statusDropdown-${shipment.id}">
|
title="Edit Status">
|
||||||
<form action="/admin/shipments/update-status" method="POST" class="status-form">
|
<i class="bi bi-pencil"></i>
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
</button>
|
||||||
<input type="hidden" name="shipment_id" value="${shipment.id}">
|
|
||||||
<button type="submit" name="status" value="loading" class="status-option loading">
|
<div class="status-dropdown" id="statusDropdown-${shipment.id}">
|
||||||
<span class="status-indicator loading"></span>
|
<form action="/admin/shipments/update-status" method="POST" class="status-form">
|
||||||
Loading
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
</button>
|
<input type="hidden" name="shipment_id" value="${shipment.id}">
|
||||||
<button type="submit" name="status" value="pending" class="status-option pending">
|
|
||||||
<span class="status-indicator pending"></span>
|
<button type="submit" name="status" value="shipment_ready" class="status-option shipment_ready">
|
||||||
Pending
|
<span class="status-indicator shipment_ready"></span>
|
||||||
</button>
|
Shipment Ready
|
||||||
<button type="submit" name="status" value="in_transit" class="status-option in_transit">
|
</button>
|
||||||
<span class="status-indicator in_transit"></span>
|
|
||||||
In Transit
|
<button type="submit" name="status" value="export_custom" class="status-option export_custom">
|
||||||
</button>
|
<span class="status-indicator export_custom"></span>
|
||||||
<button type="submit" name="status" value="dispatched" class="status-option dispatched">
|
Export Custom
|
||||||
<span class="status-indicator dispatched"></span>
|
</button>
|
||||||
Dispatched
|
|
||||||
</button>
|
<button type="submit" name="status" value="international_transit" class="status-option international_transit">
|
||||||
<button type="submit" name="status" value="delivered" class="status-option delivered">
|
<span class="status-indicator international_transit"></span>
|
||||||
<span class="status-indicator delivered"></span>
|
International Transit
|
||||||
Delivered
|
</button>
|
||||||
</button>
|
|
||||||
</form>
|
<button type="submit" name="status" value="arrived_india" class="status-option arrived_india">
|
||||||
</div>
|
<span class="status-indicator arrived_india"></span>
|
||||||
</div>
|
Arrived at India
|
||||||
</td>
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="import_custom" class="status-option import_custom">
|
||||||
|
<span class="status-indicator import_custom"></span>
|
||||||
|
Import Custom
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="warehouse" class="status-option warehouse">
|
||||||
|
<span class="status-indicator warehouse"></span>
|
||||||
|
Warehouse
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="domestic_distribution" class="status-option domestic_distribution">
|
||||||
|
<span class="status-indicator domestic_distribution"></span>
|
||||||
|
Domestic Distribution
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="out_for_delivery" class="status-option out_for_delivery">
|
||||||
|
<span class="status-indicator out_for_delivery"></span>
|
||||||
|
Out for Delivery
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button type="submit" name="status" value="delivered" class="status-option delivered">
|
||||||
|
<span class="status-indicator delivered"></span>
|
||||||
|
Delivered
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
tbody.appendChild(row);
|
tbody.appendChild(row);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ Route::middleware(['auth:api'])->group(function () {
|
|||||||
Route::get('/user/order/{order_id}/shipment', [UserOrderController::class, 'orderShipment']);
|
Route::get('/user/order/{order_id}/shipment', [UserOrderController::class, 'orderShipment']);
|
||||||
Route::get('/user/order/{order_id}/invoice', [UserOrderController::class, 'orderInvoice']);
|
Route::get('/user/order/{order_id}/invoice', [UserOrderController::class, 'orderInvoice']);
|
||||||
Route::get('/user/order/{order_id}/track', [UserOrderController::class, 'trackOrder']);
|
Route::get('/user/order/{order_id}/track', [UserOrderController::class, 'trackOrder']);
|
||||||
|
Route::post('/user/orders/{order_id}/confirm', [UserOrderController::class, 'confirmOrder']);
|
||||||
|
|
||||||
|
|
||||||
// Invoice List
|
// Invoice List
|
||||||
|
|||||||
Reference in New Issue
Block a user