aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-21 11:20:47 -0700
committerAdam Soltys <[email protected]>2026-09-21 11:20:47 -0700
commit91b50248982c81412bf2c750e9604c68b1ac5b1d (patch)
tree120d07ff4568c80e6649ada9672d61c5e8328ebd /src
parent01827dd23f29a6e0d6db673f5dc330cd7f4a6f4f (diff)
downloadcoinosv3-91b50248982c81412bf2c750e9604c68b1ac5b1d.tar.gz
coinosv3-91b50248982c81412bf2c750e9604c68b1ac5b1d.zip
Point of sale: a sale the till never saw settle is adopted from the wallet's own record.
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp
Diffstat (limited to 'src')
-rw-r--r--src/features/pos.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/features/pos.js b/src/features/pos.js
index 7f47f88..6a46b78 100644
--- a/src/features/pos.js
+++ b/src/features/pos.js
@@ -151,9 +151,26 @@ export function posFeature(ctx) {
function openSale(sale) {
const m = movementOf(sale);
if (!m) { toast(t('posNoDetail')); return; }
+ // the money arrived while nobody was watching the till (app closed,
+ // screen elsewhere): the record says so now
+ if (sale.status !== 'paid') {
+ const s = st();
+ const row = s.sales.find((x) => x.id === sale.id);
+ if (row) { row.status = 'paid'; row.paidAt = row.paidAt || m.ts || Date.now(); save(s); }
+ }
ui.arkMoveDetail = m.id;
render();
}
+ // Sales the till never saw settle, but the wallet did: adopt them on paint.
+ function adoptPaid(s) {
+ let changed = false;
+ for (const x of s.sales) {
+ if (x.status === 'paid') continue;
+ const m = movementOf(x);
+ if (m) { x.status = 'paid'; x.paidAt = x.paidAt || m.ts || Date.now(); changed = true; }
+ }
+ if (changed) save(s);
+ }
const saleOfMovement = (m) => (m && m.type === 'ln-receive' && m.invoice ? st().sales.find((x) => x.invoice === m.invoice) : null);
// ---- screens -------------------------------------------------------------
@@ -204,6 +221,7 @@ export function posFeature(ctx) {
h('span', { class: 'small muted' }, '%')) : null);
}
function salesCard(s) {
+ adoptPaid(s);
const sales = [...s.sales].reverse();
if (!sales.length) return null;
const today = dayKey(Date.now());