message
This commit is contained in:
@@ -5,74 +5,198 @@ namespace App\Http\Controllers\Admin;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Order;
|
use App\Models\Order;
|
||||||
use App\Models\MarkList; // ✅ Correct model
|
use App\Models\OrderItem;
|
||||||
|
use App\Models\MarkList;
|
||||||
|
|
||||||
class AdminOrderController extends Controller
|
class AdminOrderController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$orders = Order::latest()->get();
|
$orders = Order::latest()->get();
|
||||||
$markList = MarkList::where('status', 'active')->get(); // ✅ Correct usage
|
$markList = MarkList::where('status', 'active')->get();
|
||||||
|
|
||||||
return view('admin.dashboard', compact('orders', 'markList'));
|
return view('admin.dashboard', compact('orders', 'markList'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
// -------------------------------------------------------------------------
|
||||||
{
|
// STEP 1 : ADD TEMPORARY ITEM
|
||||||
$request->validate([
|
// -------------------------------------------------------------------------
|
||||||
'mark_no' => 'required',
|
|
||||||
'description' => 'required',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// ✅ Generate custom order_id like KNT-25-00000001
|
public function addTempItem(Request $request)
|
||||||
$year = date('y');
|
{
|
||||||
$prefix = "KNT-$year-";
|
// Validate item fields
|
||||||
|
$item = $request->validate([
|
||||||
|
'mark_no' => 'required',
|
||||||
|
'origin' => 'required',
|
||||||
|
'destination' => 'required',
|
||||||
|
'description' => 'required|string',
|
||||||
|
'ctn' => 'nullable|numeric',
|
||||||
|
'qty' => 'nullable|numeric',
|
||||||
|
'ttl_qty' => 'nullable|numeric',
|
||||||
|
'unit' => 'nullable|string',
|
||||||
|
'price' => 'nullable|numeric',
|
||||||
|
'ttl_amount' => 'nullable|numeric',
|
||||||
|
'cbm' => 'nullable|numeric',
|
||||||
|
'ttl_cbm' => 'nullable|numeric',
|
||||||
|
'kg' => 'nullable|numeric',
|
||||||
|
'ttl_kg' => 'nullable|numeric',
|
||||||
|
'shop_no' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
// Get the last order to increment number
|
// ❌ Prevent changing mark_no once first item added
|
||||||
$lastOrder = Order::latest('id')->first();
|
if (session()->has('mark_no') && session('mark_no') != $request->mark_no) {
|
||||||
$nextNumber = $lastOrder ? intval(substr($lastOrder->order_id, -8)) + 1 : 1;
|
return redirect()->to(route('admin.orders.index') . '#createOrderForm')
|
||||||
|
->with('error', 'You must finish or clear the current order before changing Mark No.');
|
||||||
|
}
|
||||||
|
|
||||||
// Format number with leading zeros (8 digits)
|
// Save mark, origin, destination ONLY ONCE
|
||||||
$newOrderId = $prefix . str_pad($nextNumber, 8, '0', STR_PAD_LEFT);
|
if (!session()->has('mark_no')) {
|
||||||
|
session([
|
||||||
|
'mark_no' => $request->mark_no,
|
||||||
|
'origin' => $request->origin,
|
||||||
|
'destination' => $request->destination
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// ✅ Create order
|
// ❌ DO NOT overwrite these values again
|
||||||
$order = new Order();
|
// session(['mark_no' => $request->mark_no]);
|
||||||
$order->order_id = $newOrderId; // ✅ set this field
|
// session(['origin' => $request->origin]);
|
||||||
$order->mark_no = $request->mark_no;
|
// session(['destination' => $request->destination]);
|
||||||
$order->origin = $request->origin;
|
|
||||||
$order->destination = $request->destination;
|
|
||||||
$order->description = $request->description;
|
|
||||||
$order->ctn = $request->ctn;
|
|
||||||
$order->qty = $request->qty;
|
|
||||||
$order->ttl_qty = $request->ttl_qty;
|
|
||||||
$order->unit = $request->unit;
|
|
||||||
$order->price = $request->price;
|
|
||||||
$order->ttl_amount = $request->ttl_amount;
|
|
||||||
$order->cbm = $request->cbm;
|
|
||||||
$order->ttl_cbm = $request->ttl_cbm;
|
|
||||||
$order->kg = $request->kg;
|
|
||||||
$order->ttl_kg = $request->ttl_kg;
|
|
||||||
$order->shop_no = $request->shop_no;
|
|
||||||
$order->status = 'pending';
|
|
||||||
$order->save();
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Order created successfully with ID: ' . $newOrderId);
|
// Add new sub-item into session
|
||||||
}
|
session()->push('temp_order_items', $item);
|
||||||
|
|
||||||
|
return redirect()->to(route('admin.orders.index') . '#createOrderForm')
|
||||||
|
->with('success', 'Item added.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// STEP 2 : DELETE TEMPORARY ITEM
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function deleteTempItem(Request $request)
|
||||||
|
{
|
||||||
|
$index = $request->index;
|
||||||
|
|
||||||
|
$items = session('temp_order_items', []);
|
||||||
|
|
||||||
|
if (isset($items[$index])) {
|
||||||
|
unset($items[$index]);
|
||||||
|
session(['temp_order_items' => array_values($items)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no items left → reset mark_no lock
|
||||||
|
if (empty($items)) {
|
||||||
|
session()->forget(['mark_no', 'origin', 'destination']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->to(route('admin.orders.index') . '#createOrderForm')
|
||||||
|
->with('success', 'Item removed successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// STEP 3 : FINISH ORDER
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public function finishOrder(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'mark_no' => 'required',
|
||||||
|
'origin' => 'required',
|
||||||
|
'destination' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$items = session('temp_order_items', []);
|
||||||
|
|
||||||
|
if (empty($items)) {
|
||||||
|
return redirect()->to(route('admin.orders.index') . '#createOrderForm')
|
||||||
|
->with('error', 'Add at least one item before finishing.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate Order ID
|
||||||
|
$year = date('y');
|
||||||
|
$prefix = "KNT-$year-";
|
||||||
|
|
||||||
|
$lastOrder = Order::latest('id')->first();
|
||||||
|
$nextNumber = $lastOrder ? intval(substr($lastOrder->order_id, -8)) + 1 : 1;
|
||||||
|
|
||||||
|
$orderId = $prefix . str_pad($nextNumber, 8, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
// TOTAL SUMS
|
||||||
|
$total_ctn = array_sum(array_column($items, 'ctn'));
|
||||||
|
$total_qty = array_sum(array_column($items, 'qty'));
|
||||||
|
$total_ttl_qty = array_sum(array_column($items, 'ttl_qty'));
|
||||||
|
$total_amount = array_sum(array_column($items, 'ttl_amount'));
|
||||||
|
$total_cbm = array_sum(array_column($items, 'cbm'));
|
||||||
|
$total_ttl_cbm = array_sum(array_column($items, 'ttl_cbm'));
|
||||||
|
$total_kg = array_sum(array_column($items, 'kg'));
|
||||||
|
$total_ttl_kg = array_sum(array_column($items, 'ttl_kg'));
|
||||||
|
|
||||||
|
// CREATE ORDER
|
||||||
|
$order = Order::create([
|
||||||
|
'order_id' => $orderId,
|
||||||
|
'mark_no' => $request->mark_no,
|
||||||
|
'origin' => $request->origin,
|
||||||
|
'destination' => $request->destination,
|
||||||
|
'ctn' => $total_ctn,
|
||||||
|
'qty' => $total_qty,
|
||||||
|
'ttl_qty' => $total_ttl_qty,
|
||||||
|
'ttl_amount' => $total_amount,
|
||||||
|
'cbm' => $total_cbm,
|
||||||
|
'ttl_cbm' => $total_ttl_cbm,
|
||||||
|
'kg' => $total_kg,
|
||||||
|
'ttl_kg' => $total_ttl_kg,
|
||||||
|
'status' => 'pending',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// SAVE ALL SUB-ITEMS
|
||||||
|
foreach ($items as $item) {
|
||||||
|
OrderItem::create([
|
||||||
|
'order_id' => $order->id,
|
||||||
|
'description' => $item['description'],
|
||||||
|
'ctn' => $item['ctn'],
|
||||||
|
'qty' => $item['qty'],
|
||||||
|
'ttl_qty' => $item['ttl_qty'],
|
||||||
|
'unit' => $item['unit'],
|
||||||
|
'price' => $item['price'],
|
||||||
|
'ttl_amount' => $item['ttl_amount'],
|
||||||
|
'cbm' => $item['cbm'],
|
||||||
|
'ttl_cbm' => $item['ttl_cbm'],
|
||||||
|
'kg' => $item['kg'],
|
||||||
|
'ttl_kg' => $item['ttl_kg'],
|
||||||
|
'shop_no' => $item['shop_no'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// CLEAR TEMP DATA
|
||||||
|
session()->forget(['temp_order_items', 'mark_no', 'origin', 'destination']);
|
||||||
|
|
||||||
|
return redirect()->route('admin.orders.index')
|
||||||
|
->with('success', 'Order saved successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
// ORDER SHOW PAGE
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$order = Order::with('markList')->findOrFail($id);
|
$order = Order::with('items', 'markList')->findOrFail($id);
|
||||||
|
|
||||||
// Get the mark list associated with this order
|
|
||||||
$markList = $order->markList;
|
|
||||||
|
|
||||||
// Fetch the user using the customer_id from mark list
|
|
||||||
$user = null;
|
$user = null;
|
||||||
if ($markList && $markList->customer_id) {
|
if ($order->markList && $order->markList->customer_id) {
|
||||||
$user = \App\Models\User::where('customer_id', $markList->customer_id)->first();
|
$user = \App\Models\User::where('customer_id', $order->markList->customer_id)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.orders_show', compact('order', 'markList', 'user'));
|
return view('admin.orders_show', compact('order', 'user'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetTemp()
|
||||||
|
{
|
||||||
|
session()->forget(['temp_order_items', 'mark_no', 'origin', 'destination']);
|
||||||
|
|
||||||
|
return redirect()->to(route('admin.orders.index') . '#createOrderForm')
|
||||||
|
->with('success', 'Order reset successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,37 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use App\Models\MarkList;
|
|
||||||
|
|
||||||
class Order extends Model
|
class Order extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'order_id', 'mark_no', 'description', 'origin', 'destination',
|
'order_id',
|
||||||
'ctn', 'qty', 'ttl_qty', 'unit', 'price', 'ttl_amount',
|
'mark_no',
|
||||||
'cbm', 'ttl_cbm', 'kg', 'ttl_kg', 'shop_no', 'status'
|
'origin',
|
||||||
|
'destination',
|
||||||
|
|
||||||
|
// totals only
|
||||||
|
'ctn',
|
||||||
|
'qty',
|
||||||
|
'ttl_qty',
|
||||||
|
'ttl_amount',
|
||||||
|
'cbm',
|
||||||
|
'ttl_cbm',
|
||||||
|
'kg',
|
||||||
|
'ttl_kg',
|
||||||
|
|
||||||
|
'status'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Relation using mark_no instead of id
|
// One order has many items
|
||||||
|
public function items()
|
||||||
|
{
|
||||||
|
return $this->hasMany(OrderItem::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Link using mark_no (optional)
|
||||||
public function markList()
|
public function markList()
|
||||||
{
|
{
|
||||||
return $this->hasOne(MarkList::class, 'mark_no', 'mark_no');
|
return $this->hasOne(MarkList::class, 'mark_no', 'mark_no');
|
||||||
|
|||||||
38
app/Models/OrderItem.php
Normal file
38
app/Models/OrderItem.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OrderItem extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'order_id',
|
||||||
|
'description',
|
||||||
|
'ctn',
|
||||||
|
'qty',
|
||||||
|
'ttl_qty',
|
||||||
|
'unit',
|
||||||
|
'price',
|
||||||
|
'ttl_amount',
|
||||||
|
'cbm',
|
||||||
|
'ttl_cbm',
|
||||||
|
'kg',
|
||||||
|
'ttl_kg',
|
||||||
|
'shop_no',
|
||||||
|
'meta',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'meta' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Link to parent order
|
||||||
|
public function order()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Order::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateOrderItemsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('order_items', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
|
||||||
|
// Link to orders table (parent order)
|
||||||
|
$table->foreignId('order_id')->constrained('orders')->onDelete('cascade');
|
||||||
|
|
||||||
|
// Sub-order / line item fields
|
||||||
|
$table->string('description')->nullable();
|
||||||
|
$table->integer('ctn')->nullable()->default(0);
|
||||||
|
$table->integer('qty')->nullable()->default(0);
|
||||||
|
$table->integer('ttl_qty')->nullable()->default(0);
|
||||||
|
|
||||||
|
$table->string('unit')->nullable();
|
||||||
|
|
||||||
|
// financials & measurements
|
||||||
|
$table->decimal('price', 14, 2)->nullable()->default(0.00);
|
||||||
|
$table->decimal('ttl_amount', 16, 2)->nullable()->default(0.00);
|
||||||
|
|
||||||
|
$table->decimal('cbm', 12, 3)->nullable()->default(0.000);
|
||||||
|
$table->decimal('ttl_cbm', 14, 3)->nullable()->default(0.000);
|
||||||
|
|
||||||
|
$table->decimal('kg', 12, 3)->nullable()->default(0.000);
|
||||||
|
$table->decimal('ttl_kg', 14, 3)->nullable()->default(0.000);
|
||||||
|
|
||||||
|
$table->string('shop_no')->nullable();
|
||||||
|
|
||||||
|
// optional extra data (json for extensibility)
|
||||||
|
$table->json('meta')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
// Indexes for common queries
|
||||||
|
$table->index('order_id');
|
||||||
|
$table->index('ctn');
|
||||||
|
$table->index('qty');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('order_items');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -135,29 +135,29 @@ body, .container-fluid { background: #f4f7fc; }
|
|||||||
|
|
||||||
<div class="container-fluid py-3">
|
<div class="container-fluid py-3">
|
||||||
|
|
||||||
<!-- DASHBOARD TITLE & DESC -->
|
<!-- DASHBOARD TITLE -->
|
||||||
<div class="dash-top-titlebox">
|
<div class="dash-top-titlebox">
|
||||||
<div class="dash-title-main">Admin Dashboard</div>
|
<div class="dash-title-main">Admin Dashboard</div>
|
||||||
<div class="dash-title-desc">Monitor operations and manage system</div>
|
<div class="dash-title-desc">Monitor operations and manage system</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- STATS CARDS BLOCK: 2 x 4 layout -->
|
<!-- 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 style="z-index:2;"><div class="stats-label">Total Shipments</div><div class="stats-value">1,247</div></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">1,247</div></div>
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">👥</span><div style="z-index:2;"><div class="stats-label">Active Customers</div><div class="stats-value">342</div></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-green"><span class="stats-icon">💰</span><div style="z-index:2;"><div class="stats-label">Total Revenue</div><div class="stats-value">₹123</div></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-red"><span class="stats-icon">⏳</span><div style="z-index:2;"><div class="stats-label">Pending Order</div><div class="stats-value">23</div></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>
|
</div>
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">📦</span><div style="z-index:2;"><div class="stats-label">Total Orders</div><div class="stats-value">453</div></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">453</div></div>
|
||||||
<div class="stats-card stats-card-blue"><span class="stats-icon">🧑💼</span><div style="z-index:2;"><div class="stats-label">Total Staff</div><div class="stats-value">125</div></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 style="z-index:2;"><div class="stats-label">Total Items</div><div class="stats-value">321</div></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-orng"><span class="stats-icon">⛔</span><div style="z-index:2;"><div class="stats-label">Inactive Customers</div><div class="stats-value">10</div></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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ORDER MANAGEMENT BOX (header + main) -->
|
<!-- ORDER MANAGEMENT -->
|
||||||
<div class="order-mgmt-box">
|
<div class="order-mgmt-box">
|
||||||
<div class="order-mgmt-bar">
|
<div class="order-mgmt-bar">
|
||||||
<span class="order-mgmt-title"><i class="bi bi-table"></i> Order Management</span>
|
<span class="order-mgmt-title"><i class="bi bi-table"></i> Order Management</span>
|
||||||
@@ -165,123 +165,307 @@ body, .container-fluid { background: #f4f7fc; }
|
|||||||
<i class="bi bi-plus-circle"></i> Create Order
|
<i class="bi bi-plus-circle"></i> Create Order
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="order-mgmt-main">
|
<div class="order-mgmt-main">
|
||||||
<!-- Create Order Form -->
|
<!-- CREATE ORDER FORM -->
|
||||||
<div id="createOrderForm" class="collapse mb-3">
|
<div id="createOrderForm" class="collapse mb-3">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
||||||
<div class="card-header bg-light"><strong>New Order Form</strong></div>
|
<div class="card-header bg-light"><strong>New Order Form</strong></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="{{ route('admin.orders.store') }}" method="POST">
|
|
||||||
|
{{-- FORM START --}}
|
||||||
|
<form action="{{ route('admin.orders.temp.add') }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-4"><label class="form-label">Mark No</label>
|
|
||||||
<select class="form-select" id="markNoSelect" name="mark_no" required>
|
{{-- MARK NO --}}
|
||||||
<option value="">Select Mark No</option>
|
<div class="col-md-4">
|
||||||
@foreach($markList as $mark)
|
<label class="form-label">Mark No</label>
|
||||||
<option value="{{ $mark->mark_no }}"
|
|
||||||
data-origin="{{ $mark->origin }}"
|
@if(session('temp_order_items'))
|
||||||
data-destination="{{ $mark->destination }}">
|
{{-- Mark No locked, cannot be changed --}}
|
||||||
{{ $mark->mark_no }} - {{ $mark->customer_name }}
|
<input type="text" class="form-control" value="{{ session('mark_no') }}" disabled>
|
||||||
</option>
|
|
||||||
@endforeach
|
{{-- Hidden field to submit mark_no --}}
|
||||||
</select>
|
<input type="hidden" name="mark_no" value="{{ session('mark_no') }}">
|
||||||
|
|
||||||
|
@else
|
||||||
|
{{-- Normal selectable dropdown --}}
|
||||||
|
<select class="form-select" id="markNoSelect" name="mark_no" required>
|
||||||
|
<option value="">Select Mark No</option>
|
||||||
|
@foreach($markList as $mark)
|
||||||
|
<option value="{{ $mark->mark_no }}"
|
||||||
|
data-origin="{{ $mark->origin }}"
|
||||||
|
data-destination="{{ $mark->destination }}"
|
||||||
|
@if(session('mark_no') == $mark->mark_no) selected @endif>
|
||||||
|
{{ $mark->mark_no }} - {{ $mark->customer_name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4"><label class="form-label">Origin</label><input type="text" class="form-control" name="origin" id="originField" readonly></div>
|
|
||||||
<div class="col-md-4"><label class="form-label">Destination</label><input type="text" class="form-control" name="destination" id="destinationField" readonly></div>
|
|
||||||
<div class="col-md-4"><label class="form-label">Description</label><input type="text" class="form-control" name="description" required></div>
|
{{-- ORIGIN --}}
|
||||||
<div class="col-md-2"><label class="form-label">CTN</label><input type="number" class="form-control" name="ctn"></div>
|
<div class="col-md-4">
|
||||||
<div class="col-md-2"><label class="form-label">QTY</label><input type="number" class="form-control" name="qty"></div>
|
<label class="form-label">Origin</label>
|
||||||
<div class="col-md-2"><label class="form-label">TTL/QTY</label><input type="number" class="form-control" name="ttl_qty"></div>
|
<input type="text" class="form-control"
|
||||||
<div class="col-md-2"><label class="form-label">Unit</label><input type="text" class="form-control" name="unit"></div>
|
id="originField"
|
||||||
<div class="col-md-2"><label class="form-label">Price</label><input type="number" step="0.01" class="form-control" name="price"></div>
|
name="origin"
|
||||||
<div class="col-md-2"><label class="form-label">TTL Amount</label><input type="number" step="0.01" class="form-control" name="ttl_amount"></div>
|
readonly required
|
||||||
<div class="col-md-2"><label class="form-label">CBM</label><input type="number" step="0.001" class="form-control" name="cbm"></div>
|
value="{{ session('origin') }}">
|
||||||
<div class="col-md-2"><label class="form-label">TTL CBM</label><input type="number" step="0.001" class="form-control" name="ttl_cbm"></div>
|
</div>
|
||||||
<div class="col-md-2"><label class="form-label">KG</label><input type="number" step="0.001" class="form-control" name="kg"></div>
|
|
||||||
<div class="col-md-2"><label class="form-label">TTL KG</label><input type="number" step="0.001" class="form-control" name="ttl_kg"></div>
|
{{-- DESTINATION --}}
|
||||||
<div class="col-md-3"><label class="form-label">Shop No</label><input type="text" class="form-control" name="shop_no"></div>
|
<div class="col-md-4">
|
||||||
<div class="col-md-12 text-end">
|
<label class="form-label">Destination</label>
|
||||||
<button type="submit" class="btn btn-success mt-3"><i class="bi bi-save"></i> Submit Order</button>
|
<input type="text" class="form-control"
|
||||||
|
id="destinationField"
|
||||||
|
name="destination"
|
||||||
|
readonly required
|
||||||
|
value="{{ session('destination') }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-3">
|
||||||
|
|
||||||
|
{{-- ITEM INPUTS --}}
|
||||||
|
<h6 class="text-primary">Add Item</h6>
|
||||||
|
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label">Description</label>
|
||||||
|
<input type="text" class="form-control" name="description" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-2"><label>CTN</label><input type="number" name="ctn" class="form-control"></div>
|
||||||
|
<div class="col-md-2"><label>QTY</label><input type="number" name="qty" class="form-control"></div>
|
||||||
|
<div class="col-md-2"><label>TTL/QTY</label><input type="number" name="ttl_qty" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-2"><label>Unit</label><input type="text" name="unit" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-2"><label>Price</label><input type="number" step="0.01" name="price" class="form-control"></div>
|
||||||
|
<div class="col-md-2"><label>TTL Amount</label><input type="number" step="0.01" name="ttl_amount" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-2"><label>CBM</label><input type="number" step="0.001" name="cbm" class="form-control"></div>
|
||||||
|
<div class="col-md-2"><label>TTL CBM</label><input type="number" step="0.001" name="ttl_cbm" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-2"><label>KG</label><input type="number" step="0.001" name="kg" class="form-control"></div>
|
||||||
|
<div class="col-md-2"><label>TTL KG</label><input type="number" step="0.001" name="ttl_kg" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-3"><label>Shop No</label><input type="text" name="shop_no" class="form-control"></div>
|
||||||
|
|
||||||
|
<div class="col-md-12 text-end mt-3">
|
||||||
|
<button class="btn btn-info">
|
||||||
|
<i class="bi bi-plus-circle"></i> Add Item
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
{{-- FORM END --}}
|
||||||
|
|
||||||
|
{{-- RESET ORDER BUTTON --}}
|
||||||
|
@if(session('temp_order_items'))
|
||||||
|
<div class="text-start mt-2">
|
||||||
|
<form action="{{ route('admin.orders.temp.reset') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<button class="btn btn-sm btn-warning">
|
||||||
|
<i class="bi bi-arrow-repeat"></i> Reset Order
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{-- TEMPORARY ITEMS TABLE --}}
|
||||||
|
@if(session('temp_order_items') && count(session('temp_order_items')) > 0)
|
||||||
|
|
||||||
|
<hr class="my-4">
|
||||||
|
|
||||||
|
<h5 class="text-success">Temporary Items</h5>
|
||||||
|
|
||||||
|
<table class="table table-bordered text-center align-middle">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>CTN</th>
|
||||||
|
<th>QTY</th>
|
||||||
|
<th>TTL/QTY</th>
|
||||||
|
<th>Unit</th>
|
||||||
|
<th>Price</th>
|
||||||
|
<th>TTL Amount</th>
|
||||||
|
<th>CBM</th>
|
||||||
|
<th>TTL CBM</th>
|
||||||
|
<th>KG</th>
|
||||||
|
<th>TTL KG</th>
|
||||||
|
<th>Shop No</th>
|
||||||
|
<th>Remove</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach(session('temp_order_items') as $index => $item)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $index + 1 }}</td>
|
||||||
|
<td>{{ $item['description'] }}</td>
|
||||||
|
<td>{{ $item['ctn'] }}</td>
|
||||||
|
<td>{{ $item['qty'] }}</td>
|
||||||
|
<td>{{ $item['ttl_qty'] }}</td>
|
||||||
|
<td>{{ $item['unit'] }}</td>
|
||||||
|
<td>{{ $item['price'] }}</td>
|
||||||
|
<td>{{ $item['ttl_amount'] }}</td>
|
||||||
|
<td>{{ $item['cbm'] }}</td>
|
||||||
|
<td>{{ $item['ttl_cbm'] }}</td>
|
||||||
|
<td>{{ $item['kg'] }}</td>
|
||||||
|
<td>{{ $item['ttl_kg'] }}</td>
|
||||||
|
<td>{{ $item['shop_no'] }}</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<form action="{{ route('admin.orders.temp.delete') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="index" value="{{ $index }}">
|
||||||
|
<button class="btn btn-sm btn-danger">
|
||||||
|
<i class="bi bi-trash"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="text-end mt-3">
|
||||||
|
<form action="{{ route('admin.orders.finish') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="mark_no" value="{{ session('mark_no') }}">
|
||||||
|
<input type="hidden" name="origin" value="{{ session('origin') }}">
|
||||||
|
<input type="hidden" name="destination" value="{{ session('destination') }}">
|
||||||
|
|
||||||
|
<button class="btn btn-success btn-lg">
|
||||||
|
<i class="bi bi-check-circle"></i> Finish & Save Order
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Recent Orders Table --}}
|
<!-- RECENT ORDERS TABLE -->
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
<div class="card-header bg-light">
|
<div class="card-header bg-light">
|
||||||
<strong>Recent Orders</strong>
|
<strong>Recent Orders</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body table-responsive">
|
|
||||||
<table class="table table-striped table-bordered align-middle text-center">
|
<div class="card-body table-responsive">
|
||||||
<thead class="table-light">
|
<table class="table table-striped table-bordered align-middle text-center">
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
<thead class="table-light">
|
||||||
<th>Order ID</th>
|
<tr>
|
||||||
<th>Mark No</th>
|
<th>#</th>
|
||||||
<th>Description</th>
|
<th>Order ID</th>
|
||||||
<th>Origin</th>
|
<th>Mark No</th>
|
||||||
<th>Destination</th>
|
<th>Origin</th>
|
||||||
<th>CTN</th>
|
<th>Destination</th>
|
||||||
<th>QTY</th>
|
<th>Total CTN</th>
|
||||||
<th>TTL/QTY</th>
|
<th>Total QTY</th>
|
||||||
<th>Unit</th>
|
<th>Total TTL/QTY</th>
|
||||||
<th>Price (₹)</th>
|
<th>Total Amount (₹)</th>
|
||||||
<th>TTL Amount (₹)</th>
|
<th>Total CBM</th>
|
||||||
<th>CBM</th>
|
<th>Total TTL CBM</th>
|
||||||
<th>TTL CBM</th>
|
<th>Total KG</th>
|
||||||
<th>KG</th>
|
<th>Total TTL KG</th>
|
||||||
<th>TTL KG</th>
|
<th>Status</th>
|
||||||
<th>Shop No</th>
|
<th>Date</th>
|
||||||
<th>Status</th>
|
<th>Action</th>
|
||||||
<th>Date</th>
|
</tr>
|
||||||
<th>Action</th>
|
</thead>
|
||||||
</tr>
|
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
@forelse($orders as $order)
|
||||||
@forelse($orders as $index => $order)
|
<tr>
|
||||||
<tr>
|
<td>{{ $order->id }}</td>
|
||||||
<td>{{ $order->id }}</td>
|
|
||||||
<td><a href="{{ route('admin.orders.show', $order->id) }}" class="fw-semibold text-primary">{{ $order->order_id }}</a></td>
|
<td>
|
||||||
<td>{{ $order->mark_no }}</td>
|
<a href="{{ route('admin.orders.show', $order->id) }}" class="fw-semibold text-primary">
|
||||||
<td>{{ $order->description }}</td>
|
{{ $order->order_id }}
|
||||||
<td>{{ $order->origin }}</td>
|
</a>
|
||||||
<td>{{ $order->destination }}</td>
|
</td>
|
||||||
<td>{{ $order->ctn }}</td>
|
|
||||||
<td>{{ $order->qty }}</td>
|
<td>{{ $order->mark_no }}</td>
|
||||||
<td>{{ $order->ttl_qty }}</td>
|
<td>{{ $order->origin }}</td>
|
||||||
<td>{{ $order->unit }}</td>
|
<td>{{ $order->destination }}</td>
|
||||||
<td>₹{{ number_format($order->price, 2) }}</td>
|
|
||||||
<td>₹{{ number_format($order->ttl_amount, 2) }}</td>
|
<td>{{ $order->ctn }}</td>
|
||||||
<td>{{ $order->cbm }}</td>
|
<td>{{ $order->qty }}</td>
|
||||||
<td>{{ $order->ttl_cbm }}</td>
|
<td>{{ $order->ttl_qty }}</td>
|
||||||
<td>{{ $order->kg }}</td>
|
<td>₹{{ number_format($order->ttl_amount, 2) }}</td>
|
||||||
<td>{{ $order->ttl_kg }}</td>
|
|
||||||
<td>{{ $order->shop_no }}</td>
|
<td>{{ $order->cbm }}</td>
|
||||||
<td><span class="badge bg-info text-dark">{{ ucfirst($order->status) }}</span></td>
|
<td>{{ $order->ttl_cbm }}</td>
|
||||||
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
<td>{{ $order->kg }}</td>
|
||||||
<td>
|
<td>{{ $order->ttl_kg }}</td>
|
||||||
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
|
||||||
<i class="bi bi-eye"></i> View
|
<td>
|
||||||
</a>
|
<span class="badge bg-info text-dark">{{ ucfirst($order->status) }}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
|
||||||
@empty
|
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
||||||
<tr><td colspan="20" class="text-center text-muted">No orders found</td></tr>
|
|
||||||
@endforelse
|
<td>
|
||||||
</tbody>
|
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
||||||
</table>
|
<i class="bi bi-eye"></i> View
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="16" class="text-muted">No orders found</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- JS: LOCK MARK NO + LOAD ORIGIN/DESTINATION --}}
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('markNoSelect').addEventListener('change', function() {
|
document.getElementById('markNoSelect').addEventListener('change', function () {
|
||||||
const option = this.options[this.selectedIndex];
|
|
||||||
document.getElementById('originField').value = option.dataset.origin || '';
|
const locked = {{ session('temp_order_items') ? 'true' : 'false' }};
|
||||||
document.getElementById('destinationField').value = option.dataset.destination || '';
|
|
||||||
|
if (locked) {
|
||||||
|
alert("You must finish the current order before changing Mark No.");
|
||||||
|
this.value = "{{ session('mark_no') }}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const option = this.options[this.selectedIndex];
|
||||||
|
document.getElementById('originField').value = option.dataset.origin || '';
|
||||||
|
document.getElementById('destinationField').value = option.dataset.destination || '';
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{{-- AUTO OPEN FORM AFTER REDIRECT --}}
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
if (window.location.hash === "#createOrderForm") {
|
||||||
|
new bootstrap.Collapse(document.getElementById('createOrderForm'), { toggle: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between align-items-start">
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
<div>
|
<div>
|
||||||
<h4 class="fw-bold mb-0">Orders Details</h4>
|
<h4 class="fw-bold mb-0">Order Details</h4>
|
||||||
<small class="text-muted">Detailed view of all orders in this shipment consolidation.</small>
|
<small class="text-muted">Detailed view of this shipment order</small>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('admin.dashboard') }}" class="btn-close"></a>
|
<a href="{{ route('admin.dashboard') }}" class="btn-close"></a>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,61 +43,101 @@
|
|||||||
{{-- Order Summary --}}
|
{{-- Order Summary --}}
|
||||||
<div class="bg-light rounded p-3 mb-3">
|
<div class="bg-light rounded p-3 mb-3">
|
||||||
<div class="row text-center">
|
<div class="row text-center">
|
||||||
<div class="col-md-4 border-end">
|
<div class="col-md-3 border-end">
|
||||||
<p class="fw-semibold mb-1">Order ID</p>
|
<p class="fw-semibold mb-1">Order ID</p>
|
||||||
<h6 class="text-primary fw-bold">{{ $order->order_id }}</h6>
|
<h6 class="text-primary fw-bold">{{ $order->order_id }}</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 border-end">
|
|
||||||
<p class="fw-semibold mb-1">Total Orders</p>
|
<div class="col-md-3 border-end">
|
||||||
<h6>{{ 1 }}</h6>
|
<p class="fw-semibold mb-1">Mark No</p>
|
||||||
|
<h6>{{ $order->mark_no }}</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
|
||||||
|
<div class="col-md-3 border-end">
|
||||||
|
<p class="fw-semibold mb-1">Total Items</p>
|
||||||
|
<h6>{{ $order->items->count() }}</h6>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
<p class="fw-semibold mb-1">Status</p>
|
<p class="fw-semibold mb-1">Status</p>
|
||||||
<span class="badge bg-warning text-dark">{{ ucfirst($order->status) }}</span>
|
<span class="badge bg-warning text-dark">{{ ucfirst($order->status) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Order Table --}}
|
{{-- Origin - Destination --}}
|
||||||
|
<div class="row text-center mb-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p class="mb-1 fw-semibold text-muted">Origin</p>
|
||||||
|
<h6>{{ $order->origin }}</h6>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p class="mb-1 fw-semibold text-muted">Destination</p>
|
||||||
|
<h6>{{ $order->destination }}</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Order Items Table --}}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-bordered align-middle">
|
<table class="table table-bordered align-middle text-center">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Item No</th>
|
<th>#</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>CTN</th>
|
<th>CTN</th>
|
||||||
<th>QTY</th>
|
<th>QTY</th>
|
||||||
<th>TTL/QTY</th>
|
<th>TTL/QTY</th>
|
||||||
<th>Unit</th>
|
<th>Unit</th>
|
||||||
<th>Amount (₹)</th>
|
<th>Price (₹)</th>
|
||||||
|
<th>TTL Amount (₹)</th>
|
||||||
|
<th>CBM</th>
|
||||||
|
<th>TTL CBM</th>
|
||||||
|
<th>KG</th>
|
||||||
|
<th>TTL KG</th>
|
||||||
|
<th>Shop No</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@foreach($order->items as $index => $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $order->mark_no }}</td>
|
<td>{{ $index + 1 }}</td>
|
||||||
<td>{{ $order->description }}</td>
|
<td>{{ $item->description }}</td>
|
||||||
<td>{{ $order->ctn }}</td>
|
<td>{{ $item->ctn }}</td>
|
||||||
<td>{{ $order->qty }}</td>
|
<td>{{ $item->qty }}</td>
|
||||||
<td>{{ $order->ttl_qty }}</td>
|
<td>{{ $item->ttl_qty }}</td>
|
||||||
<td>{{ $order->unit }}</td>
|
<td>{{ $item->unit }}</td>
|
||||||
<td>₹{{ number_format($order->ttl_amount, 2) }}</td>
|
<td>{{ number_format($item->price, 2) }}</td>
|
||||||
|
<td>{{ number_format($item->ttl_amount, 2) }}</td>
|
||||||
|
<td>{{ $item->cbm }}</td>
|
||||||
|
<td>{{ $item->ttl_cbm }}</td>
|
||||||
|
<td>{{ $item->kg }}</td>
|
||||||
|
<td>{{ $item->ttl_kg }}</td>
|
||||||
|
<td>{{ $item->shop_no }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Totals --}}
|
{{-- Totals --}}
|
||||||
<div class="d-flex justify-content-between mt-3">
|
<div class="row text-center mt-4">
|
||||||
<div>
|
<div class="col-md-3">
|
||||||
<h6 class="text-primary mb-0 fw-bold">{{ $order->ttl_qty }}</h6>
|
<h6 class="fw-bold text-primary">{{ $order->ctn }}</h6>
|
||||||
<small class="text-muted">Total TTL/QTY</small>
|
<small class="text-muted">Total CTN</small>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<h6 class="text-success mb-0 fw-bold">{{ $order->ttl_kg }}</h6>
|
<div class="col-md-3">
|
||||||
|
<h6 class="fw-bold text-primary">{{ $order->qty }}</h6>
|
||||||
|
<small class="text-muted">Total QTY</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h6 class="fw-bold text-success">{{ $order->ttl_kg }}</h6>
|
||||||
<small class="text-muted">Total TTL KG</small>
|
<small class="text-muted">Total TTL KG</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-end">
|
|
||||||
<h6 class="text-danger mb-0 fw-bold">₹{{ number_format($order->ttl_amount, 2) }}</h6>
|
<div class="col-md-3">
|
||||||
|
<h6 class="fw-bold text-danger">₹{{ number_format($order->ttl_amount, 2) }}</h6>
|
||||||
<small class="text-muted">Total Amount</small>
|
<small class="text-muted">Total Amount</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -51,9 +51,30 @@ Route::prefix('admin')->middleware('auth:admin')->group(function () {
|
|||||||
Route::get('/mark-list/status/{id}', [AdminMarkListController::class, 'toggleStatus'])->name('admin.marklist.toggle');
|
Route::get('/mark-list/status/{id}', [AdminMarkListController::class, 'toggleStatus'])->name('admin.marklist.toggle');
|
||||||
|
|
||||||
Route::get('/orders', fn() => view('admin.orders'))->name('admin.orders');
|
Route::get('/orders', fn() => view('admin.orders'))->name('admin.orders');
|
||||||
|
|
||||||
// Orders Controller Routes
|
// Orders Controller Routes
|
||||||
Route::get('/orders/list', [AdminOrderController::class, 'index'])->name('admin.orders.index');
|
// Show admin order dashboard (list + create form)
|
||||||
Route::post('/orders/store', [AdminOrderController::class, 'store'])->name('admin.orders.store');
|
Route::get('/orders/list', [AdminOrderController::class, 'index'])
|
||||||
Route::get('/orders/{id}', [AdminOrderController::class, 'show'])->name('admin.orders.show');
|
->name('admin.orders.index');
|
||||||
|
|
||||||
|
// View a single order
|
||||||
|
Route::get('/orders/{id}', [AdminOrderController::class, 'show'])
|
||||||
|
->name('admin.orders.show');
|
||||||
|
|
||||||
|
// TEMPORARY ITEMS (multi-order system)
|
||||||
|
Route::post('/orders/temp/add', [AdminOrderController::class, 'addTempItem'])
|
||||||
|
->name('admin.orders.temp.add');
|
||||||
|
|
||||||
|
Route::post('/orders/temp/delete', [AdminOrderController::class, 'deleteTempItem'])
|
||||||
|
->name('admin.orders.temp.delete');
|
||||||
|
|
||||||
|
// Finish and save order
|
||||||
|
Route::post('/orders/finish', [AdminOrderController::class, 'finishOrder'])
|
||||||
|
->name('admin.orders.finish');
|
||||||
|
|
||||||
|
Route::post('/orders/temp/reset', [AdminOrderController::class, 'resetTemp'])
|
||||||
|
->name('admin.orders.temp.reset');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user