diff --git a/resources/views/admin/account.blade.php b/resources/views/admin/account.blade.php
index ae55af8..14d0b08 100644
--- a/resources/views/admin/account.blade.php
+++ b/resources/views/admin/account.blade.php
@@ -2784,85 +2784,76 @@ async function submitEditEntry(e) {
}
-function openEntryOrdersModal(entryNo) {
- // header la entry no show kar
- document.getElementById('entryOrdersEntryNo-span').textContent = `(${entryNo})`;
+ function openEntryOrdersModal(entryNo) {
+ document.getElementById('entryOrdersEntryNo-span').textContent = `(${entryNo})`;
- // table clean / loading state
- const tbody = document.getElementById('entryOrdersTableBody');
- tbody.innerHTML = `
-
- | Loading orders... |
-
- `;
-
- // API call: /admin/account/entry-orders/{entryno}
- jsonFetch(`/admin/account/entry-orders/${encodeURIComponent(entryNo)}`, {
- method: 'GET'
- })
- .then(res => {
- if (!res.success) {
+ const tbody = document.getElementById('entryOrdersTableBody');
tbody.innerHTML = `
-
- | Failed to load orders |
-
+
+ | Loading orders... |
+
`;
- return;
- }
- const orders = res.orders || [];
- if (!orders.length) {
- tbody.innerHTML = `
-
- | No orders associated with this entry |
-
- `;
- return;
- }
+ jsonFetch(`/admin/account/entry-orders/${encodeURIComponent(entryNo)}`, {
+ method: 'GET'
+ })
+ .then(res => {
+ if (!res.success) {
+ tbody.innerHTML = `
+
+ | Failed to load orders |
+
+ `;
+ return;
+ }
- tbody.innerHTML = '';
- orders.forEach(order => {
- const tr = document.createElement('tr');
+ const orders = res.orders || [];
+ if (!orders.length) {
+ tbody.innerHTML = `
+
+ | No orders associated with this entry |
+
+ `;
+ return;
+ }
- const idString = (order.orderid ?? order.id ?? '').toString().trim();
- const numericId = parseInt(idString, 10);
- const formattedId = isNaN(numericId)
- ? escapeHtml(idString)
- : 'KNT-25-' + String(numericId).padStart(8, '0');
+ tbody.innerHTML = '';
- // इथे वेगवेगळी शक्य keys try कर
- const amountValue =
- order.ttl_amount ??
- order.ttlamount ??
- order.total_amount ??
- order.order_amount ??
- order.amount ??
- 0;
+ orders.forEach(order => {
+ const tr = document.createElement('tr');
- tr.innerHTML = `
- ${formattedId} |
- ${escapeHtml(order.markno ?? order.mark_no ?? '')} |
- ${escapeHtml(order.origin ?? '')} |
- ${escapeHtml(order.destination ?? '')} |
- ${escapeHtml(order.ctn ?? '')} |
- ${escapeHtml(order.qty ?? '')} |
- ${formatCurrency(amountValue)} |
- `;
- tbody.appendChild(tr);
-});
+ const amountValue =
+ order.ttl_amount ??
+ order.ttlamount ??
+ order.total_amount ??
+ order.order_amount ??
+ order.amount ??
+ 0;
+ tr.innerHTML = `
+ ${escapeHtml(order.order_id)} |
+ ${escapeHtml(order.mark_no ?? '')} |
+ ${escapeHtml(order.origin ?? '')} |
+ ${escapeHtml(order.destination ?? '')} |
+ ${escapeHtml(order.ctn ?? '')} |
+ ${escapeHtml(order.qty ?? '')} |
+ ${formatCurrency(amountValue)} |
+ `;
- })
- .catch(() => {
- tbody.innerHTML = `
-
- | Error loading orders |
-
- `;
- });
+ tbody.appendChild(tr);
+ });
+ })
+ .catch(() => {
+ tbody.innerHTML = `
+
+ | Error loading orders |
+
+ `;
+ });
+
+ document.getElementById('entryOrdersModal').classList.add('modal-open');
+ }
- document.getElementById('entryOrdersModal').classList.add('modal-open');
-}
function closeEntryOrdersModal() {
document.getElementById('entryOrdersModal').classList.remove('modal-open');