shipment Changes
This commit is contained in:
@@ -48,7 +48,7 @@ body {
|
|||||||
|
|
||||||
/* top actions row */
|
/* top actions row */
|
||||||
.top-actions {
|
.top-actions {
|
||||||
display:flex; align-items:center; justify-content:space-between;
|
align-items:center; justify-content:space-between;
|
||||||
gap:12px; margin:16px 0 20px 0; flex-wrap:wrap;
|
gap:12px; margin:16px 0 20px 0; flex-wrap:wrap;
|
||||||
}
|
}
|
||||||
.top-actions .left {
|
.top-actions .left {
|
||||||
@@ -67,7 +67,7 @@ body {
|
|||||||
cursor:pointer; transition: transform .15s ease, box-shadow .15s;
|
cursor:pointer; transition: transform .15s ease, box-shadow .15s;
|
||||||
}
|
}
|
||||||
.btn.ghost { background: transparent; color:var(--primary-1); border:1.5px 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); }
|
.btn:hover{ transform: translateY(-3px); box-shadow: 0 8px 26px rgba(227, 229, 234, 0.12); }
|
||||||
|
|
||||||
/* account panels */
|
/* account panels */
|
||||||
.account-panels {
|
.account-panels {
|
||||||
@@ -89,12 +89,12 @@ body {
|
|||||||
background: var(--card-bg);
|
background: var(--card-bg);
|
||||||
border-radius:12px;
|
border-radius:12px;
|
||||||
box-shadow:0 8px 20px rgba(25,40,80,0.06);
|
box-shadow:0 8px 20px rgba(25,40,80,0.06);
|
||||||
padding:22px;
|
padding:20px; /* 005 */
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
overflow-x:auto;
|
overflow-x:auto;
|
||||||
transition: transform .12s, box-shadow .12s;
|
transition: transform .12s, box-shadow .12s;
|
||||||
min-height: 520px;
|
min-height: 520px;
|
||||||
display: flex;
|
/* display: flex; */ /* 005 */
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -205,8 +205,8 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
.toggle-switch-btn {
|
.toggle-switch-btn {
|
||||||
appearance:none;
|
appearance:none;
|
||||||
-webkit-appearance:none;
|
-webkit-appearance:none;
|
||||||
width:60px;
|
width:64px;
|
||||||
height:24px;
|
height:26.5px; /* 005 */
|
||||||
background:#f25b5b;
|
background:#f25b5b;
|
||||||
border:2px solid #f25b5b;
|
border:2px solid #f25b5b;
|
||||||
border-radius:999px;
|
border-radius:999px;
|
||||||
@@ -313,7 +313,16 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
padding: 12px 0;
|
padding: 12px 0;
|
||||||
border-top: 1px solid #eef3fb;
|
border-top: 1px solid #eef3fb;
|
||||||
margin-right:550px;
|
/* margin-right:550px; */
|
||||||
|
}
|
||||||
|
.pagination-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 15px;
|
||||||
|
padding: 12px 0;
|
||||||
|
border-top: 1px solid #eef3fb;
|
||||||
|
margin-right:550px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-info {
|
.pagination-info {
|
||||||
@@ -326,14 +335,15 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-right:-1050px;
|
position: absolute;
|
||||||
|
right: 16px; /* 005 */
|
||||||
|
|
||||||
}
|
}
|
||||||
.pagination-controls1 {
|
.pagination-controls1 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-right:-550px;
|
/* margin-right:-550px; */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +573,7 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
|
|
||||||
/* Combined filters row styling */
|
/* Combined filters row styling */
|
||||||
.combined-filters-row {
|
.combined-filters-row {
|
||||||
display: flex;
|
display: ruby; /* 005 */
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
@@ -576,8 +586,8 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
.right{
|
.right{
|
||||||
margin-left:auto;
|
/* margin-left:auto;
|
||||||
margin-top:-16px;
|
margin-top:-16px; */ /* 005 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-group1 {
|
.filter-group1 {
|
||||||
@@ -953,6 +963,15 @@ tr:hover td{ background:#fbfdff; }
|
|||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.combined-top-row .btn:hover {
|
||||||
|
color: #ffffff !important;
|
||||||
|
background-color: inherit !important;
|
||||||
|
border-color: inherit !important;
|
||||||
|
transform: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.remove-order-btn:hover {
|
.remove-order-btn:hover {
|
||||||
background: #d42c3f;
|
background: #d42c3f;
|
||||||
}
|
}
|
||||||
@@ -1314,7 +1333,7 @@ html, body {
|
|||||||
<div class="create-order-modal" id="createOrderModal">
|
<div class="create-order-modal" id="createOrderModal">
|
||||||
<div class="modal-box">
|
<div class="modal-box">
|
||||||
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;">
|
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;">
|
||||||
<div style="font-size:20px; font-weight:800; color:var(--primary-1)">Create New Installment</div>
|
<div style="font-size:20px; font-weight:800;">Create New Installment</div>
|
||||||
<button class="btn ghost" id="closeCreateModal" title="Close create form">✕</button>
|
<button class="btn ghost" id="closeCreateModal" title="Close create form">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1375,7 +1394,7 @@ html, body {
|
|||||||
|
|
||||||
<!-- Pagination for Create Order Modal -->
|
<!-- Pagination for Create Order Modal -->
|
||||||
<div class="modal-pagination-wrapper pagination-right">
|
<div class="modal-pagination-wrapper pagination-right">
|
||||||
<div class="pagination-container">
|
<div class="pagination-container1">
|
||||||
<div class="pagination-info" id="modalPageInfo">Showing 0 entries</div>
|
<div class="pagination-info" id="modalPageInfo">Showing 0 entries</div>
|
||||||
<div class="pagination-controls2">
|
<div class="pagination-controls2">
|
||||||
<button class="pagination-img-btn" id="modalPrevBtn" title="Previous page">
|
<button class="pagination-img-btn" id="modalPrevBtn" title="Previous page">
|
||||||
|
|||||||
@@ -632,24 +632,49 @@ body, .container-fluid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.create-order-modal .table-wrapper {
|
.create-order-modal .table-wrapper {
|
||||||
max-height: 300px;
|
width: 100%;
|
||||||
|
max-height: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden !important; /* NO HORIZONTAL SCROLL */
|
||||||
border: 1px solid #e9ecef;
|
border: 1px solid #e9ecef;
|
||||||
border-radius: 8px;
|
border-radius: 12px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
||||||
|
padding: 12px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.create-order-modal .table {
|
|
||||||
|
.create-order-modal .table-wrapper .table {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
min-width: 100% !important; /* FULL RESPONSIVE WIDTH */
|
||||||
|
font-size: 13px;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.create-order-modal .table th {
|
.create-order-modal .table th,
|
||||||
background: #f8f9fa;
|
.create-order-modal .table td {
|
||||||
font-weight: 600;
|
padding: 8px 6px !important;
|
||||||
position: sticky;
|
white-space: nowrap;
|
||||||
top: 0;
|
overflow: hidden;
|
||||||
z-index: 10;
|
text-overflow: ellipsis;
|
||||||
font-family: 'Inter', sans-serif;
|
max-width: 120px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.create-order-modal .table th:nth-child(2), /* Description */
|
||||||
|
.create-order-modal .table td:nth-child(2) { max-width: 160px; }
|
||||||
|
|
||||||
|
.create-order-modal .table th:nth-child(9), /* TTL Amount */
|
||||||
|
.create-order-modal .table td:nth-child(9) { max-width: 90px; font-weight: 600; }
|
||||||
|
|
||||||
|
.create-order-modal .table .items-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 4px 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
min-width: 60px;
|
||||||
|
max-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* items table inputs */
|
/* items table inputs */
|
||||||
@@ -1311,6 +1336,7 @@ body, .container-fluid {
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $order->mark_no }}</td>
|
<td>{{ $order->mark_no }}</td>
|
||||||
|
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
||||||
<td>{{ $order->origin }}</td>
|
<td>{{ $order->origin }}</td>
|
||||||
<td>{{ $order->destination }}</td>
|
<td>{{ $order->destination }}</td>
|
||||||
<td>{{ $order->ctn }}</td>
|
<td>{{ $order->ctn }}</td>
|
||||||
@@ -1322,20 +1348,48 @@ body, .container-fluid {
|
|||||||
<td>{{ $order->kg }}</td>
|
<td>{{ $order->kg }}</td>
|
||||||
<td>{{ $order->ttl_kg }}</td>
|
<td>{{ $order->ttl_kg }}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge badge-{{ $order->status }}">
|
@php
|
||||||
@if($order->status == 'pending')
|
// Badge color mapping
|
||||||
<i class="bi bi-clock-fill status-icon"></i>
|
$badgeMap = [
|
||||||
@elseif($order->status == 'in_transit')
|
'order_placed' => 'secondary',
|
||||||
<i class="bi bi-truck status-icon"></i>
|
'order_confirmed' => 'info',
|
||||||
@elseif($order->status == 'dispatched')
|
'supplier_warehouse' => 'warning',
|
||||||
<i class="bi bi-box-seam status-icon"></i>
|
'consolidate_warehouse' => 'warning',
|
||||||
@elseif($order->status == 'delivered')
|
'export_custom' => 'primary',
|
||||||
<i class="bi bi-check-circle-fill status-icon"></i>
|
'international_transit' => 'primary',
|
||||||
@endif
|
'arrived_india' => 'info',
|
||||||
{{ ucfirst(str_replace('_', ' ', $order->status)) }}
|
'import_custom' => 'info',
|
||||||
|
'warehouse' => 'dark',
|
||||||
|
'domestic_distribution' => 'primary',
|
||||||
|
'out_for_delivery' => 'success',
|
||||||
|
'delivered' => 'success',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Icon mapping
|
||||||
|
$iconMap = [
|
||||||
|
'order_placed' => 'bi-clock-fill',
|
||||||
|
'order_confirmed' => 'bi-check-circle',
|
||||||
|
'supplier_warehouse' => 'bi-box-seam',
|
||||||
|
'consolidate_warehouse' => 'bi-boxes',
|
||||||
|
'export_custom' => 'bi-upload',
|
||||||
|
'international_transit' => 'bi-truck',
|
||||||
|
'arrived_india' => 'bi-geo-alt',
|
||||||
|
'import_custom' => 'bi-download',
|
||||||
|
'warehouse' => 'bi-building',
|
||||||
|
'domestic_distribution' => 'bi-diagram-3',
|
||||||
|
'out_for_delivery' => 'bi-truck-flatbed',
|
||||||
|
'delivered' => 'bi-check-circle-fill',
|
||||||
|
];
|
||||||
|
|
||||||
|
$badgeClass = $badgeMap[$order->status] ?? 'secondary';
|
||||||
|
$iconClass = $iconMap[$order->status] ?? 'bi-info-circle';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<span class="badge bg-{{ $badgeClass }}">
|
||||||
|
<i class="bi {{ $iconClass }} status-icon"></i>
|
||||||
|
{{ $order->status_label }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
||||||
<i class="bi bi-eye"></i> View
|
<i class="bi bi-eye"></i> View
|
||||||
@@ -1350,76 +1404,9 @@ body, .container-fluid {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pagination-container">
|
||||||
<td>{{ $order->mark_no }}</td>
|
<div class="pagination-info" id="pageInfo">
|
||||||
<td>{{ $order->origin }}</td>
|
Showing 1 to {{ min($orders->count(), 10) }} of {{ $orders->count() }} entries
|
||||||
<td>{{ $order->destination }}</td>
|
|
||||||
<td>{{ $order->ctn }}</td>
|
|
||||||
<td>{{ $order->qty }}</td>
|
|
||||||
<td>{{ $order->ttl_qty }}</td>
|
|
||||||
<td>₹{{ number_format($order->ttl_amount, 2) }}</td>
|
|
||||||
<td>{{ $order->cbm }}</td>
|
|
||||||
<td>{{ $order->ttl_cbm }}</td>
|
|
||||||
<td>{{ $order->kg }}</td>
|
|
||||||
<td>{{ $order->ttl_kg }}</td>
|
|
||||||
<td>
|
|
||||||
@php
|
|
||||||
// Badge color mapping
|
|
||||||
$badgeMap = [
|
|
||||||
'order_placed' => 'secondary',
|
|
||||||
'order_confirmed' => 'info',
|
|
||||||
'supplier_warehouse' => 'warning',
|
|
||||||
'consolidate_warehouse' => 'warning',
|
|
||||||
'export_custom' => 'primary',
|
|
||||||
'international_transit' => 'primary',
|
|
||||||
'arrived_india' => 'info',
|
|
||||||
'import_custom' => 'info',
|
|
||||||
'warehouse' => 'dark',
|
|
||||||
'domestic_distribution' => 'primary',
|
|
||||||
'out_for_delivery' => 'success',
|
|
||||||
'delivered' => 'success',
|
|
||||||
];
|
|
||||||
|
|
||||||
// Icon mapping
|
|
||||||
$iconMap = [
|
|
||||||
'order_placed' => 'bi-clock-fill',
|
|
||||||
'order_confirmed' => 'bi-check-circle',
|
|
||||||
'supplier_warehouse' => 'bi-box-seam',
|
|
||||||
'consolidate_warehouse' => 'bi-boxes',
|
|
||||||
'export_custom' => 'bi-upload',
|
|
||||||
'international_transit' => 'bi-truck',
|
|
||||||
'arrived_india' => 'bi-geo-alt',
|
|
||||||
'import_custom' => 'bi-download',
|
|
||||||
'warehouse' => 'bi-building',
|
|
||||||
'domestic_distribution' => 'bi-diagram-3',
|
|
||||||
'out_for_delivery' => 'bi-truck-flatbed',
|
|
||||||
'delivered' => 'bi-check-circle-fill',
|
|
||||||
];
|
|
||||||
|
|
||||||
$badgeClass = $badgeMap[$order->status] ?? 'secondary';
|
|
||||||
$iconClass = $iconMap[$order->status] ?? 'bi-info-circle';
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<span class="badge bg-{{ $badgeClass }}">
|
|
||||||
<i class="bi {{ $iconClass }} status-icon"></i>
|
|
||||||
{{ $order->status_label }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>{{ $order->created_at->format('d-m-Y') }}</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ route('admin.orders.show', $order->id) }}" class="btn btn-sm btn-outline-primary">
|
|
||||||
<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 class="pagination-controls">
|
<div class="pagination-controls">
|
||||||
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page">
|
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page">
|
||||||
@@ -1447,7 +1434,6 @@ body, .container-fluid {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1923,6 +1909,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>${order.mark_no || ''}</td>
|
<td>${order.mark_no || ''}</td>
|
||||||
|
<td>${new Date(order.created_at).toLocaleDateString('en-GB')}</td>
|
||||||
<td>${order.origin || ''}</td>
|
<td>${order.origin || ''}</td>
|
||||||
<td>${order.destination || ''}</td>
|
<td>${order.destination || ''}</td>
|
||||||
<td>${order.ctn || ''}</td>
|
<td>${order.ctn || ''}</td>
|
||||||
@@ -1934,15 +1921,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
<td>${order.kg || ''}</td>
|
<td>${order.kg || ''}</td>
|
||||||
<td>${order.ttl_kg || ''}</td>
|
<td>${order.ttl_kg || ''}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge badge-${order.status}">
|
<span class="badge bg-${getBadgeClass(order.status)}">
|
||||||
${order.status === 'pending' ? '<i class="bi bi-clock-fill status-icon"></i>' : ''}
|
<i class="bi ${getIconClass(order.status)} status-icon"></i>
|
||||||
${order.status === 'in_transit' ? '<i class="bi bi-truck status-icon"></i>' : ''}
|
${order.status_label || order.status}
|
||||||
${order.status === 'dispatched' ? '<i class="bi bi-box-seam status-icon"></i>' : ''}
|
|
||||||
${order.status === 'delivered' ? '<i class="bi bi-check-circle-fill status-icon"></i>' : ''}
|
|
||||||
${order.status ? order.status.charAt(0).toUpperCase() + order.status.slice(1).replace('_', ' ') : ''}
|
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>${new Date(order.created_at).toLocaleDateString('en-GB')}</td>
|
|
||||||
<td>
|
<td>
|
||||||
<a href="/admin/orders/${order.id}" class="btn btn-sm btn-outline-primary">
|
<a href="/admin/orders/${order.id}" class="btn btn-sm btn-outline-primary">
|
||||||
<i class="bi bi-eye"></i> View
|
<i class="bi bi-eye"></i> View
|
||||||
@@ -1976,6 +1959,50 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBadgeClass(status) {
|
||||||
|
const badgeMap = {
|
||||||
|
'order_placed': 'secondary',
|
||||||
|
'order_confirmed': 'info',
|
||||||
|
'supplier_warehouse': 'warning',
|
||||||
|
'consolidate_warehouse': 'warning',
|
||||||
|
'export_custom': 'primary',
|
||||||
|
'international_transit': 'primary',
|
||||||
|
'arrived_india': 'info',
|
||||||
|
'import_custom': 'info',
|
||||||
|
'warehouse': 'dark',
|
||||||
|
'domestic_distribution': 'primary',
|
||||||
|
'out_for_delivery': 'success',
|
||||||
|
'delivered': 'success',
|
||||||
|
'pending': 'warning',
|
||||||
|
'in_transit': 'info',
|
||||||
|
'dispatched': 'primary',
|
||||||
|
'delivered': 'success'
|
||||||
|
};
|
||||||
|
return badgeMap[status] || 'secondary';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIconClass(status) {
|
||||||
|
const iconMap = {
|
||||||
|
'order_placed': 'bi-clock-fill',
|
||||||
|
'order_confirmed': 'bi-check-circle',
|
||||||
|
'supplier_warehouse': 'bi-box-seam',
|
||||||
|
'consolidate_warehouse': 'bi-boxes',
|
||||||
|
'export_custom': 'bi-upload',
|
||||||
|
'international_transit': 'bi-truck',
|
||||||
|
'arrived_india': 'bi-geo-alt',
|
||||||
|
'import_custom': 'bi-download',
|
||||||
|
'warehouse': 'bi-building',
|
||||||
|
'domestic_distribution': 'bi-diagram-3',
|
||||||
|
'out_for_delivery': 'bi-truck-flatbed',
|
||||||
|
'delivered': 'bi-check-circle-fill',
|
||||||
|
'pending': 'bi-clock-fill',
|
||||||
|
'in_transit': 'bi-truck',
|
||||||
|
'dispatched': 'bi-box-seam',
|
||||||
|
'delivered': 'bi-check-circle-fill'
|
||||||
|
};
|
||||||
|
return iconMap[status] || 'bi-info-circle';
|
||||||
|
}
|
||||||
|
|
||||||
itemsTableBody.addEventListener('keydown', function(e) {
|
itemsTableBody.addEventListener('keydown', function(e) {
|
||||||
if (e.key !== 'Enter' || e.target.tagName !== 'INPUT') return;
|
if (e.key !== 'Enter' || e.target.tagName !== 'INPUT') return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -2024,74 +2051,72 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
reindexRows();
|
reindexRows();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ===== EXCEL UPLOAD LOGIC =====
|
// ===== EXCEL UPLOAD LOGIC =====
|
||||||
const uploadExcelBtn = document.getElementById('uploadExcelBtn');
|
const uploadExcelBtn = document.getElementById('uploadExcelBtn');
|
||||||
const excelInput = document.getElementById('excelInput');
|
const excelInput = document.getElementById('excelInput');
|
||||||
|
|
||||||
if (uploadExcelBtn && excelInput) {
|
if (uploadExcelBtn && excelInput) {
|
||||||
|
uploadExcelBtn.addEventListener('click', () => excelInput.click());
|
||||||
|
|
||||||
uploadExcelBtn.addEventListener('click', () => excelInput.click());
|
excelInput.addEventListener('change', function () {
|
||||||
|
const file = this.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
excelInput.addEventListener('change', function () {
|
const formData = new FormData();
|
||||||
const file = this.files[0];
|
formData.append('excel', file);
|
||||||
if (!file) return;
|
formData.append('_token', '{{ csrf_token() }}');
|
||||||
|
|
||||||
const formData = new FormData();
|
fetch('{{ route("admin.orders.upload.excel.preview") }}', {
|
||||||
formData.append('excel', file);
|
method: 'POST',
|
||||||
formData.append('_token', '{{ csrf_token() }}');
|
body: formData,
|
||||||
|
headers: {
|
||||||
fetch('{{ route("admin.orders.upload.excel.preview") }}', {
|
'Accept': 'application/json'
|
||||||
method: 'POST',
|
}
|
||||||
body: formData,
|
})
|
||||||
headers: {
|
.then(async res => {
|
||||||
'Accept': 'application/json'
|
if (!res.ok) {
|
||||||
}
|
const text = await res.text();
|
||||||
})
|
throw new Error(text);
|
||||||
.then(async res => {
|
}
|
||||||
if (!res.ok) {
|
return res.json();
|
||||||
const text = await res.text();
|
})
|
||||||
throw new Error(text);
|
.then(res => {
|
||||||
}
|
if (!res.success) {
|
||||||
return res.json();
|
alert('Invalid Excel file');
|
||||||
})
|
return;
|
||||||
.then(res => {
|
}
|
||||||
if (!res.success) {
|
populateItemsTable(res.items);
|
||||||
alert('Invalid Excel file');
|
})
|
||||||
return;
|
.catch(err => {
|
||||||
}
|
console.error(err);
|
||||||
populateItemsTable(res.items);
|
alert('Excel upload failed');
|
||||||
})
|
});
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
alert('Excel upload failed');
|
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
function populateItemsTable(items) {
|
||||||
|
itemsTableBody.innerHTML = '';
|
||||||
|
|
||||||
function populateItemsTable(items) {
|
items.forEach((item, index) => {
|
||||||
itemsTableBody.innerHTML = '';
|
addRow(index);
|
||||||
|
const row = itemsTableBody.children[index];
|
||||||
|
|
||||||
items.forEach((item, index) => {
|
row.querySelector('[data-field="description"]').value = item.description ?? '';
|
||||||
addRow(index);
|
row.querySelector('[data-field="ctn"]').value = item.ctn ?? '';
|
||||||
const row = itemsTableBody.children[index];
|
row.querySelector('[data-field="qty"]').value = item.qty ?? '';
|
||||||
|
row.querySelector('[data-field="ttl_qty"]').value = item.ttl_qty ?? '';
|
||||||
|
row.querySelector('[data-field="unit"]').value = item.unit ?? '';
|
||||||
|
row.querySelector('[data-field="price"]').value = item.price ?? '';
|
||||||
|
row.querySelector('[data-field="ttl_amount"]').value = item.ttl_amount ?? '';
|
||||||
|
row.querySelector('[data-field="cbm"]').value = item.cbm ?? '';
|
||||||
|
row.querySelector('[data-field="ttl_cbm"]').value = item.ttl_cbm ?? '';
|
||||||
|
row.querySelector('[data-field="kg"]').value = item.kg ?? '';
|
||||||
|
row.querySelector('[data-field="ttl_kg"]').value = item.ttl_kg ?? '';
|
||||||
|
row.querySelector('[data-field="shop_no"]').value = item.shop_no ?? '';
|
||||||
|
});
|
||||||
|
|
||||||
row.querySelector('[data-field="description"]').value = item.description ?? '';
|
reindexRows();
|
||||||
row.querySelector('[data-field="ctn"]').value = item.ctn ?? '';
|
}
|
||||||
row.querySelector('[data-field="qty"]').value = item.qty ?? '';
|
|
||||||
row.querySelector('[data-field="ttl_qty"]').value = item.ttl_qty ?? '';
|
|
||||||
row.querySelector('[data-field="unit"]').value = item.unit ?? '';
|
|
||||||
row.querySelector('[data-field="price"]').value = item.price ?? '';
|
|
||||||
row.querySelector('[data-field="ttl_amount"]').value = item.ttl_amount ?? '';
|
|
||||||
row.querySelector('[data-field="cbm"]').value = item.cbm ?? '';
|
|
||||||
row.querySelector('[data-field="ttl_cbm"]').value = item.ttl_cbm ?? '';
|
|
||||||
row.querySelector('[data-field="kg"]').value = item.kg ?? '';
|
|
||||||
row.querySelector('[data-field="ttl_kg"]').value = item.ttl_kg ?? '';
|
|
||||||
row.querySelector('[data-field="shop_no"]').value = item.shop_no ?? '';
|
|
||||||
});
|
|
||||||
|
|
||||||
reindexRows();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -2103,4 +2128,4 @@ document.addEventListener("hidden.bs.modal", function () {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user