feat(cashier+checker): add cashier deposit maker-checker flow and voucher system
- Add cashier deposit service and submit flow via maker-checker - New CashierDepositService: submit, approve, reject, list endpoints - Transaction-entry: cashier SD deposit goes to deposit-requests instead of direct credit - Checker inbox: new Deposit Requests tab with approve/reject review dialog - Cashier nav: My Deposit Requests tracking page - Withdrawal requests: show voucher_no from backend instead of JS-padded id - clerk-withdrawal.service: disburse denominationData accepts null for non-cash - Role-based checker enforcement: only manager/head-cashier can approve/reject - Maker cannot approve own request (self-approval blocked at backend) - Denomination total validation: breakdown must match transaction amount Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
61cb09f352
commit
e5d6cd32dc
+297
@@ -0,0 +1,297 @@
|
||||
<!--
|
||||
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="cv-tab-content dri-tab">
|
||||
<!-- ── TITLE BAR ── -->
|
||||
<div class="dri-action-bar">
|
||||
<div class="dri-action-bar__left">
|
||||
<mat-icon class="dri-action-bar__icon">savings</mat-icon>
|
||||
<div>
|
||||
<div class="dri-action-bar__title">Deposit Requests</div>
|
||||
<div class="dri-action-bar__sub">Review, approve or reject cashier deposit requests.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── FILTER BAR ── -->
|
||||
<div class="dri-filter-bar">
|
||||
<select class="dri-filter-select" [(ngModel)]="filterStatus" (change)="onFilterChange()">
|
||||
@for (opt of statusOptions; track opt.value) {
|
||||
<option [value]="opt.value">{{ opt.label }}</option>
|
||||
}
|
||||
</select>
|
||||
|
||||
<span class="dri-fb-sep"></span>
|
||||
|
||||
<div class="dri-presets">
|
||||
@for (p of datePresets; track p.key) {
|
||||
<button
|
||||
type="button"
|
||||
class="dri-preset-chip"
|
||||
[class.dri-preset-chip--active]="activePreset === p.key"
|
||||
(click)="applyPreset(p.key)"
|
||||
>
|
||||
{{ p.label }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<span class="dri-fb-sep"></span>
|
||||
|
||||
<div class="dri-date-range">
|
||||
<div class="dri-date-box">
|
||||
<span class="dri-date-box__lbl">From</span>
|
||||
<input
|
||||
class="dri-date-box__input"
|
||||
[matDatepicker]="fromPicker"
|
||||
[(ngModel)]="fromDate"
|
||||
[max]="maxDate"
|
||||
(dateChange)="onFromDateChange()"
|
||||
readonly
|
||||
/>
|
||||
<button type="button" class="dri-date-box__btn" (click)="fromPicker.open()">
|
||||
<mat-icon>event</mat-icon>
|
||||
</button>
|
||||
<mat-datepicker #fromPicker></mat-datepicker>
|
||||
</div>
|
||||
<span class="dri-date-range__sep">—</span>
|
||||
<div class="dri-date-box">
|
||||
<span class="dri-date-box__lbl">To</span>
|
||||
<input
|
||||
class="dri-date-box__input"
|
||||
[matDatepicker]="toPicker"
|
||||
[(ngModel)]="toDate"
|
||||
[min]="fromDate"
|
||||
[max]="maxDate"
|
||||
(dateChange)="onToDateChange()"
|
||||
readonly
|
||||
/>
|
||||
<button type="button" class="dri-date-box__btn" (click)="toPicker.open()">
|
||||
<mat-icon>event</mat-icon>
|
||||
</button>
|
||||
<mat-datepicker #toPicker></mat-datepicker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="dri-btn dri-btn--refresh" (click)="load()" [disabled]="loading">
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- ── TABLE ── -->
|
||||
@if (loading) {
|
||||
<div class="empty-state">
|
||||
<p class="empty-title">Loading…</p>
|
||||
</div>
|
||||
} @else if (loaded && requests.length === 0) {
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-inbox empty-icon"></i>
|
||||
<p class="empty-title">No deposit requests</p>
|
||||
<p class="empty-text">
|
||||
@if (filterStatus === 'PENDING') {
|
||||
There are no pending deposit requests waiting for review.
|
||||
} @else {
|
||||
No {{ filterStatus | lowercase }} deposit requests found.
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="dri-table-wrap">
|
||||
<table class="dri-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="dri-th-id">Voucher No</th>
|
||||
<th>Account No</th>
|
||||
<th>Client Name</th>
|
||||
<th class="num">Amount</th>
|
||||
<th>Payment Mode</th>
|
||||
<th>Cashier</th>
|
||||
<th>Reviewed By</th>
|
||||
<th>Submitted At</th>
|
||||
<th>Status</th>
|
||||
<th class="dri-th-action">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (r of requests; track r.id) {
|
||||
<tr class="dri-row" [class.dri-row--approved]="r.status === 'APPROVED'" (click)="review(r)">
|
||||
<td class="cell-mono dri-voucher">{{ r.voucher_no || '—' }}</td>
|
||||
<td class="cell-mono">{{ r.account_no }}</td>
|
||||
<td class="dri-client">{{ r.client_name }}</td>
|
||||
<td class="num dri-amount">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||
<td>{{ r.payment_type_name || 'Cash' }}</td>
|
||||
<td>{{ r.cashier_name }}</td>
|
||||
<td>{{ r.manager_name || r.manager_username || '—' }}</td>
|
||||
<td class="dri-dt">{{ formatDateTime(r.submitted_at) }}</td>
|
||||
<td>
|
||||
<span class="dri-status" [ngClass]="statusClass(r.status)">
|
||||
{{ statusLabel(r.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="dri-action-cell" (click)="$event.stopPropagation()">
|
||||
<button type="button" class="dri-btn dri-btn--review" (click)="review(r)">
|
||||
<mat-icon>rate_review</mat-icon>
|
||||
Review
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<mat-paginator
|
||||
[length]="totalRecords"
|
||||
[pageSize]="pageSize"
|
||||
[pageSizeOptions]="pageSizeOptions"
|
||||
[pageIndex]="pageIndex"
|
||||
showFirstLastButtons
|
||||
(page)="onPageChange($event)"
|
||||
></mat-paginator>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- ── REVIEW MODAL ── -->
|
||||
@if (reviewRequest) {
|
||||
<div class="dri-modal-overlay" (click)="closeReview()">
|
||||
<div class="dri-modal" (click)="$event.stopPropagation()">
|
||||
<div class="dri-modal__header">
|
||||
<div>
|
||||
<div class="dri-modal__eyebrow">DEPOSIT REQUEST · VOUCHER {{ reviewRequest.voucher_no || '—' }}</div>
|
||||
<div class="dri-modal__title">
|
||||
₹{{ reviewRequest.amount | number: '1.2-2' }} — {{ reviewRequest.client_name }}
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="dri-modal__close" (click)="closeReview()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="dri-modal__body">
|
||||
<div class="dri-detail-grid">
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Account No</span>
|
||||
<span class="dri-detail__val cell-mono">{{ reviewRequest.account_no }}</span>
|
||||
</div>
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Account Type</span>
|
||||
<span class="dri-detail__val">{{ reviewRequest.account_type || 'SAVINGS' }}</span>
|
||||
</div>
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Payment Mode</span>
|
||||
<span class="dri-detail__val">{{ reviewRequest.payment_type_name || 'Cash' }}</span>
|
||||
</div>
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Cashier</span>
|
||||
<span class="dri-detail__val">{{ reviewRequest.cashier_name }}</span>
|
||||
</div>
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Submitted At</span>
|
||||
<span class="dri-detail__val">{{ formatDateTime(reviewRequest.submitted_at) }}</span>
|
||||
</div>
|
||||
@if (reviewRequest.cheque_no) {
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Cheque No</span>
|
||||
<span class="dri-detail__val cell-mono">{{ reviewRequest.cheque_no }}</span>
|
||||
</div>
|
||||
}
|
||||
@if (reviewRequest.bank_name) {
|
||||
<div class="dri-detail">
|
||||
<span class="dri-detail__lbl">Bank</span>
|
||||
<span class="dri-detail__val">{{ reviewRequest.bank_name }}</span>
|
||||
</div>
|
||||
}
|
||||
@if (reviewRequest.description) {
|
||||
<div class="dri-detail dri-detail--wide">
|
||||
<span class="dri-detail__lbl">Description</span>
|
||||
<span class="dri-detail__val">{{ reviewRequest.description }}</span>
|
||||
</div>
|
||||
}
|
||||
@if (reviewRequest.status === 'REJECTED' && reviewRequest.rejection_reason) {
|
||||
<div class="dri-detail dri-detail--wide">
|
||||
<span class="dri-detail__lbl">Rejection Reason</span>
|
||||
<span class="dri-detail__val dri-detail__val--reject">{{ reviewRequest.rejection_reason }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (reviewDenominations.length > 0) {
|
||||
<div class="dri-denoms">
|
||||
<div class="dri-denoms__title">Cash Denomination (received by cashier)</div>
|
||||
<table class="dri-denoms__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Denomination</th>
|
||||
<th class="num">Count</th>
|
||||
<th class="num">Subtotal</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (d of reviewDenominations; track d.label) {
|
||||
<tr>
|
||||
<td>{{ d.label }}</td>
|
||||
<td class="num">{{ d.count }}</td>
|
||||
<td class="num">₹{{ d.subtotal | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
<tr class="dri-denoms__total">
|
||||
<td>Total</td>
|
||||
<td></td>
|
||||
<td class="num">₹{{ denominationTotal | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (actionResult) {
|
||||
<div class="dri-result" [class.dri-result--error]="actionResult.type === 'error'">
|
||||
@for (line of actionResult.lines; track line) {
|
||||
<div>{{ line }}</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (showRejectInput) {
|
||||
<div class="dri-reject-box">
|
||||
<label class="dri-reject-box__lbl" for="dri-reject-reason">Rejection Reason</label>
|
||||
<textarea
|
||||
id="dri-reject-reason"
|
||||
class="dri-reject-box__input"
|
||||
rows="3"
|
||||
[(ngModel)]="rejectionReason"
|
||||
placeholder="Why is this deposit request being rejected?"
|
||||
></textarea>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="dri-modal__actions">
|
||||
@if (reviewRequest.status === 'PENDING' && !actionResult) {
|
||||
@if (showRejectInput) {
|
||||
<button type="button" class="dri-btn" [disabled]="actioning" (click)="cancelReject()">Back</button>
|
||||
<button type="button" class="dri-btn dri-btn--reject" [disabled]="actioning" (click)="confirmReject()">
|
||||
{{ actioning ? 'Rejecting…' : 'Confirm Reject' }}
|
||||
</button>
|
||||
} @else {
|
||||
<button type="button" class="dri-btn" [disabled]="actioning" (click)="closeReview()">Close</button>
|
||||
<button type="button" class="dri-btn dri-btn--reject" [disabled]="actioning" (click)="openReject()">
|
||||
<mat-icon>block</mat-icon> Reject
|
||||
</button>
|
||||
<button type="button" class="dri-btn dri-btn--approve" [disabled]="actioning" (click)="approve()">
|
||||
<mat-icon>task_alt</mat-icon>
|
||||
{{ actioning ? 'Approving…' : 'Approve & Credit' }}
|
||||
</button>
|
||||
}
|
||||
} @else {
|
||||
<button type="button" class="dri-btn" (click)="closeReview()">Close</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
+606
@@ -0,0 +1,606 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dri-tab {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dri-action-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 14px 20px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
|
||||
&__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
font-size: 28px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
color: #1e40af;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0d1b2a;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 20px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dri-fb-sep {
|
||||
width: 1px;
|
||||
height: 22px;
|
||||
background: #e2e8f0;
|
||||
flex-shrink: 0;
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
.dri-filter-select {
|
||||
height: 34px;
|
||||
min-width: 130px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 7px;
|
||||
font-size: 13px;
|
||||
color: #0d1b2a;
|
||||
font-family: inherit;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #1e40af;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-presets {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dri-preset-chip {
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #fff;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
color: #475569;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
border-color: #1e40af;
|
||||
color: #1e40af;
|
||||
background: #eff6ff;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background: #1e40af;
|
||||
border-color: #1e40af;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
background: #1e3a8a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dri-date-range {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
|
||||
&__sep {
|
||||
color: #94a3b8;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
padding: 0 2px;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-date-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 34px;
|
||||
padding: 0 6px 0 10px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
transition: border-color 0.15s;
|
||||
|
||||
&:hover {
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
border-color: #1e40af;
|
||||
}
|
||||
|
||||
&__lbl {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #94a3b8;
|
||||
white-space: nowrap;
|
||||
user-select: none;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
&__input {
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 13px;
|
||||
width: 76px;
|
||||
color: #0d1b2a;
|
||||
font-family: inherit;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
|
||||
&::placeholder {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
}
|
||||
|
||||
&__btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
color: #94a3b8;
|
||||
padding: 0;
|
||||
border-radius: 4px;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #1e40af;
|
||||
background: #eff6ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dri-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border-radius: 7px;
|
||||
font-family: inherit;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
border: 1px solid #e2e8f0;
|
||||
transition: background 0.15s;
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
font-size: 13px;
|
||||
background: #fff;
|
||||
color: #0d1b2a;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&--refresh {
|
||||
padding: 0 8px;
|
||||
color: #64748b;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
}
|
||||
|
||||
&--review {
|
||||
background: #1e40af;
|
||||
color: #fff;
|
||||
border-color: #1e40af;
|
||||
|
||||
&:hover {
|
||||
background: #1e3a8a;
|
||||
}
|
||||
}
|
||||
|
||||
&--approve {
|
||||
background: #15803d;
|
||||
color: #fff;
|
||||
border-color: #15803d;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #166534;
|
||||
}
|
||||
}
|
||||
|
||||
&--reject {
|
||||
background: #b91c1c;
|
||||
color: #fff;
|
||||
border-color: #b91c1c;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #991b1b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dri-table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.dri-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 10px 14px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
th {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: #64748b;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
background: #f8fafc;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-row {
|
||||
cursor: pointer;
|
||||
transition: background 0.1s;
|
||||
|
||||
&:hover td {
|
||||
background: #eff6ff;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-row--approved td {
|
||||
background: #f0fdf4;
|
||||
}
|
||||
|
||||
.dri-th-id {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.dri-th-action {
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dri-action-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dri-client {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.dri-amount {
|
||||
font-weight: 700;
|
||||
color: #1e40af;
|
||||
}
|
||||
|
||||
.dri-dt {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dri-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 20px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
white-space: nowrap;
|
||||
|
||||
&--pending {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
&--approved {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
&--rejected {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-mono {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.dri-voucher {
|
||||
font-weight: 700;
|
||||
color: #1e40af;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
// ── Review modal ────────────────────────────────────────────────────────────
|
||||
|
||||
.dri-modal-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgb(13 27 42 / 55%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.dri-modal {
|
||||
background: #fff;
|
||||
border-radius: 14px;
|
||||
width: min(640px, 100%);
|
||||
max-height: 90vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 24px 64px rgb(13 27 42 / 35%);
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 18px 22px;
|
||||
background: linear-gradient(135deg, #1e40af, #1e3a8a);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&__eyebrow {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
&__close {
|
||||
border: none;
|
||||
background: rgb(255 255 255 / 15%);
|
||||
color: #fff;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
mat-icon {
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 28%);
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 18px 22px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 14px 22px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
background: #f8fafc;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px 18px;
|
||||
}
|
||||
|
||||
.dri-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
&--wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
&__lbl {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: #94a3b8;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
&__val {
|
||||
font-size: 13px;
|
||||
color: #0d1b2a;
|
||||
font-weight: 500;
|
||||
|
||||
&--reject {
|
||||
color: #b91c1c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dri-denoms {
|
||||
margin-top: 16px;
|
||||
|
||||
&__title {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #475569;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
&__table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: #64748b;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.num {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
&__total td {
|
||||
font-weight: 700;
|
||||
color: #1e40af;
|
||||
border-top: 2px solid #e2e8f0;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-result {
|
||||
margin-top: 14px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 8px;
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
|
||||
&--error {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
}
|
||||
|
||||
.dri-reject-box {
|
||||
margin-top: 14px;
|
||||
|
||||
&__lbl {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #475569;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
&__input {
|
||||
width: 100%;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 8px 10px;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
resize: vertical;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #b91c1c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Empty state (re-use checker inbox styles)
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 48px 24px;
|
||||
color: #94a3b8;
|
||||
|
||||
.empty-icon {
|
||||
font-size: 40px;
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
margin: 12px 0 4px;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
+341
@@ -0,0 +1,341 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||
import { MatNativeDateModule } from '@angular/material/core';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { CashierDepositService } from '../../../cashier/cashier-deposit.service';
|
||||
import { SettingsService } from '../../../settings/settings.service';
|
||||
|
||||
interface DenomLine {
|
||||
label: string;
|
||||
kind: string;
|
||||
value: number;
|
||||
count: number;
|
||||
subtotal: number;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-deposit-requests',
|
||||
templateUrl: './deposit-requests.component.html',
|
||||
styleUrls: ['./deposit-requests.component.scss'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
MatIconModule,
|
||||
MatPaginatorModule,
|
||||
MatNativeDateModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatDatepickerModule
|
||||
]
|
||||
})
|
||||
export class DepositRequestsComponent implements OnInit {
|
||||
private service = inject(CashierDepositService);
|
||||
private settingsService = inject(SettingsService);
|
||||
|
||||
requests: any[] = [];
|
||||
totalRecords = 0;
|
||||
pageSize = 20;
|
||||
pageIndex = 0;
|
||||
pageSizeOptions = [
|
||||
10,
|
||||
20,
|
||||
50
|
||||
];
|
||||
|
||||
filterStatus = 'PENDING';
|
||||
fromDate: Date | null = null;
|
||||
toDate: Date | null = null;
|
||||
maxDate!: Date;
|
||||
activePreset: string = 'today';
|
||||
loading = false;
|
||||
loaded = false;
|
||||
|
||||
// Review modal state
|
||||
reviewRequest: any = null;
|
||||
reviewDenominations: DenomLine[] = [];
|
||||
showRejectInput = false;
|
||||
rejectionReason = '';
|
||||
actioning = false;
|
||||
actionResult: { type: 'success' | 'error'; lines: string[] } | null = null;
|
||||
|
||||
readonly datePresets = [
|
||||
{ key: 'today', label: 'Today' },
|
||||
{ key: 'week', label: 'This Week' },
|
||||
{ key: 'month', label: 'This Month' },
|
||||
{ key: 'all', label: 'All' }
|
||||
];
|
||||
|
||||
get statusOptions(): { value: string; label: string }[] {
|
||||
return [
|
||||
{ value: 'PENDING', label: 'Pending' },
|
||||
{ value: 'APPROVED', label: 'Approved' },
|
||||
{ value: 'REJECTED', label: 'Rejected' }
|
||||
];
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
const today = new Date(this.settingsService.businessDate);
|
||||
today.setHours(0, 0, 0, 0);
|
||||
this.maxDate = today;
|
||||
this.applyPreset('today');
|
||||
}
|
||||
|
||||
load(): void {
|
||||
this.loading = true;
|
||||
this.service
|
||||
.getPendingRequests(
|
||||
this.filterStatus,
|
||||
this.pageIndex * this.pageSize,
|
||||
this.pageSize,
|
||||
this.isoDate(this.fromDate),
|
||||
this.isoDate(this.toDate)
|
||||
)
|
||||
.pipe(catchError(() => of({ pageItems: [], totalFilteredRecords: 0 })))
|
||||
.subscribe((res: any) => {
|
||||
this.requests = res?.pageItems ?? [];
|
||||
this.totalRecords = Number(res?.totalFilteredRecords ?? 0);
|
||||
this.loading = false;
|
||||
this.loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
onPageChange(event: PageEvent): void {
|
||||
this.pageSize = event.pageSize;
|
||||
this.pageIndex = event.pageIndex;
|
||||
this.load();
|
||||
}
|
||||
|
||||
onFilterChange(): void {
|
||||
this.pageIndex = 0;
|
||||
this.load();
|
||||
}
|
||||
|
||||
onFromDateChange(): void {
|
||||
this.activePreset = '';
|
||||
if (this.fromDate && this.toDate && this.fromDate > this.toDate) {
|
||||
this.toDate = new Date(this.fromDate);
|
||||
}
|
||||
this.pageIndex = 0;
|
||||
this.load();
|
||||
}
|
||||
|
||||
onToDateChange(): void {
|
||||
this.activePreset = '';
|
||||
this.pageIndex = 0;
|
||||
this.load();
|
||||
}
|
||||
|
||||
applyPreset(key: string): void {
|
||||
this.activePreset = key;
|
||||
const today = new Date(this.settingsService.businessDate);
|
||||
today.setHours(0, 0, 0, 0);
|
||||
if (key === 'today') {
|
||||
this.fromDate = new Date(today);
|
||||
this.toDate = new Date(today);
|
||||
} else if (key === 'week') {
|
||||
const start = new Date(today);
|
||||
start.setDate(today.getDate() - today.getDay());
|
||||
this.fromDate = start;
|
||||
this.toDate = new Date(today);
|
||||
} else if (key === 'month') {
|
||||
this.fromDate = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
this.toDate = new Date(today);
|
||||
} else {
|
||||
this.fromDate = null;
|
||||
this.toDate = null;
|
||||
}
|
||||
this.pageIndex = 0;
|
||||
this.load();
|
||||
}
|
||||
|
||||
private isoDate(d: Date | null): string | undefined {
|
||||
if (!d) return undefined;
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(d.getDate()).padStart(2, '0');
|
||||
return `${y}-${m}-${day}`;
|
||||
}
|
||||
|
||||
// ── Review modal ──────────────────────────────────────────────────────────
|
||||
|
||||
review(req: any): void {
|
||||
this.reviewRequest = req;
|
||||
this.reviewDenominations = this.parseDenominations(req.denomination_data);
|
||||
this.showRejectInput = false;
|
||||
this.rejectionReason = '';
|
||||
this.actionResult = null;
|
||||
}
|
||||
|
||||
closeReview(): void {
|
||||
if (this.actioning) return;
|
||||
this.reviewRequest = null;
|
||||
this.reviewDenominations = [];
|
||||
this.showRejectInput = false;
|
||||
this.rejectionReason = '';
|
||||
this.actionResult = null;
|
||||
}
|
||||
|
||||
/** denomination_data format: {"note:500": 2, "coin:1": 10} */
|
||||
private parseDenominations(raw: string | null): DenomLine[] {
|
||||
if (!raw) return [];
|
||||
let map: Record<string, number>;
|
||||
try {
|
||||
map = JSON.parse(raw);
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
const lines: DenomLine[] = [];
|
||||
for (const key of Object.keys(map ?? {})) {
|
||||
const count = Number(map[key]) || 0;
|
||||
if (count <= 0) continue;
|
||||
const [
|
||||
kind,
|
||||
valStr
|
||||
] = key.split(':');
|
||||
const value = Number(valStr) || 0;
|
||||
if (!value) continue;
|
||||
lines.push({
|
||||
label: `${kind === 'coin' ? 'Coin' : 'Note'} ₹${value}`,
|
||||
kind,
|
||||
value,
|
||||
count,
|
||||
subtotal: value * count
|
||||
});
|
||||
}
|
||||
return lines.sort((a, b) => b.value - a.value || a.kind.localeCompare(b.kind));
|
||||
}
|
||||
|
||||
get denominationTotal(): number {
|
||||
return this.reviewDenominations.reduce((s, d) => s + d.subtotal, 0);
|
||||
}
|
||||
|
||||
approve(): void {
|
||||
if (!this.reviewRequest || this.actioning) return;
|
||||
this.actioning = true;
|
||||
this.service
|
||||
.approve(this.reviewRequest.id)
|
||||
.pipe(
|
||||
catchError((err: any) => {
|
||||
const msg =
|
||||
err?.error?.errors?.[0]?.defaultUserMessage ??
|
||||
err?.error?.developerMessage ??
|
||||
err?.error?.defaultUserMessage ??
|
||||
'Approval failed. Please try again.';
|
||||
this.actionResult = { type: 'error', lines: [msg] };
|
||||
this.actioning = false;
|
||||
return of(null);
|
||||
})
|
||||
)
|
||||
.subscribe((res: any) => {
|
||||
this.actioning = false;
|
||||
if (res) {
|
||||
this.reviewRequest.status = 'APPROVED';
|
||||
this.actionResult = {
|
||||
type: 'success',
|
||||
lines: [
|
||||
'Deposit approved — amount credited to the customer account.',
|
||||
res.txnId ? `Transaction Ref: ${res.txnId}` : ''
|
||||
].filter(Boolean)
|
||||
};
|
||||
this.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openReject(): void {
|
||||
this.showRejectInput = true;
|
||||
this.rejectionReason = '';
|
||||
}
|
||||
|
||||
cancelReject(): void {
|
||||
this.showRejectInput = false;
|
||||
this.rejectionReason = '';
|
||||
}
|
||||
|
||||
confirmReject(): void {
|
||||
if (!this.reviewRequest || this.actioning) return;
|
||||
if (!this.rejectionReason.trim()) {
|
||||
this.actionResult = { type: 'error', lines: ['Please enter a reason for rejecting this request.'] };
|
||||
return;
|
||||
}
|
||||
this.actioning = true;
|
||||
this.service
|
||||
.reject(this.reviewRequest.id, this.rejectionReason.trim())
|
||||
.pipe(
|
||||
catchError((err: any) => {
|
||||
const msg =
|
||||
err?.error?.errors?.[0]?.defaultUserMessage ??
|
||||
err?.error?.developerMessage ??
|
||||
err?.error?.defaultUserMessage ??
|
||||
'Rejection failed. Please try again.';
|
||||
this.actionResult = { type: 'error', lines: [msg] };
|
||||
this.actioning = false;
|
||||
return of(null);
|
||||
})
|
||||
)
|
||||
.subscribe((res: any) => {
|
||||
this.actioning = false;
|
||||
if (res) {
|
||||
this.showRejectInput = false;
|
||||
this.reviewRequest.status = 'REJECTED';
|
||||
this.reviewRequest.rejection_reason = this.rejectionReason.trim();
|
||||
this.actionResult = {
|
||||
type: 'success',
|
||||
lines: ['Deposit request rejected — sent back to the cashier.']
|
||||
};
|
||||
this.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
statusClass(status: string): string {
|
||||
const map: Record<string, string> = {
|
||||
PENDING: 'dri-status--pending',
|
||||
APPROVED: 'dri-status--approved',
|
||||
REJECTED: 'dri-status--rejected'
|
||||
};
|
||||
return map[status] ?? '';
|
||||
}
|
||||
|
||||
statusLabel(status: string): string {
|
||||
const map: Record<string, string> = {
|
||||
PENDING: 'Pending',
|
||||
APPROVED: 'Approved',
|
||||
REJECTED: 'Rejected'
|
||||
};
|
||||
return map[status] ?? status;
|
||||
}
|
||||
|
||||
formatDateTime(val: any): string {
|
||||
if (!val) return '—';
|
||||
try {
|
||||
const d = new Date(val);
|
||||
return d.toLocaleString('en-IN', {
|
||||
day: '2-digit',
|
||||
month: 'short',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
} catch {
|
||||
return String(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -105,7 +105,8 @@
|
||||
<table class="wri-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wri-th-id">#</th>
|
||||
<th class="wri-th-id">Voucher No</th>
|
||||
<th>Token No</th>
|
||||
<th>Account No</th>
|
||||
<th>Client Name</th>
|
||||
<th class="num">Amount</th>
|
||||
@@ -121,7 +122,8 @@
|
||||
<tbody>
|
||||
@for (r of requests; track r.id) {
|
||||
<tr class="wri-row" [class.wri-row--disbursed]="r.status === 'DISBURSED'" (click)="review(r)">
|
||||
<td class="cell-mono">{{ r.id }}</td>
|
||||
<td class="cell-mono wri-voucher">{{ r.voucher_no || '—' }}</td>
|
||||
<td class="cell-mono wri-token">{{ r.tok_no || '—' }}</td>
|
||||
<td class="cell-mono">{{ r.account_no }}</td>
|
||||
<td class="wri-client">{{ r.client_name }}</td>
|
||||
<td class="num wri-amount">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||
|
||||
+12
@@ -387,6 +387,18 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wri-voucher {
|
||||
font-weight: 700;
|
||||
color: #1e40af;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.wri-token {
|
||||
font-weight: 700;
|
||||
color: #0f766e;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
// Empty state (re-use checker inbox styles)
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
|
||||
@@ -118,6 +118,18 @@
|
||||
<fa-icon icon="money-bill-wave" class="ac-tab__ic"></fa-icon>
|
||||
<span>Withdrawal Requests</span>
|
||||
</a>
|
||||
<a
|
||||
mat-tab-link
|
||||
class="ac-tab"
|
||||
[routerLink]="['./deposit-requests']"
|
||||
routerLinkActive
|
||||
#depositRequests="routerLinkActive"
|
||||
[active]="depositRequests.isActive"
|
||||
*mifosxHasPermission="'ALL_FUNCTIONS_READ'"
|
||||
>
|
||||
<fa-icon icon="hand-holding-usd" class="ac-tab__ic"></fa-icon>
|
||||
<span>Deposit Requests</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<mat-tab-nav-panel #tabPanel>
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Route } from '../core/route/route.service';
|
||||
import { CheckerInboxAndTasksComponent } from './checker-inbox-and-tasks/checker-inbox-and-tasks.component';
|
||||
import { CheckerInboxComponent } from './checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component';
|
||||
import { WithdrawalRequestsComponent } from './checker-inbox-and-tasks-tabs/withdrawal-requests/withdrawal-requests.component';
|
||||
import { DepositRequestsComponent } from './checker-inbox-and-tasks-tabs/deposit-requests/deposit-requests.component';
|
||||
import { ClientApprovalComponent } from './checker-inbox-and-tasks-tabs/client-approval/client-approval.component';
|
||||
import { LoanApprovalComponent } from './checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component';
|
||||
import { LoanDisbursalComponent } from './checker-inbox-and-tasks-tabs/loan-disbursal/loan-disbursal.component';
|
||||
@@ -107,6 +108,11 @@ const routes: Routes = [
|
||||
path: 'withdrawal-requests',
|
||||
component: WithdrawalRequestsComponent,
|
||||
data: { title: 'Withdrawal Requests' }
|
||||
},
|
||||
{
|
||||
path: 'deposit-requests',
|
||||
component: DepositRequestsComponent,
|
||||
data: { title: 'Deposit Requests' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user