diff --git a/call_center_pro.php b/call_center_pro.php index 4a6aba85..d95b008c 100644 --- a/call_center_pro.php +++ b/call_center_pro.php @@ -850,12 +850,80 @@ try { } } + if ($view === 'todos') { + if ($aImport !== $bImport) { + return $bImport <=> $aImport; + } + + $aSourceRow = (int) ($a['source_row'] ?? 0); + $bSourceRow = (int) ($b['source_row'] ?? 0); + if ($aSourceRow !== $bSourceRow) { + return $bSourceRow <=> $aSourceRow; + } + + $aId = (int) ($a['id'] ?? 0); + $bId = (int) ($b['id'] ?? 0); + if ($aId !== $bId) { + return $bId <=> $aId; + } + + return strcmp((string) ($a['source_key'] ?? ''), (string) ($b['source_key'] ?? '')); + } + if ($aImport !== $bImport) { return $bImport <=> $aImport; } return cc_test_order_time($b) <=> cc_test_order_time($a); }); + + $visibleOrdersTotalCount = count($visibleOrders); + $todosPageSize = 200; + $todosPage = 1; + $todosTotalPages = 1; + $todosPageStart = 0; + $todosPageEnd = 0; + $todosPaginationPages = []; + + if ($view === 'todos') { + $requestedPage = (int) ($_GET['page'] ?? 1); + if ($requestedPage < 1) { + $requestedPage = 1; + } + + $todosTotalPages = max(1, (int) ceil($visibleOrdersTotalCount / $todosPageSize)); + if ($requestedPage > $todosTotalPages) { + $requestedPage = $todosTotalPages; + } + + $todosPage = $requestedPage; + $todosPageStart = ($todosPage - 1) * $todosPageSize; + $visibleOrders = array_slice($visibleOrders, $todosPageStart, $todosPageSize); + $todosPageEnd = $todosPageStart + count($visibleOrders); + + if ($todosTotalPages <= 7) { + $todosPaginationPages = range(1, $todosTotalPages); + } else { + $todosPaginationPages[] = 1; + $windowStart = max(2, $todosPage - 1); + $windowEnd = min($todosTotalPages - 1, $todosPage + 1); + + if ($windowStart > 2) { + $todosPaginationPages[] = 'ellipsis'; + } + + for ($pageNumber = $windowStart; $pageNumber <= $windowEnd; $pageNumber++) { + $todosPaginationPages[] = $pageNumber; + } + + if ($windowEnd < $todosTotalPages - 1) { + $todosPaginationPages[] = 'ellipsis'; + } + + $todosPaginationPages[] = $todosTotalPages; + } + } + } catch (Throwable $exception) { $errorMessage = $exception->getMessage(); } @@ -1224,7 +1292,10 @@ require_once 'layout_header.php'; Asesora: - pedidos únicos en esta bandeja + pedidos únicos en esta bandeja + + Página de · 200 por página +
@@ -1873,6 +1944,50 @@ require_once 'layout_header.php';
+ +
+
+ 0): ?> + Mostrando - de pedidos · 200 por página + + No hay pedidos para mostrar en esta vista. + +
+ 1): ?> + + +
+ diff --git a/gestiones_callcenter.php b/gestiones_callcenter.php index a6261937..d3df3400 100644 --- a/gestiones_callcenter.php +++ b/gestiones_callcenter.php @@ -328,7 +328,10 @@ $uploadErrorMessage = null; $assessors = []; $orders = []; $visibleOrders = []; -$modalsHtml = []; +$modalsHtml = fopen('php://temp', 'w+'); +if ($modalsHtml === false) { + $modalsHtml = null; +} $totalRows = 0; $agregadosCount = 0; $lastProcessedRow = null; @@ -1131,12 +1134,80 @@ try { } } + if ($view === 'todos') { + if ($aImport !== $bImport) { + return $bImport <=> $aImport; + } + + $aSourceRow = (int) ($a['source_row'] ?? 0); + $bSourceRow = (int) ($b['source_row'] ?? 0); + if ($aSourceRow !== $bSourceRow) { + return $bSourceRow <=> $aSourceRow; + } + + $aId = (int) ($a['id'] ?? 0); + $bId = (int) ($b['id'] ?? 0); + if ($aId !== $bId) { + return $bId <=> $aId; + } + + return strcmp((string) ($a['source_key'] ?? ''), (string) ($b['source_key'] ?? '')); + } + if ($aImport !== $bImport) { return $bImport <=> $aImport; } return cc_test_order_time($b) <=> cc_test_order_time($a); }); + + $visibleOrdersTotalCount = count($visibleOrders); + $todosPageSize = 200; + $todosPage = 1; + $todosTotalPages = 1; + $todosPageStart = 0; + $todosPageEnd = 0; + $todosPaginationPages = []; + + if ($view === 'todos') { + $requestedPage = (int) ($_GET['page'] ?? 1); + if ($requestedPage < 1) { + $requestedPage = 1; + } + + $todosTotalPages = max(1, (int) ceil($visibleOrdersTotalCount / $todosPageSize)); + if ($requestedPage > $todosTotalPages) { + $requestedPage = $todosTotalPages; + } + + $todosPage = $requestedPage; + $todosPageStart = ($todosPage - 1) * $todosPageSize; + $visibleOrders = array_slice($visibleOrders, $todosPageStart, $todosPageSize); + $todosPageEnd = $todosPageStart + count($visibleOrders); + + if ($todosTotalPages <= 7) { + $todosPaginationPages = range(1, $todosTotalPages); + } else { + $todosPaginationPages[] = 1; + $windowStart = max(2, $todosPage - 1); + $windowEnd = min($todosTotalPages - 1, $todosPage + 1); + + if ($windowStart > 2) { + $todosPaginationPages[] = 'ellipsis'; + } + + for ($pageNumber = $windowStart; $pageNumber <= $windowEnd; $pageNumber++) { + $todosPaginationPages[] = $pageNumber; + } + + if ($windowEnd < $todosTotalPages - 1) { + $todosPaginationPages[] = 'ellipsis'; + } + + $todosPaginationPages[] = $todosTotalPages; + } + } + } catch (Throwable $exception) { $errorMessage = $exception->getMessage(); } @@ -1784,7 +1855,10 @@ require_once 'layout_header.php';

- pedidos únicos en esta bandeja + pedidos únicos en esta bandeja + + Página de · 200 por página +
@@ -1950,7 +2024,7 @@ require_once 'layout_header.php';
- $assessor): ?> @@ -2473,18 +2547,66 @@ require_once 'layout_header.php';
- + + +
+
+ 0): ?> + Mostrando - de pedidos · 200 por página + + No hay pedidos para mostrar en esta vista. + +
+ 1): ?> + + +
+ - - + +