Account Changes

This commit is contained in:
Utkarsh Khedkar
2025-12-03 16:17:14 +05:30
parent 9b8c50fcec
commit 5114357ff2
5 changed files with 126 additions and 528 deletions

View File

@@ -329,6 +329,22 @@ tr:hover td{ background:#fbfdff; }
margin-right:-1050px;
}
.pagination-controls1 {
display: flex;
align-items: center;
gap: 8px;
margin-right:-550px;
}
.pagination-controls2 {
display: flex;
align-items: center;
gap: 8px;
margin-right:-550px;
}
.pagination-btn {
background: #fff;
@@ -1212,7 +1228,7 @@ tr:hover td{ background:#fbfdff; }
<div class="modal-pagination-wrapper pagination-right">
<div class="pagination-container">
<div class="pagination-info" id="modalPageInfo">Showing 0 entries</div>
<div class="pagination-controls">
<div class="pagination-controls2">
<button class="pagination-img-btn" id="modalPrevBtn" title="Previous page">
<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"/>
@@ -1509,7 +1525,7 @@ tr:hover td{ background:#fbfdff; }
<div class="modal-pagination-wrapper pagination-right">
<div class="pagination-container">
<div class="pagination-info" id="addOrderPageInfo">Showing 0 entries</div>
<div class="pagination-controls">
<div class="pagination-controls1">
<button class="pagination-img-btn" id="addOrderPrevBtn" title="Previous page">
<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"/>
@@ -2047,6 +2063,47 @@ function loadDashboard(){
updateModalPaginationControls();
});
}
function loadAvailableOrdersForAddModal() {
const tbody = document.getElementById('addOrderTableBody');
if (tbody) {
tbody.innerHTML = `
<tr>
<td colspan="8" class="empty-state">Loading available orders...</td>
</tr>
`;
}
jsonFetch('/admin/account/available-orders', {
method: 'GET'
})
.then(res => {
if (!res.success) {
throw new Error(res.message || 'Failed to load available orders');
}
availableOrders = res.orders || [];
addOrderCurrentPage = 1;
renderAddOrderModal(availableOrders);
updateAddOrderPaginationControls();
})
.catch(err => {
console.error(err);
if (tbody) {
tbody.innerHTML = `
<tr>
<td colspan="8" class="empty-state">Unable to load available orders</td>
</tr>
`;
}
updateAddOrderPaginationControls();
});
}
/* ---------- Renderers ---------- */
@@ -2541,13 +2598,15 @@ function closeEntryOrdersModal() {
/* ---------- Add Order Modal Functions ---------- */
function openAddOrderModal() {
if (!currentEditEntry) return;
document.getElementById('addOrderModal').classList.add('modal-open');
// नेहमी इथेच ताजे orders load कर
addOrderCurrentPage = 1;
renderAddOrderModal(availableOrders);
updateAddOrderPaginationControls();
loadAvailableOrdersForAddModal();
}
function closeAddOrderModal() {
document.getElementById('addOrderModal').classList.remove('modal-open');
}

View File

@@ -748,10 +748,13 @@
<script>
// Pagination state
let currentPage = 1;
const itemsPerPage = 10;
let allOrders = @json($orders);
let filteredOrders = [...allOrders];
let currentPage = 1;
const itemsPerPage = 10;
let allOrders = @json($orders);
let filteredOrders = [...allOrders];
console.log('ORDERS SAMPLE:', allOrders[0]);
// Status icon helper functions
function getInvoiceStatusIcon(status) {
@@ -931,10 +934,11 @@
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 matchesSearch = !searchTerm ||
order.order_id?.toLowerCase().includes(searchTerm) ||
order.mark_list?.company_name?.toLowerCase().includes(searchTerm) ||
order.invoice?.invoice_number?.toLowerCase().includes(searchTerm);
const matchesStatus = !statusFilter ||
(order.invoice?.status && order.invoice.status.toLowerCase() === statusFilter);
@@ -1049,7 +1053,7 @@
const paginatedItems = filteredOrders.slice(startIndex, endIndex);
paginatedItems.forEach(order => {
const mark = order.markList || null;
const mark = order.mark_list || null;
const invoice = order.invoice || null;
const shipment = order.shipments?.[0] || null;
const invoiceStatus = (invoice?.status || '').toLowerCase();