removed files
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
orderQuantity,
|
||||
orderValue,
|
||||
statusColor,
|
||||
billedAtMs,
|
||||
syncLagMs,
|
||||
type StatusKey,
|
||||
} from '../orderStatus';
|
||||
@@ -114,7 +115,11 @@ export function SalesPage() {
|
||||
.toLowerCase()
|
||||
.includes(term),
|
||||
)
|
||||
.sort((a, b) => (b.bill.billedat ?? '').localeCompare(a.bill.billedat ?? ''));
|
||||
/* Sorted on the recovered instant, not the raw stamp. A string compare
|
||||
put the one terminal that sends correct UTC five and a half hours
|
||||
adrift of the rest, so newest-first was newest-first only within a
|
||||
terminal. */
|
||||
.sort((a, b) => (billedAtMs(b.bill) ?? 0) - (billedAtMs(a.bill) ?? 0));
|
||||
}, [billPages, branchIds, branches, keyword]);
|
||||
|
||||
/** Counts for the tab strip, from the unfiltered set. */
|
||||
@@ -753,6 +758,8 @@ function BillsTable({
|
||||
restarting its series would collide. */}
|
||||
{rows.map(({ bill, branch }) => {
|
||||
const lag = syncLagMs(bill);
|
||||
// The recovered instant, not the stamp — see `billedAtMs`.
|
||||
const billedAt = billedAtMs(bill);
|
||||
return (
|
||||
<tr key={bill.terminalorderid ?? `${branch}:${bill.posorderid}`}>
|
||||
<Td>
|
||||
@@ -773,7 +780,7 @@ function BillsTable({
|
||||
</Secondary>
|
||||
</Td>
|
||||
<Td isMuted>
|
||||
{clockOf(bill.billedat)}
|
||||
{clockOf(billedAt ?? bill.billedat)}
|
||||
</Td>
|
||||
{showBranch ? (
|
||||
<Td isMuted>
|
||||
@@ -824,10 +831,16 @@ function stamp(value: string | undefined): string {
|
||||
return `${parsed.toLocaleDateString('en-IN', { day: '2-digit', month: 'short' })}, ${clockOf(value)}`;
|
||||
}
|
||||
|
||||
function clockOf(value: string | undefined): string {
|
||||
if (!value) return '—';
|
||||
/**
|
||||
* Takes an epoch too, so a bill can pass the instant `billedAtMs` recovered
|
||||
* rather than the stamp it arrived with. Formatting the raw `billedat` shifted
|
||||
* an already-wrong time by another +05:30 and put a 17:17 sale on the row at
|
||||
* 22:47 — two bugs compounding into a plausible-looking number.
|
||||
*/
|
||||
function clockOf(value: string | number | undefined): string {
|
||||
if (value === undefined || value === '') return '—';
|
||||
const parsed = new Date(value);
|
||||
if (Number.isNaN(parsed.getTime())) return value;
|
||||
if (Number.isNaN(parsed.getTime())) return String(value);
|
||||
return parsed.toLocaleTimeString('en-IN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
|
||||
Reference in New Issue
Block a user