From 4ffeb6ee922aa74d8e4d99cce7bcacd37e337005 Mon Sep 17 00:00:00 2001 From: Jaanu423 Date: Mon, 1 Jun 2026 13:14:29 +0530 Subject: [PATCH] feat(cashier): add morning transfer & previous-day settlement hard block - validateCashierHasMorningTransfer() blocks deposits & withdrawals when no today's cash transfer received - validatePreviousDayClosed() blocks all transactions when previous day unsettled - morningTransferReceived field added to cashier-day-status API response - Warning banners shown in Savings, Current, FD, RD transaction forms - Submit button disabled when either condition is active - getCashierTotalCash SQL fixed: dm.denomination_value -> dm.denomination Co-Authored-By: Claude Sonnet 4.6 --- src/app/cashier/cashier.service.ts | 3 + ...urrent-account-transactions.component.html | 38 ++++++++- ...urrent-account-transactions.component.scss | 83 +++++++++++++++++++ .../current-account-transactions.component.ts | 23 ++++- ...d-deposits-cash-transaction.component.html | 38 ++++++++- ...d-deposits-cash-transaction.component.scss | 83 +++++++++++++++++++ ...xed-deposits-cash-transaction.component.ts | 23 ++++- ...-recurring-deposits-account.component.html | 38 ++++++++- ...-recurring-deposits-account.component.scss | 83 +++++++++++++++++++ ...it-recurring-deposits-account.component.ts | 23 ++++- ...avings-account-transactions.component.html | 38 ++++++++- ...avings-account-transactions.component.scss | 83 +++++++++++++++++++ .../savings-account-transactions.component.ts | 27 +++++- 13 files changed, 575 insertions(+), 8 deletions(-) diff --git a/src/app/cashier/cashier.service.ts b/src/app/cashier/cashier.service.ts index e1be9b5c3..892d61bac 100644 --- a/src/app/cashier/cashier.service.ts +++ b/src/app/cashier/cashier.service.ts @@ -125,6 +125,9 @@ export class CashierService { if (asOfDate) params = params.set('asOfDate', asOfDate); return this.http.get('/cashreports/cashier-position/me', { params }); } + getCashierDayStatus(): Observable { + return this.http.get('/cashreports/cashier-day-status'); + } checkSettlement(cashierId: number, date: string): Observable { const params = new HttpParams().set('cashierId', String(cashierId)).set('date', date); diff --git a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.html b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.html index 038c62eb4..c848c2599 100644 --- a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.html +++ b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.html @@ -135,6 +135,40 @@ + + @if (previousDayUnsettled) { +
+ lock_clock +
+ Previous day not closed — {{ unsettledSince }} + + Complete Cash Settlement for {{ unsettledSince }} before processing any transactions. + All deposits and withdrawals are blocked. + Pending cash: ₹{{ pendingAmount | number: '1.2-2' }} + +
+ + arrow_forward Go to Settlement + +
+ } + + @if (!morningTransferReceived && !previousDayUnsettled) { +
+ account_balance_wallet +
+ Morning cash transfer not received + + No cash has been allocated to your drawer today. Request a morning transfer from the vault before processing + any transactions. All deposits and withdrawals are blocked. + +
+ + arrow_forward Request Transfer + +
+ } +
@@ -514,7 +548,9 @@ [disabled]=" !currentAccountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm) || - hasWithdrawalDenomOverdraft + hasWithdrawalDenomOverdraft || + previousDayUnsettled || + !morningTransferReceived " > diff --git a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.scss b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.scss index 9211b069a..5ac7872fa 100644 --- a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.scss +++ b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.scss @@ -1189,3 +1189,86 @@ $red: #b91c1c; color: #b91c1c; } } + +// ── Previous-day settlement pending banner ── +.sat__day-close-banner { + display: flex; + align-items: flex-start; + gap: 14px; + margin: 12px 20px 0; + padding: 14px 18px; + background: #fffbeb; + border: 1.5px solid #fcd34d; + border-left: 5px solid #f59e0b; + border-radius: 10px; + + &--withdrawal { + background: #fff5f5; + border-color: #fca5a5; + border-left-color: #ef4444; + + .sat__day-close-ico { + color: #ef4444; + } + + .sat__day-close-link { + color: #b91c1c; + border-color: #fca5a5; + } + } +} + +.sat__day-close-ico { + color: #b45309; + font-size: 22px; + height: 22px; + width: 22px; + flex-shrink: 0; + margin-top: 1px; +} + +.sat__day-close-body { + flex: 1; + display: flex; + flex-direction: column; + gap: 3px; + + strong { + font-size: 13px; + font-weight: 700; + color: #78350f; + } + + span { + font-size: 12px; + color: #92400e; + line-height: 1.5; + } + + b { + font-weight: 800; + color: #b91c1c; + } +} + +.sat__day-close-link { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 5px 12px; + border-radius: 999px; + border: 1.5px solid #fcd34d; + background: #fff; + color: #92400e; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + text-decoration: none; + flex-shrink: 0; + + mat-icon { + font-size: 14px; + height: 14px; + width: 14px; + } +} diff --git a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.ts b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.ts index 413e198f5..fa9ff3566 100644 --- a/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.ts +++ b/src/app/current-accounts/current-account-actions/current-account-transactions/current-account-transactions.component.ts @@ -120,6 +120,11 @@ export class CurrentAccountTransactionsComponent implements OnInit { openingTotal = 0; openingLoaded = false; + previousDayUnsettled = false; + morningTransferReceived = true; + unsettledSince = ''; + pendingAmount = 0; + get openingNotes(): any[] { return this.openingDenoms.filter((d) => d.kind !== 'coin'); } @@ -151,6 +156,7 @@ export class CurrentAccountTransactionsComponent implements OnInit { this.loadDenominations(); this.loadContextStrip(); this.loadOpeningPosition(); + this.loadDayStatus(); } /** Load active denominations from the Denomination Master so the cash @@ -203,6 +209,21 @@ export class CurrentAccountTransactionsComponent implements OnInit { }); } + private loadDayStatus(): void { + this.cashierService.getCashierDayStatus().subscribe({ + next: (res: any) => { + this.previousDayUnsettled = res?.previousDayUnsettled ?? false; + this.morningTransferReceived = res?.morningTransferReceived ?? true; + this.unsettledSince = res?.unsettledSince ?? ''; + this.pendingAmount = Number(res?.pendingAmount ?? 0); + }, + error: () => { + this.previousDayUnsettled = false; + this.morningTransferReceived = true; + } + }); + } + private loadOpeningPosition(): void { const today = new Date(); const asOfDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; @@ -390,7 +411,7 @@ export class CurrentAccountTransactionsComponent implements OnInit { } get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> { - if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return []; + if (!this.transactionType.withdrawal || !this.openingLoaded) return []; const openMap = new Map(); for (const d of this.openingDenoms) { openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0)); diff --git a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.html b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.html index ac9b16a5b..1d7c470ae 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.html @@ -109,6 +109,40 @@ + + @if (previousDayUnsettled) { +
+ lock_clock +
+ Previous day not closed — {{ unsettledSince }} + + Complete Cash Settlement for {{ unsettledSince }} before processing any transactions. + All deposits and withdrawals are blocked. + Pending cash: ₹{{ pendingAmount | number: '1.2-2' }} + +
+ + arrow_forward Go to Settlement + +
+ } + + @if (!morningTransferReceived && !previousDayUnsettled) { +
+ account_balance_wallet +
+ Morning cash transfer not received + + No cash has been allocated to your drawer today. Request a morning transfer from the vault before processing + any transactions. All deposits and withdrawals are blocked. + +
+ + arrow_forward Request Transfer + +
+ } +
@@ -480,7 +514,9 @@ [disabled]=" !accountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm) || - hasWithdrawalDenomOverdraft + hasWithdrawalDenomOverdraft || + previousDayUnsettled || + !morningTransferReceived " > diff --git a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.scss b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.scss index ca898f512..ebfbdff24 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.scss +++ b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.scss @@ -1101,3 +1101,86 @@ $amber-d: #b45309; color: #b91c1c; } } + +// ── Previous-day settlement pending banner ── +.sat__day-close-banner { + display: flex; + align-items: flex-start; + gap: 14px; + margin: 12px 20px 0; + padding: 14px 18px; + background: #fffbeb; + border: 1.5px solid #fcd34d; + border-left: 5px solid #f59e0b; + border-radius: 10px; + + &--withdrawal { + background: #fff5f5; + border-color: #fca5a5; + border-left-color: #ef4444; + + .sat__day-close-ico { + color: #ef4444; + } + + .sat__day-close-link { + color: #b91c1c; + border-color: #fca5a5; + } + } +} + +.sat__day-close-ico { + color: #b45309; + font-size: 22px; + height: 22px; + width: 22px; + flex-shrink: 0; + margin-top: 1px; +} + +.sat__day-close-body { + flex: 1; + display: flex; + flex-direction: column; + gap: 3px; + + strong { + font-size: 13px; + font-weight: 700; + color: #78350f; + } + + span { + font-size: 12px; + color: #92400e; + line-height: 1.5; + } + + b { + font-weight: 800; + color: #b91c1c; + } +} + +.sat__day-close-link { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 5px 12px; + border-radius: 999px; + border: 1.5px solid #fcd34d; + background: #fff; + color: #92400e; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + text-decoration: none; + flex-shrink: 0; + + mat-icon { + font-size: 14px; + height: 14px; + width: 14px; + } +} diff --git a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.ts b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.ts index 79538fd5b..b6febc7b2 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.ts +++ b/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component.ts @@ -95,6 +95,11 @@ export class FixedDepositsCashTransactionComponent implements OnInit { openingTotal = 0; openingLoaded = false; + previousDayUnsettled = false; + morningTransferReceived = true; + unsettledSince = ''; + pendingAmount = 0; + get openingNotes(): any[] { return this.openingDenoms.filter((d) => d.kind !== 'coin'); } @@ -130,6 +135,7 @@ export class FixedDepositsCashTransactionComponent implements OnInit { this.loadDenominations(); this.loadContextStrip(); this.loadOpeningPosition(); + this.loadDayStatus(); } /** Load active denominations from the Denomination Master so the cash @@ -180,6 +186,21 @@ export class FixedDepositsCashTransactionComponent implements OnInit { }); } + private loadDayStatus(): void { + this.cashierService.getCashierDayStatus().subscribe({ + next: (res: any) => { + this.previousDayUnsettled = res?.previousDayUnsettled ?? false; + this.morningTransferReceived = res?.morningTransferReceived ?? true; + this.unsettledSince = res?.unsettledSince ?? ''; + this.pendingAmount = Number(res?.pendingAmount ?? 0); + }, + error: () => { + this.previousDayUnsettled = false; + this.morningTransferReceived = true; + } + }); + } + private loadOpeningPosition(): void { const today = new Date(); const asOfDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; @@ -313,7 +334,7 @@ export class FixedDepositsCashTransactionComponent implements OnInit { } get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> { - if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return []; + if (!this.transactionType.withdrawal || !this.openingLoaded) return []; const openMap = new Map(); for (const d of this.openingDenoms) { openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0)); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.html index 3f4c8da95..779d1a413 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.html @@ -109,6 +109,40 @@ + + @if (previousDayUnsettled) { +
+ lock_clock +
+ Previous day not closed — {{ unsettledSince }} + + Complete Cash Settlement for {{ unsettledSince }} before processing any transactions. + All deposits and withdrawals are blocked. + Pending cash: ₹{{ pendingAmount | number: '1.2-2' }} + +
+ + arrow_forward Go to Settlement + +
+ } + + @if (!morningTransferReceived && !previousDayUnsettled) { +
+ account_balance_wallet +
+ Morning cash transfer not received + + No cash has been allocated to your drawer today. Request a morning transfer from the vault before processing + any transactions. All deposits and withdrawals are blocked. + +
+ + arrow_forward Request Transfer + +
+ } +
@@ -486,7 +520,9 @@ [disabled]=" !depositRecurringDepositForm.valid || (denominationTotal > 0 && !denominationMatchesForm) || - hasWithdrawalDenomOverdraft + hasWithdrawalDenomOverdraft || + previousDayUnsettled || + !morningTransferReceived " > diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.scss index ca898f512..ebfbdff24 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.scss +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.scss @@ -1101,3 +1101,86 @@ $amber-d: #b45309; color: #b91c1c; } } + +// ── Previous-day settlement pending banner ── +.sat__day-close-banner { + display: flex; + align-items: flex-start; + gap: 14px; + margin: 12px 20px 0; + padding: 14px 18px; + background: #fffbeb; + border: 1.5px solid #fcd34d; + border-left: 5px solid #f59e0b; + border-radius: 10px; + + &--withdrawal { + background: #fff5f5; + border-color: #fca5a5; + border-left-color: #ef4444; + + .sat__day-close-ico { + color: #ef4444; + } + + .sat__day-close-link { + color: #b91c1c; + border-color: #fca5a5; + } + } +} + +.sat__day-close-ico { + color: #b45309; + font-size: 22px; + height: 22px; + width: 22px; + flex-shrink: 0; + margin-top: 1px; +} + +.sat__day-close-body { + flex: 1; + display: flex; + flex-direction: column; + gap: 3px; + + strong { + font-size: 13px; + font-weight: 700; + color: #78350f; + } + + span { + font-size: 12px; + color: #92400e; + line-height: 1.5; + } + + b { + font-weight: 800; + color: #b91c1c; + } +} + +.sat__day-close-link { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 5px 12px; + border-radius: 999px; + border: 1.5px solid #fcd34d; + background: #fff; + color: #92400e; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + text-decoration: none; + flex-shrink: 0; + + mat-icon { + font-size: 14px; + height: 14px; + width: 14px; + } +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.ts index 9c48fa7ba..6098c3f50 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component.ts @@ -104,6 +104,11 @@ export class DepositRecurringDepositsAccountComponent implements OnInit { openingDenoms: any[] = []; openingTotal = 0; + + previousDayUnsettled = false; + morningTransferReceived = true; + unsettledSince = ''; + pendingAmount = 0; openingLoaded = false; get openingNotes(): any[] { @@ -148,6 +153,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit { this.loadDenominations(); this.loadContextStrip(); this.loadOpeningPosition(); + this.loadDayStatus(); } /** Load active denominations from the Denomination Master so the cash @@ -198,6 +204,21 @@ export class DepositRecurringDepositsAccountComponent implements OnInit { }); } + private loadDayStatus(): void { + this.cashierService.getCashierDayStatus().subscribe({ + next: (res: any) => { + this.previousDayUnsettled = res?.previousDayUnsettled ?? false; + this.morningTransferReceived = res?.morningTransferReceived ?? true; + this.unsettledSince = res?.unsettledSince ?? ''; + this.pendingAmount = Number(res?.pendingAmount ?? 0); + }, + error: () => { + this.previousDayUnsettled = false; + this.morningTransferReceived = true; + } + }); + } + private loadOpeningPosition(): void { const today = new Date(); const asOfDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; @@ -334,7 +355,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit { } get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> { - if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return []; + if (!this.transactionType.withdrawal || !this.openingLoaded) return []; const openMap = new Map(); for (const d of this.openingDenoms) { openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0)); diff --git a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html index 143c88ec1..d21e35c0c 100644 --- a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html +++ b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.html @@ -135,6 +135,40 @@ + + @if (previousDayUnsettled) { +
+ lock_clock +
+ Previous day not closed — {{ unsettledSince }} + + Complete Cash Settlement for {{ unsettledSince }} before processing any transactions. + All deposits and withdrawals are blocked. + Pending cash: ₹{{ pendingAmount | number: '1.2-2' }} + +
+ + arrow_forward Go to Settlement + +
+ } + + @if (!morningTransferReceived && !previousDayUnsettled) { +
+ account_balance_wallet +
+ Morning cash transfer not received + + No cash has been allocated to your drawer today. Request a morning transfer from the vault before processing + any transactions. All deposits and withdrawals are blocked. + +
+ + arrow_forward Request Transfer + +
+ } +
@@ -514,7 +548,9 @@ [disabled]=" !savingAccountTransactionForm.valid || (denominationTotal > 0 && !denominationMatchesForm) || - hasWithdrawalDenomOverdraft + hasWithdrawalDenomOverdraft || + previousDayUnsettled || + !morningTransferReceived " > diff --git a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.scss b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.scss index e6a0990b0..b441c6503 100644 --- a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.scss +++ b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.scss @@ -1216,3 +1216,86 @@ $red: #b91c1c; } } } + +// ── Previous-day settlement pending banner ── +.sat__day-close-banner { + display: flex; + align-items: flex-start; + gap: 14px; + margin: 12px 20px 0; + padding: 14px 18px; + background: #fffbeb; + border: 1.5px solid #fcd34d; + border-left: 5px solid #f59e0b; + border-radius: 10px; + + &--withdrawal { + background: #fff5f5; + border-color: #fca5a5; + border-left-color: #ef4444; + + .sat__day-close-ico { + color: #ef4444; + } + + .sat__day-close-link { + color: #b91c1c; + border-color: #fca5a5; + } + } +} + +.sat__day-close-ico { + color: #b45309; + font-size: 22px; + height: 22px; + width: 22px; + flex-shrink: 0; + margin-top: 1px; +} + +.sat__day-close-body { + flex: 1; + display: flex; + flex-direction: column; + gap: 3px; + + strong { + font-size: 13px; + font-weight: 700; + color: #78350f; + } + + span { + font-size: 12px; + color: #92400e; + line-height: 1.5; + } + + b { + font-weight: 800; + color: #b91c1c; + } +} + +.sat__day-close-link { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 5px 12px; + border-radius: 999px; + border: 1.5px solid #fcd34d; + background: #fff; + color: #92400e; + font-size: 12px; + font-weight: 700; + white-space: nowrap; + text-decoration: none; + flex-shrink: 0; + + mat-icon { + font-size: 14px; + height: 14px; + width: 14px; + } +} diff --git a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts index e1a1946d4..487ebef9c 100644 --- a/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts +++ b/src/app/savings/saving-account-actions/savings-account-transactions/savings-account-transactions.component.ts @@ -140,6 +140,15 @@ export class SavingsAccountTransactionsComponent implements OnInit { /** True once the opening-position API has responded (success or error). */ openingLoaded = false; + /** True when cashier has an unsettled previous business day. */ + previousDayUnsettled = false; + /** False when cashier has not received today's morning cash transfer. */ + morningTransferReceived = true; + /** Date string of the earliest unsettled transfer (yyyy-MM-dd). */ + unsettledSince = ''; + /** Pending cash amount from previous day. */ + pendingAmount = 0; + get openingNotes(): any[] { return this.openingDenoms.filter((d) => d.kind !== 'coin'); } @@ -171,6 +180,7 @@ export class SavingsAccountTransactionsComponent implements OnInit { this.loadDenominations(); this.loadContextStrip(); this.loadOpeningPosition(); + this.loadDayStatus(); } /** Load active denominations from the Denomination Master so the cash @@ -231,6 +241,21 @@ export class SavingsAccountTransactionsComponent implements OnInit { }); } + private loadDayStatus(): void { + this.cashierService.getCashierDayStatus().subscribe({ + next: (res: any) => { + this.previousDayUnsettled = res?.previousDayUnsettled ?? false; + this.morningTransferReceived = res?.morningTransferReceived ?? true; + this.unsettledSince = res?.unsettledSince ?? ''; + this.pendingAmount = Number(res?.pendingAmount ?? 0); + }, + error: () => { + this.previousDayUnsettled = false; + this.morningTransferReceived = true; + } + }); + } + private loadOpeningPosition(): void { const today = new Date(); const asOfDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; @@ -457,7 +482,7 @@ export class SavingsAccountTransactionsComponent implements OnInit { /** Denominations where cashier is giving more than currently available (withdrawal only). */ get withdrawalDenomOverdraft(): Array<{ label: string; available: number; requested: number }> { - if (!this.transactionType.withdrawal || !this.openingLoaded || this.openingDenoms.length === 0) return []; + if (!this.transactionType.withdrawal || !this.openingLoaded) return []; const openMap = new Map(); for (const d of this.openingDenoms) { openMap.set(`${d.kind}:${d.denominationValue}`, Number(d.count ?? 0));