Files
cbsnexora/src/app/clerk/disbursement-review/disbursement-review.component.html
T
niteshandClaude Sonnet 5 da1f57c3b6
Playwright E2E Tests / Run Playwright Tests (push) Canceled after 0s
Tests / testRigor (push) Canceled after 0s
build-run / Run Lint, Build and Deploy (push) Canceled after 0s
Publish Image in Docker Hub / build (push) Canceled after 0s
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>
2026-08-28 14:40:13 +05:30

373 lines
14 KiB
HTML

<!--
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/.
-->
<div class="dri" [class.dri--dialog]="isDialog">
<!-- ── HEADER ── -->
<nav class="cashier-nav cashier-nav--clerk">
<span class="dri-header-title">
{{
isBankTransferMode
? 'Bank Transfer Review'
: isCollectionMode
? 'Collection Review'
: isFundTransferMode
? 'Fund Transfer Review'
: 'Disbursement Review'
}}
</span>
<span class="cashier-nav__esc-hint" (click)="backToInbox()">{{ isDialog ? '✕ Close' : '← Back to Inbox' }}</span>
</nav>
<!-- ── LOADING ── -->
@if (loading) {
<div class="dri-loading">
<mat-icon class="dri-loading__icon">hourglass_empty</mat-icon>
<span>Loading request…</span>
</div>
}
<!-- ── NOT FOUND ── -->
@if (!loading && !request) {
<div class="dri-loading">
<mat-icon class="dri-loading__icon">error_outline</mat-icon>
<span>Request not found.</span>
</div>
}
<!-- ── MAIN CONTENT ── -->
@if (!loading && request) {
<div class="dri-body">
<!-- Header card -->
<div class="dri-card dri-card--header">
<div class="dri-card-header">
<div class="dri-card-header__left">
<span class="dri-voucher">{{ request.voucher_no || '—' }}</span>
<span class="dri-status" [ngClass]="statusClass(request.status)">{{ request.status }}</span>
</div>
<div class="dri-card-header__meta">
<span class="dri-meta-item">
<mat-icon>person</mat-icon>
{{ request.clerk_name }} ({{ request.clerk_username }})
</span>
<span class="dri-meta-item">
<mat-icon>schedule</mat-icon>
{{ formatDateTime(request.submitted_at) }}
</span>
@if (request.actioned_at) {
<span class="dri-meta-item">
<mat-icon>check_circle</mat-icon>
Actioned: {{ formatDateTime(request.actioned_at) }}
</span>
}
</div>
</div>
</div>
<!-- GL card — Source (disbursement) or Target (collection). Hidden for bank transfer. -->
@if (!isBankTransferMode) {
<div class="dri-card">
<div class="dri-section-title">
<mat-icon>account_balance</mat-icon>
{{ isCollectionMode ? 'GL Credit (Target)' : 'GL Debit (Source)' }}
</div>
<div class="dri-detail-grid">
<div class="dri-detail-item">
<span class="dri-detail-label">GL Account No</span>
<span class="dri-detail-value cell-mono">{{ request.gl_account_no }}</span>
</div>
<div class="dri-detail-item">
<span class="dri-detail-label">GL Account Name</span>
<span class="dri-detail-value">{{ request.gl_account_name }}</span>
</div>
<div class="dri-detail-item">
<span class="dri-detail-label">{{ isCollectionMode ? 'CR Amount' : 'DR Amount' }}</span>
<span class="dri-detail-value dri-amount">₹{{ request.dr_amount | number: '1.2-2' }}</span>
</div>
<div class="dri-detail-item">
<span class="dri-detail-label">Payment Mode</span>
<span class="dri-detail-value">{{ request.payment_type_name || 'Transfer' }}</span>
</div>
@if (request.description) {
<div class="dri-detail-item dri-detail-item--full">
<span class="dri-detail-label">Description</span>
<span class="dri-detail-value">{{ request.description }}</span>
</div>
}
</div>
</div>
}
<!-- Bank Transfer summary card (replaces GL card) -->
@if (isBankTransferMode) {
<div class="dri-card">
<div class="dri-section-title">
<mat-icon>swap_horiz</mat-icon>
Bank Transfer Summary
</div>
<div class="dri-detail-grid">
<div class="dri-detail-item">
<span class="dri-detail-label">Total Amount</span>
<span class="dri-detail-value dri-amount">₹{{ request.dr_amount | number: '1.2-2' }}</span>
</div>
<div class="dri-detail-item">
<span class="dri-detail-label">DR Accounts</span>
<span class="dri-detail-value"
>{{ drEntries.length }} account{{ drEntries.length !== 1 ? 's' : '' }}</span
>
</div>
<div class="dri-detail-item">
<span class="dri-detail-label">CR Accounts</span>
<span class="dri-detail-value"
>{{ crEntries.length }} account{{ crEntries.length !== 1 ? 's' : '' }}</span
>
</div>
@if (request.description) {
<div class="dri-detail-item dri-detail-item--full">
<span class="dri-detail-label">Description</span>
<span class="dri-detail-value">{{ request.description }}</span>
</div>
}
</div>
</div>
}
<!-- Entries table — DR savings (collection) or CR accounts (disbursement) -->
@if (!isBankTransferMode) {
<div class="dri-card">
<div class="dri-section-title">
<mat-icon>account_balance_wallet</mat-icon>
@if (isCollectionMode) {
Debit Entries ({{ drEntries.length }} account{{ drEntries.length !== 1 ? 's' : '' }} — collect from)
} @else {
Credit Entries ({{ crEntries.length }} account{{ crEntries.length !== 1 ? 's' : '' }})
}
</div>
<table class="dri-cr-table">
<thead>
<tr>
<th>#</th>
<th>Account No</th>
<th>Account Name</th>
<th>Type</th>
<th class="num">{{ isCollectionMode ? 'Amount (DR)' : 'Amount (CR)' }}</th>
</tr>
</thead>
<tbody>
@for (entry of isCollectionMode ? drEntries : crEntries; track entry.accountNo; let i = $index) {
<tr>
<td class="dri-cr-idx">{{ i + 1 }}</td>
<td class="cell-mono">{{ entry.accountNo }}</td>
<td>{{ entry.accountName }}</td>
<td>
<span class="dri-type-badge">{{ accountTypeLabel(entry.accountType) }}</span>
</td>
<td class="num dri-cr-amount">₹{{ entry.amount | number: '1.2-2' }}</td>
</tr>
}
<tr class="dri-cr-total-row">
<td colspan="4" class="dri-cr-total-label">{{ isCollectionMode ? 'Total Debit' : 'Total Credit' }}</td>
<td class="num dri-cr-total-amount">₹{{ totalCreditAmount() | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
}
<!-- Bank Transfer: DR entries table -->
@if (isBankTransferMode) {
<div class="dri-card">
<div class="dri-section-title">
<mat-icon>arrow_upward</mat-icon>
Debit Entries ({{ drEntries.length }} account{{ drEntries.length !== 1 ? 's' : '' }} — funds out)
</div>
<table class="dri-cr-table">
<thead>
<tr>
<th>#</th>
<th>Account No</th>
<th>Account Name</th>
<th>Type</th>
<th class="num">Amount (DR)</th>
</tr>
</thead>
<tbody>
@for (entry of drEntries; track entry.accountNo; let i = $index) {
<tr>
<td class="dri-cr-idx">{{ i + 1 }}</td>
<td class="cell-mono">{{ entry.accountNo }}</td>
<td>{{ entry.accountName }}</td>
<td>
<span class="dri-type-badge">{{ accountTypeLabel(entry.accountType) }}</span>
</td>
<td class="num dri-cr-amount">₹{{ entry.amount | number: '1.2-2' }}</td>
</tr>
}
<tr class="dri-cr-total-row">
<td colspan="4" class="dri-cr-total-label">Total Debit</td>
<td class="num dri-cr-total-amount">₹{{ totalDebitAmount() | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
<!-- Bank Transfer: CR entries table -->
<div class="dri-card">
<div class="dri-section-title">
<mat-icon>arrow_downward</mat-icon>
Credit Entries ({{ crEntries.length }} account{{ crEntries.length !== 1 ? 's' : '' }} — funds in)
</div>
<table class="dri-cr-table">
<thead>
<tr>
<th>#</th>
<th>Account No</th>
<th>Account Name</th>
<th>Type</th>
<th class="num">Amount (CR)</th>
</tr>
</thead>
<tbody>
@for (entry of crEntries; track entry.accountNo; let i = $index) {
<tr>
<td class="dri-cr-idx">{{ i + 1 }}</td>
<td class="cell-mono">{{ entry.accountNo }}</td>
<td>{{ entry.accountName }}</td>
<td>
<span class="dri-type-badge">{{ accountTypeLabel(entry.accountType) }}</span>
</td>
<td class="num dri-cr-amount">₹{{ entry.amount | number: '1.2-2' }}</td>
</tr>
}
<tr class="dri-cr-total-row">
<td colspan="4" class="dri-cr-total-label">Total Credit</td>
<td class="num dri-cr-total-amount">₹{{ totalCreditAmount() | number: '1.2-2' }}</td>
</tr>
</tbody>
</table>
</div>
}
<!-- Processing indicator -->
@if (request.status === 'PROCESSING') {
<div class="dri-card dri-card--processing">
<div class="dri-section-title">
<mat-icon>hourglass_top</mat-icon>
Processing
</div>
<p class="dri-processing-text">Transactions are being posted. Please refresh in a few moments.</p>
</div>
}
<!-- Rejection reason (if rejected) -->
@if (request.status === 'REJECTED' && request.rejection_reason) {
<div class="dri-card dri-card--rejected">
<div class="dri-section-title">
<mat-icon>cancel</mat-icon>
Rejection Reason
</div>
<p class="dri-rejection-text">{{ request.rejection_reason }}</p>
<div class="dri-meta-item" style="margin-top: 8px">
<mat-icon>manage_accounts</mat-icon>
{{ request.manager_name || request.manager_username || '—' }}
</div>
</div>
}
<!-- Processing failed (system error — transactions reversed) -->
@if (request.status === 'FAILED') {
<div class="dri-card dri-card--failed">
<div class="dri-section-title">
<mat-icon>error</mat-icon>
Processing Failed — Transactions Reversed
</div>
<p class="dri-rejection-text">
{{ request.error_message || 'An unexpected error occurred during approval.' }}
</p>
<p class="dri-processing-text" style="margin-top: 6px; font-size: 12px">
All partial transactions have been automatically reversed. The request can be re-submitted by the clerk.
</p>
@if (request.manager_name || request.manager_username) {
<div class="dri-meta-item" style="margin-top: 8px">
<mat-icon>manage_accounts</mat-icon>
Attempted by: {{ request.manager_name || request.manager_username }}
</div>
}
</div>
}
<!-- Txn refs (if approved) -->
@if (request.status === 'APPROVED' && request.txn_refs) {
<div class="dri-card dri-card--approved">
<div class="dri-section-title">
<mat-icon>check_circle</mat-icon>
Transaction References
</div>
<p class="dri-txn-refs cell-mono">{{ request.txn_refs }}</p>
<div class="dri-meta-item" style="margin-top: 8px">
<mat-icon>manage_accounts</mat-icon>
Approved by: {{ request.manager_name || request.manager_username || '—' }}
</div>
</div>
}
<!-- Action buttons (only for PENDING) -->
@if (request.status === 'PENDING') {
<div class="dri-actions">
@if (!showRejectForm) {
<button type="button" class="dri-btn dri-btn--approve" [disabled]="acting" (click)="approve()">
<mat-icon>check_circle</mat-icon>
{{
acting
? 'Processing…'
: isBankTransferMode
? 'Approve Bank Transfer'
: isCollectionMode
? 'Approve Collection'
: 'Approve Disbursement'
}}
</button>
<button type="button" class="dri-btn dri-btn--reject" [disabled]="acting" (click)="showRejectForm = true">
<mat-icon>cancel</mat-icon>
Reject
</button>
} @else {
<div class="dri-reject-form">
<label class="dri-reject-label">Rejection Reason</label>
<textarea
class="dri-reject-textarea"
[(ngModel)]="rejectionReason"
placeholder="State the reason for rejection…"
rows="3"
></textarea>
<div class="dri-reject-actions">
<button
type="button"
class="dri-btn dri-btn--reject"
[disabled]="acting || !rejectionReason.trim()"
(click)="reject()"
>
<mat-icon>cancel</mat-icon>
{{ acting ? 'Processing…' : 'Confirm Rejection' }}
</button>
<button
type="button"
class="dri-btn dri-btn--ghost"
[disabled]="acting"
(click)="showRejectForm = false"
>
Cancel
</button>
</div>
</div>
}
</div>
}
</div>
}
</div>