diff --git a/resources/views/admin/account.blade.php b/resources/views/admin/account.blade.php index 4ffeedd..5446a56 100644 --- a/resources/views/admin/account.blade.php +++ b/resources/views/admin/account.blade.php @@ -48,7 +48,7 @@ body { /* top actions row */ .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; } .top-actions .left { @@ -67,7 +67,7 @@ body { 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: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 { @@ -89,12 +89,12 @@ body { background: var(--card-bg); border-radius:12px; box-shadow:0 8px 20px rgba(25,40,80,0.06); - padding:22px; + padding:20px; /* 005 */ box-sizing:border-box; overflow-x:auto; transition: transform .12s, box-shadow .12s; min-height: 520px; - display: flex; + /* display: flex; */ /* 005 */ flex-direction: column; flex: 1; height: 100%; @@ -205,8 +205,8 @@ tr:hover td{ background:#fbfdff; } .toggle-switch-btn { appearance:none; -webkit-appearance:none; - width:60px; - height:24px; + width:64px; + height:26.5px; /* 005 */ background:#f25b5b; border:2px solid #f25b5b; border-radius:999px; @@ -313,7 +313,16 @@ tr:hover td{ background:#fbfdff; } margin-top: 15px; padding: 12px 0; 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 { @@ -326,14 +335,15 @@ tr:hover td{ background:#fbfdff; } display: flex; align-items: center; gap: 8px; - margin-right:-1050px; + position: absolute; + right: 16px; /* 005 */ } .pagination-controls1 { display: flex; align-items: center; gap: 8px; - margin-right:-550px; + /* margin-right:-550px; */ } @@ -563,7 +573,7 @@ tr:hover td{ background:#fbfdff; } /* Combined filters row styling */ .combined-filters-row { - display: flex; + display: ruby; /* 005 */ gap: 12px; align-items: center; margin-bottom: 16px; @@ -576,8 +586,8 @@ tr:hover td{ background:#fbfdff; } } .right{ - margin-left:auto; - margin-top:-16px; + /* margin-left:auto; + margin-top:-16px; */ /* 005 */ } .filter-group1 { @@ -953,6 +963,15 @@ tr:hover td{ background:#fbfdff; } 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 { background: #d42c3f; } @@ -1314,7 +1333,7 @@ html, body {
- - - {{ $order->order_id }} - - {{ $order->origin }} - {{ $order->destination }} - {{ $order->ctn }} - {{ $order->qty }} - {{ $order->ttl_qty }} - {{ $order->cbm }} - {{ $order->ttl_cbm }} - {{ $order->kg }} - {{ $order->ttl_kg }} - ₹{{ number_format($order->ttl_amount, 2) }} - - @empty - - No available orders to add to shipment - - @endforelse + +
+ + +
@@ -1609,6 +2045,30 @@ const itemsPerPage = 10; let allShipments = @json($shipments); let filteredShipments = [...allShipments]; +// Modal pagination state +let modalCurrentPage = 1; +const modalItemsPerPage = 10; + +// IMPORTANT: सर्व orders एकाच decending order मध्ये +// प्रथम सर्व orders ला एकत्रित decending order मध्ये sort करा +let allAvailableOrders = @json($availableOrders); + +// Sort all orders in descending order by order_id (newest first) +// Order ID च्या क्रमाने sort करा (KNT-25-00000041, KNT-25-00000040, etc.) +allAvailableOrders.sort((a, b) => { + // Extract the number from order_id (e.g., "KNT-25-00000041" -> 41) + const extractNumber = (orderId) => { + const match = orderId.match(/\d+$/); + return match ? parseInt(match[0]) : 0; + }; + + const numA = extractNumber(a.order_id); + const numB = extractNumber(b.order_id); + + // Descending order (highest number first) + return numB - numA; +}); + // Initialize pagination on page load document.addEventListener('DOMContentLoaded', function() { renderTable(); @@ -1664,11 +2124,163 @@ document.addEventListener('DOMContentLoaded', function() { searchInput.addEventListener('input', filterShipments); carrierFilter.addEventListener('change', filterShipments); + // Update status filter appearance based on selection + statusFilter.addEventListener('change', function() { + // Update data-status attribute for CSS styling + if (this.value === 'all') { + this.removeAttribute('data-status'); + } else { + this.setAttribute('data-status', this.value); + } + }); + // Initialize filter on page load filterShipments(); + + // Modal pagination initialization + initModalPagination(); }); -// Pagination Functions +// Modal Pagination Functions +function initModalPagination() { + renderModalTable(); + updateModalPaginationControls(); + + // Bind modal pagination events + document.getElementById('modalPrevPageBtn').addEventListener('click', goToModalPreviousPage); + document.getElementById('modalNextPageBtn').addEventListener('click', goToModalNextPage); +} + +function goToModalPreviousPage() { + if (modalCurrentPage > 1) { + modalCurrentPage--; + renderModalTable(); + updateModalPaginationControls(); + } +} + +function goToModalNextPage() { + const totalPages = Math.ceil(allAvailableOrders.length / modalItemsPerPage); + if (modalCurrentPage < totalPages) { + modalCurrentPage++; + renderModalTable(); + updateModalPaginationControls(); + } +} + +function updateModalPaginationControls() { + const totalPages = Math.ceil(allAvailableOrders.length / modalItemsPerPage); + const prevBtn = document.getElementById('modalPrevPageBtn'); + const nextBtn = document.getElementById('modalNextPageBtn'); + const pageInfo = document.getElementById('modalPageInfo'); + const paginationPages = document.getElementById('modalPaginationPages'); + + prevBtn.disabled = modalCurrentPage === 1; + nextBtn.disabled = modalCurrentPage === totalPages || totalPages === 0; + + // Update page info text + const startIndex = (modalCurrentPage - 1) * modalItemsPerPage + 1; + const endIndex = Math.min(modalCurrentPage * modalItemsPerPage, allAvailableOrders.length); + pageInfo.textContent = `Showing ${startIndex} to ${endIndex} of ${allAvailableOrders.length} entries`; + + // Generate page numbers + paginationPages.innerHTML = ''; + + if (totalPages <= 7) { + // Show all pages + for (let i = 1; i <= totalPages; i++) { + addModalPageButton(i, paginationPages); + } + } else { + // Show first page, current page range, and last page + addModalPageButton(1, paginationPages); + + if (modalCurrentPage > 3) { + paginationPages.innerHTML += '...'; + } + + const start = Math.max(2, modalCurrentPage - 1); + const end = Math.min(totalPages - 1, modalCurrentPage + 1); + + for (let i = start; i <= end; i++) { + addModalPageButton(i, paginationPages); + } + + if (modalCurrentPage < totalPages - 2) { + paginationPages.innerHTML += '...'; + } + + addModalPageButton(totalPages, paginationPages); + } +} + +function addModalPageButton(pageNumber, container) { + const button = document.createElement('button'); + button.className = 'modal-pagination-page-btn'; + if (pageNumber === modalCurrentPage) { + button.classList.add('active'); + } + button.textContent = pageNumber; + button.addEventListener('click', () => { + modalCurrentPage = pageNumber; + renderModalTable(); + updateModalPaginationControls(); + }); + container.appendChild(button); +} + +function renderModalTable() { + const tbody = document.getElementById('modalOrdersTableBody'); + + if (allAvailableOrders.length === 0) { + tbody.innerHTML = ` + + + + No available orders to add to shipment + + + `; + return; + } + + // Calculate pagination - पेजवर दाखवायचे orders + const startIndex = (modalCurrentPage - 1) * modalItemsPerPage; + const endIndex = startIndex + modalItemsPerPage; + + // IMPORTANT: सर्व orders आधीच sorted आहेत (descending order मध्ये) + // फक्त current page चे orders घ्या + const paginatedItems = allAvailableOrders.slice(startIndex, endIndex); + + // Render table rows + tbody.innerHTML = ''; + paginatedItems.forEach((order, index) => { + const globalIndex = startIndex + index + 1; + const row = document.createElement('tr'); + + row.innerHTML = ` + + + + + ${order.order_id} + + ${order.origin} + ${order.destination} + ${order.ctn} + ${order.qty} + ${order.ttl_qty} + ${order.cbm} + ${order.ttl_cbm} + ${order.kg} + ${order.ttl_kg} + ₹${parseFloat(order.ttl_amount).toLocaleString('en-IN', {minimumFractionDigits: 2, maximumFractionDigits: 2})} + `; + tbody.appendChild(row); + }); +} + +// Main Pagination Functions function goToPreviousPage() { if (currentPage > 1) { currentPage--; @@ -1768,7 +2380,7 @@ function renderTable() { const endIndex = startIndex + itemsPerPage; const paginatedItems = filteredShipments.slice(startIndex, endIndex); - // Sort by creation date (newest first) + // Sort by creation date (newest first) - descending order const sortedItems = [...paginatedItems].sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); // Render table rows @@ -2086,8 +2698,6 @@ document.addEventListener('DOMContentLoaded', function() { }); }); - - function openShipmentOrderDetails(orderId) { const modal = new bootstrap.Modal( document.getElementById('shipmentOrderDetailsModal') @@ -2109,6 +2719,19 @@ function openShipmentOrderDetails(orderId) { }); } +// Reset modal pagination when modal is shown +document.addEventListener('DOMContentLoaded', function() { + const createShipmentModal = document.getElementById('createShipmentModal'); + if (createShipmentModal) { + createShipmentModal.addEventListener('show.bs.modal', function() { + // Reset to first page + modalCurrentPage = 1; + renderModalTable(); + updateModalPaginationControls(); + }); + } +}); +