feat: default request sorting by status
This commit is contained in:
parent
cd05a93047
commit
f968b0c5e2
@ -22,7 +22,7 @@ class RequestsController extends BaseController
|
|||||||
$pageSize = max(1, min(self::MAX_PAGE_SIZE, $pageSize));
|
$pageSize = max(1, min(self::MAX_PAGE_SIZE, $pageSize));
|
||||||
$offset = ($page - 1) * $pageSize;
|
$offset = ($page - 1) * $pageSize;
|
||||||
|
|
||||||
$sortCol = (string) ($this->request->getGet('sortCol') ?? 'REQDATE');
|
$sortCol = (string) ($this->request->getGet('sortCol') ?? 'STATS');
|
||||||
$sortDirRaw = strtoupper((string) ($this->request->getGet('sortDir') ?? 'DESC'));
|
$sortDirRaw = strtoupper((string) ($this->request->getGet('sortDir') ?? 'DESC'));
|
||||||
$sortDir = $sortDirRaw === 'ASC' ? 'ASC' : 'DESC';
|
$sortDir = $sortDirRaw === 'ASC' ? 'ASC' : 'DESC';
|
||||||
$sortSql = $this->resolveSortColumn($sortCol);
|
$sortSql = $this->resolveSortColumn($sortCol);
|
||||||
@ -164,10 +164,19 @@ class RequestsController extends BaseController
|
|||||||
'HOSTORDERNUMBER' => 'd.HOSTORDERNUMBER',
|
'HOSTORDERNUMBER' => 'd.HOSTORDERNUMBER',
|
||||||
'REFF' => 'd.REFF',
|
'REFF' => 'd.REFF',
|
||||||
'DOC' => 'd.DOC',
|
'DOC' => 'd.DOC',
|
||||||
'STATS' => 'd.STATS',
|
'STATS' => "CASE d.STATS
|
||||||
|
WHEN 'Pend' THEN 1
|
||||||
|
WHEN 'PartColl' THEN 2
|
||||||
|
WHEN 'Coll' THEN 3
|
||||||
|
WHEN 'PartRecv' THEN 4
|
||||||
|
WHEN 'Recv' THEN 5
|
||||||
|
WHEN 'Inc' THEN 6
|
||||||
|
WHEN 'Fin' THEN 7
|
||||||
|
ELSE 99
|
||||||
|
END",
|
||||||
];
|
];
|
||||||
|
|
||||||
return $map[$sortCol] ?? 'd.REQDATE';
|
return $map[$sortCol] ?? $map['STATS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -97,6 +97,9 @@ $canUnval = $userLevel <= 1;
|
|||||||
<th style='width:9%;'>
|
<th style='width:9%;'>
|
||||||
<div class="skeleton h-4 w-20"></div>
|
<div class="skeleton h-4 w-20"></div>
|
||||||
</th>
|
</th>
|
||||||
|
<th style='width:7%;'>
|
||||||
|
<div class="skeleton h-4 w-16"></div>
|
||||||
|
</th>
|
||||||
<th style='width:18%;'>
|
<th style='width:18%;'>
|
||||||
<div class="skeleton h-4 w-32"></div>
|
<div class="skeleton h-4 w-32"></div>
|
||||||
</th>
|
</th>
|
||||||
@ -124,12 +127,18 @@ $canUnval = $userLevel <= 1;
|
|||||||
<th style='width:5%;'>
|
<th style='width:5%;'>
|
||||||
<div class="skeleton h-4 w-12"></div>
|
<div class="skeleton h-4 w-12"></div>
|
||||||
</th>
|
</th>
|
||||||
|
<th style='width:5%;'>
|
||||||
|
<div class="skeleton h-4 w-12"></div>
|
||||||
|
</th>
|
||||||
|
<th style='width:5%;'>
|
||||||
|
<div class="skeleton h-4 w-12"></div>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template x-for="i in 5" :key="i">
|
<template x-for="i in 5" :key="i">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="10">
|
<td colspan="13">
|
||||||
<div class="skeleton h-4 w-full"></div>
|
<div class="skeleton h-4 w-full"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -155,6 +164,14 @@ $canUnval = $userLevel <= 1;
|
|||||||
:class="sortCol === 'REQDATE' ? (sortAsc ? 'fa-sort-up' : 'fa-sort-down') : 'fa-sort opacity-20'"></i>
|
:class="sortCol === 'REQDATE' ? (sortAsc ? 'fa-sort-up' : 'fa-sort-down') : 'fa-sort opacity-20'"></i>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
<th style='width:7%;' @click="sort('STATS')"
|
||||||
|
class="cursor-pointer hover:bg-base-200 transition-colors select-none">
|
||||||
|
<div class="flex items-center gap-1">
|
||||||
|
Status
|
||||||
|
<i class="fa text-xs"
|
||||||
|
:class="sortCol === 'STATS' ? (sortAsc ? 'fa-sort-up' : 'fa-sort-down') : 'fa-sort opacity-20'"></i>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
<th style='width:18%;' @click="sort('Name')"
|
<th style='width:18%;' @click="sort('Name')"
|
||||||
class="cursor-pointer hover:bg-base-200 transition-colors select-none">
|
class="cursor-pointer hover:bg-base-200 transition-colors select-none">
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
@ -207,6 +224,7 @@ $canUnval = $userLevel <= 1;
|
|||||||
<template x-for="req in filteredRows" :key="req.SP_ACCESSNUMBER">
|
<template x-for="req in filteredRows" :key="req.SP_ACCESSNUMBER">
|
||||||
<tr class="hover:bg-base-300">
|
<tr class="hover:bg-base-300">
|
||||||
<td x-text="req.REQDATE" :class="statusRowBg[req.STATS]"></td>
|
<td x-text="req.REQDATE" :class="statusRowBg[req.STATS]"></td>
|
||||||
|
<td x-text="req.STATS" :class="statusRowBg[req.STATS]"></td>
|
||||||
<td x-text="req.Name" :class="statusRowBg[req.STATS]"></td>
|
<td x-text="req.Name" :class="statusRowBg[req.STATS]"></td>
|
||||||
<td x-text="req.SP_ACCESSNUMBER" class="font-bold" :class="statusRowBg[req.STATS]"></td>
|
<td x-text="req.SP_ACCESSNUMBER" class="font-bold" :class="statusRowBg[req.STATS]"></td>
|
||||||
<td x-text="req.HOSTORDERNUMBER" class="font-bold" :class="statusRowBg[req.STATS]"></td>
|
<td x-text="req.HOSTORDERNUMBER" class="font-bold" :class="statusRowBg[req.STATS]"></td>
|
||||||
|
|||||||
@ -48,8 +48,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
filterKey: 'Total',
|
filterKey: 'Total',
|
||||||
|
|
||||||
// Sorting & Pagination
|
// Sorting & Pagination
|
||||||
sortCol: 'REQDATE',
|
sortCol: 'STATS',
|
||||||
sortAsc: false,
|
sortAsc: true,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
totalPages: 1,
|
totalPages: 1,
|
||||||
@ -166,8 +166,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this.filterTable = '';
|
this.filterTable = '';
|
||||||
this.filterKey = 'Total';
|
this.filterKey = 'Total';
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.sortCol = 'REQDATE';
|
this.sortCol = 'STATS';
|
||||||
this.sortAsc = false;
|
this.sortAsc = true;
|
||||||
this.fetchList();
|
this.fetchList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user