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
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* 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 { Injectable, inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** HTTP service for Cashier Deposit Request maker-checker workflow. */
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class CashierDepositService {
|
||||||
|
private http = inject(HttpClient);
|
||||||
|
|
||||||
|
submit(data: any): Observable<any> {
|
||||||
|
return this.http.post('/cashier/deposit-requests', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
update(id: number, data: any): Observable<any> {
|
||||||
|
return this.http.put(`/cashier/deposit-requests/${id}`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMyRequests(status?: string, offset = 0, limit = 20, fromDate?: string, toDate?: string): Observable<any> {
|
||||||
|
let params = new HttpParams().set('offset', String(offset)).set('limit', String(limit));
|
||||||
|
if (status) params = params.set('status', status);
|
||||||
|
if (fromDate) params = params.set('fromDate', fromDate);
|
||||||
|
if (toDate) params = params.set('toDate', toDate);
|
||||||
|
return this.http.get('/cashier/deposit-requests/my', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
getPendingRequests(status = 'PENDING', offset = 0, limit = 20, fromDate?: string, toDate?: string): Observable<any> {
|
||||||
|
let params = new HttpParams().set('status', status).set('offset', String(offset)).set('limit', String(limit));
|
||||||
|
if (fromDate) params = params.set('fromDate', fromDate);
|
||||||
|
if (toDate) params = params.set('toDate', toDate);
|
||||||
|
return this.http.get('/cashier/deposit-requests', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
getById(id: number): Observable<any> {
|
||||||
|
return this.http.get(`/cashier/deposit-requests/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
approve(id: number): Observable<any> {
|
||||||
|
return this.http.post(`/cashier/deposit-requests/${id}/approve`, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
reject(id: number, reason: string): Observable<any> {
|
||||||
|
return this.http.post(`/cashier/deposit-requests/${id}/reject`, { reason });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -153,6 +153,12 @@ const routes: Routes = [
|
|||||||
breadcrumb: 'Transaction Entry',
|
breadcrumb: 'Transaction Entry',
|
||||||
hideShellLayout: true
|
hideShellLayout: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'my-deposit-requests',
|
||||||
|
loadComponent: () =>
|
||||||
|
import('./my-deposit-requests/my-deposit-requests.component').then((m) => m.MyDepositRequestsComponent),
|
||||||
|
data: { title: 'My Deposit Requests', breadcrumb: 'My Deposit Requests' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class ClerkWithdrawalService {
|
|||||||
return this.http.get(`/clerk/withdrawal-requests/by-token/${encodeURIComponent(token)}`);
|
return this.http.get(`/clerk/withdrawal-requests/by-token/${encodeURIComponent(token)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
disburse(id: number, denominationData: string, transactionAmount?: number): Observable<any> {
|
disburse(id: number, denominationData: string | null, transactionAmount?: number): Observable<any> {
|
||||||
return this.http.post(`/clerk/withdrawal-requests/${id}/disburse`, {
|
return this.http.post(`/clerk/withdrawal-requests/${id}/disburse`, {
|
||||||
denominationData,
|
denominationData,
|
||||||
transactionAmount: transactionAmount != null ? String(transactionAmount) : null
|
transactionAmount: transactionAmount != null ? String(transactionAmount) : null
|
||||||
|
|||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<!--
|
||||||
|
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="pg">
|
||||||
|
<!-- ── HEADER ── -->
|
||||||
|
<header class="pg-head">
|
||||||
|
<div>
|
||||||
|
<div class="pg-eyebrow">CASHIER · DEPOSIT REQUESTS</div>
|
||||||
|
<h1 class="pg-title">My Deposit Requests</h1>
|
||||||
|
<p class="pg-sub">Track the status of your submitted deposit requests awaiting manager approval.</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="pg-btn pg-btn--primary" (click)="newDeposit()">
|
||||||
|
<mat-icon>add</mat-icon> New Deposit
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- ── FILTER ROW ── -->
|
||||||
|
<div class="pg-filter-row">
|
||||||
|
<select class="mdr-select" [(ngModel)]="filterStatus" (change)="onFilterChange()">
|
||||||
|
@for (opt of statusOptions; track opt.value) {
|
||||||
|
<option [value]="opt.value">{{ opt.label }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<span class="pg-fb-sep"></span>
|
||||||
|
|
||||||
|
<div class="pg-presets">
|
||||||
|
@for (p of datePresets; track p.key) {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pg-preset-chip"
|
||||||
|
[class.pg-preset-chip--active]="activePreset === p.key"
|
||||||
|
(click)="applyPreset(p.key)"
|
||||||
|
>
|
||||||
|
{{ p.label }}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span class="pg-fb-sep"></span>
|
||||||
|
|
||||||
|
<div class="pg-date-range">
|
||||||
|
<div class="pg-date-box">
|
||||||
|
<span class="pg-date-box__lbl">From</span>
|
||||||
|
<input
|
||||||
|
class="pg-date-box__input"
|
||||||
|
[matDatepicker]="fromPicker"
|
||||||
|
[(ngModel)]="fromDate"
|
||||||
|
[max]="maxDate"
|
||||||
|
(dateChange)="onFromDateChange()"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<button type="button" class="pg-date-box__btn" (click)="fromPicker.open()">
|
||||||
|
<mat-icon>event</mat-icon>
|
||||||
|
</button>
|
||||||
|
<mat-datepicker #fromPicker></mat-datepicker>
|
||||||
|
</div>
|
||||||
|
<span class="pg-date-range__sep">—</span>
|
||||||
|
<div class="pg-date-box">
|
||||||
|
<span class="pg-date-box__lbl">To</span>
|
||||||
|
<input
|
||||||
|
class="pg-date-box__input"
|
||||||
|
[matDatepicker]="toPicker"
|
||||||
|
[(ngModel)]="toDate"
|
||||||
|
[min]="fromDate"
|
||||||
|
[max]="maxDate"
|
||||||
|
(dateChange)="onToDateChange()"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<button type="button" class="pg-date-box__btn" (click)="toPicker.open()">
|
||||||
|
<mat-icon>event</mat-icon>
|
||||||
|
</button>
|
||||||
|
<mat-datepicker #toPicker></mat-datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="mdr-btn-refresh" (click)="load()" [disabled]="loading">
|
||||||
|
<mat-icon>refresh</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ── TABLE CARD ── -->
|
||||||
|
<div class="pg-card">
|
||||||
|
@if (loading) {
|
||||||
|
<div class="pg-empty">Loading requests…</div>
|
||||||
|
} @else if (loaded && requests.length === 0) {
|
||||||
|
<div class="pg-empty">
|
||||||
|
<mat-icon style="font-size: 36px; color: #cbd5e1; display: block; text-align: center">inbox</mat-icon>
|
||||||
|
<p style="margin-top: 8px; color: #94a3b8">No deposit requests found.</p>
|
||||||
|
<button type="button" class="pg-btn pg-btn--primary" (click)="newDeposit()" style="margin-top: 12px">
|
||||||
|
<mat-icon>add</mat-icon> New Deposit
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<table class="pg-table mdr-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Voucher No</th>
|
||||||
|
<th>Account</th>
|
||||||
|
<th>Client</th>
|
||||||
|
<th class="num">Amount</th>
|
||||||
|
<th>Payment Mode</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Submitted</th>
|
||||||
|
<th>Reviewed By</th>
|
||||||
|
<th>Rejection Reason</th>
|
||||||
|
<th class="mdr-th-action">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (r of requests; track r.id) {
|
||||||
|
<tr
|
||||||
|
class="mdr-row"
|
||||||
|
[class.mdr-row--pending]="r.status === 'PENDING'"
|
||||||
|
[class.mdr-row--approved]="r.status === 'APPROVED'"
|
||||||
|
[class.mdr-row--rejected]="r.status === 'REJECTED'"
|
||||||
|
>
|
||||||
|
<td class="cell-mono mdr-voucher">{{ r.voucher_no || '—' }}</td>
|
||||||
|
<td class="cell-mono">{{ r.account_no }}</td>
|
||||||
|
<td>{{ r.client_name }}</td>
|
||||||
|
<td class="num">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||||
|
<td>{{ r.payment_type_name || 'Cash' }}</td>
|
||||||
|
<td>
|
||||||
|
<span class="mdr-status" [ngClass]="statusClass(r.status)">
|
||||||
|
{{ statusLabel(r.status) }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>{{ formatDateTime(r.submitted_at) }}</td>
|
||||||
|
<td>{{ r.manager_name || r.manager_username || '—' }}</td>
|
||||||
|
<td class="mdr-rejection">
|
||||||
|
@if (r.status === 'REJECTED' && r.rejection_reason) {
|
||||||
|
<span class="mdr-rejection-text" [title]="r.rejection_reason">
|
||||||
|
{{ r.rejection_reason | slice: 0 : 60 }}{{ r.rejection_reason?.length > 60 ? '…' : '' }}
|
||||||
|
</span>
|
||||||
|
} @else {
|
||||||
|
<span class="mdr-none">—</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="mdr-actions-cell">
|
||||||
|
<button type="button" class="pg-btn mdr-btn-view" (click)="view(r)">
|
||||||
|
<mat-icon>visibility</mat-icon> View
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator
|
||||||
|
[length]="totalRecords"
|
||||||
|
[pageSize]="pageSize"
|
||||||
|
[pageSizeOptions]="pageSizeOptions"
|
||||||
|
[pageIndex]="pageIndex"
|
||||||
|
showFirstLastButtons
|
||||||
|
(page)="onPageChange($event)"
|
||||||
|
></mat-paginator>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ── VIEW MODAL ── -->
|
||||||
|
@if (viewRequest) {
|
||||||
|
<div class="mdr-modal-overlay" (click)="closeView()">
|
||||||
|
<div class="mdr-modal" (click)="$event.stopPropagation()">
|
||||||
|
<div class="mdr-modal__header">
|
||||||
|
<div>
|
||||||
|
<div class="mdr-modal__eyebrow">DEPOSIT REQUEST · VOUCHER {{ viewRequest.voucher_no || '—' }}</div>
|
||||||
|
<div class="mdr-modal__title">
|
||||||
|
₹{{ viewRequest.amount | number: '1.2-2' }} — {{ viewRequest.client_name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="mdr-modal__close" (click)="closeView()">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="mdr-modal__body">
|
||||||
|
<div class="mdr-detail-grid">
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Account No</span>
|
||||||
|
<span class="mdr-detail__val cell-mono">{{ viewRequest.account_no }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Payment Mode</span>
|
||||||
|
<span class="mdr-detail__val">{{ viewRequest.payment_type_name || 'Cash' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Status</span>
|
||||||
|
<span class="mdr-detail__val">
|
||||||
|
<span class="mdr-status" [ngClass]="statusClass(viewRequest.status)">
|
||||||
|
{{ statusLabel(viewRequest.status) }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Submitted</span>
|
||||||
|
<span class="mdr-detail__val">{{ formatDateTime(viewRequest.submitted_at) }}</span>
|
||||||
|
</div>
|
||||||
|
@if (viewRequest.manager_name || viewRequest.manager_username) {
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Reviewed By</span>
|
||||||
|
<span class="mdr-detail__val">{{ viewRequest.manager_name || viewRequest.manager_username }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (viewRequest.actioned_at) {
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Actioned At</span>
|
||||||
|
<span class="mdr-detail__val">{{ formatDateTime(viewRequest.actioned_at) }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (viewRequest.txn_id) {
|
||||||
|
<div class="mdr-detail">
|
||||||
|
<span class="mdr-detail__lbl">Transaction Ref</span>
|
||||||
|
<span class="mdr-detail__val cell-mono">{{ viewRequest.txn_id }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (viewRequest.description) {
|
||||||
|
<div class="mdr-detail mdr-detail--wide">
|
||||||
|
<span class="mdr-detail__lbl">Description</span>
|
||||||
|
<span class="mdr-detail__val">{{ viewRequest.description }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (viewRequest.status === 'REJECTED' && viewRequest.rejection_reason) {
|
||||||
|
<div class="mdr-detail mdr-detail--wide">
|
||||||
|
<span class="mdr-detail__lbl">Rejection Reason</span>
|
||||||
|
<span class="mdr-detail__val mdr-detail__val--reject">{{ viewRequest.rejection_reason }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
@if (viewRequest.status === 'REJECTED') {
|
||||||
|
<div class="mdr-hint">This request was rejected. Enter a fresh deposit at Transaction Entry to resubmit.</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="mdr-modal__actions">
|
||||||
|
<button type="button" class="pg-btn" (click)="closeView()">Close</button>
|
||||||
|
@if (viewRequest.status === 'REJECTED') {
|
||||||
|
<button type="button" class="pg-btn pg-btn--primary" (click)="newDeposit()">
|
||||||
|
<mat-icon>add</mat-icon> New Deposit
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@@ -0,0 +1,416 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-table {
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-row {
|
||||||
|
cursor: default;
|
||||||
|
transition: background 0.1s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--rejected td {
|
||||||
|
background: #fff5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--approved td {
|
||||||
|
background: #f0fdf4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-voucher {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1e40af;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-status {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 3px 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-rejection {
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-rejection-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #991b1b;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-none {
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-actions-cell {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-btn-view {
|
||||||
|
font-size: 12px;
|
||||||
|
height: 30px;
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-th-action {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-btn-refresh {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #64748b;
|
||||||
|
font-family: inherit;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover:not(:disabled) {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: #0d1b2a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-select {
|
||||||
|
height: 32px;
|
||||||
|
min-width: 120px;
|
||||||
|
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: #1353a0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-filter-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-fb-sep {
|
||||||
|
width: 1px;
|
||||||
|
height: 22px;
|
||||||
|
background: #e2e8f0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-presets {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 4px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-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: #1353a0;
|
||||||
|
color: #1353a0;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background: #1353a0;
|
||||||
|
border-color: #1353a0;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #0f4080;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pg-date-box {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
height: 32px;
|
||||||
|
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: #1353a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__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: 72px;
|
||||||
|
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: #1353a0;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── View modal ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
.mdr-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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-modal {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 14px;
|
||||||
|
width: min(560px, 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-detail-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 10px 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdr-hint {
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #92400e;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-mono {
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
/**
|
||||||
|
* 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 { Router } from '@angular/router';
|
||||||
|
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-deposit.service';
|
||||||
|
import { SettingsService } from '../../settings/settings.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-my-deposit-requests',
|
||||||
|
templateUrl: './my-deposit-requests.component.html',
|
||||||
|
styleUrls: [
|
||||||
|
'../cashier-shared.scss',
|
||||||
|
'./my-deposit-requests.component.scss'
|
||||||
|
],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatNativeDateModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatDatepickerModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class MyDepositRequestsComponent implements OnInit {
|
||||||
|
private service = inject(CashierDepositService);
|
||||||
|
private router = inject(Router);
|
||||||
|
private settingsService = inject(SettingsService);
|
||||||
|
|
||||||
|
requests: any[] = [];
|
||||||
|
totalRecords = 0;
|
||||||
|
pageSize = 20;
|
||||||
|
pageIndex = 0;
|
||||||
|
pageSizeOptions = [
|
||||||
|
10,
|
||||||
|
20,
|
||||||
|
50
|
||||||
|
];
|
||||||
|
|
||||||
|
filterStatus = '';
|
||||||
|
fromDate: Date | null = null;
|
||||||
|
toDate: Date | null = null;
|
||||||
|
maxDate!: Date;
|
||||||
|
activePreset: string = 'today';
|
||||||
|
loading = false;
|
||||||
|
loaded = false;
|
||||||
|
|
||||||
|
viewRequest: any = null;
|
||||||
|
|
||||||
|
readonly datePresets = [
|
||||||
|
{ key: 'today', label: 'Today' },
|
||||||
|
{ key: 'week', label: 'This Week' },
|
||||||
|
{ key: 'month', label: 'This Month' },
|
||||||
|
{ key: 'all', label: 'All' }
|
||||||
|
];
|
||||||
|
|
||||||
|
readonly statusOptions = [
|
||||||
|
{ value: '', label: 'All Statuses' },
|
||||||
|
{ 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
|
||||||
|
.getMyRequests(
|
||||||
|
this.filterStatus || undefined,
|
||||||
|
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}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
newDeposit(): void {
|
||||||
|
this.router.navigate(['/cashier/transaction-entry']);
|
||||||
|
}
|
||||||
|
|
||||||
|
view(req: any): void {
|
||||||
|
this.viewRequest = req;
|
||||||
|
}
|
||||||
|
|
||||||
|
closeView(): void {
|
||||||
|
this.viewRequest = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
statusClass(status: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
PENDING: 'mdr-status--pending',
|
||||||
|
APPROVED: 'mdr-status--approved',
|
||||||
|
REJECTED: 'mdr-status--rejected'
|
||||||
|
};
|
||||||
|
return map[status] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
statusLabel(status: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
PENDING: 'Pending Approval',
|
||||||
|
APPROVED: 'Approved & Credited',
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1415,9 +1415,9 @@
|
|||||||
class="te-confirm-header"
|
class="te-confirm-header"
|
||||||
[class.te-confirm-header--deposit]="confirmData.type === 'DEPOSIT'"
|
[class.te-confirm-header--deposit]="confirmData.type === 'DEPOSIT'"
|
||||||
[class.te-confirm-header--withdrawal]="confirmData.type === 'WITHDRAWAL'"
|
[class.te-confirm-header--withdrawal]="confirmData.type === 'WITHDRAWAL'"
|
||||||
[class.te-confirm-header--disbursement]="confirmData.isDisbursement"
|
[class.te-confirm-header--disbursement]="confirmData.isDisbursement || confirmData.isDepositRequest"
|
||||||
>
|
>
|
||||||
<span class="te-confirm-icon">{{ confirmData.type === 'DEPOSIT' ? '⬇' : '⬆' }}</span>
|
<span class="te-confirm-icon">{{ confirmData.type === 'WITHDRAWAL' ? '⬆' : '⬇' }}</span>
|
||||||
<span>Confirm {{ confirmData.isDisbursement ? 'CASH DISBURSEMENT' : confirmData.type }}</span>
|
<span>Confirm {{ confirmData.isDisbursement ? 'CASH DISBURSEMENT' : confirmData.type }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="te-confirm-body">
|
<div class="te-confirm-body">
|
||||||
@@ -1465,6 +1465,25 @@
|
|||||||
>Balance already deducted at manager approval — no further deduction</span
|
>Balance already deducted at manager approval — no further deduction</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
} @else if (confirmData.isDepositRequest) {
|
||||||
|
<!-- Maker-checker deposit: balance credits only after manager approval -->
|
||||||
|
<div class="te-confirm-row">
|
||||||
|
<span class="te-confirm-label">Current Balance</span>
|
||||||
|
<span class="te-confirm-val"
|
||||||
|
>{{ confirmData.symbol }}{{ confirmData.currentBalance | number: '1.2-2' }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="te-confirm-row te-confirm-row--amount">
|
||||||
|
<span class="te-confirm-label">Deposit Amount</span>
|
||||||
|
<span class="te-confirm-val te-cr"
|
||||||
|
>+{{ confirmData.symbol }}{{ confirmData.amount | number: '1.2-2' }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="te-confirm-row te-confirm-disbursed-note">
|
||||||
|
<span class="te-confirm-disbursed-badge"
|
||||||
|
>Sent for manager approval — balance will be credited only after approval</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<div class="te-confirm-row">
|
<div class="te-confirm-row">
|
||||||
<span class="te-confirm-label">Current Balance</span
|
<span class="te-confirm-label">Current Balance</span
|
||||||
@@ -1499,7 +1518,13 @@
|
|||||||
<button class="te-btn" type="button" (click)="showConfirmDialog = false">Cancel</button>
|
<button class="te-btn" type="button" (click)="showConfirmDialog = false">Cancel</button>
|
||||||
<button class="te-btn te-btn--primary" type="button" [disabled]="saving" (click)="confirmSubmit()">
|
<button class="te-btn te-btn--primary" type="button" [disabled]="saving" (click)="confirmSubmit()">
|
||||||
{{
|
{{
|
||||||
saving ? 'Posting…' : confirmData.isDisbursement ? 'Confirm DISBURSEMENT' : 'Confirm ' + confirmData.type
|
saving
|
||||||
|
? 'Posting…'
|
||||||
|
: confirmData.isDisbursement
|
||||||
|
? 'Confirm DISBURSEMENT'
|
||||||
|
: confirmData.isDepositRequest
|
||||||
|
? 'Submit for Approval'
|
||||||
|
: 'Confirm ' + confirmData.type
|
||||||
}}
|
}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { CashierService } from '../cashier.service';
|
|||||||
import { AuthenticationService } from '../../core/authentication/authentication.service';
|
import { AuthenticationService } from '../../core/authentication/authentication.service';
|
||||||
import { ClerkUiStateService, ClerkSavedAccount } from '../clerk-ui-state.service';
|
import { ClerkUiStateService, ClerkSavedAccount } from '../clerk-ui-state.service';
|
||||||
import { ClerkWithdrawalService } from '../clerk-withdrawal.service';
|
import { ClerkWithdrawalService } from '../clerk-withdrawal.service';
|
||||||
|
import { CashierDepositService } from '../cashier-deposit.service';
|
||||||
import { SettingsService } from '../../settings/settings.service';
|
import { SettingsService } from '../../settings/settings.service';
|
||||||
|
|
||||||
interface TxnRow {
|
interface TxnRow {
|
||||||
@@ -653,6 +654,7 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
private dialog = inject(MatDialog);
|
private dialog = inject(MatDialog);
|
||||||
private clerkUiState = inject(ClerkUiStateService);
|
private clerkUiState = inject(ClerkUiStateService);
|
||||||
private clerkWithdrawalService = inject(ClerkWithdrawalService);
|
private clerkWithdrawalService = inject(ClerkWithdrawalService);
|
||||||
|
private cashierDepositService = inject(CashierDepositService);
|
||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
|
|
||||||
@@ -2277,15 +2279,25 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
private openConfirmDialog(row: TxnRow, amount: number, isDeposit: boolean, selectedPt: any): void {
|
private openConfirmDialog(row: TxnRow, amount: number, isDeposit: boolean, selectedPt: any): void {
|
||||||
// Token-based cashier disbursement: balance was already deducted at manager approval
|
// Token-based cashier disbursement: balance was already deducted at manager approval
|
||||||
const isDisbursement = !isDeposit && !this.isClerk && !!this.activeWithdrawalRequest;
|
const isDisbursement = !isDeposit && !this.isClerk && !!this.activeWithdrawalRequest;
|
||||||
const balanceAfterTxn = isDisbursement
|
// Cashier savings deposit goes via maker-checker: balance credits only after manager approval
|
||||||
? this.currentBalance // no further deduction — just handing cash
|
const isDepositRequest = isDeposit && !this.isClerk && row.acTyp === 'SD';
|
||||||
: isDeposit
|
const balanceAfterTxn =
|
||||||
? this.currentBalance + amount
|
isDisbursement || isDepositRequest
|
||||||
: this.currentBalance - amount;
|
? this.currentBalance // no immediate balance change
|
||||||
|
: isDeposit
|
||||||
|
? this.currentBalance + amount
|
||||||
|
: this.currentBalance - amount;
|
||||||
|
|
||||||
this.confirmData = {
|
this.confirmData = {
|
||||||
type: isDisbursement ? 'DISBURSEMENT' : isDeposit ? 'DEPOSIT' : 'WITHDRAWAL',
|
type: isDisbursement
|
||||||
|
? 'DISBURSEMENT'
|
||||||
|
: isDepositRequest
|
||||||
|
? 'DEPOSIT REQUEST'
|
||||||
|
: isDeposit
|
||||||
|
? 'DEPOSIT'
|
||||||
|
: 'WITHDRAWAL',
|
||||||
isDisbursement,
|
isDisbursement,
|
||||||
|
isDepositRequest,
|
||||||
accountNo: this.accountDetails.glCode ?? this.accountDetails.accountNo,
|
accountNo: this.accountDetails.glCode ?? this.accountDetails.accountNo,
|
||||||
clientName: this.clientName,
|
clientName: this.clientName,
|
||||||
amount,
|
amount,
|
||||||
@@ -2320,6 +2332,13 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cashier savings deposit → route through maker-checker (create PENDING request, no direct credit)
|
||||||
|
// Use the dialog-confirmed amount — for cash that is the denomination total
|
||||||
|
if (!this.isClerk && !this.reviewMode && isDeposit && row.acTyp === 'SD') {
|
||||||
|
this.submitCashierDepositRequest(row, this.confirmData?.amount ?? amount);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Hard block: cashier direct withdrawal never reaches here — caught in onSave()
|
// Hard block: cashier direct withdrawal never reaches here — caught in onSave()
|
||||||
// Extra safety net in case confirmSubmit() is ever called directly
|
// Extra safety net in case confirmSubmit() is ever called directly
|
||||||
if (!this.isClerk && !this.reviewMode && !isDeposit && !this.activeWithdrawalRequest) {
|
if (!this.isClerk && !this.reviewMode && !isDeposit && !this.activeWithdrawalRequest) {
|
||||||
@@ -2334,7 +2353,11 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
// Do NOT post another savings transaction — just record disbursement
|
// Do NOT post another savings transaction — just record disbursement
|
||||||
if (!this.isClerk && this.activeWithdrawalRequest && !isDeposit) {
|
if (!this.isClerk && this.activeWithdrawalRequest && !isDeposit) {
|
||||||
this.saving = true;
|
this.saving = true;
|
||||||
const denomJson = JSON.stringify(this.denominationCounts);
|
// Send denominations only for cash payments — stale counts on a cheque
|
||||||
|
// disbursement would fail the backend denomination-total check
|
||||||
|
const selectedPtDisb = this.paymentTypes.find((p: any) => p.id === row.paymentTypeId);
|
||||||
|
const denomJson =
|
||||||
|
selectedPtDisb?.isCashPayment && this.denominationTotal > 0 ? JSON.stringify(this.denominationCounts) : null;
|
||||||
const req = this.activeWithdrawalRequest;
|
const req = this.activeWithdrawalRequest;
|
||||||
this.clerkWithdrawalService
|
this.clerkWithdrawalService
|
||||||
.disburse(req.id, denomJson, amount)
|
.disburse(req.id, denomJson, amount)
|
||||||
@@ -2352,9 +2375,11 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe((res: any) => {
|
.subscribe((res: any) => {
|
||||||
this.saving = false;
|
this.saving = false;
|
||||||
if (res) {
|
if (res) {
|
||||||
|
const disbVoucher = res.voucherNo || req.voucher_no || '—';
|
||||||
this.showAlert('success', 'Cash Disbursed Successfully', [
|
this.showAlert('success', 'Cash Disbursed Successfully', [
|
||||||
`₹${amount.toLocaleString('en-IN', { minimumFractionDigits: 2 })} disbursed to customer.`,
|
`₹${amount.toLocaleString('en-IN', { minimumFractionDigits: 2 })} disbursed to customer.`,
|
||||||
`Token No: ${req.tok_no} · Client: ${req.client_name}`
|
`Token No: ${req.tok_no} · Client: ${req.client_name}`,
|
||||||
|
`Voucher No: ${disbVoucher}`
|
||||||
]);
|
]);
|
||||||
this.activeWithdrawalRequest = null;
|
this.activeWithdrawalRequest = null;
|
||||||
this.clearDenominations();
|
this.clearDenominations();
|
||||||
@@ -2646,18 +2671,78 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe((res: any) => {
|
.subscribe((res: any) => {
|
||||||
this.saving = false;
|
this.saving = false;
|
||||||
if (res) {
|
if (res) {
|
||||||
const ref = res.resourceId ?? res.requestId ?? res.id ?? 'N/A';
|
|
||||||
const tok = row.tokNo?.trim() ?? '—';
|
const tok = row.tokNo?.trim() ?? '—';
|
||||||
|
const voucherNo = res.voucherNo ?? '—';
|
||||||
this.showAlert('success', 'Withdrawal Request Submitted', [
|
this.showAlert('success', 'Withdrawal Request Submitted', [
|
||||||
`Withdrawal of ₹${amount.toLocaleString('en-IN', { minimumFractionDigits: 2 })} sent for manager approval.`,
|
`Withdrawal of ₹${amount.toLocaleString('en-IN', { minimumFractionDigits: 2 })} sent for manager approval.`,
|
||||||
'Balance will be deducted only after approval.',
|
'Balance will be deducted only after approval.',
|
||||||
`Token No: ${tok} · Request No: ${ref}`
|
`Token No: ${tok} · Voucher No: ${voucherNo}`
|
||||||
]);
|
]);
|
||||||
this.onCancel();
|
this.onCancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Build the deposit-request payload from the current row + loaded account. */
|
||||||
|
private buildDepositPayload(row: TxnRow, amount: number): any {
|
||||||
|
const today = new Date();
|
||||||
|
const txnDateIso = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`;
|
||||||
|
const selectedPt = this.paymentTypes.find((p: any) => p.id === row.paymentTypeId);
|
||||||
|
// Send denominations only for cash payments — stale counts on a cheque
|
||||||
|
// deposit would fail the backend denomination-total check
|
||||||
|
const isCash = !!selectedPt?.isCashPayment;
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountNo: this.accountDetails.accountNo,
|
||||||
|
accountType: 'SAVINGS',
|
||||||
|
savingsAccountId: this.accountDetails.id,
|
||||||
|
clientId: this.accountDetails.clientId ?? this.clientDetails?.id ?? null,
|
||||||
|
clientName: this.clientDetails?.displayName ?? this.accountDetails?.clientName ?? null,
|
||||||
|
amount,
|
||||||
|
txnDate: txnDateIso,
|
||||||
|
paymentTypeId: row.paymentTypeId || null,
|
||||||
|
paymentTypeName: selectedPt?.name ?? 'Cash',
|
||||||
|
description: row.description || null,
|
||||||
|
chequeNo: row.chequeNo || null,
|
||||||
|
bankName: row.bankName || null,
|
||||||
|
denominationData: isCash && this.denominationTotal > 0 ? JSON.stringify(this.denominationCounts) : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Cashier maker-checker: create a PENDING deposit request instead of crediting balance directly. */
|
||||||
|
private submitCashierDepositRequest(row: TxnRow, amount: number): void {
|
||||||
|
const payload = this.buildDepositPayload(row, amount);
|
||||||
|
|
||||||
|
this.saving = true;
|
||||||
|
this.cashierDepositService
|
||||||
|
.submit(payload)
|
||||||
|
.pipe(
|
||||||
|
catchError((err: any) => {
|
||||||
|
const msg =
|
||||||
|
err?.error?.errors?.[0]?.defaultUserMessage ??
|
||||||
|
err?.error?.developerMessage ??
|
||||||
|
err?.error?.defaultUserMessage ??
|
||||||
|
'Failed to submit deposit request. Please try again.';
|
||||||
|
this.showAlert('error', 'Deposit Request Failed', [msg]);
|
||||||
|
this.saving = false;
|
||||||
|
return of(null);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe((res: any) => {
|
||||||
|
this.saving = false;
|
||||||
|
if (res) {
|
||||||
|
const voucherNo = res.voucherNo ?? '—';
|
||||||
|
this.showAlert('success', 'Deposit Request Submitted', [
|
||||||
|
`Deposit of ₹${amount.toLocaleString('en-IN', { minimumFractionDigits: 2 })} sent for manager approval.`,
|
||||||
|
'Balance will be credited only after approval.',
|
||||||
|
`Voucher No: ${voucherNo}`
|
||||||
|
]);
|
||||||
|
this.clearDenominations();
|
||||||
|
this.onCancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onCancel(): void {
|
onCancel(): void {
|
||||||
this.clerkUiState.clear();
|
this.clerkUiState.clear();
|
||||||
this.accountDetails = null;
|
this.accountDetails = null;
|
||||||
|
|||||||
@@ -100,7 +100,8 @@
|
|||||||
<table class="pg-table myr-table">
|
<table class="pg-table myr-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>Voucher No</th>
|
||||||
|
<th>Token No</th>
|
||||||
<th>Account</th>
|
<th>Account</th>
|
||||||
<th>Client</th>
|
<th>Client</th>
|
||||||
<th class="num">Amount</th>
|
<th class="num">Amount</th>
|
||||||
@@ -121,7 +122,8 @@
|
|||||||
[class.myr-row--rejected]="r.status === 'REJECTED'"
|
[class.myr-row--rejected]="r.status === 'REJECTED'"
|
||||||
[class.myr-row--disbursed]="r.status === 'DISBURSED'"
|
[class.myr-row--disbursed]="r.status === 'DISBURSED'"
|
||||||
>
|
>
|
||||||
<td class="cell-mono">{{ r.id }}</td>
|
<td class="cell-mono myr-voucher">{{ r.voucher_no || '—' }}</td>
|
||||||
|
<td class="cell-mono myr-token">{{ r.tok_no || '—' }}</td>
|
||||||
<td class="cell-mono">{{ r.account_no }}</td>
|
<td class="cell-mono">{{ r.account_no }}</td>
|
||||||
<td>{{ r.client_name }}</td>
|
<td>{{ r.client_name }}</td>
|
||||||
<td class="num">₹{{ r.amount | number: '1.2-2' }}</td>
|
<td class="num">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||||
|
|||||||
@@ -34,6 +34,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.myr-voucher {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1e40af;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myr-token {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0f766e;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.myr-status {
|
.myr-status {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -144,6 +144,13 @@
|
|||||||
>
|
>
|
||||||
<fa-icon icon="keyboard"></fa-icon> Transaction Entry
|
<fa-icon icon="keyboard"></fa-icon> Transaction Entry
|
||||||
</a>
|
</a>
|
||||||
|
<a
|
||||||
|
class="cashier-nav__item"
|
||||||
|
[routerLink]="['/cashier/my-deposit-requests']"
|
||||||
|
routerLinkActive="cashier-nav__item--active"
|
||||||
|
>
|
||||||
|
<fa-icon icon="money-bill-wave"></fa-icon> My Deposits
|
||||||
|
</a>
|
||||||
<a
|
<a
|
||||||
class="cashier-nav__item"
|
class="cashier-nav__item"
|
||||||
[routerLink]="['/cashier/share-collection']"
|
[routerLink]="['/cashier/share-collection']"
|
||||||
|
|||||||
+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">
|
<table class="wri-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="wri-th-id">#</th>
|
<th class="wri-th-id">Voucher No</th>
|
||||||
|
<th>Token No</th>
|
||||||
<th>Account No</th>
|
<th>Account No</th>
|
||||||
<th>Client Name</th>
|
<th>Client Name</th>
|
||||||
<th class="num">Amount</th>
|
<th class="num">Amount</th>
|
||||||
@@ -121,7 +122,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@for (r of requests; track r.id) {
|
@for (r of requests; track r.id) {
|
||||||
<tr class="wri-row" [class.wri-row--disbursed]="r.status === 'DISBURSED'" (click)="review(r)">
|
<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="cell-mono">{{ r.account_no }}</td>
|
||||||
<td class="wri-client">{{ r.client_name }}</td>
|
<td class="wri-client">{{ r.client_name }}</td>
|
||||||
<td class="num wri-amount">₹{{ r.amount | number: '1.2-2' }}</td>
|
<td class="num wri-amount">₹{{ r.amount | number: '1.2-2' }}</td>
|
||||||
|
|||||||
+12
@@ -387,6 +387,18 @@
|
|||||||
font-size: 12px;
|
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 (re-use checker inbox styles)
|
||||||
.empty-state {
|
.empty-state {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -118,6 +118,18 @@
|
|||||||
<fa-icon icon="money-bill-wave" class="ac-tab__ic"></fa-icon>
|
<fa-icon icon="money-bill-wave" class="ac-tab__ic"></fa-icon>
|
||||||
<span>Withdrawal Requests</span>
|
<span>Withdrawal Requests</span>
|
||||||
</a>
|
</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>
|
</nav>
|
||||||
|
|
||||||
<mat-tab-nav-panel #tabPanel>
|
<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 { 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 { 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 { 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 { 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 { 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';
|
import { LoanDisbursalComponent } from './checker-inbox-and-tasks-tabs/loan-disbursal/loan-disbursal.component';
|
||||||
@@ -107,6 +108,11 @@ const routes: Routes = [
|
|||||||
path: 'withdrawal-requests',
|
path: 'withdrawal-requests',
|
||||||
component: WithdrawalRequestsComponent,
|
component: WithdrawalRequestsComponent,
|
||||||
data: { title: 'Withdrawal Requests' }
|
data: { title: 'Withdrawal Requests' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'deposit-requests',
|
||||||
|
component: DepositRequestsComponent,
|
||||||
|
data: { title: 'Deposit Requests' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user