feat(cashier,organization): denomination-aware vault UI, Bank/Branch Profile screens, popup disbursement review
Branch Day open/close now captures a denomination-wise count (carried forward automatically to the next day), and shows an auto-fetched EOD summary at close time -- vault + every cashier's position, a branch-total reconciliation against the book figure, and each cashier's reconciliation/settlement status and transaction count -- so closing the day no longer means separately checking Vault Position and every cashier's own screen by hand. New Vault Position screen (branch-ops menu) mirrors Cashier Position for the teller/vault. Cash Transfer now shows the vault's live per-denomination availability while counting a handout, with a client-side warning before it can be over-counted. New Organization screens for Bank Profile, Branch Profile and Clearing GL Configuration, wired into the Organization landing page and the previously-dead "Bank Profile" admin menu button. Cashier Transaction Entry: TYPE is now Receipt/Payment only (cash-only TXN TP.) on the cashier side, with no change to the clerk dashboard's own Withdrawal Slip/Cheque/Disbursement/Enter Bank Transfer/DD flow beyond adding a new Fund Transfer type alongside Disbursement for a GL credit that isn't a loan payout. Neither TYPE nor TXN TP. offers a blank placeholder option anymore -- a new row starts on a real default instead. Footer no longer polls the business-date config for cashier/clerk roles, who never have permission to read it. Disbursement & Transfer Requests: "Review" now opens the review screen as a popup instead of navigating to a separate route, refreshing the list on close; the review screen recognises the new Fund Transfer request type too, and its non-functional "+ Disbursement Review" tab-styled label is now a plain heading. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>Date</mat-label>
|
||||
<input matInput type="date" [value]="transferDate" (change)="transferDate = $any($event.target).value" />
|
||||
<input matInput type="date" [value]="transferDate" (change)="onDateChange($any($event.target).value)" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" subscriptSizing="dynamic" class="pg-note-field">
|
||||
@@ -59,11 +59,28 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- What the vault actually has, before anyone starts counting a handout it can't cover. -->
|
||||
@if (fromTellerId && !loadingVault) {
|
||||
@if (vaultHasBreakdown) {
|
||||
<div class="ct-vault-banner">
|
||||
<mat-icon>account_balance</mat-icon>
|
||||
Vault available: <strong>₹{{ vaultTotalAvailable | number: '1.2-2' }}</strong>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="ct-vault-banner ct-vault-banner--warn">
|
||||
<mat-icon>warning</mat-icon>
|
||||
No denomination breakdown recorded for this vault — per-note availability can't be checked, only the total
|
||||
opening balance.
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<div class="pg-card">
|
||||
<table class="pg-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Denomination</th>
|
||||
<th class="num">Available</th>
|
||||
<th style="text-align: center">Count</th>
|
||||
<th class="num">Amount</th>
|
||||
</tr>
|
||||
@@ -71,14 +88,17 @@
|
||||
<tbody>
|
||||
@if (notes.length) {
|
||||
<tr class="pg-section">
|
||||
<td colspan="3">Bank Notes</td>
|
||||
<td colspan="4">Bank Notes</td>
|
||||
</tr>
|
||||
}
|
||||
@for (d of notes; track d.id) {
|
||||
<tr>
|
||||
<tr [class.ct-row--over]="exceedsAvailable(d)">
|
||||
<td>
|
||||
<span class="pg-chip">{{ d.label }}</span>
|
||||
</td>
|
||||
<td class="num" [class.ct-available--over]="exceedsAvailable(d)">
|
||||
{{ vaultHasBreakdown ? availableFor(d) : '—' }}
|
||||
</td>
|
||||
<td style="display: flex; justify-content: center">
|
||||
<div class="pg-step">
|
||||
<button type="button" (click)="bump(d, -1)" [disabled]="countFor(d) === 0">−</button>
|
||||
@@ -91,14 +111,17 @@
|
||||
}
|
||||
@if (coins.length) {
|
||||
<tr class="pg-section">
|
||||
<td colspan="3">Coins</td>
|
||||
<td colspan="4">Coins</td>
|
||||
</tr>
|
||||
}
|
||||
@for (d of coins; track d.id) {
|
||||
<tr>
|
||||
<tr [class.ct-row--over]="exceedsAvailable(d)">
|
||||
<td>
|
||||
<span class="pg-chip pg-chip--coin">{{ d.label }}</span>
|
||||
</td>
|
||||
<td class="num" [class.ct-available--over]="exceedsAvailable(d)">
|
||||
{{ vaultHasBreakdown ? availableFor(d) : '—' }}
|
||||
</td>
|
||||
<td style="display: flex; justify-content: center">
|
||||
<div class="pg-step">
|
||||
<button type="button" (click)="bump(d, -1)" [disabled]="countFor(d) === 0">−</button>
|
||||
@@ -111,13 +134,24 @@
|
||||
}
|
||||
@if (denoms.length === 0) {
|
||||
<tr>
|
||||
<td colspan="3" class="pg-empty">No active denominations. Add some in Cash Denomination.</td>
|
||||
<td colspan="4" class="pg-empty">No active denominations. Add some in Cash Denomination.</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@if (anyDenomExceedsAvailable) {
|
||||
<div class="ct-limit-warn">
|
||||
One or more notes/coins above are counted higher than the vault currently holds — reduce them before recording the
|
||||
transfer.
|
||||
</div>
|
||||
} @else if (exceedsVaultTotal) {
|
||||
<div class="ct-limit-warn">
|
||||
Total exceeds what the vault has available (₹{{ vaultTotalAvailable | number: '1.2-2' }}).
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="pg-total-bar">
|
||||
Total to transfer: <strong>₹{{ total | number: '1.2-2' }}</strong>
|
||||
<button type="button" class="pg-btn pg-btn--primary" [disabled]="!valid || saving" (click)="submit()">
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright since 2025 Mifos Initiative
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
.ct-vault-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 14px;
|
||||
margin-bottom: 10px;
|
||||
background: #eff6ff;
|
||||
border: 1px solid #bfdbfe;
|
||||
border-radius: 8px;
|
||||
font-size: 12px;
|
||||
color: #1e40af;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&--warn {
|
||||
background: #fffbeb;
|
||||
border-color: #fde68a;
|
||||
color: #92400e;
|
||||
}
|
||||
}
|
||||
|
||||
.ct-row--over {
|
||||
background: #fef2f2;
|
||||
}
|
||||
|
||||
.ct-available--over {
|
||||
color: #b91c1c;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.ct-limit-warn {
|
||||
margin: 8px 0;
|
||||
padding: 8px 14px;
|
||||
background: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
border-radius: 8px;
|
||||
font-size: 12px;
|
||||
color: #991b1b;
|
||||
}
|
||||
@@ -29,7 +29,10 @@ interface Denom {
|
||||
@Component({
|
||||
selector: 'mifosx-cash-transfer',
|
||||
templateUrl: './cash-transfer.component.html',
|
||||
styleUrls: ['../cashier-shared.scss'],
|
||||
styleUrls: [
|
||||
'../cashier-shared.scss',
|
||||
'./cash-transfer.component.scss'
|
||||
],
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
@@ -70,6 +73,14 @@ export class CashTransferComponent implements OnInit {
|
||||
];
|
||||
}
|
||||
|
||||
/** What the selected vault currently holds, denomination-wise — fetched so a clerk can see
|
||||
* before counting whether the vault even has enough of a given note, instead of finding out
|
||||
* only after the backend rejects the transfer. */
|
||||
vaultAvailable: Record<number, number> = {};
|
||||
vaultTotalAvailable = 0;
|
||||
vaultHasBreakdown = true;
|
||||
loadingVault = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
const d = new Date();
|
||||
this.transferDate = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
||||
@@ -101,7 +112,8 @@ export class CashTransferComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/** When a From-teller is chosen, load ONLY that teller's cashiers into the To dropdown. */
|
||||
/** When a From-teller is chosen, load ONLY that teller's cashiers into the To dropdown, and the
|
||||
* vault's own current denomination-wise stock so it can be shown against every count field. */
|
||||
onTellerSelect(tellerId: number): void {
|
||||
this.fromTellerId = tellerId;
|
||||
const teller = this.tellers.find((t) => t.id === tellerId);
|
||||
@@ -109,6 +121,7 @@ export class CashTransferComponent implements OnInit {
|
||||
this.toParty = '';
|
||||
this.toCashierId = null;
|
||||
this.cashiers = [];
|
||||
this.loadVaultAvailability();
|
||||
if (!tellerId) {
|
||||
return;
|
||||
}
|
||||
@@ -125,6 +138,45 @@ export class CashTransferComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/** Refetched whenever the vault or the transfer date changes — the vault's stock is only ever
|
||||
* meaningful as of a specific business date. */
|
||||
loadVaultAvailability(): void {
|
||||
this.vaultAvailable = {};
|
||||
this.vaultTotalAvailable = 0;
|
||||
this.vaultHasBreakdown = true;
|
||||
if (!this.fromTellerId) return;
|
||||
this.loadingVault = true;
|
||||
this.service
|
||||
.vaultPosition(this.fromTellerId, this.transferDate)
|
||||
.pipe(catchError(() => of(null)))
|
||||
.subscribe((res: any) => {
|
||||
this.loadingVault = false;
|
||||
this.vaultHasBreakdown = !!res?.hasBreakdown;
|
||||
this.vaultTotalAvailable = Number(res?.totalAmount ?? 0);
|
||||
const map: Record<number, number> = {};
|
||||
((res?.denominations || []) as any[]).forEach((d: any) => (map[d.denominationId] = d.count));
|
||||
this.vaultAvailable = map;
|
||||
});
|
||||
}
|
||||
|
||||
onDateChange(value: string): void {
|
||||
this.transferDate = value;
|
||||
this.loadVaultAvailability();
|
||||
}
|
||||
|
||||
/** How many of this denomination the vault currently holds — 0, not undefined, when the vault's
|
||||
* breakdown is known but simply doesn't list this denomination (i.e. it truly has none left). */
|
||||
availableFor(d: Denom): number {
|
||||
return this.vaultAvailable[d.id] ?? 0;
|
||||
}
|
||||
|
||||
/** Whether the count entered for this denomination is more than the vault is known to hold —
|
||||
* only flagged once the vault's breakdown has actually loaded, so an empty in-flight state
|
||||
* doesn't flash every row as over-limit. */
|
||||
exceedsAvailable(d: Denom): boolean {
|
||||
return this.vaultHasBreakdown && this.countFor(d) > this.availableFor(d);
|
||||
}
|
||||
|
||||
/** When a To-cashier is chosen, capture its id and name. */
|
||||
onCashierSelect(cashierId: number): void {
|
||||
this.toCashierId = cashierId;
|
||||
@@ -152,8 +204,24 @@ export class CashTransferComponent implements OnInit {
|
||||
return this.denoms.reduce((s, d) => s + this.subtotal(d), 0);
|
||||
}
|
||||
|
||||
/** True once any counted denomination is over what the vault holds — checked client-side purely
|
||||
* so the clerk sees it before submitting; the backend enforces this too regardless. */
|
||||
get anyDenomExceedsAvailable(): boolean {
|
||||
return this.denoms.some((d) => this.exceedsAvailable(d));
|
||||
}
|
||||
|
||||
get exceedsVaultTotal(): boolean {
|
||||
return this.vaultHasBreakdown && this.total > this.vaultTotalAvailable && this.total > 0;
|
||||
}
|
||||
|
||||
get valid(): boolean {
|
||||
return this.total > 0 && !!this.fromTellerId && !!this.toCashierId;
|
||||
return (
|
||||
this.total > 0 &&
|
||||
!!this.fromTellerId &&
|
||||
!!this.toCashierId &&
|
||||
!this.anyDenomExceedsAvailable &&
|
||||
!this.exceedsVaultTotal
|
||||
);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
|
||||
Reference in New Issue
Block a user