merge resolve conflict

This commit is contained in:
divya abdar
2025-12-01 11:42:47 +05:30
7 changed files with 2467 additions and 780 deletions

View File

@@ -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,
]);
});
}
}

View File

@@ -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');
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -12,30 +12,41 @@
/* Use Inter globally */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root { --admin-font: 'Inter', sans-serif; }
:root {
--admin-font: 'Inter', sans-serif;
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--success-gradient: linear-gradient(135deg, #10b981, #34d399);
--warning-gradient: linear-gradient(135deg, #fef3c7, #fde68a);
--danger-gradient: linear-gradient(135deg, #fef2f2, #fecaca);
--info-gradient: linear-gradient(135deg, #dbeafe, #bfdbfe);
--purple-gradient: linear-gradient(135deg, #e9d5ff, #d8b4fe);
}
body, input, select, textarea, button, table, th, td, .orders-container {
font-family: var(--admin-font);
}
/* VARIABLES AND BASE STYLES */
:root {
--primary-color: #3b82f6; /* Blue 500 */
--primary-hover: #2563eb; /* Blue 600 */
--border-light: #e5e7eb; /* Gray 200 */
--primary-color: #3b82f6;
--primary-hover: #2563eb;
--border-light: #e5e7eb;
--bg-container: #ffffff;
--bg-light: #f9fafb; /* Gray 50 */
--bg-hover: #f3f4f6; /* Gray 100 */
--text-dark: #1f2937; /* Gray 800 */
--text-muted: #6b7280; /* Gray 500 */
--bg-light: #f9fafb;
--bg-hover: #f3f4f6;
--text-dark: #1f2937;
--text-muted: #6b7280;
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.orders-container {
background: var(--bg-container);
padding: 24px;
border-radius: 12px;
border-radius: 16px;
box-shadow: var(--shadow-lg);
margin-top: 28px;
border: 1px solid rgba(0,0,0,0.05);
}
.orders-title {
@@ -43,30 +54,136 @@
font-weight: 700;
margin-bottom: 24px;
color: var(--text-dark);
border-bottom: 1px solid var(--border-light);
padding-bottom: 16px;
display: flex;
align-items: center;
gap: 12px;
}
.orders-title i {
background: var(--primary-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 32px;
}
/* HEADER STATS CARDS */
.stats-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 16px;
margin-bottom: 24px;
}
.stat-card {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: var(--shadow-sm);
border-left: 4px solid;
display: flex;
flex-direction: column;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.stat-card.total { border-left-color: #667eea; }
.stat-card.paid { border-left-color: #10b981; }
.stat-card.pending { border-left-color: #f59e0b; }
.stat-card.overdue { border-left-color: #ef4444; }
.stat-value {
font-size: 28px;
font-weight: 700;
margin-bottom: 8px;
}
.stat-label {
font-size: 14px;
color: var(--text-muted);
font-weight: 500;
}
/* ===== DOWNLOAD BUTTONS STYLES ===== */
.download-section {
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
gap: 12px;
}
.download-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 12px 20px;
border: none;
border-radius: 10px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
box-shadow: var(--shadow-sm);
}
.download-btn i {
font-size: 16px;
}
.download-btn.pdf {
background: linear-gradient(135deg, #ef4444, #dc2626);
color: white;
}
.download-btn.pdf:hover {
background: linear-gradient(135deg, #dc2626, #b91c1c);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.download-btn.excel {
background: linear-gradient(135deg, #10b981, #059669);
color: white;
}
.download-btn.excel:hover {
background: linear-gradient(135deg, #059669, #047857);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.download-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none !important;
}
/* TABLE STRUCTURE & WRAPPER FOR RESPONSIVENESS */
.table-wrapper {
overflow-x: auto; /* Enables horizontal scrollbar */
overflow-x: auto;
max-width: 100%;
border-radius: 8px;
border-radius: 12px;
border: 1px solid var(--border-light);
box-shadow: var(--shadow-sm);
background: white;
}
.orders-table {
width: 100%;
min-width: 1300px; /* Minimum width to prevent excessive squeezing of columns */
border-collapse: separate; /* Required for border-radius on cells in the future */
min-width: 1300px;
border-collapse: separate;
border-spacing: 0;
font-size: 14px;
color: var(--text-dark);
}
/* GRADIENT HEADER STYLES FROM SHIPPING REPORT */
/* GRADIENT HEADER STYLES */
.orders-table thead {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: var(--primary-gradient);
position: sticky;
top: 0;
z-index: 10;
@@ -74,13 +191,18 @@
.orders-table th {
padding: 16px 20px;
text-align: center; /* Center align header text */
text-align: center;
font-size: 14px;
font-weight: 600;
color: white;
border-bottom: none;
white-space: nowrap;
position: relative;
transition: background 0.3s ease;
}
.orders-table th:hover {
background: rgba(255, 255, 255, 0.1);
}
.orders-table th:not(:last-child)::after {
@@ -98,31 +220,29 @@
padding: 14px 20px;
border-bottom: 1px solid var(--border-light);
white-space: nowrap;
text-align: center; /* Center align all table data */
text-align: center;
transition: background 0.2s ease;
}
.orders-table tbody tr:last-child td {
border-bottom: none;
}
.orders-table tbody tr:hover {
.orders-table tbody tr:hover td {
background: var(--bg-hover);
transition: background 0.2s ease;
}
/* ===== IMPROVED STATUS BADGES (FROM SHIPPING REPORT) ===== */
/* ===== ENHANCED STATUS BADGES ===== */
.status-badge {
font-size: 11px !important;
font-weight: 600 !important;
padding: 6px 12px 6px 8px !important;
padding: 8px 14px 8px 10px !important;
border-radius: 20px !important;
text-transform: uppercase;
letter-spacing: 0.3px;
display: inline-flex !important;
align-items: center;
justify-content: center;
background-size: cover !important;
background-position: center !important;
color: #fff !important;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
border: 2px solid transparent !important;
@@ -133,7 +253,14 @@
position: relative;
overflow: hidden;
white-space: nowrap;
margin: 0 auto; /* Center badges */
margin: 0 auto;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.status-badge:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.status-badge::before {
@@ -160,21 +287,21 @@
/* Invoice Status Badges */
.status-paid {
background: linear-gradient(135deg, #10b981, #34d399) !important;
background: var(--success-gradient) !important;
color: white !important;
border-color: #059669 !important;
width: 99px;
}
.status-pending {
background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
background: var(--warning-gradient) !important;
color: #d97706 !important;
border-color: #f59e0b !important;
width: 99px;
}
.status-overdue {
background: linear-gradient(135deg, #fef2f2, #fecaca) !important;
background: var(--danger-gradient) !important;
color: #dc2626 !important;
border-color: #ef4444 !important;
width: 99px;
@@ -182,60 +309,73 @@
/* Shipment Status Badges */
.ship-pending {
background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
background: var(--warning-gradient) !important;
color: #d97706 !important;
border-color: #f59e0b !important;
width: 99px;
}
.ship-in_transit {
background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
background: var(--info-gradient) !important;
color: #1e40af !important;
border-color: #3b82f6 !important;
width: 99px;
}
.ship-dispatched {
background: linear-gradient(135deg, #e9d5ff, #d8b4fe) !important;
background: var(--purple-gradient) !important;
color: #7e22ce !important;
border-color: #8b5cf6 !important;
width: 99px;
}
.ship-delivered {
background: linear-gradient(135deg, #d1fae5, #a7f3d0) !important;
background: var(--success-gradient) !important;
color: #065f46 !important;
border-color: #10b981 !important;
width: 99px;
}
.shipstatus{
}
/* ACTION BUTTON */
.action-btn {
color: var(--text-muted);
cursor: pointer;
transition: color 0.2s ease, transform 0.2s ease;
transition: all 0.3s ease;
font-size: 18px;
background: #f8fafc;
padding: 8px;
border-radius: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.action-btn:hover {
color: var(--primary-color);
transform: scale(1.15);
transform: scale(1.1);
background: #e0f2fe;
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}
/* EMPTY STATE */
.no-data {
padding: 40px;
padding: 60px 40px;
text-align: center;
font-size: 16px;
color: var(--text-muted);
background: var(--bg-light);
border-radius: 8px;
border-radius: 12px;
margin-top: 10px;
border: 1px solid var(--border-light);
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
}
.no-data i {
font-size: 48px;
color: #d1d5db;
}
/* RESPONSIVE ADJUSTMENTS */
@@ -243,25 +383,47 @@
.orders-title {
font-size: 24px;
}
.orders-container {
padding: 16px;
}
.stats-container {
grid-template-columns: 1fr;
}
/* ---------- Pagination Styles (Same as Account Dashboard) ---------- */
.stat-card {
padding: 16px;
}
.stat-value {
font-size: 24px;
}
.download-section {
justify-content: stretch;
}
.download-btn {
flex: 1;
justify-content: center;
}
}
/* ---------- Enhanced Pagination Styles ---------- */
.pagination-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 15px;
padding: 12px 0;
margin-top: 20px;
padding: 16px 0;
border-top: 1px solid #eef3fb;
}
.pagination-info {
font-size: 13px;
color: #9ba5bb;
font-weight: 600;
font-size: 14px;
color: #6b7280;
font-weight: 500;
}
.pagination-controls {
@@ -270,61 +432,62 @@
gap: 8px;
}
.pagination-btn {
background: #fff;
.pagination-img-btn {
background: white;
border: 1px solid #e3eaf6;
color: #1a2951;
padding: 8px 12px;
border-radius: 6px;
font-size: 13px;
font-weight: 600;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 40px;
height: 32px;
width: 40px;
height: 40px;
padding: 0;
box-shadow: var(--shadow-sm);
}
.pagination-btn:hover:not(:disabled) {
background: #1a2951;
color: white;
border-color: #1a2951;
.pagination-img-btn:hover:not(:disabled) {
background: var(--primary-color);
border-color: var(--primary-color);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.pagination-btn:disabled {
.pagination-img-btn:disabled {
background: #f8fafc;
color: #cbd5e0;
border-color: #e2e8f0;
cursor: not-allowed;
opacity: 0.6;
opacity: 0.5;
}
.pagination-page-btn {
background: #fff;
background: white;
border: 1px solid #e3eaf6;
color: #1a2951;
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
padding: 8px 12px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
min-width: 36px;
min-width: 40px;
text-align: center;
box-shadow: var(--shadow-sm);
}
.pagination-page-btn:hover {
background: #1a2951;
background: var(--primary-color);
color: white;
border-color: #1a2951;
border-color: var(--primary-color);
transform: translateY(-2px);
}
.pagination-page-btn.active {
background: #1a2951;
background: var(--primary-color);
color: white;
border-color: #1a2951;
border-color: var(--primary-color);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.pagination-pages {
@@ -335,60 +498,138 @@
.pagination-ellipsis {
color: #9ba5bb;
font-size: 13px;
padding: 0 4px;
font-size: 14px;
padding: 0 8px;
}
/* Image-based pagination buttons */
.pagination-img-btn {
background: #fff;
border: 1px solid #e3eaf6;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
/* Search and Filter Bar */
.filter-bar {
display: flex;
gap: 16px;
margin-bottom: 24px;
flex-wrap: wrap;
align-items: center;
justify-content: center;
min-width: 40px;
height: 32px;
padding: 0;
}
.pagination-img-btn:hover:not(:disabled) {
background: #1a2951;
border-color: #1a2951;
.search-box {
flex: 1;
min-width: 300px;
position: relative;
}
.pagination-img-btn:disabled {
background: #f8fafc;
border-color: #e2e8f0;
cursor: not-allowed;
opacity: 0.5;
.search-input {
width: 100%;
padding: 12px 16px 12px 44px;
border: 1px solid var(--border-light);
border-radius: 10px;
font-size: 14px;
transition: all 0.3s ease;
background: white;
box-shadow: var(--shadow-sm);
}
.pagination-img-btn img {
width: 16px;
height: 16px;
filter: brightness(0) saturate(100%) invert(26%) sepia(89%) saturate(748%) hue-rotate(201deg) brightness(93%) contrast(89%);
transition: filter 0.3s ease;
.search-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.pagination-img-btn:hover:not(:disabled) img {
filter: brightness(0) saturate(100%) invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(106%) contrast(101%);
.search-icon {
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
color: var(--text-muted);
}
.pagination-img-btn:disabled img {
filter: brightness(0) saturate(100%) invert(84%) sepia(8%) saturate(165%) hue-rotate(179deg) brightness(89%) contrast(86%);
.filter-select {
padding: 12px 16px;
border: 1px solid var(--border-light);
border-radius: 10px;
font-size: 14px;
background: white;
box-shadow: var(--shadow-sm);
cursor: pointer;
min-width: 160px;
}
@media (max-width: 768px) {
.filter-bar {
flex-direction: column;
align-items: stretch;
}
.search-box {
min-width: 100%;
}
.filter-select {
width: 100%;
}
.pagination-container {
flex-direction: column;
gap: 16px;
}
}
</style>
{{-- Make sure you include Font Awesome CDN in your main layout file, e.g., in <head>:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
--}}
<div class="orders-container">
<div class="orders-title">
<i class="fas fa-box-open mr-2"></i> Orders List
<i class="fas fa-box-open"></i> Orders Management
</div>
<!-- Stats Cards -->
<div class="stats-container">
<div class="stat-card total">
<div class="stat-value">{{ $orders->count() }}</div>
<div class="stat-label">Total Orders</div>
</div>
<div class="stat-card paid">
<div class="stat-value">{{ $orders->where('invoice.status', 'paid')->count() }}</div>
<div class="stat-label">Paid Invoices</div>
</div>
<div class="stat-card pending">
<div class="stat-value">{{ $orders->where('invoice.status', 'pending')->count() }}</div>
<div class="stat-label">Pending Invoices</div>
</div>
<div class="stat-card overdue">
<div class="stat-value">{{ $orders->where('invoice.status', 'overdue')->count() }}</div>
<div class="stat-label">Overdue Invoices</div>
</div>
</div>
<!-- Download Buttons -->
<div class="download-section">
<button class="download-btn pdf" id="downloadPdf" {{ $orders->count() == 0 ? 'disabled' : '' }}>
<i class="fas fa-file-pdf"></i>
Download PDF
</button>
<button class="download-btn excel" id="downloadExcel" {{ $orders->count() == 0 ? 'disabled' : '' }}>
<i class="fas fa-file-excel"></i>
Download Excel
</button>
</div>
<!-- Filter Bar -->
<div class="filter-bar">
<div class="search-box">
<i class="fas fa-search search-icon"></i>
<input type="text" class="search-input" placeholder="Search orders..." id="searchInput">
</div>
<select class="filter-select" id="statusFilter">
<option value="">All Status</option>
<option value="paid">Paid</option>
<option value="pending">Pending</option>
<option value="overdue">Overdue</option>
</select>
<select class="filter-select" id="shipmentFilter">
<option value="">All Shipments</option>
<option value="pending">Pending</option>
<option value="in_transit">In Transit</option>
<option value="dispatched">Dispatched</option>
<option value="delivered">Delivered</option>
</select>
</div>
@if(isset($orders) && $orders->count() > 0)
@@ -482,7 +723,6 @@
<div class="pagination-info" id="pageInfo">Showing 1 to {{ min(10, count($orders)) }} of {{ count($orders) }} entries</div>
<div class="pagination-controls">
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page" disabled>
<!-- Left arrow SVG -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10 12L6 8L10 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
@@ -491,7 +731,6 @@
<!-- Page numbers will be inserted here -->
</div>
<button class="pagination-img-btn" id="nextPageBtn" title="Next page" {{ count($orders) > 10 ? '' : 'disabled' }}>
<!-- Right arrow SVG -->
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 4L10 8L6 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
@@ -499,9 +738,11 @@
</div>
</div>
@else
<p class="no-data">
<i class="fas fa-info-circle mr-2"></i> No orders found.
</p>
<div class="no-data">
<i class="fas fa-inbox"></i>
<div>No orders found</div>
<p class="text-muted">There are currently no orders in the system.</p>
</div>
@endif
</div>
@@ -516,11 +757,11 @@
function getInvoiceStatusIcon(status) {
switch(status) {
case 'paid':
return '<i class="bi bi-check-circle-fill status-icon"></i>';
return '<i class="fas fa-check-circle status-icon"></i>';
case 'pending':
return '<i class="bi bi-clock-fill status-icon"></i>';
return '<i class="fas fa-clock status-icon"></i>';
case 'overdue':
return '<i class="bi bi-exclamation-triangle-fill status-icon"></i>';
return '<i class="fas fa-exclamation-triangle status-icon"></i>';
default:
return '';
}
@@ -529,19 +770,19 @@
function getShipmentStatusIcon(status) {
switch(status) {
case 'pending':
return '<i class="bi bi-clock-fill status-icon"></i>';
return '<i class="fas fa-clock status-icon"></i>';
case 'in_transit':
return '<i class="bi bi-truck status-icon"></i>';
return '<i class="fas fa-truck status-icon"></i>';
case 'dispatched':
return '<i class="bi bi-send-fill status-icon"></i>';
return '<i class="fas fa-paper-plane status-icon"></i>';
case 'delivered':
return '<i class="bi bi-check-circle-fill status-icon"></i>';
return '<i class="fas fa-check-circle status-icon"></i>';
default:
return '';
}
}
// Initialize pagination
// Initialize pagination and filters
document.addEventListener('DOMContentLoaded', function() {
renderTable();
updatePaginationControls();
@@ -549,8 +790,170 @@
// Bind pagination events
document.getElementById('prevPageBtn').addEventListener('click', goToPreviousPage);
document.getElementById('nextPageBtn').addEventListener('click', goToNextPage);
// Bind filter events
document.getElementById('searchInput').addEventListener('input', handleSearch);
document.getElementById('statusFilter').addEventListener('change', handleFilter);
document.getElementById('shipmentFilter').addEventListener('change', handleFilter);
// Bind download events
document.getElementById('downloadPdf').addEventListener('click', downloadPdf);
document.getElementById('downloadExcel').addEventListener('click', downloadExcel);
});
// Download Functions
function downloadPdf() {
if (filteredOrders.length === 0) {
showNotification('No data available to download', 'warning');
return;
}
showNotification('Preparing PDF download...', 'info');
// Get current filters for the download
const searchTerm = document.getElementById('searchInput').value;
const statusFilter = document.getElementById('statusFilter').value;
const shipmentFilter = document.getElementById('shipmentFilter').value;
// Create download URL with filters
let downloadUrl = "{{ route('admin.orders.download.pdf') }}";
let params = new URLSearchParams();
if (searchTerm) params.append('search', searchTerm);
if (statusFilter) params.append('status', statusFilter);
if (shipmentFilter) params.append('shipment', shipmentFilter);
if (params.toString()) {
downloadUrl += '?' + params.toString();
}
// Trigger download
window.location.href = downloadUrl;
}
function downloadExcel() {
if (filteredOrders.length === 0) {
showNotification('No data available to download', 'warning');
return;
}
showNotification('Preparing Excel download...', 'info');
// Get current filters for the download
const searchTerm = document.getElementById('searchInput').value;
const statusFilter = document.getElementById('statusFilter').value;
const shipmentFilter = document.getElementById('shipmentFilter').value;
// Create download URL with filters
let downloadUrl = "{{ route('admin.orders.download.excel') }}";
let params = new URLSearchParams();
if (searchTerm) params.append('search', searchTerm);
if (statusFilter) params.append('status', statusFilter);
if (shipmentFilter) params.append('shipment', shipmentFilter);
if (params.toString()) {
downloadUrl += '?' + params.toString();
}
// Trigger download
window.location.href = downloadUrl;
}
// Notification function
function showNotification(message, type = 'info') {
// Remove existing notification
const existingNotification = document.querySelector('.download-notification');
if (existingNotification) {
existingNotification.remove();
}
const notification = document.createElement('div');
notification.className = `download-notification alert alert-${type}`;
notification.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
z-index: 10000;
padding: 12px 20px;
border-radius: 8px;
color: white;
font-weight: 500;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
animation: slideIn 0.3s ease;
`;
if (type === 'info') {
notification.style.background = 'linear-gradient(135deg, #3b82f6, #1d4ed8)';
} else if (type === 'warning') {
notification.style.background = 'linear-gradient(135deg, #f59e0b, #d97706)';
} else if (type === 'success') {
notification.style.background = 'linear-gradient(135deg, #10b981, #059669)';
}
notification.textContent = message;
document.body.appendChild(notification);
setTimeout(() => {
notification.style.animation = 'slideOut 0.3s ease';
setTimeout(() => notification.remove(), 300);
}, 3000);
}
// Add CSS for notifications
const style = document.createElement('style');
style.textContent = `
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
from { transform: translateX(0); opacity: 1; }
to { transform: translateX(100%); opacity: 0; }
}
`;
document.head.appendChild(style);
// Search functionality
function handleSearch(e) {
const searchTerm = e.target.value.toLowerCase();
filterOrders();
}
// Filter functionality
function handleFilter() {
filterOrders();
}
function filterOrders() {
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
const statusFilter = document.getElementById('statusFilter').value;
const shipmentFilter = document.getElementById('shipmentFilter').value;
filteredOrders = allOrders.filter(order => {
const matchesSearch = !searchTerm ||
(order.order_id && order.order_id.toLowerCase().includes(searchTerm)) ||
(order.markList?.company_name && order.markList.company_name.toLowerCase().includes(searchTerm)) ||
(order.invoice?.invoice_number && order.invoice.invoice_number.toLowerCase().includes(searchTerm));
const matchesStatus = !statusFilter ||
(order.invoice?.status && order.invoice.status.toLowerCase() === statusFilter);
const matchesShipment = !shipmentFilter ||
(order.shipments?.[0]?.status && order.shipments[0].status.toLowerCase() === shipmentFilter);
return matchesSearch && matchesStatus && matchesShipment;
});
currentPage = 1;
renderTable();
updatePaginationControls();
// Update download buttons state
document.getElementById('downloadPdf').disabled = filteredOrders.length === 0;
document.getElementById('downloadExcel').disabled = filteredOrders.length === 0;
}
// Pagination Functions
function goToPreviousPage() {
if (currentPage > 1) {
@@ -636,7 +1039,7 @@
tbody.innerHTML = '';
if (filteredOrders.length === 0) {
tbody.innerHTML = '<tr><td colspan="14" class="text-center py-4 text-muted">No orders found.</td></tr>';
tbody.innerHTML = '<tr><td colspan="14" class="text-center py-4 text-muted">No orders found matching your criteria.</td></tr>';
return;
}
@@ -668,13 +1071,13 @@
<td>
${invoice?.status
? `<span class="status-badge status-${invoiceStatus}">${getInvoiceStatusIcon(invoiceStatus)}${invoice.status.charAt(0).toUpperCase() + invoice.status.slice(1)}</span>`
: '<span class="status-badge status-pending"><i class="bi bi-clock-fill status-icon"></i>Pending</span>'
: '<span class="status-badge status-pending"><i class="fas fa-clock status-icon"></i>Pending</span>'
}
</td>
<td>
${shipment?.status
? `<span class="status-badge ship-${shipmentStatus.replace(' ', '_')}">${getShipmentStatusIcon(shipmentStatus.replace(' ', '_'))}${shipment.status.charAt(0).toUpperCase() + shipment.status.slice(1)}</span>`
: '<span class="status-badge ship-pending"><i class="bi bi-clock-fill status-icon"></i>Pending</span>'
: '<span class="status-badge ship-pending"><i class="fas fa-clock status-icon"></i>Pending</span>'
}
</td>
<td class="text-center">

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Orders Report</title>
<style>
body { font-family: DejaVu Sans, sans-serif; font-size: 12px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
th { background: #f3f4f6; }
</style>
</head>
<body>
<h3>Orders Report</h3>
<table>
<thead>
<tr>
<th>Order ID</th>
<th>Company</th>
<th>Invoice No</th>
<th>Invoice Status</th>
<th>Shipment Status</th>
</tr>
</thead>
<tbody>
@foreach($orders as $order)
@php
$mark = $order->markList ?? null;
$invoice = $order->invoice ?? null;
$shipment = $order->shipments->first() ?? null;
@endphp
<tr>
<td>{{ $order->order_id ?? '-' }}</td>
<td>{{ $mark->company_name ?? '-' }}</td>
<td>{{ $invoice->invoice_number ?? '-' }}</td>
<td>{{ $invoice->status ?? '-' }}</td>
<td>{{ $shipment->status ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>

View File

@@ -189,7 +189,101 @@
filter: brightness(0) saturate(100%) invert(84%) sepia(8%) saturate(165%) hue-rotate(179deg) brightness(89%) contrast(86%);
}
/* Responsive pagination */
/* ===== UPDATED SEARCH BAR STYLES ===== */
.search-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
gap: 15px;
}
.search-form {
flex: 1;
max-width: 400px;
}
.search-input-group {
display: flex;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
border-radius: 10px;
overflow: hidden;
}
.search-input {
flex: 1;
border: 1px solid #e2e8f0;
border-right: none;
padding: 10px 16px;
font-size: 14px;
background-color: #fff;
transition: all 0.3s ease;
}
.search-input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.search-button {
background: #3b82f6;
border: 1px solid #3b82f6;
color: white;
padding: 10px 16px;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
}
.search-button:hover {
background: #2563eb;
border-color: #2563eb;
}
.search-icon {
width: 16px;
height: 16px;
}
.status-badges {
display: flex;
gap: 8px;
align-items: center;
}
.status-badge {
font-size: 12px;
font-weight: 600;
padding: 6px 12px;
border-radius: 20px;
display: inline-flex;
align-items: center;
gap: 4px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.status-badge-pending {
background: linear-gradient(135deg, #fef3c7, #fde68a);
color: #d97706;
border: 1px solid #f59e0b;
}
.status-badge-approved {
background: linear-gradient(135deg, #d1fae5, #a7f3d0);
color: #065f46;
border: 1px solid #10b981;
}
.status-badge-rejected {
background: linear-gradient(135deg, #fecaca, #fca5a5);
color: #991b1b;
border: 1px solid #ef4444;
}
/* Responsive styles */
@media (max-width: 768px) {
.pagination-container {
flex-direction: column;
@@ -199,29 +293,51 @@
.pagination-controls {
justify-content: center;
}
.search-container {
flex-direction: column;
align-items: stretch;
}
.search-form {
max-width: 100%;
}
.status-badges {
justify-content: center;
}
}
</style>
<!-- Counts -->
<div class="d-flex justify-content-between align-items-center mb-2 mt-3">
<h4 class="fw-bold mb-0">User Requests (Total: {{ $total }})</h4>
<div>
<span class="count-badge badge rounded-pill bg-warning text-dark me-1">{{ $requests->where('status', 'pending')->count() }} Pending</span>
<span class="count-badge badge rounded-pill bg-success me-1">{{ $requests->where('status', 'approved')->count() }} Approved</span>
<span class="count-badge badge rounded-pill bg-danger">{{ $requests->where('status', 'rejected')->count() }} Rejected</span>
</div>
</div>
<!-- Search + Table -->
<div class="card mb-4 shadow-sm">
<div class="card-body pb-1">
<form method="GET" action="">
<div class="input-group mb-2">
<input type="text" name="search" value="{{ request('search') }}" class="form-control" placeholder="🔍 Search by name, email, company...">
<button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
<!-- Updated Search Bar with Status Badges in the same line -->
<div class="search-container">
<form method="GET" action="" class="search-form">
<div class="search-input-group">
<input type="text" name="search" value="{{ request('search') }}" class="search-input" placeholder="Search by name, email, company...">
<button class="search-button" type="submit">
<svg class="search-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21 21L16.514 16.506L21 21ZM19 10.5C19 15.194 15.194 19 10.5 19C5.806 19 2 15.194 2 10.5C2 5.806 5.806 2 10.5 2C15.194 2 19 5.806 19 10.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
</div>
</form>
<div class="status-badges">
<span class="status-badge status-badge-pending">{{ $requests->where('status', 'pending')->count() }} Pending</span>
<span class="status-badge status-badge-approved">{{ $requests->where('status', 'approved')->count() }} Approved</span>
<span class="status-badge status-badge-rejected">{{ $requests->where('status', 'rejected')->count() }} Rejected</span>
</div>
</div>
<div class="table-responsive custom-table-wrapper">
<table class="table align-middle mb-0 custom-table">
<thead><tr>

View File

@@ -218,11 +218,10 @@ Route::prefix('admin')
->name('admin.customers.status');
});
// ==========================================
// ADMIN ACCOUNT (AJAX) ROUTES
// ==========================================
Route::prefix('admin/account')
// ==========================================
// ADMIN ACCOUNT (AJAX) ROUTES
// ==========================================
Route::prefix('admin/account')
->middleware('auth:admin')
->name('admin.account.')
->group(function () {
@@ -247,4 +246,39 @@ Route::prefix('admin/account')
Route::get('/entry/{entry_no}', [AdminAccountController::class, 'getEntryDetails'])
->name('entry.details');
// ⬇⬇ NEW ROUTES FOR EDIT + DELETE ⬇⬇
Route::post('/update-entry', [AdminAccountController::class, 'updateEntry'])
->name('update.entry');
Route::post('/delete-entry', [AdminAccountController::class, 'deleteEntry'])
->name('delete.entry');
// ===== Associated Orders Routes (EDIT MODAL साठी) =====
Route::post('/add-orders-to-entry', [AdminAccountController::class, 'addOrdersToEntry'])
->name('add.orders.to.entry');
Route::get('/entry-orders/{entry_no}', [AdminAccountController::class, 'getEntryOrders'])
->name('entry.orders');
Route::post('/remove-order-from-entry', [AdminAccountController::class, 'removeOrderFromEntry'])
->name('remove.order.from.entry');
});
// ---------------------------
// REPORTS DOWNLOAD ROUTES
// ---------------------------
Route::get('/admin/orders/download/pdf', [OrderController::class, 'downloadPdf'])->name('admin.orders.download.pdf');
Route::get('/admin/orders/download/excel', [OrderController::class, 'downloadExcel'])->name('admin.orders.download.excel');
//---------------------------
//Edit Button Route
//---------------------------