diff --git a/app/Http/Controllers/Admin/AdminAccountController.php b/app/Http/Controllers/Admin/AdminAccountController.php
index d760951..8b5d98d 100644
--- a/app/Http/Controllers/Admin/AdminAccountController.php
+++ b/app/Http/Controllers/Admin/AdminAccountController.php
@@ -11,6 +11,71 @@ use Illuminate\Support\Facades\DB;
class AdminAccountController extends Controller
{
+ public function updateEntry(Request $request)
+{
+ try {
+ $data = $request->validate([
+ 'entry_no' => 'required|exists:entries,entry_no',
+ 'description' => 'required|string|max:255',
+ 'order_quantity' => 'required|numeric|min:0',
+ ]);
+
+ $entry = Entry::where('entry_no', $data['entry_no'])->first();
+
+ if (!$entry) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Entry not found.',
+ ], 404);
+ }
+
+ $entry->description = $data['description'];
+ $entry->order_quantity = $data['order_quantity'];
+ $entry->save();
+
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Entry updated successfully.',
+ 'entry' => $entry,
+ ]);
+ } catch (\Throwable $e) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Server error: '.$e->getMessage(),
+ ], 500);
+ }
+}
+
+public function deleteEntry(Request $request)
+{
+ try {
+ $data = $request->validate([
+ 'entry_no' => 'required|exists:entries,entry_no',
+ ]);
+
+ $entry = Entry::where('entry_no', $data['entry_no'])->first();
+
+ if (!$entry) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Entry not found.',
+ ], 404);
+ }
+
+ $entry->delete();
+
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Entry deleted successfully.',
+ ]);
+ } catch (\Throwable $e) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Server error: '.$e->getMessage(),
+ ], 500);
+ }
+}
+
/**
* 🚀 1. Get dashboard entries
*/
@@ -245,4 +310,82 @@ class AdminAccountController extends Controller
'pending' => $entry->pending_amount,
]);
}
+
+ //--------------------------
+ //add order Entry
+ //--------------------------
+ public function addOrdersToEntry(Request $request)
+{
+ $data = $request->validate([
+ 'entry_no' => 'required|exists:entries,entry_no',
+ 'order_ids' => 'required|array',
+ 'order_ids.*' => 'integer|exists:orders,id',
+ ]);
+
+ return DB::transaction(function () use ($data) {
+ $entry = Entry::where('entry_no', $data['entry_no'])->firstOrFail();
+
+ // आधीचे orders काढू नका, फक्त नवीन add करा
+ $entry->orders()->syncWithoutDetaching($data['order_ids']);
+
+ // इथे quantity auto update
+ $entry->order_quantity = $entry->orders()->count();
+ $entry->save();
+
+ $entry->load('orders');
+
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Orders added successfully.',
+ 'entry' => $entry,
+ ]);
+ });
}
+
+
+
+public function getEntryOrders($entry_no)
+{
+ $entry = Entry::where('entry_no', $entry_no)
+ ->with('orders')
+ ->first();
+
+ if (!$entry) {
+ return response()->json([
+ 'success' => false,
+ 'message' => 'Entry not found.',
+ ], 404);
+ }
+
+ return response()->json([
+ 'success' => true,
+ 'orders' => $entry->orders,
+ ]);
+}
+
+public function removeOrderFromEntry(Request $request)
+{
+ $data = $request->validate([
+ 'entry_no' => 'required|exists:entries,entry_no',
+ 'order_id' => 'required|integer|exists:orders,id',
+ ]);
+
+ return DB::transaction(function () use ($data) {
+ $entry = Entry::where('entry_no', $data['entry_no'])->firstOrFail();
+
+ // order detach करा
+ $entry->orders()->detach($data['order_id']);
+
+ // इथे quantity auto update
+ $entry->order_quantity = $entry->orders()->count();
+ $entry->save();
+
+ return response()->json([
+ 'success' => true,
+ 'message' => 'Order removed successfully.',
+ 'entry' => $entry,
+ ]);
+ });
+}
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Admin/AdminOrderController.php b/app/Http/Controllers/Admin/AdminOrderController.php
index bdaef1e..ce86dfc 100644
--- a/app/Http/Controllers/Admin/AdminOrderController.php
+++ b/app/Http/Controllers/Admin/AdminOrderController.php
@@ -28,14 +28,14 @@ class AdminOrderController extends Controller
/**
* Orders list (detailed)
*/
- public function orderShow()
- {
- $orders = Order::with(['markList', 'shipments', 'invoice'])
- ->latest('id')
- ->get();
+ // public function orderShow()
+ // {
+ // $orders = Order::with(['markList', 'shipments', 'invoice'])
+ // ->latest('id')
+ // ->get();
- return view('admin.orders', compact('orders'));
- }
+ // return view('admin.orders', compact('orders'));
+ // }
// ---------------------------
// CREATE NEW ORDER (simple DB flow)
@@ -105,13 +105,13 @@ class AdminOrderController extends Controller
return view('admin.orders_show', compact('order', 'user'));
}
- public function popup($id)
- {
- $order = Order::with(['items', 'markList'])->findOrFail($id);
- $user = $this->getCustomerFromOrder($order);
+ // public function popup($id)
+ // {
+ // $order = Order::with(['items', 'markList'])->findOrFail($id);
+ // $user = $this->getCustomerFromOrder($order);
- return view('admin.popup', compact('order', 'user'));
- }
+ // return view('admin.popup', compact('order', 'user'));
+ // }
// ---------------------------
// ORDER ITEM MANAGEMENT (DB)
@@ -340,4 +340,84 @@ class AdminOrderController extends Controller
return null;
}
+
+ public function popup($id)
+ {
+ // Load order with items + markList
+ $order = Order::with(['items', 'markList'])->findOrFail($id);
+
+ // Fetch user based on markList customer_id (same as show method)
+ $user = null;
+ if ($order->markList && $order->markList->customer_id) {
+ $user = \App\Models\User::where('customer_id', $order->markList->customer_id)->first();
+ }
+
+ return view('admin.popup', 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.');
+ }
+
+ public function orderShow()
+ {
+ $orders = Order::with([
+ 'markList', // company, customer, origin, destination, date
+ 'shipments', // shipment_id, shipment_date, status
+ 'invoice' // invoice number, dates, amounts, status
+ ])
+ ->latest('id') // show latest orders first
+ ->get();
+
+ return view('admin.orders', compact('orders'));
+ }
+
+public function downloadPdf(Request $request)
+{
+ $query = Order::with(['markList', 'invoice', 'shipments']);
+
+ // Apply filters
+ if ($request->has('search') && $request->search) {
+ $search = $request->search;
+ $query->where(function($q) use ($search) {
+ $q->where('order_id', 'like', "%{$search}%")
+ ->orWhereHas('markList', function($q) use ($search) {
+ $q->where('company_name', 'like', "%{$search}%");
+ })
+ ->orWhereHas('invoice', function($q) use ($search) {
+ $q->where('invoice_number', 'like', "%{$search}%");
+ });
+ });
+ }
+
+ if ($request->has('status') && $request->status) {
+ $query->whereHas('invoice', function($q) use ($request) {
+ $q->where('status', $request->status);
+ });
+ }
+
+ if ($request->has('shipment') && $request->shipment) {
+ $query->whereHas('shipments', function($q) use ($request) {
+ $q->where('status', $request->shipment);
+ });
+ }
+
+ $orders = $query->get();
+
+ $pdf = PDF::loadView('admin.orders.pdf', compact('orders'));
+ return $pdf->download('orders-report-' . date('Y-m-d') . '.pdf');
+}
+
+public function downloadExcel(Request $request)
+{
+ return Excel::download(new OrdersExport($request), 'orders-report-' . date('Y-m-d') . '.xlsx');
+}
+
}
diff --git a/resources/views/admin/account.blade.php b/resources/views/admin/account.blade.php
index 4bbc8f4..cf3d3a3 100644
--- a/resources/views/admin/account.blade.php
+++ b/resources/views/admin/account.blade.php
@@ -66,29 +66,38 @@ body {
color:#fff; border:none; padding:10px 16px; border-radius:10px; font-weight:600;
cursor:pointer; transition: transform .15s ease, box-shadow .15s;
}
-.btn.ghost { background: transparent; color:var(--primary-1); border:1px solid #dbe4f5; box-shadow:none; }
+.btn.ghost { background: transparent; color:var(--primary-1); border:1.5px solid #dbe4f5; box-shadow:none; }
.btn:hover{ transform: translateY(-3px); box-shadow: 0 8px 26px rgba(36,58,114,0.12); }
/* account panels */
.account-panels {
display:flex;
gap:22px;
- align-items:flex-start;
+ align-items:stretch;
flex-wrap:wrap;
}
+
+/* Payment block with pagination */
+.payment-block {
+ flex:1;
+ min-width:48%;
+ display: flex;
+ flex-direction: column;
+}
+
.panel-card {
background: var(--card-bg);
border-radius:12px;
box-shadow:0 8px 20px rgba(25,40,80,0.06);
- flex:1;
- min-width:48%;
padding:22px;
box-sizing:border-box;
overflow-x:auto;
transition: transform .12s, box-shadow .12s;
- min-height: 480px;
+ min-height: 520px;
display: flex;
flex-direction: column;
+ flex: 1;
+ height: 100%;
}
.panel-card:hover{ transform: translateY(-4px); box-shadow:0 12px 28px rgba(25,40,80,0.08); }
.panel-title {
@@ -139,12 +148,11 @@ tr:hover td{ background:#fbfdff; }
text-align: center;
box-shadow: 0 2px 8px rgba(33, 43, 90, 0.07);
letter-spacing: 0.1px;
- background: #6b7280; /* fallback */
+ background: #6b7280;
transition: box-shadow 0.22s, transform 0.17s, background 0.22s;
vertical-align: middle;
margin: 3px 2px;
cursor: default;
- /* subtle glass effect */
backdrop-filter: blur(2px);
width: 99px;
}
@@ -199,7 +207,7 @@ tr:hover td{ background:#fbfdff; }
-webkit-appearance:none;
width:60px;
height:24px;
- background:#f25b5b; /* RED */
+ background:#f25b5b;
border:2px solid #f25b5b;
border-radius:999px;
position:relative;
@@ -305,6 +313,7 @@ tr:hover td{ background:#fbfdff; }
margin-top: 15px;
padding: 12px 0;
border-top: 1px solid #eef3fb;
+ margin-right:550px;
}
.pagination-info {
@@ -317,6 +326,8 @@ tr:hover td{ background:#fbfdff; }
display: flex;
align-items: center;
gap: 8px;
+ margin-right:-1050px;
+
}
.pagination-btn {
@@ -505,6 +516,190 @@ tr:hover td{ background:#fbfdff; }
margin-top:16px;
}
+/* Filter section styles - FOR BOTH TABLES */
+.payment-filters, .order-filters {
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ margin-bottom: 16px;
+ flex-wrap: wrap;
+ padding: 14px 16px;
+ background: linear-gradient(90deg, #f8fbff, #f5f9ff);
+ border-radius: 10px;
+ border: 1px solid #eef3fb;
+ width: 480px;
+ max-width: 480px;
+}
+
+.filter-group {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+}
+
+.filter-label {
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--primary-1);
+}
+
+.filter-control {
+ padding: 8px 12px;
+ border-radius: 8px;
+ border: 1px solid #e3eaf6;
+ background: #fff;
+ font-size: 14px;
+ min-width: 140px;
+}
+
+.filter-control:focus {
+ outline: none;
+ border-color: var(--primary-1);
+ box-shadow: 0 0 0 2px rgba(26, 41, 81, 0.1);
+}
+
+.filter-actions {
+ display: flex;
+ gap: 8px;
+ align-items: flex-end;
+}
+
+/* Action buttons in table */
+.action-btn {
+ background: transparent;
+ border: none;
+ cursor: pointer;
+ padding: 6px 8px;
+ border-radius: 6px;
+ transition: all 0.2s ease;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.edit-btn {
+ color: var(--primary-1);
+}
+
+.edit-btn:hover {
+ background: rgba(26, 41, 81, 0.08);
+}
+
+.delete-btn {
+ color: var(--danger);
+}
+
+.delete-btn:hover {
+ background: rgba(239, 79, 79, 0.08);
+}
+
+.action-btns {
+ display: flex;
+ gap: 4px;
+ justify-content: center;
+}
+
+/* Edit modal styles */
+.edit-modal .modal-box1 {
+ max-width: 800px;
+}
+
+.edit-form-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 16px;
+ margin-bottom: 16px;
+}
+
+.edit-form-actions {
+ display: flex;
+ gap: 12px;
+ justify-content: flex-end;
+ margin-top: 20px;
+}
+
+/* Order management in edit modal */
+.order-management-section {
+ margin-top: 20px;
+ border-top: 1px solid #eef3fb;
+ padding-top: 16px;
+}
+
+.order-management-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+}
+
+.order-management-title {
+ font-weight: 700;
+ color: var(--primary-1);
+ font-size: 16px;
+}
+
+.orders-table-container {
+ max-height: 300px;
+ overflow-y: auto;
+ border: 1px solid #eef3fb;
+ border-radius: 8px;
+ margin-bottom: 12px;
+}
+
+.orders-table {
+ width: 100%;
+ border-collapse: collapse;
+ font-size: 13px;
+}
+
+.orders-table th {
+ background: #f8fbff;
+ padding: 10px 12px;
+ text-align: left;
+ font-weight: 600;
+ color: var(--primary-1);
+ border-bottom: 1px solid #eef3fb;
+ position: sticky;
+ top: 0;
+}
+
+.orders-table td {
+ padding: 10px 12px;
+ border-bottom: 1px solid #f1f6ff;
+}
+
+.order-actions {
+ display: flex;
+ gap: 6px;
+}
+
+.remove-order-btn {
+ background: var(--danger);
+ color: white;
+ border: none;
+ border-radius: 4px;
+ padding: 4px 8px;
+ font-size: 12px;
+ cursor: pointer;
+ transition: background 0.2s;
+}
+
+.remove-order-btn:hover {
+ background: #d42c3f;
+}
+
+/* Add Order Modal */
+.add-order-modal .modal-box1 {
+ max-width: 1000px;
+}
+
+.add-order-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 12px;
+ margin-top: 16px;
+}
+
/* responsive */
@media (max-width:980px){
.create-grid { grid-template-columns: 1fr; }
@@ -514,6 +709,10 @@ tr:hover td{ background:#fbfdff; }
.pagination-controls { justify-content: center; }
.account-container { padding: 20px; }
.panel-card { padding: 18px; }
+ .payment-filters, .order-filters { flex-direction: column; align-items: stretch; }
+ .filter-group { width: 100%; }
+ .filter-control { min-width: auto; }
+ .edit-form-grid { grid-template-columns: 1fr; }
}
@media (max-width:768px){
@@ -522,6 +721,8 @@ tr:hover td{ background:#fbfdff; }
.top-actions .left { justify-content: center; }
.entry-summary-cards { gap: 12px; }
.entry-summary-card { min-width: 140px; }
+ .edit-form-grid { grid-template-columns: 1fr; }
+ .order-management-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
/* Table pagination wrapper */
@@ -537,6 +738,11 @@ tr:hover td{ background:#fbfdff; }
border-top: 1px solid #eef3fb;
padding-top: 12px;
}
+
+/* Right-aligned pagination */
+.pagination-right {
+ justify-content: flex-end;
+}
@@ -554,7 +760,7 @@ tr:hover td{ background:#fbfdff; }
-
+
@@ -565,26 +771,52 @@ tr:hover td{ background:#fbfdff; }
-
-
-
-
Payment Sent to China
-
Total entries: 0
+
+
+
+
+ Payment Sent to China
+ Total entries: 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Entry No | Date | Description |
+ Order Quantity | Region | Payment | Amount | Status |
+ Actions |
+
+
+
+
+
+
-
-
-
- | Entry No | Date | Description |
- Order Quantity | Region | Payment | Amount | Status |
-
-
-
-
-
-
-
-
-
@@ -654,7 +890,7 @@ tr:hover td{ background:#fbfdff; }
-
Create New Order
+
Create New Installment
@@ -714,7 +950,7 @@ tr:hover td{ background:#fbfdff; }
-