Production readiness hardening and ops tooling

This commit is contained in:
2026-05-29 10:10:12 +07:00
parent e0b8f9af9a
commit 648e77cee9
68 changed files with 12222 additions and 848 deletions

View File

@ -388,15 +388,15 @@
const detailContent = document.getElementById("transaction-detail-content");
const normalizeText = (value) => String(value || "").toLowerCase().trim();
const toDateValue = (value) => {
const toDateBoundary = (value, endOfDay = false) => {
if (!value) {
return "";
return null;
}
const date = new Date(value);
const date = new Date(`${value}T${endOfDay ? "23:59:59.999" : "00:00:00.000"}`);
if (Number.isNaN(date.getTime())) {
return value;
return null;
}
return date.toISOString().slice(0, 10);
return date;
};
const statusMeta = (status) => {
@ -529,10 +529,11 @@
const merchant = merchantFilter?.value || "";
const outlet = outletFilter?.value || "";
const terminal = terminalFilter?.value || "";
const from = toDateValue(fromFilter?.value);
const to = toDateValue(toFilter?.value);
const from = toDateBoundary(fromFilter?.value);
const to = toDateBoundary(toFilter?.value, true);
const filtered = transactions.filter((tx) => {
const txTime = new Date(tx.created_at).getTime();
const id = normalizeText(tx.transaction_code || tx.id || tx.code);
const rrn = normalizeText(tx.partner_reference || tx.rrn || tx.reference || "");
const merchantName = normalizeText(merchantMap.get(tx.merchant_id) || "");
@ -551,8 +552,8 @@
const matchesMerchant = !merchant || merchantId === merchant;
const matchesOutlet = !outlet || tx.outlet_id === outlet;
const matchesTerminal = !terminal || tx.terminal_id === terminal;
const matchesFrom = !from || normalizeText(tx.created_at) >= from;
const matchesTo = !to || normalizeText(tx.created_at) <= to;
const matchesFrom = !from || txTime >= from.getTime();
const matchesTo = !to || txTime <= to.getTime();
return matchesSearch && matchesStatus && matchesMerchant && matchesOutlet && matchesTerminal && matchesFrom && matchesTo;
});
@ -728,17 +729,15 @@
try {
api.requireToken();
const q = normalizeText(searchInput?.value);
const status = normalizeText(statusFilter?.value);
const merchant = merchantFilter?.value || "";
const from = fromFilter?.value || "";
const to = toFilter?.value || "";
const from = toDateBoundary(fromFilter?.value);
const to = toDateBoundary(toFilter?.value, true);
const query = {
q,
status,
merchant_id: merchant,
from,
to
from: from ? from.toISOString() : "",
to: to ? to.toISOString() : ""
};
const [