changes
This commit is contained in:
@@ -1284,6 +1284,7 @@ body, .container-fluid {
|
||||
<th>#</th>
|
||||
<th>Order ID</th>
|
||||
<th>Mark No</th>
|
||||
<th>Date</th>
|
||||
<th>Origin</th>
|
||||
<th>Destination</th>
|
||||
<th>Total CTN</th>
|
||||
@@ -1295,7 +1296,6 @@ body, .container-fluid {
|
||||
<th>Total KG</th>
|
||||
<th>Total TTL KG</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -1351,10 +1351,75 @@ body, .container-fluid {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination Controls -->
|
||||
<div class="pagination-container">
|
||||
<div class="pagination-info" id="pageInfo">
|
||||
Showing 1 to 10 of {{ $orders->count() }} entries
|
||||
<td>{{ $order->mark_no }}</td>
|
||||
<td>{{ $order->origin }}</td>
|
||||
<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 class="pagination-controls">
|
||||
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page">
|
||||
@@ -1490,6 +1555,13 @@ body, .container-fluid {
|
||||
<button type="submit" class="btn btn-info" id="addItemBtn">
|
||||
<i class="bi bi-plus-circle"></i> Add Item
|
||||
</button>
|
||||
|
||||
<input type="file" id="excelInput" accept=".xlsx,.xls" hidden>
|
||||
|
||||
<button type="button" class="btn btn-outline-success" id="uploadExcelBtn">
|
||||
<i class="bi bi-file-earmark-excel"></i> Upload Excel
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1951,6 +2023,75 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
e.target.closest('tr').remove();
|
||||
reindexRows();
|
||||
});
|
||||
|
||||
// ===== EXCEL UPLOAD LOGIC =====
|
||||
const uploadExcelBtn = document.getElementById('uploadExcelBtn');
|
||||
const excelInput = document.getElementById('excelInput');
|
||||
|
||||
if (uploadExcelBtn && excelInput) {
|
||||
|
||||
uploadExcelBtn.addEventListener('click', () => excelInput.click());
|
||||
|
||||
excelInput.addEventListener('change', function () {
|
||||
const file = this.files[0];
|
||||
if (!file) return;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('excel', file);
|
||||
formData.append('_token', '{{ csrf_token() }}');
|
||||
|
||||
fetch('{{ route("admin.orders.upload.excel.preview") }}', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(async res => {
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(text);
|
||||
}
|
||||
return res.json();
|
||||
})
|
||||
.then(res => {
|
||||
if (!res.success) {
|
||||
alert('Invalid Excel file');
|
||||
return;
|
||||
}
|
||||
populateItemsTable(res.items);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
alert('Excel upload failed');
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function populateItemsTable(items) {
|
||||
itemsTableBody.innerHTML = '';
|
||||
|
||||
items.forEach((item, index) => {
|
||||
addRow(index);
|
||||
const row = itemsTableBody.children[index];
|
||||
|
||||
row.querySelector('[data-field="description"]').value = item.description ?? '';
|
||||
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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user