Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57a61b3057 |
@@ -11,6 +11,10 @@ import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { Route } from '../core/route/route.service';
|
||||
import { AccountsListComponent } from './accounts-list/accounts-list.component';
|
||||
import { PartyMasterComponent } from '../deposits/party-master/party-master.component';
|
||||
import { DailyTransactionEntryComponent } from '../deposits/daily-transaction-entry/daily-transaction-entry.component';
|
||||
import { DdsReportsComponent } from '../deposits/dds-reports/dds-reports.component';
|
||||
import { ReportViewerComponent } from '../deposits/dds-reports/report-viewer/report-viewer.component';
|
||||
|
||||
const routes: Routes = [
|
||||
Route.withShell([
|
||||
@@ -41,6 +45,28 @@ const routes: Routes = [
|
||||
title: 'Recurring Deposit Accounts',
|
||||
breadcrumb: 'Recurring Deposit Accounts'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'dds',
|
||||
component: PartyMasterComponent,
|
||||
data: { title: 'Daily Deposit Scheme — Party Master', breadcrumb: 'Party Master' }
|
||||
},
|
||||
{
|
||||
path: 'dds-collection',
|
||||
component: DailyTransactionEntryComponent,
|
||||
data: { title: 'Daily Transaction Entry', breadcrumb: 'Daily Transaction Entry' }
|
||||
},
|
||||
{
|
||||
path: 'dds-reports',
|
||||
data: { title: 'DDS Reports', breadcrumb: 'DDS Reports' },
|
||||
children: [
|
||||
{ path: '', component: DdsReportsComponent },
|
||||
{
|
||||
path: 'view/:reportName',
|
||||
component: ReportViewerComponent,
|
||||
data: { title: 'DDS Report', breadcrumb: 'reportName', routeParamBreadcrumb: 'reportName' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -263,6 +263,7 @@
|
||||
<mat-form-field appearance="outline" class="name-field last-name">
|
||||
<mat-label>{{ 'labels.inputs.Last Name' | translate }}</mat-label>
|
||||
<span matPrefix class="field-prefix-icon"><mat-icon>person</mat-icon></span>
|
||||
<<<<<<< Updated upstream
|
||||
<input
|
||||
matInput
|
||||
required
|
||||
@@ -271,6 +272,9 @@
|
||||
(blur)="capitalizeControl('lastname')"
|
||||
style="text-transform: capitalize"
|
||||
/>
|
||||
=======
|
||||
<input matInput required formControlName="lastname" autocomplete="off" (input)="formatName('lastname')" />
|
||||
>>>>>>> Stashed changes
|
||||
@if (createClientForm.controls.lastname.hasError('required')) {
|
||||
<mat-error>Last name is <strong>required</strong></mat-error>
|
||||
} @else if (createClientForm.controls.lastname.hasError('pattern')) {
|
||||
|
||||
@@ -2590,6 +2590,28 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
||||
dormantFlag: 'ACTIVE'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically capitalizes the first letter of each word and lowercases the rest.
|
||||
* e.g., "sri rAm" -> "Sri Ram"
|
||||
*/
|
||||
formatName(controlName: string): void {
|
||||
const control = this.createClientForm.get(controlName);
|
||||
if (!control || typeof control.value !== 'string') return;
|
||||
|
||||
const val = control.value;
|
||||
const formatted = val
|
||||
.split(' ')
|
||||
.map((word: string) => {
|
||||
if (!word) return '';
|
||||
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
||||
})
|
||||
.join(' ');
|
||||
|
||||
if (formatted !== val) {
|
||||
control.setValue(formatted, { emitEvent: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -435,17 +435,12 @@
|
||||
|
||||
@if (!showClosedFixedAccounts) {
|
||||
<div class="table-wrapper">
|
||||
<table mat-table [dataSource]="fixedDepositAccountsForDisplay | accountsFilter: 'saving' : 'open' : 'isFixed'">
|
||||
<table mat-table [dataSource]="savingAccounts | accountsFilter: 'saving' : 'open' : 'isFixed'">
|
||||
<ng-container matColumnDef="Account No">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Account No' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<i class="fa fa-stop" [ngClass]="element.status.code | statusLookup"></i>
|
||||
<mifosx-account-number
|
||||
accountNo="{{ element.fdAccountNumber || element.accountNo }}"
|
||||
></mifosx-account-number>
|
||||
@if (element.renewalCycleNo) {
|
||||
<span class="fd-renewal-badge">Renewal {{ element.renewalCycleNo }}</span>
|
||||
}
|
||||
<mifosx-account-number accountNo="{{ element.accountNo }}"></mifosx-account-number>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Saving Account">
|
||||
@@ -529,20 +524,12 @@
|
||||
<!-- Closed Fixed Deposit Accounts -->
|
||||
@if (showClosedFixedAccounts) {
|
||||
<div class="table-wrapper">
|
||||
<table
|
||||
mat-table
|
||||
[dataSource]="fixedDepositAccountsForDisplay | accountsFilter: 'saving' : 'closed' : 'isFixed'"
|
||||
>
|
||||
<table mat-table [dataSource]="savingAccounts | accountsFilter: 'saving' : 'closed' : 'isFixed'">
|
||||
<ng-container matColumnDef="Account No">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Account No' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<i class="fa fa-stop" [ngClass]="element.status.code | statusLookup"></i>
|
||||
<mifosx-account-number
|
||||
accountNo="{{ element.fdAccountNumber || element.accountNo }}"
|
||||
></mifosx-account-number>
|
||||
@if (element.renewalCycleNo) {
|
||||
<span class="fd-renewal-badge">Renewal {{ element.renewalCycleNo }}</span>
|
||||
}
|
||||
<mifosx-account-number accountNo="{{ element.accountNo }}"></mifosx-account-number>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="Saving Account">
|
||||
|
||||
@@ -209,20 +209,6 @@ $red: #d93025;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
// Marks an FD row that is a renewal of an earlier term, since the row shows the original FD number
|
||||
// rather than this term's own account number.
|
||||
.fd-renewal-badge {
|
||||
display: inline-block;
|
||||
margin-left: 8px;
|
||||
padding: 1px 7px;
|
||||
border-radius: 10px;
|
||||
background-color: $gray-200;
|
||||
color: $gray-700;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// ── Table Wrapper ──
|
||||
.table-wrapper {
|
||||
border-radius: 0 0 8px 8px;
|
||||
|
||||
@@ -234,57 +234,7 @@ export class GeneralTabComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
get fixedDepositCount(): number {
|
||||
return this.fixedDepositAccountsForDisplay.filter(
|
||||
(a: any) => a.depositType?.code === 'depositAccountType.fixedDeposit'
|
||||
).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accounts for the Fixed Deposit sections, with superseded renewal cycles folded away.
|
||||
*
|
||||
* An FD renewal closes one account and opens the next term as its own account row, so a renewed FD
|
||||
* would otherwise appear twice on this page -- the matured term under Closed and the new term under
|
||||
* Active -- reading as two unrelated deposits. A closed term is therefore dropped whenever a later
|
||||
* cycle of the same FD (same `fdAccountNumber`) exists, leaving one row per FD that shows its
|
||||
* current term. A chain that has genuinely ended keeps its final term, so it still lists as closed.
|
||||
*
|
||||
* Only FD rows are rewritten; savings, RD, current and share accounts pass through untouched.
|
||||
*/
|
||||
get fixedDepositAccountsForDisplay(): any[] {
|
||||
// Memoised on the source array's identity. This getter is bound straight to two [dataSource] inputs, so
|
||||
// returning a freshly built array on every change-detection pass would make the table re-bind and
|
||||
// re-render its rows on every tick -- mouse moves included.
|
||||
if (this.fdDisplayCacheSource !== this.savingAccounts) {
|
||||
this.fdDisplayCacheSource = this.savingAccounts;
|
||||
this.fdDisplayCache = this.foldSupersededFdCycles(this.savingAccounts);
|
||||
}
|
||||
return this.fdDisplayCache;
|
||||
}
|
||||
|
||||
private fdDisplayCacheSource: any[] = null;
|
||||
private fdDisplayCache: any[] = [];
|
||||
|
||||
private foldSupersededFdCycles(accounts: any[]): any[] {
|
||||
const latestCycleByFd = new Map<string, number>();
|
||||
for (const account of accounts) {
|
||||
if (account?.depositType?.code !== 'depositAccountType.fixedDeposit') {
|
||||
continue;
|
||||
}
|
||||
const fdNumber = account.fdAccountNumber ?? account.accountNo;
|
||||
const cycle = account.renewalCycleNo ?? 0;
|
||||
if (cycle > (latestCycleByFd.get(fdNumber) ?? -1)) {
|
||||
latestCycleByFd.set(fdNumber, cycle);
|
||||
}
|
||||
}
|
||||
|
||||
return accounts.filter((account: any) => {
|
||||
if (account?.depositType?.code !== 'depositAccountType.fixedDeposit') {
|
||||
return true;
|
||||
}
|
||||
const fdNumber = account.fdAccountNumber ?? account.accountNo;
|
||||
const cycle = account.renewalCycleNo ?? 0;
|
||||
return cycle === latestCycleByFd.get(fdNumber);
|
||||
});
|
||||
return this.savingAccounts.filter((a: any) => a.depositType?.code === 'depositAccountType.fixedDeposit').length;
|
||||
}
|
||||
|
||||
get recurringDepositCount(): number {
|
||||
|
||||
@@ -1048,14 +1048,16 @@
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/accounts/recurring-deposits']">
|
||||
<fa-icon icon="sync" class="menu-item-icon"></fa-icon> Recurring
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0"><fa-icon icon="coins" class="menu-item-icon"></fa-icon> DDS</button>
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/accounts/dds']">
|
||||
<fa-icon icon="coins" class="menu-item-icon"></fa-icon> DDS
|
||||
</button>
|
||||
</div>
|
||||
<div class="deposit-menu-group">
|
||||
<div class="deposit-group-title">Agent</div>
|
||||
<button mat-menu-item tabindex="0">
|
||||
<fa-icon icon="hand-holding-usd" class="menu-item-icon"></fa-icon> Agent Commission
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0">
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/accounts/dds-collection']">
|
||||
<fa-icon icon="calendar-check" class="menu-item-icon"></fa-icon> Today Collection
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0">
|
||||
@@ -1070,6 +1072,9 @@
|
||||
</div>
|
||||
<div class="deposit-menu-group">
|
||||
<div class="deposit-group-title">Reports</div>
|
||||
<button mat-menu-item tabindex="0" [routerLink]="['/accounts/dds-reports']">
|
||||
<fa-icon icon="coins" class="menu-item-icon"></fa-icon> DDS Reports
|
||||
</button>
|
||||
<button mat-menu-item tabindex="0">
|
||||
<fa-icon icon="clock" class="menu-item-icon"></fa-icon> Account Expiry
|
||||
</button>
|
||||
|
||||
+31
-2
@@ -12,7 +12,9 @@
|
||||
<fa-icon icon="university" class="cca-header__icon"></fa-icon>
|
||||
<div>
|
||||
<h2 class="cca-header__title">Create Current Account</h2>
|
||||
<div class="cca-header__sub">Pick a product, confirm currency and review before submit.</div>
|
||||
<div class="cca-header__sub">
|
||||
Pick a product, confirm currency, set digital channels and review before submit.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +78,34 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 3: Preview -->
|
||||
<!-- Tab 3: Digital -->
|
||||
<mat-tab [disabled]="!currentAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="mobile-alt" class="cca-tab__icon"></fa-icon>
|
||||
Digital
|
||||
</ng-template>
|
||||
<div class="cca-tab-body">
|
||||
@if (currentAccountProductTemplate) {
|
||||
<mifosx-current-account-digital-step
|
||||
[currentAccountProductTemplate]="currentAccountProductTemplate"
|
||||
></mifosx-current-account-digital-step>
|
||||
}
|
||||
|
||||
<div class="cca-actions">
|
||||
<button mat-stroked-button (click)="prev()">
|
||||
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Previous' | translate }}
|
||||
</button>
|
||||
<span class="cca-actions__spacer"></span>
|
||||
<button mat-raised-button color="primary" (click)="next()">
|
||||
{{ 'labels.buttons.Next' | translate }}
|
||||
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 4: Preview -->
|
||||
<mat-tab [disabled]="!currentAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="eye" class="cca-tab__icon"></fa-icon>
|
||||
|
||||
@@ -57,8 +57,8 @@ export class CreateCurrentAccountComponent {
|
||||
currentAccountProductTemplate: any;
|
||||
/** Currently visible wizard tab (0-indexed). */
|
||||
selectedTabIndex = 0;
|
||||
/** Total wizard tabs — Product, Currency, Preview. */
|
||||
private readonly totalTabs = 3;
|
||||
/** Total wizard tabs — Product, Currency, Digital, Preview. */
|
||||
private readonly totalTabs = 4;
|
||||
|
||||
@ViewChild(CurrentAccountDetailsStepComponent, { static: true })
|
||||
currentAccountDetailsStep: CurrentAccountDetailsStepComponent;
|
||||
|
||||
+12
@@ -30,6 +30,18 @@
|
||||
</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-fill">
|
||||
<mat-label>Opening Balance</mat-label>
|
||||
<input matInput type="number" [min]="minRequiredOpeningBalance ?? 0" formControlName="openingBalance" />
|
||||
<span matPrefix>₹ </span>
|
||||
@if (minRequiredOpeningBalance) {
|
||||
<mat-hint>Minimum required: ₹{{ minRequiredOpeningBalance }}</mat-hint>
|
||||
}
|
||||
@if (activateCurrentAccountForm.controls.openingBalance.hasError('min')) {
|
||||
<mat-error>Opening balance must be at least ₹{{ minRequiredOpeningBalance ?? 0 }}</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
|
||||
+11
-1
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { Component, OnInit, Input, inject } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
@@ -36,6 +36,8 @@ export class ActivateCurrentAccountComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
|
||||
@Input() minRequiredOpeningBalance: number | null = null;
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -69,10 +71,18 @@ export class ActivateCurrentAccountComponent implements OnInit {
|
||||
* Creates the activate current account form.
|
||||
*/
|
||||
createActivateCurrentAccountForm() {
|
||||
const minBalance = this.minRequiredOpeningBalance ?? 0;
|
||||
this.activateCurrentAccountForm = this.formBuilder.group({
|
||||
activatedOnDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
openingBalance: [
|
||||
minBalance,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.min(minBalance)
|
||||
]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
<mat-card>
|
||||
<form [formGroup]="approveCurrentAccountForm" (ngSubmit)="submit()">
|
||||
<mat-card-content>
|
||||
<p class="mat-body-2">This approves and activates the account in one step -- it goes straight to Active.</p>
|
||||
<div class="layout-column">
|
||||
<mat-form-field (click)="approvedOnDatePicker.open()">
|
||||
<mat-label>{{ 'labels.inputs.Approved On Date' | translate }}</mat-label>
|
||||
|
||||
+3
-13
@@ -81,9 +81,8 @@ export class ApproveCurrentAccountComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form, approves the current account, then immediately activates it on the same
|
||||
* date -- Approve and Activate are still two separate Fineract commands underneath (each shows
|
||||
* up in the audit trail), but the officer only sees and clicks through one step.
|
||||
* Submits the form and approves the current account,
|
||||
* if successful redirects to the current account.
|
||||
*/
|
||||
submit() {
|
||||
const approveCurrentAccountFormData = this.approveCurrentAccountForm.value;
|
||||
@@ -99,16 +98,7 @@ export class ApproveCurrentAccountComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.currentAccountsService.executeCurrentAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||
const activationData = {
|
||||
activatedOnDate: approveCurrentAccountFormData.approvedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.currentAccountsService
|
||||
.executeCurrentAccountCommand(this.accountId, 'activate', activationData)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -13,7 +13,9 @@
|
||||
<mifosx-reject-current-account></mifosx-reject-current-account>
|
||||
}
|
||||
@if (actions['Activate']) {
|
||||
<mifosx-activate-current-account></mifosx-activate-current-account>
|
||||
<mifosx-activate-current-account
|
||||
[minRequiredOpeningBalance]="accountData?.minRequiredOpeningBalance"
|
||||
></mifosx-activate-current-account>
|
||||
}
|
||||
@if (actions['Undo Approval']) {
|
||||
<mifosx-undo-approval-current-account></mifosx-undo-approval-current-account>
|
||||
|
||||
+1
@@ -15,6 +15,7 @@
|
||||
<h3 class="dig-header__title">Digital & Account Features</h3>
|
||||
<p class="dig-header__sub">Toggle the facilities available for this account (as per RBI guidelines)</p>
|
||||
</div>
|
||||
<span class="dig-header__badge">FROM PRODUCT</span>
|
||||
</div>
|
||||
|
||||
<div class="dig-grid">
|
||||
|
||||
+5
-4
@@ -52,11 +52,12 @@ export class CurrentAccountDigitalStepComponent {
|
||||
}
|
||||
}
|
||||
|
||||
// Note: a new account always starts with every digital facility off, even if the product has
|
||||
// its own defaults configured -- those are enabled deliberately, one at a time, after the
|
||||
// account is created and active, not inherited automatically at opening.
|
||||
@Input()
|
||||
currentAccountProductTemplate: any;
|
||||
set currentAccountProductTemplate(value: any) {
|
||||
if (!this.hasExistingAccount && value?.accountFacilityConfig) {
|
||||
this.facilityConfig = { ...DEFAULT_FACILITY_CONFIG, ...value.accountFacilityConfig };
|
||||
}
|
||||
}
|
||||
|
||||
get currentAccountDigital() {
|
||||
return { accountFacilityConfig: { ...this.facilityConfig } };
|
||||
|
||||
+5
-4
@@ -136,11 +136,12 @@ export class CurrentAccountPreviewStepComponent implements OnChanges {
|
||||
return this.currentAccountSettingsForm?.getRawValue?.() || this.currentAccount || {};
|
||||
}
|
||||
|
||||
/** Digital facility config as actually captured by a digital step in this wizard -- no fallback
|
||||
* to the product's own defaults, since account creation no longer has a digital step at all and
|
||||
* must not preview facilities the officer never actually chose. */
|
||||
get digitalFacilityConfig(): any {
|
||||
return this.currentAccountDigital?.accountFacilityConfig ?? null;
|
||||
return (
|
||||
this.currentAccountDigital?.accountFacilityConfig ??
|
||||
this.currentAccountProductTemplate?.accountFacilityConfig ??
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
get hasDigitalSection(): boolean {
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
<!--
|
||||
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="dte-container">
|
||||
<div class="dte-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="dte-back">
|
||||
<i class="fas fa-arrow-left"></i> Deposits
|
||||
</button>
|
||||
<h2 class="dte-header__title">Daily Transaction Detail</h2>
|
||||
</div>
|
||||
|
||||
<div class="dte-card">
|
||||
<form [formGroup]="entryForm">
|
||||
<div class="dte-info-panels">
|
||||
<div class="dte-info-panel">
|
||||
<div class="dte-info-panel__title">Agent Information</div>
|
||||
<dl>
|
||||
<dt>Name</dt>
|
||||
<dd>{{ agentInfo.name || '—' }}</dd>
|
||||
<dt>Address</dt>
|
||||
<dd>{{ agentInfo.address || '—' }}</dd>
|
||||
<dt>City</dt>
|
||||
<dd>{{ agentInfo.city || '—' }}</dd>
|
||||
<dt>A/C</dt>
|
||||
<dd>{{ agentInfo.accountNo || '—' }}</dd>
|
||||
<dt>Guarantor</dt>
|
||||
<dd>{{ agentInfo.guarantor1 || '—' }}</dd>
|
||||
<dt>Guarantor</dt>
|
||||
<dd>{{ agentInfo.guarantor2 || '—' }}</dd>
|
||||
<dt>Curr Bal</dt>
|
||||
<dd>{{ agentInfo.currentBalance | number: '1.2-2' }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="dte-info-panel">
|
||||
<div class="dte-info-panel__title">Party Information</div>
|
||||
<p class="dte-info-panel__hint">Populated once a party is selected in a collection row below.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dte-controls">
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Agent</mat-label>
|
||||
<input matInput required formControlName="agentId" />
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-stroked-button type="button" (click)="loadAgent()"><i class="fas fa-search"></i> Load</button>
|
||||
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Date</mat-label>
|
||||
<input matInput required [matDatepicker]="txnDatePicker" formControlName="transactionDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="txnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #txnDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Tran. Type</mat-label>
|
||||
<mat-select required formControlName="transactionType">
|
||||
@for (type of transactionTypes; track type) {
|
||||
<mat-option [value]="type">{{ type }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@if (isPartyTran) {
|
||||
<div class="dte-section">
|
||||
<div class="dte-section__header">
|
||||
<i class="fas fa-list"></i>
|
||||
<h3>Today's Collections</h3>
|
||||
<button mat-stroked-button type="button" class="dte-add-row" (click)="addCollectionRow()">
|
||||
<i class="fas fa-plus"></i> Add Row
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (collections.length === 0) {
|
||||
<p class="dte-empty">No collection rows added yet.</p>
|
||||
}
|
||||
|
||||
@for (row of collections.controls; track row; let i = $index) {
|
||||
<div class="dte-collection-row" [formGroup]="$any(row)">
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Party Code</mat-label>
|
||||
<input matInput required formControlName="partyCode" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>TRTP</mat-label>
|
||||
<mat-select required formControlName="transactionMode">
|
||||
@for (mode of transactionModes; track mode) {
|
||||
<mat-option [value]="mode">{{ mode }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>AC Type</mat-label>
|
||||
<input matInput formControlName="accountType" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>A/C No.</mat-label>
|
||||
<input matInput required formControlName="accountNo" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Amount</mat-label>
|
||||
<input matInput required type="number" formControlName="amount" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Cheque No</mat-label>
|
||||
<input matInput formControlName="chequeNo" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Token No</mat-label>
|
||||
<input matInput formControlName="tokenNo" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field dte-field--wide">
|
||||
<mat-label>Description</mat-label>
|
||||
<input matInput formControlName="description" />
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
class="dte-remove-row"
|
||||
(click)="removeCollectionRow(i)"
|
||||
matTooltip="Remove row"
|
||||
>
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (isAgentTran) {
|
||||
<div class="dte-section">
|
||||
<div class="dte-section__header">
|
||||
<i class="fas fa-hand-holding-usd"></i>
|
||||
<h3>Agent Settlement</h3>
|
||||
</div>
|
||||
<p class="dte-info-panel__hint">
|
||||
Cash the agent hands over to the branch, deducted from the agent's collected balance shown above.
|
||||
</p>
|
||||
<div class="dte-grid">
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Amount</mat-label>
|
||||
<input matInput required type="number" formControlName="settlementAmount" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>TRTP</mat-label>
|
||||
<mat-select required formControlName="settlementMode">
|
||||
@for (mode of transactionModes; track mode) {
|
||||
<mat-option [value]="mode">{{ mode }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>AC Type</mat-label>
|
||||
<input matInput formControlName="settlementAccountType" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>A/C No.</mat-label>
|
||||
<input matInput formControlName="settlementAccountNo" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field dte-field--wide">
|
||||
<mat-label>Description</mat-label>
|
||||
<input matInput formControlName="settlementDescription" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (isWithdrawDeposite) {
|
||||
<div class="dte-section">
|
||||
<div class="dte-section__header">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
<h3>Withdraw Deposite</h3>
|
||||
</div>
|
||||
<div class="dte-grid">
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Creditor Party Code</mat-label>
|
||||
<input matInput formControlName="creditorPartyCode" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Creditor Party Name</mat-label>
|
||||
<input matInput formControlName="creditorPartyName" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Creditor Curr Bal</mat-label>
|
||||
<input matInput formControlName="creditorPartyBalance" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Debit Party Code</mat-label>
|
||||
<input matInput formControlName="debitPartyCode" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Debit Party Name</mat-label>
|
||||
<input matInput formControlName="debitPartyName" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Debit Curr Bal</mat-label>
|
||||
<input matInput formControlName="debitPartyBalance" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="dte-field">
|
||||
<mat-label>Amount</mat-label>
|
||||
<input matInput type="number" formControlName="withdrawAmount" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="dte-field dte-field--wide">
|
||||
<mat-label>Description</mat-label>
|
||||
<input matInput formControlName="withdrawDescription" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!isPartyTran && !isWithdrawDeposite && !isAgentTran) {
|
||||
<div class="dte-section">
|
||||
<p class="dte-empty">
|
||||
"{{ entryForm.get('transactionType').value }}" entry screen — same shape as Party Tran, to be filled in once
|
||||
the backend distinguishes these transaction types.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="dte-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-stroked-button type="button" (click)="cancel()">Cancel</button>
|
||||
<button mat-stroked-button type="button" (click)="retrieve()">Retrieve</button>
|
||||
<button mat-stroked-button type="button" (click)="viewLedger()">View Ledger</button>
|
||||
<button mat-stroked-button type="button" (click)="signature()">Signature</button>
|
||||
<button mat-raised-button color="primary" type="button" [disabled]="entryForm.invalid" (click)="save()">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.dte-container {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.dte-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.dte-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.dte-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
padding: 20px 24px 24px;
|
||||
}
|
||||
|
||||
.dte-info-panels {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.dte-info-panel {
|
||||
border: 1px solid rgb(0 0 0 / 10%);
|
||||
border-radius: 8px;
|
||||
padding: 12px 16px;
|
||||
background: rgb(15 118 110 / 4%);
|
||||
|
||||
&__title {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: $primary;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__hint {
|
||||
margin: 0;
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
dl {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 4px 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 500;
|
||||
color: rgb(0 0 0 / 60%);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.dte-controls {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.dte-field {
|
||||
min-width: 180px;
|
||||
|
||||
&--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
.dte-section {
|
||||
padding: 16px 0;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
i {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dte-add-row {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.dte-empty {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dte-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.dte-collection-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr) auto;
|
||||
gap: 8px 12px;
|
||||
align-items: start;
|
||||
padding: 10px 0;
|
||||
border-top: 1px dashed rgb(0 0 0 / 10%);
|
||||
|
||||
&:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
.dte-collection-row .dte-field--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
.dte-remove-row {
|
||||
color: #b91c1c;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.dte-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (width <= 1000px) {
|
||||
.dte-info-panels {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.dte-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.dte-collection-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, UntypedFormArray, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Daily Transaction Entry component.
|
||||
*
|
||||
* The screen a collection agent uses at the end of a day's round: pick a
|
||||
* transaction type, then batch-enter that day's collections against
|
||||
* assigned parties (Party Tran), settle collected cash to the branch
|
||||
* (Agent Tran), or record a withdrawal/transfer between accounts (Withdraw
|
||||
* Deposite). Modelled directly on the legacy Daily Transaction Detail
|
||||
* screen this replaces.
|
||||
*
|
||||
* Backed by the DDS Party Transaction API (`/dds/partytransactions`) for
|
||||
* Party Tran, Agent Tran and Withdraw Deposite - the three types this
|
||||
* screen actually collects fields for; Party Payment / OD Entry / OD
|
||||
* Payment remain placeholders until the backend distinguishes them too.
|
||||
* "Retrieve" (a ready-made list of today's assigned parties) isn't wired -
|
||||
* that needs a dedicated per-agent Party lookup this MVP doesn't have yet.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-daily-transaction-entry',
|
||||
templateUrl: './daily-transaction-entry.component.html',
|
||||
styleUrls: ['./daily-transaction-entry.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class DailyTransactionEntryComponent {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private organizationService = inject(OrganizationService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
private static readonly TRANSACTION_TYPE_CODES: Record<string, string> = {
|
||||
'Party Tran': 'PARTY_TRAN',
|
||||
'Agent Tran': 'AGENT_TRAN',
|
||||
'Withdraw Deposite': 'WITHDRAW_DEPOSITE'
|
||||
};
|
||||
|
||||
transactionTypes = [
|
||||
'Party Tran',
|
||||
'Agent Tran',
|
||||
'Party Payment',
|
||||
'OD Entry',
|
||||
'OD Payment',
|
||||
'Withdraw Deposite'
|
||||
];
|
||||
|
||||
transactionModes = [
|
||||
'Cash',
|
||||
'Transfer',
|
||||
'Clearing'
|
||||
];
|
||||
|
||||
entryForm: UntypedFormGroup = this.formBuilder.group({
|
||||
agentId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transactionType: [
|
||||
'Party Tran',
|
||||
Validators.required
|
||||
],
|
||||
transactionDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
// Withdraw Deposite fields
|
||||
creditorPartyCode: [''],
|
||||
creditorPartyName: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
creditorPartyBalance: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
debitPartyCode: [''],
|
||||
debitPartyName: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
debitPartyBalance: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
withdrawAmount: [0],
|
||||
withdrawDescription: [''],
|
||||
// Agent Tran fields
|
||||
settlementAmount: [0],
|
||||
settlementMode: ['Cash'],
|
||||
settlementAccountType: [''],
|
||||
settlementAccountNo: [''],
|
||||
settlementDescription: [''],
|
||||
collections: this.formBuilder.array([])
|
||||
});
|
||||
|
||||
agentInfo = {
|
||||
name: '',
|
||||
address: '',
|
||||
city: '',
|
||||
accountNo: '',
|
||||
guarantor1: '',
|
||||
guarantor2: '',
|
||||
currentBalance: 0
|
||||
};
|
||||
|
||||
get isPartyTran(): boolean {
|
||||
return this.entryForm.get('transactionType').value === 'Party Tran';
|
||||
}
|
||||
|
||||
get isWithdrawDeposite(): boolean {
|
||||
return this.entryForm.get('transactionType').value === 'Withdraw Deposite';
|
||||
}
|
||||
|
||||
get isAgentTran(): boolean {
|
||||
return this.entryForm.get('transactionType').value === 'Agent Tran';
|
||||
}
|
||||
|
||||
get collections(): UntypedFormArray {
|
||||
return this.entryForm.get('collections') as UntypedFormArray;
|
||||
}
|
||||
|
||||
private buildCollectionRow(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
partyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transactionMode: [
|
||||
'Cash',
|
||||
Validators.required
|
||||
],
|
||||
accountType: [''],
|
||||
accountNo: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
0,
|
||||
Validators.required
|
||||
],
|
||||
chequeNo: [''],
|
||||
tokenNo: [''],
|
||||
description: [''],
|
||||
partyName: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
balanceAfterTransaction: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
addCollectionRow(): void {
|
||||
this.collections.push(this.buildCollectionRow());
|
||||
}
|
||||
|
||||
removeCollectionRow(index: number): void {
|
||||
this.collections.removeAt(index);
|
||||
}
|
||||
|
||||
loadAgent(): void {
|
||||
const agentId = this.entryForm.get('agentId')?.value;
|
||||
if (!agentId) {
|
||||
return;
|
||||
}
|
||||
this.organizationService.getAgent(agentId).subscribe((agent: any) => {
|
||||
const guarantors = agent.guarantors || [];
|
||||
this.agentInfo = {
|
||||
name: agent.agentNameId || '',
|
||||
address: agent.agentAddress1 || '',
|
||||
city: agent.agentCity || '',
|
||||
accountNo: agent.agentSavingAccountNo || '',
|
||||
guarantor1: guarantors[0]?.guarantorName || '',
|
||||
guarantor2: guarantors[1]?.guarantorName || '',
|
||||
currentBalance: agent.agentCurrentBalance || 0
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
retrieve(): void {
|
||||
// No "my assigned parties" read API exists yet — this will pre-fill
|
||||
// the collections grid with today's assigned parties once available.
|
||||
}
|
||||
|
||||
viewLedger(): void {
|
||||
// No ledger view exists yet for this agent.
|
||||
}
|
||||
|
||||
signature(): void {
|
||||
// No signature capture/verification flow exists yet.
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
this.entryForm.reset({
|
||||
transactionType: 'Party Tran',
|
||||
transactionDate: new Date()
|
||||
});
|
||||
this.collections.clear();
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['/accounts/savings']);
|
||||
}
|
||||
|
||||
save(): void {
|
||||
const raw = this.entryForm.getRawValue();
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const transactionType = DailyTransactionEntryComponent.TRANSACTION_TYPE_CODES[raw.transactionType];
|
||||
|
||||
const payload: any = {
|
||||
agentId: Number(raw.agentId),
|
||||
transactionType,
|
||||
transactionDate: this.dateUtils.formatDate(raw.transactionDate, dateFormat),
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
if (this.isPartyTran) {
|
||||
payload.collections = (raw.collections || []).map((row: any) => ({
|
||||
partyCode: row.partyCode,
|
||||
transactionMode: row.transactionMode,
|
||||
accountType: row.accountType || undefined,
|
||||
accountNo: row.accountNo,
|
||||
amount: row.amount,
|
||||
chequeNo: row.chequeNo || undefined,
|
||||
tokenNo: row.tokenNo || undefined,
|
||||
description: row.description || undefined
|
||||
}));
|
||||
} else if (this.isWithdrawDeposite) {
|
||||
payload.creditorPartyCode = raw.creditorPartyCode;
|
||||
payload.debitPartyCode = raw.debitPartyCode;
|
||||
payload.withdrawAmount = raw.withdrawAmount;
|
||||
payload.withdrawDescription = raw.withdrawDescription || undefined;
|
||||
} else if (this.isAgentTran) {
|
||||
payload.amount = raw.settlementAmount;
|
||||
payload.transactionMode = raw.settlementMode;
|
||||
payload.accountType = raw.settlementAccountType || undefined;
|
||||
payload.accountNo = raw.settlementAccountNo || undefined;
|
||||
payload.description = raw.settlementDescription || undefined;
|
||||
}
|
||||
|
||||
this.organizationService.createPartyTransaction(payload).subscribe(() => {
|
||||
this.collections.clear();
|
||||
this.entryForm.patchValue({
|
||||
creditorPartyCode: '',
|
||||
debitPartyCode: '',
|
||||
withdrawAmount: 0,
|
||||
withdrawDescription: '',
|
||||
settlementAmount: 0,
|
||||
settlementAccountType: '',
|
||||
settlementAccountNo: '',
|
||||
settlementDescription: ''
|
||||
});
|
||||
this.loadAgent();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<!--
|
||||
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="dr-container">
|
||||
<div class="dr-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="dr-back">
|
||||
<i class="fas fa-arrow-left"></i> Deposits
|
||||
</button>
|
||||
<h2 class="dr-header__title">DDS Reports</h2>
|
||||
</div>
|
||||
|
||||
@for (group of reportGroups; track group.title) {
|
||||
<div class="dr-group">
|
||||
<div class="dr-group__title">{{ group.title }}</div>
|
||||
<div class="dr-grid">
|
||||
@for (report of group.reports; track report) {
|
||||
<a class="dr-card" [routerLink]="['view', report]">
|
||||
<div class="dr-card__icon">
|
||||
<i class="fas fa-file-alt"></i>
|
||||
</div>
|
||||
<div class="dr-card__title">{{ report }}</div>
|
||||
<i class="fas fa-chevron-right dr-card__arrow"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.dr-container {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.dr-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.dr-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.dr-group {
|
||||
margin-bottom: 24px;
|
||||
|
||||
&__title {
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: $primary;
|
||||
font-weight: 700;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.dr-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.dr-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border: 1px solid rgb(0 0 0 / 8%);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: box-shadow 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
&__icon {
|
||||
color: $primary;
|
||||
font-size: 16px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
&__title {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&__arrow {
|
||||
color: rgb(0 0 0 / 30%);
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 900px) {
|
||||
.dr-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 600px) {
|
||||
.dr-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* DDS Reports hub component.
|
||||
*
|
||||
* Lists every DDS report from the legacy Reports menu, grouped the same
|
||||
* way (As-On-Date, Interest, Daily/Balance/Master, Transaction). Each
|
||||
* links to the shared report viewer, parameterised by report name.
|
||||
*
|
||||
* UI only for now: no report actually queries the backend yet — see
|
||||
* ReportViewerComponent.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-dds-reports',
|
||||
templateUrl: './dds-reports.component.html',
|
||||
styleUrls: ['./dds-reports.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class DdsReportsComponent {
|
||||
reportGroups = [
|
||||
{
|
||||
title: 'As On Date',
|
||||
reports: [
|
||||
'Supplementary-DDS (As On)',
|
||||
'Agent Check List',
|
||||
'Party Check List-As On',
|
||||
'Party Balance',
|
||||
'Agent Wise Balance',
|
||||
'Agent Wise Monthly Collection',
|
||||
'Commission Register',
|
||||
'Collection Summary Agent Wise',
|
||||
'Close Party Ac Register',
|
||||
'Agent Partywise Daily Collection',
|
||||
'Daily Collection Balance',
|
||||
'Interest Certificate',
|
||||
'Mature Date Wise Report'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Interest',
|
||||
reports: [
|
||||
'Party Int. Register',
|
||||
'Commission Register'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Daily / Balance / Master',
|
||||
reports: [
|
||||
'Daily Collection Report',
|
||||
'Balance Summary',
|
||||
'Master Data Export'
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Transaction',
|
||||
reports: ['Transaction Register']
|
||||
},
|
||||
{
|
||||
title: 'Statements',
|
||||
reports: ['Agent Commission Statement']
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<!--
|
||||
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="rv-container">
|
||||
<div class="rv-header">
|
||||
<button mat-stroked-button [routerLink]="['../../']" class="rv-back">
|
||||
<i class="fas fa-arrow-left"></i> DDS Reports
|
||||
</button>
|
||||
<h2 class="rv-header__title">{{ reportName }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="rv-card">
|
||||
<form [formGroup]="filterForm">
|
||||
<div class="rv-grid">
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>From Date</mat-label>
|
||||
<input matInput required [matDatepicker]="fromPicker" formControlName="fromDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="fromPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #fromPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>To Date</mat-label>
|
||||
<input matInput required [matDatepicker]="toPicker" formControlName="toDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="toPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #toPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>Agent From</mat-label>
|
||||
<input matInput type="number" formControlName="agentFrom" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>Agent To</mat-label>
|
||||
<input matInput type="number" formControlName="agentTo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>Party From</mat-label>
|
||||
<input matInput type="number" formControlName="partyFrom" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rv-field">
|
||||
<mat-label>Party To</mat-label>
|
||||
<input matInput type="number" formControlName="partyTo" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="rv-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-raised-button color="primary" type="button" [disabled]="filterForm.invalid" (click)="runReport()">
|
||||
<i class="fas fa-play" style="margin-right: 6px"></i> Run Report
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (hasRun) {
|
||||
<div class="rv-results">
|
||||
@if (!available) {
|
||||
<p class="rv-empty">{{ unavailableMessage }}</p>
|
||||
} @else if (rows.length === 0) {
|
||||
<p class="rv-empty">No rows matched these filters.</p>
|
||||
} @else {
|
||||
<div class="rv-table-scroll">
|
||||
<table class="rv-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@for (column of columns; track column) {
|
||||
<th>{{ column }}</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rows; track row) {
|
||||
<tr>
|
||||
@for (column of columns; track column) {
|
||||
<td>{{ row[column] }}</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.rv-container {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.rv-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.rv-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.rv-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
padding: 20px 24px 24px;
|
||||
}
|
||||
|
||||
.rv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.rv-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rv-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
.rv-results {
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
.rv-empty {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.rv-table-scroll {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.rv-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
white-space: nowrap;
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: rgb(0 0 0 / 55%);
|
||||
padding: 8px 10px;
|
||||
border-bottom: 2px solid rgb(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid rgb(0 0 0 / 6%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 900px) {
|
||||
.rv-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Generic DDS report viewer.
|
||||
*
|
||||
* One shared screen for all 13+ DDS reports — the report name comes from
|
||||
* the route and is mapped to a backend report key. Every report in the
|
||||
* legacy system shared the same basic filter shape (date, agent range,
|
||||
* party range), so this avoids building a bespoke screen per report - the
|
||||
* backend returns a generic {columns, rows} shape this renders as one
|
||||
* table regardless of which report it is.
|
||||
*
|
||||
* One legacy report (Close Party Ac Register) has no corresponding data in
|
||||
* the backend yet - Party accounts have no closed/open status at all. Run
|
||||
* Report still calls through, and the backend's `available: false` +
|
||||
* message is shown instead of a table.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-dds-report-viewer',
|
||||
templateUrl: './report-viewer.component.html',
|
||||
styleUrls: ['./report-viewer.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class ReportViewerComponent {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private organizationService = inject(OrganizationService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
private static readonly REPORT_KEYS: Record<string, string> = {
|
||||
'Supplementary-DDS (As On)': 'SUPPLEMENTARY_DDS',
|
||||
'Agent Check List': 'AGENT_CHECK_LIST',
|
||||
'Party Check List-As On': 'PARTY_CHECK_LIST',
|
||||
'Party Balance': 'PARTY_BALANCE',
|
||||
'Agent Wise Balance': 'AGENT_WISE_BALANCE',
|
||||
'Agent Wise Monthly Collection': 'AGENT_WISE_MONTHLY_COLLECTION',
|
||||
'Commission Register': 'COMMISSION_REGISTER',
|
||||
'Collection Summary Agent Wise': 'COLLECTION_SUMMARY_AGENT_WISE',
|
||||
'Close Party Ac Register': 'CLOSE_PARTY_AC_REGISTER',
|
||||
'Agent Partywise Daily Collection': 'AGENT_PARTYWISE_DAILY_COLLECTION',
|
||||
'Daily Collection Balance': 'DAILY_COLLECTION_REPORT',
|
||||
'Interest Certificate': 'INTEREST_CERTIFICATE',
|
||||
'Mature Date Wise Report': 'MATURE_DATE_WISE',
|
||||
'Party Int. Register': 'PARTY_INTEREST_REGISTER',
|
||||
'Daily Collection Report': 'DAILY_COLLECTION_REPORT',
|
||||
'Balance Summary': 'BALANCE_SUMMARY',
|
||||
'Master Data Export': 'MASTER_DATA_EXPORT',
|
||||
'Transaction Register': 'TRANSACTION_REGISTER',
|
||||
'Agent Commission Statement': 'AGENT_COMMISSION_STATEMENT'
|
||||
};
|
||||
|
||||
reportName: string = this.route.snapshot.paramMap.get('reportName') || 'Report';
|
||||
|
||||
hasRun = false;
|
||||
available = true;
|
||||
unavailableMessage = '';
|
||||
columns: string[] = [];
|
||||
rows: Array<Record<string, any>> = [];
|
||||
|
||||
filterForm: UntypedFormGroup = this.formBuilder.group({
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentFrom: [1],
|
||||
agentTo: [99999],
|
||||
partyFrom: [1],
|
||||
partyTo: [99999999]
|
||||
});
|
||||
|
||||
runReport(): void {
|
||||
const reportKey = ReportViewerComponent.REPORT_KEYS[this.reportName];
|
||||
if (!reportKey) {
|
||||
return;
|
||||
}
|
||||
const raw = this.filterForm.getRawValue();
|
||||
|
||||
this.organizationService
|
||||
.runDdsReport(reportKey, {
|
||||
fromDate: this.dateUtils.getDate(raw.fromDate),
|
||||
toDate: this.dateUtils.getDate(raw.toDate),
|
||||
agentFrom: raw.agentFrom,
|
||||
agentTo: raw.agentTo,
|
||||
partyFrom: raw.partyFrom,
|
||||
partyTo: raw.partyTo
|
||||
})
|
||||
.subscribe((result: any) => {
|
||||
this.available = result.available;
|
||||
this.unavailableMessage = result.message || '';
|
||||
this.columns = result.columns || [];
|
||||
this.rows = result.rows || [];
|
||||
this.hasRun = true;
|
||||
});
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
}
|
||||
}
|
||||
+1
-36
@@ -33,7 +33,6 @@
|
||||
<mifosx-fixed-deposit-account-details-step
|
||||
[fixedDepositsAccountTemplate]="fixedDepositsAccountTemplate"
|
||||
(fixedDepositsAccountProductTemplate)="setTemplate($event)"
|
||||
[externalLinkedAccountId]="fixedDepositAccountMaturityTermsStep?.selectedTransferAccount?.id ?? null"
|
||||
[hideButtons]="true"
|
||||
>
|
||||
</mifosx-fixed-deposit-account-details-step>
|
||||
@@ -108,40 +107,7 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 4: Terms -->
|
||||
<mat-tab [disabled]="!fixedDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="file-alt" class="cfa-tab__icon"></fa-icon>
|
||||
Terms
|
||||
</ng-template>
|
||||
<div class="cfa-tab-body">
|
||||
@if (fixedDepositsAccountProductTemplate) {
|
||||
<mifosx-fixed-deposit-account-maturity-terms-step
|
||||
[fixedDepositsAccountTemplate]="fixedDepositsAccountTemplate"
|
||||
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate"
|
||||
[linkedSavingsAccountId]="
|
||||
fixedDepositsAccountDetailsStep?.selectedLinkedAccount?.accountType === 'SAVINGS'
|
||||
? fixedDepositsAccountDetailsStep?.selectedLinkedAccount?.id
|
||||
: null
|
||||
"
|
||||
></mifosx-fixed-deposit-account-maturity-terms-step>
|
||||
}
|
||||
|
||||
<div class="cfa-actions">
|
||||
<button mat-stroked-button (click)="prev()">
|
||||
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Previous' | translate }}
|
||||
</button>
|
||||
<span class="cfa-actions__spacer"></span>
|
||||
<button mat-raised-button color="primary" (click)="next()">
|
||||
{{ 'labels.buttons.Next' | translate }}
|
||||
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 5: Preview -->
|
||||
<!-- Tab 4: Preview -->
|
||||
<mat-tab [disabled]="!fixedDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="eye" class="cfa-tab__icon"></fa-icon>
|
||||
@@ -155,7 +121,6 @@
|
||||
[fixedDepositAccountData]="fixedDepositAccount"
|
||||
[selectedTenure]="selectedTenure"
|
||||
[fdNominees]="fixedDepositAccountCurrencyStep?.nominees ?? []"
|
||||
[closureSettings]="fixedDepositAccountMaturityTermsStep?.closureSettings ?? {}"
|
||||
[hideButtons]="true"
|
||||
(submitEvent)="submit()"
|
||||
></mifosx-fixed-deposit-account-preview-step>
|
||||
|
||||
+2
-9
@@ -24,7 +24,6 @@ import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { FixedDepositAccountInterestRateChartStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-interest-rate-chart-step/fixed-deposit-account-interest-rate-chart-step.component';
|
||||
import { FixedDepositAccountPreviewStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component';
|
||||
import { FixedDepositAccountMaturityTermsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-maturity-terms-step/fixed-deposit-account-maturity-terms-step.component';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
@@ -41,7 +40,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
FixedDepositAccountDetailsStepComponent,
|
||||
FixedDepositAccountInterestRateChartStepComponent,
|
||||
FixedDepositAccountCurrencyStepComponent,
|
||||
FixedDepositAccountMaturityTermsStepComponent,
|
||||
FixedDepositAccountPreviewStepComponent
|
||||
]
|
||||
})
|
||||
@@ -58,10 +56,6 @@ export class CreateFixedDepositAccountComponent {
|
||||
fixedDepositsAccountDetailsStep: FixedDepositAccountDetailsStepComponent;
|
||||
@ViewChild(FixedDepositAccountCurrencyStepComponent)
|
||||
fixedDepositAccountCurrencyStep: FixedDepositAccountCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositAccountPreviewStepComponent)
|
||||
fixedDepositAccountPreviewStep: FixedDepositAccountPreviewStepComponent;
|
||||
@ViewChild(FixedDepositAccountMaturityTermsStepComponent)
|
||||
fixedDepositAccountMaturityTermsStep: FixedDepositAccountMaturityTermsStepComponent;
|
||||
|
||||
/** Fixed Deposits Account Template */
|
||||
fixedDepositsAccountTemplate: any;
|
||||
@@ -69,8 +63,8 @@ export class CreateFixedDepositAccountComponent {
|
||||
fixedDepositsAccountProductTemplate: any;
|
||||
/** Currently visible wizard tab (0-indexed). */
|
||||
selectedTabIndex = 0;
|
||||
/** Total wizard tabs — Product, Currency, Chart, Terms, Preview. */
|
||||
private readonly totalTabs = 5;
|
||||
/** Total wizard tabs — Product, Currency, Chart, Preview. */
|
||||
private readonly totalTabs = 4;
|
||||
/** Active CBS base interest rate versions for the selected product's FD type */
|
||||
cbsBaseRates: any[] = [];
|
||||
/** Tenure selected from the interest rate chart step */
|
||||
@@ -249,7 +243,6 @@ export class CreateFixedDepositAccountComponent {
|
||||
...this.fixedDepositAccount,
|
||||
...terms,
|
||||
...settings,
|
||||
...(this.fixedDepositAccountMaturityTermsStep?.closureSettings ?? {}),
|
||||
...(this.selectedTenure
|
||||
? {
|
||||
depositPeriod: this.selectedTenure.depositPeriod,
|
||||
|
||||
+1
-36
@@ -35,7 +35,6 @@
|
||||
<mifosx-fixed-deposit-account-details-step
|
||||
[fixedDepositsAccountTemplate]="fixedDepositsAccountAndTemplate"
|
||||
(fixedDepositsAccountProductTemplate)="setTemplate($event)"
|
||||
[externalLinkedAccountId]="fixedDepositAccountMaturityTermsStep?.selectedTransferAccount?.id ?? null"
|
||||
[hideButtons]="true"
|
||||
>
|
||||
</mifosx-fixed-deposit-account-details-step>
|
||||
@@ -112,40 +111,7 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 4: Terms -->
|
||||
<mat-tab [disabled]="!fixedDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="file-alt" class="cfa-tab__icon"></fa-icon>
|
||||
Terms
|
||||
</ng-template>
|
||||
<div class="cfa-tab-body">
|
||||
@if (fixedDepositsAccountProductTemplate) {
|
||||
<mifosx-fixed-deposit-account-maturity-terms-step
|
||||
[fixedDepositsAccountTemplate]="fixedDepositsAccountAndTemplate"
|
||||
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate"
|
||||
[linkedSavingsAccountId]="
|
||||
fixedDepositsAccountDetailsStep?.selectedLinkedAccount?.accountType === 'SAVINGS'
|
||||
? fixedDepositsAccountDetailsStep?.selectedLinkedAccount?.id
|
||||
: null
|
||||
"
|
||||
></mifosx-fixed-deposit-account-maturity-terms-step>
|
||||
}
|
||||
|
||||
<div class="cfa-actions">
|
||||
<button mat-stroked-button (click)="prev()">
|
||||
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Previous' | translate }}
|
||||
</button>
|
||||
<span class="cfa-actions__spacer"></span>
|
||||
<button mat-raised-button color="primary" (click)="next()">
|
||||
{{ 'labels.buttons.Next' | translate }}
|
||||
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 5: Preview -->
|
||||
<!-- Tab 4: Preview -->
|
||||
<mat-tab [disabled]="!fixedDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="eye" class="cfa-tab__icon"></fa-icon>
|
||||
@@ -159,7 +125,6 @@
|
||||
[fixedDepositAccountData]="fixedDepositAccount"
|
||||
[selectedTenure]="selectedTenure"
|
||||
[fdNominees]="fixedDepositAccountCurrencyStep?.nominees ?? []"
|
||||
[closureSettings]="fixedDepositAccountMaturityTermsStep?.closureSettings ?? {}"
|
||||
[hideButtons]="true"
|
||||
(submitEvent)="submit()"
|
||||
></mifosx-fixed-deposit-account-preview-step>
|
||||
|
||||
+1
-8
@@ -25,7 +25,6 @@ import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { FixedDepositAccountInterestRateChartStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-interest-rate-chart-step/fixed-deposit-account-interest-rate-chart-step.component';
|
||||
import { FixedDepositAccountPreviewStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component';
|
||||
import { FixedDepositAccountMaturityTermsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-maturity-terms-step/fixed-deposit-account-maturity-terms-step.component';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
FixedDepositAccountDetailsStepComponent,
|
||||
FixedDepositAccountInterestRateChartStepComponent,
|
||||
FixedDepositAccountCurrencyStepComponent,
|
||||
FixedDepositAccountMaturityTermsStepComponent,
|
||||
FixedDepositAccountPreviewStepComponent
|
||||
]
|
||||
})
|
||||
@@ -60,10 +58,6 @@ export class EditFixedDepositAccountComponent {
|
||||
fixedDepositsAccountDetailsStep: FixedDepositAccountDetailsStepComponent;
|
||||
@ViewChild(FixedDepositAccountCurrencyStepComponent)
|
||||
fixedDepositAccountCurrencyStep: FixedDepositAccountCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositAccountPreviewStepComponent)
|
||||
fixedDepositAccountPreviewStep: FixedDepositAccountPreviewStepComponent;
|
||||
@ViewChild(FixedDepositAccountMaturityTermsStepComponent)
|
||||
fixedDepositAccountMaturityTermsStep: FixedDepositAccountMaturityTermsStepComponent;
|
||||
|
||||
/** Full account data + template from resolver */
|
||||
fixedDepositsAccountAndTemplate: any;
|
||||
@@ -71,7 +65,7 @@ export class EditFixedDepositAccountComponent {
|
||||
fixedDepositsAccountProductTemplate: any;
|
||||
/** Currently visible wizard tab (0-indexed). */
|
||||
selectedTabIndex = 0;
|
||||
private readonly totalTabs = 5;
|
||||
private readonly totalTabs = 4;
|
||||
/** Active CBS base interest rate versions for the selected product's FD type */
|
||||
cbsBaseRates: any[] = [];
|
||||
/** Tenure selected from the interest rate chart step */
|
||||
@@ -242,7 +236,6 @@ export class EditFixedDepositAccountComponent {
|
||||
...this.fixedDepositAccount,
|
||||
...terms,
|
||||
...settings,
|
||||
...(this.fixedDepositAccountMaturityTermsStep?.closureSettings ?? {}),
|
||||
...(this.selectedTenure
|
||||
? {
|
||||
depositPeriod: this.selectedTenure.depositPeriod,
|
||||
|
||||
+2
-32
@@ -7,17 +7,7 @@
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
inject,
|
||||
ChangeDetectorRef
|
||||
} from '@angular/core';
|
||||
import { Component, OnInit, Input, Output, EventEmitter, inject, ChangeDetectorRef } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, FormsModule } from '@angular/forms';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
@@ -53,7 +43,7 @@ import { IntroducerSearchComponent } from 'app/shared/introducer-search/introduc
|
||||
IntroducerSearchComponent
|
||||
]
|
||||
})
|
||||
export class FixedDepositAccountDetailsStepComponent implements OnInit, OnChanges {
|
||||
export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
@@ -66,9 +56,6 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit, OnChange
|
||||
/** Fixed Deposits Account Template */
|
||||
@Input() fixedDepositsAccountTemplate: any;
|
||||
@Input() hideButtons = false;
|
||||
/** Linked-account id picked elsewhere in the wizard (e.g. the Terms step's Transfer to Savings
|
||||
* account) -- pre-fills this card so the officer doesn't have to pick the same account twice. */
|
||||
@Input() externalLinkedAccountId: number | null = null;
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -235,23 +222,6 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit, OnChange
|
||||
this.dalSearch = '';
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (!changes.externalLinkedAccountId || this.selectedLinkedAccount) {
|
||||
return;
|
||||
}
|
||||
const id = this.externalLinkedAccountId;
|
||||
if (!id) return;
|
||||
const savings = this.dalAllSavings.find((a: any) => a.id === id);
|
||||
const current = this.dalAllCurrent.find((a: any) => a.id === id);
|
||||
if (savings) {
|
||||
this.dalSelectedType = 'SAVINGS';
|
||||
this.selectedLinkedAccount = savings;
|
||||
} else if (current) {
|
||||
this.dalSelectedType = 'CURRENT';
|
||||
this.selectedLinkedAccount = current;
|
||||
}
|
||||
}
|
||||
|
||||
private loadClientAccounts(): void {
|
||||
const clientId = String(this.fixedDepositsAccountTemplate?.clientId);
|
||||
if (!clientId) return;
|
||||
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<form [formGroup]="closureSettingsForm" class="layout-row-wrap gap-2px responsive-column">
|
||||
<h4 class="mat-h4 flex-98">{{ 'labels.heading.For Pre-mature closure' | translate }}</h4>
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Maturity Instructions' | translate }}</mat-label>
|
||||
<mat-select formControlName="maturityInstructionId">
|
||||
@for (maturityInstruction of maturityInstructionOptions; track maturityInstruction) {
|
||||
<mat-option [value]="maturityInstruction.id">
|
||||
{{ maturityInstruction.value | translateKey: 'catalogs' }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@if (closureSettingsForm.contains('transferToSavingsId')) {
|
||||
<div class="dal-card flex-98">
|
||||
<div class="dal-card__header">
|
||||
<div class="dal-card__header-left">
|
||||
<div class="dal-card__icon">
|
||||
<mat-icon>savings</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="dal-card__title">{{ 'labels.inputs.Transfer to savings account' | translate }}</h3>
|
||||
<span class="dal-card__sub">Maturity proceeds will be credited to this account</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dal-card__body">
|
||||
@if (selectedTransferAccount) {
|
||||
<div class="dal-selected">
|
||||
<div class="dal-selected__info">
|
||||
<span class="dal-type-badge dal-type-badge--savings">
|
||||
<mat-icon>savings</mat-icon>
|
||||
Savings
|
||||
</span>
|
||||
<div class="dal-selected__details">
|
||||
<span class="dal-selected__accno">{{ selectedTransferAccount.accountNo }}</span>
|
||||
<span class="dal-selected__product">{{ selectedTransferAccount.savingsProductName }}</span>
|
||||
</div>
|
||||
@if (selectedTransferAccount.summary?.accountBalance != null) {
|
||||
<div class="dal-selected__balance">
|
||||
<span class="dal-selected__bal-label">Balance</span>
|
||||
<span class="dal-selected__bal-amount">
|
||||
{{ selectedTransferAccount.currency?.code }}
|
||||
{{ selectedTransferAccount.summary.accountBalance | number: '1.2-2' }}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button
|
||||
mat-stroked-button
|
||||
color="primary"
|
||||
type="button"
|
||||
class="dal-change-btn"
|
||||
(click)="clearTransferAccount()"
|
||||
>
|
||||
<mat-icon>swap_horiz</mat-icon>
|
||||
Change
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<mat-form-field appearance="outline" class="flex-98">
|
||||
<mat-label>{{ 'labels.inputs.Transfer to savings account' | translate }}</mat-label>
|
||||
<mat-select formControlName="transferToSavingsId" required>
|
||||
@for (account of savingsAccountsData; track account) {
|
||||
<mat-option [value]="account.id">
|
||||
({{ account.accountNo }}) {{ account.savingsProductName }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-error>Transfer to savings account is required</mat-error>
|
||||
</mat-form-field>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-checkbox class="flex-98 margin-v" labelPosition="before" formControlName="preClosurePenalApplicable">
|
||||
{{ 'labels.inputs.Apply Penal Interest (less)' | translate }}
|
||||
</mat-checkbox>
|
||||
|
||||
@if (closureSettingsForm.value.preClosurePenalApplicable) {
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Penal Interest' | translate }} (%)</mat-label>
|
||||
<input type="number" matInput formControlName="preClosurePenalInterest" min="0" step="0.01" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Period' | translate }}</mat-label>
|
||||
<mat-select formControlName="preClosurePenalInterestOnTypeId">
|
||||
@for (preClosurePenalInterestOnType of preClosurePenalInterestOnTypeData; track preClosurePenalInterestOnType) {
|
||||
<mat-option [value]="preClosurePenalInterestOnType.id">
|
||||
{{ preClosurePenalInterestOnType.value | translateKey: 'catalogs' }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
}
|
||||
</form>
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
// ── Transfer-to-Savings account card (mirrors the Deposit Account Link card) ──
|
||||
|
||||
.dal-card {
|
||||
margin-top: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
||||
}
|
||||
|
||||
&__header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 10px;
|
||||
background: #0ea5e9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 20px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.dal-selected {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 20px;
|
||||
border: 2px solid #0ea5e9;
|
||||
border-radius: 12px;
|
||||
background: #f0f9ff;
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex: 1;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__accno {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
&__product {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
&__balance {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&__bal-label {
|
||||
font-size: 10px;
|
||||
color: #94a3b8;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
&__bal-amount {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
}
|
||||
}
|
||||
|
||||
.dal-change-btn {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dal-type-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
border: 1px solid #e2e8f0;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&--savings {
|
||||
background: #eff6ff;
|
||||
color: #1d4ed8;
|
||||
border-color: #bfdbfe;
|
||||
|
||||
mat-icon {
|
||||
color: #2563eb;
|
||||
}
|
||||
}
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, Input, OnChanges, SimpleChanges, inject } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* Fixed Deposit Account Maturity Terms Step -- what happens to this account at maturity
|
||||
* (Withdraw / Transfer to Savings / Reinvest) and the pre-mature-closure penalty, decided
|
||||
* per account rather than silently inherited from the product.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-fixed-deposit-account-maturity-terms-step',
|
||||
templateUrl: './fixed-deposit-account-maturity-terms-step.component.html',
|
||||
styleUrls: ['./fixed-deposit-account-maturity-terms-step.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatCheckbox,
|
||||
MatIcon
|
||||
]
|
||||
})
|
||||
export class FixedDepositAccountMaturityTermsStepComponent implements OnChanges {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
|
||||
@Input() fixedDepositsAccountTemplate: any;
|
||||
@Input() fixedDepositsAccountProductTemplate: any;
|
||||
/** Account already linked elsewhere in the wizard (the Details step's Deposit Account Link) --
|
||||
* pre-fills Transfer to Savings so the officer doesn't have to pick the same account twice. */
|
||||
@Input() linkedSavingsAccountId: number | null = null;
|
||||
|
||||
closureSettingsForm: UntypedFormGroup;
|
||||
maturityInstructionOptions: any[] = [];
|
||||
savingsAccountsData: any[] = [];
|
||||
preClosurePenalInterestOnTypeData: any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.closureSettingsForm = this.formBuilder.group({
|
||||
maturityInstructionId: [''],
|
||||
preClosurePenalApplicable: [false],
|
||||
preClosurePenalInterest: [
|
||||
'',
|
||||
Validators.min(0)
|
||||
],
|
||||
preClosurePenalInterestOnTypeId: ['']
|
||||
});
|
||||
this.closureSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
|
||||
// 200 = Transfer to Savings -- Withdraw Deposit (100) needs no target account, and both
|
||||
// Reinvest options (300/400) open a brand-new FD instead, so they ignore this field too.
|
||||
if (value === 200) {
|
||||
this.closureSettingsForm.addControl(
|
||||
'transferToSavingsId',
|
||||
new UntypedFormControl(this.linkedSavingsAccountId ?? '', Validators.required)
|
||||
);
|
||||
} else {
|
||||
this.closureSettingsForm.removeControl('transferToSavingsId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.linkedSavingsAccountId) {
|
||||
const control = this.closureSettingsForm.get('transferToSavingsId');
|
||||
if (control && !control.value && this.linkedSavingsAccountId) {
|
||||
control.setValue(this.linkedSavingsAccountId);
|
||||
}
|
||||
}
|
||||
if (this.fixedDepositsAccountProductTemplate) {
|
||||
// Withdraw Deposit (id 100) books the maturity proceeds out of the bank's cash/vault the moment
|
||||
// the account matures, before the customer has actually collected it -- disabled everywhere.
|
||||
this.maturityInstructionOptions = (
|
||||
this.fixedDepositsAccountProductTemplate.maturityInstructionOptions ?? []
|
||||
).filter((option: any) => option.id !== 100);
|
||||
this.savingsAccountsData = this.fixedDepositsAccountProductTemplate.savingsAccounts ?? [];
|
||||
this.preClosurePenalInterestOnTypeData =
|
||||
this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnTypeOptions ?? [];
|
||||
if (!this.closureSettingsForm.get('preClosurePenalApplicable').dirty) {
|
||||
this.closureSettingsForm.patchValue({
|
||||
preClosurePenalApplicable: this.fixedDepositsAccountProductTemplate.preClosurePenalApplicable ?? false,
|
||||
preClosurePenalInterest: this.fixedDepositsAccountProductTemplate.preClosurePenalInterest ?? '',
|
||||
preClosurePenalInterestOnTypeId:
|
||||
this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType?.id ?? ''
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The linked-savings account for the transfer-to-savings maturity instruction, once picked. */
|
||||
get selectedTransferAccount(): any {
|
||||
const id = this.closureSettingsForm.value.transferToSavingsId;
|
||||
if (!id) return null;
|
||||
return this.savingsAccountsData.find((account: any) => account.id === id) ?? null;
|
||||
}
|
||||
|
||||
clearTransferAccount(): void {
|
||||
this.closureSettingsForm.get('transferToSavingsId')?.setValue('');
|
||||
}
|
||||
|
||||
/** Chosen maturity/closure settings, ready to merge into the submit payload. */
|
||||
get closureSettings() {
|
||||
const settings = this.closureSettingsForm.getRawValue();
|
||||
for (const key in settings) {
|
||||
if (settings[key] === '') {
|
||||
delete settings[key];
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
-35
@@ -683,41 +683,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-section">
|
||||
<div class="preview-section__header">
|
||||
<i class="fas fa-flag-checkered preview-section__icon"></i>
|
||||
<span class="preview-section__title">Maturity & Pre-mature Closure</span>
|
||||
</div>
|
||||
<div class="preview-body">
|
||||
<div class="preview-grid preview-grid--three">
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Maturity Instructions' | translate }}</span>
|
||||
<span class="preview-value">{{ closureMaturityInstructionLabel }}</span>
|
||||
</div>
|
||||
@if (closureSettings?.transferToSavingsId) {
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Transfer to savings account' | translate }}</span>
|
||||
<span class="preview-value">{{ closureTransferToSavingsLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Apply Penal Interest (less)' | translate }}</span>
|
||||
<span class="preview-value">{{ closureSettings?.preClosurePenalApplicable | yesNo }}</span>
|
||||
</div>
|
||||
@if (closureSettings?.preClosurePenalApplicable) {
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Penal Interest' | translate }} (%)</span>
|
||||
<span class="preview-value">{{ closureSettings?.preClosurePenalInterest }}%</span>
|
||||
</div>
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Period' | translate }}</span>
|
||||
<span class="preview-value">{{ closurePenalInterestOnTypeLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!hideButtons) {
|
||||
<div class="layout-row responsive-column align-center gap-2px margin-t">
|
||||
<button mat-raised-button matStepperPrevious>
|
||||
|
||||
+1
-20
@@ -164,26 +164,7 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
/** Form submission event */
|
||||
@Output() submitEvent = new EventEmitter();
|
||||
|
||||
/** Maturity/pre-mature-closure choices made in the Terms step -- shown here read-only. */
|
||||
@Input() closureSettings: any = {};
|
||||
|
||||
get closureMaturityInstructionLabel(): string {
|
||||
const options = this.fixedDepositsAccountProductTemplate?.maturityInstructionOptions ?? [];
|
||||
const match = options.find((o: any) => o.id === this.closureSettings?.maturityInstructionId);
|
||||
return match?.value ?? '—';
|
||||
}
|
||||
|
||||
get closureTransferToSavingsLabel(): string {
|
||||
const accounts = this.fixedDepositsAccountProductTemplate?.savingsAccounts ?? [];
|
||||
const match = accounts.find((a: any) => a.id === this.closureSettings?.transferToSavingsId);
|
||||
return match ? `(${match.accountNo}) ${match.savingsProductName}` : '—';
|
||||
}
|
||||
|
||||
get closurePenalInterestOnTypeLabel(): string {
|
||||
const options = this.fixedDepositsAccountProductTemplate?.preClosurePenalInterestOnTypeOptions ?? [];
|
||||
const match = options.find((o: any) => o.id === this.closureSettings?.preClosurePenalInterestOnTypeId);
|
||||
return match?.value ?? '—';
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.fixedDepositsAccountProductTemplate) {
|
||||
|
||||
-191
@@ -1,191 +0,0 @@
|
||||
<!--
|
||||
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="pmt">
|
||||
<div class="pmt__header">
|
||||
<span class="pmt__header-ico"><fa-icon icon="sync-alt"></fa-icon></span>
|
||||
<div class="pmt__header-text">
|
||||
<h2 class="pmt__title">{{ 'labels.heading.Payment' | translate }}</h2>
|
||||
<p class="pmt__subtitle">Process this Fixed Deposit now -- works whether it's Active or Matured.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-content class="pmt__content">
|
||||
@if (loadingTemplate) {
|
||||
<div class="pmt__loading">
|
||||
<mat-spinner diameter="36"></mat-spinner>
|
||||
</div>
|
||||
} @else if (loadFailed) {
|
||||
<div class="pmt__error" role="alert">
|
||||
<fa-icon icon="times-circle" class="m-r-10"></fa-icon>
|
||||
Could not load this account's payment options. Close this dialog and try again.
|
||||
</div>
|
||||
} @else {
|
||||
<form [formGroup]="paymentForm">
|
||||
@if (reinvestCap !== null && reinvestCap !== undefined) {
|
||||
<div class="pmt__stat">
|
||||
<span class="pmt__stat-label">
|
||||
{{
|
||||
remainderIsApproximate
|
||||
? 'Amount available on the selected date'
|
||||
: ('labels.inputs.Maturity Amount' | translate)
|
||||
}}
|
||||
</span>
|
||||
<span class="pmt__stat-value">{{ reinvestCap | formatNumber }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline" class="pmt__date" (click)="closedOnDatePicker.open()">
|
||||
<mat-label>{{ 'labels.inputs.Closed On Date' | translate }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[max]="maxDate"
|
||||
[matDatepicker]="closedOnDatePicker"
|
||||
required
|
||||
formControlName="closedOnDate"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="closedOnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #closedOnDatePicker></mat-datepicker>
|
||||
@if (paymentForm.controls.closedOnDate.hasError('required')) {
|
||||
<mat-error>
|
||||
{{ 'labels.inputs.Closed On Date' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<div class="pmt__section-label" id="pmt-action-label">{{ 'labels.inputs.Action' | translate }}</div>
|
||||
<div class="pmt__options" role="radiogroup" aria-labelledby="pmt-action-label">
|
||||
@for (closureOption of onAccountClosureOptions; track closureOption) {
|
||||
<button
|
||||
type="button"
|
||||
class="pmt__option"
|
||||
role="radio"
|
||||
[attr.aria-checked]="paymentForm.get('onAccountClosureId').value === closureOption.id"
|
||||
[class.pmt__option--active]="paymentForm.get('onAccountClosureId').value === closureOption.id"
|
||||
(click)="selectClosureType(closureOption.id)"
|
||||
>
|
||||
<span class="pmt__option-ico"><fa-icon [icon]="iconFor(closureOption.id)"></fa-icon></span>
|
||||
<span class="pmt__option-text">
|
||||
<span class="pmt__option-title">{{ closureOption.value }}</span>
|
||||
<span class="pmt__option-desc">{{ descriptionFor(closureOption.id) }}</span>
|
||||
</span>
|
||||
@if (paymentForm.get('onAccountClosureId').value === closureOption.id) {
|
||||
<fa-icon icon="check-circle" class="pmt__option-check"></fa-icon>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
@if (
|
||||
paymentForm.controls.onAccountClosureId.hasError('required') &&
|
||||
paymentForm.controls.onAccountClosureId.touched
|
||||
) {
|
||||
<div class="pmt__option-error">
|
||||
{{ 'labels.inputs.Account action' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
{{ 'labels.commons.required' | translate }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (isPartialReinvest) {
|
||||
<div class="pmt__split">
|
||||
<mat-form-field appearance="outline" class="pmt__split-input">
|
||||
<mat-label>{{ 'labels.inputs.Reinvest Amount' | translate }}</mat-label>
|
||||
<input type="number" matInput required formControlName="reinvestAmount" />
|
||||
@if (paymentForm.controls.reinvestAmount?.hasError('required')) {
|
||||
<mat-error>
|
||||
{{ 'labels.inputs.Reinvest Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
}
|
||||
@if (paymentForm.controls.reinvestAmount?.hasError('min')) {
|
||||
<mat-error>{{ 'labels.inputs.Reinvest Amount must be greater than zero' | translate }}</mat-error>
|
||||
}
|
||||
@if (paymentForm.controls.reinvestAmount?.hasError('belowMaturityAmount')) {
|
||||
<mat-error>{{
|
||||
'labels.inputs.Reinvest Amount must be less than the maturity amount' | translate
|
||||
}}</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
<span class="pmt__split-arrow"><fa-icon icon="arrow-right"></fa-icon></span>
|
||||
<div class="pmt__split-remainder">
|
||||
<span class="pmt__split-remainder-label">{{ 'labels.inputs.Remainder to Transfer' | translate }}</span>
|
||||
<span class="pmt__split-remainder-value">{{
|
||||
remainderAmount !== null ? (remainderAmount | formatNumber) : '—'
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@if (remainderIsApproximate) {
|
||||
<p class="pmt__hint">
|
||||
<fa-icon icon="info-circle" class="m-r-5"></fa-icon>
|
||||
The selected date is before maturity. Interest up to that date is posted first, so the amount actually
|
||||
transferred will be at least the figure shown.
|
||||
</p>
|
||||
}
|
||||
}
|
||||
|
||||
@if (noDestinationAccounts) {
|
||||
<p class="pmt__hint pmt__hint--warn" role="alert">
|
||||
<fa-icon icon="info-circle" class="m-r-5"></fa-icon>
|
||||
This customer has no active savings account to transfer into. Open one first, or choose an action that keeps
|
||||
the funds in this deposit.
|
||||
</p>
|
||||
}
|
||||
|
||||
@if (paymentForm.contains('toSavingsAccountId')) {
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ 'labels.inputs.Transfer to Savings' | translate }}</mat-label>
|
||||
<mat-select required formControlName="toSavingsAccountId">
|
||||
@for (account of savingsAccountsData; track account) {
|
||||
<mat-option [value]="account.id">
|
||||
{{ account.accountNo }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
@if (paymentForm.controls.toSavingsAccountId?.hasError('required')) {
|
||||
<mat-error>
|
||||
{{ 'labels.inputs.Transfer to savings account' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
@if (paymentForm.contains('transferDescription')) {
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ 'labels.inputs.Transfer Description' | translate }}</mat-label>
|
||||
<input matInput formControlName="transferDescription" />
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ 'labels.inputs.Note' | translate }}</mat-label>
|
||||
<textarea matInput formControlName="note" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
@if (submitError) {
|
||||
<p class="pmt__error" role="alert">
|
||||
<fa-icon icon="times-circle" class="m-r-5"></fa-icon>
|
||||
{{ submitError }}
|
||||
</p>
|
||||
}
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions align="end" class="pmt__actions">
|
||||
<button mat-button mat-dialog-close [disabled]="submitting">{{ 'labels.buttons.Cancel' | translate }}</button>
|
||||
<button
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
[disabled]="!paymentForm?.valid || submitting || loadFailed"
|
||||
(click)="submit()"
|
||||
>
|
||||
{{ submitting ? ('labels.buttons.Processing' | translate) : ('labels.buttons.Confirm' | translate) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
-296
@@ -1,296 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$navy: #0d1b2a;
|
||||
$slate: #475569;
|
||||
$muted: #64748b;
|
||||
$border: #e2e8f0;
|
||||
$soft: #f8fafc;
|
||||
$blue: #1e40af;
|
||||
$blue-soft: #eff6ff;
|
||||
$green: #166534;
|
||||
$green-soft: #f0fdf4;
|
||||
|
||||
.pmt {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 320px;
|
||||
max-height: 85vh;
|
||||
overflow: hidden;
|
||||
margin: -24px;
|
||||
}
|
||||
|
||||
.pmt__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
padding: 22px 28px 18px;
|
||||
background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 55%, #4338ca 100%);
|
||||
color: #fff;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.pmt__header-ico {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
min-width: 40px;
|
||||
border-radius: 10px;
|
||||
background: rgb(255 255 255 / 15%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pmt__title {
|
||||
margin: 0;
|
||||
font-size: 19px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pmt__subtitle {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12.5px;
|
||||
color: rgb(255 255 255 / 82%);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.pmt__content {
|
||||
padding: 22px 28px 8px !important;
|
||||
overflow-y: auto;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.pmt__loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 260px;
|
||||
}
|
||||
|
||||
.pmt__stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
background: $blue-soft;
|
||||
border: 1px solid #dbeafe;
|
||||
border-radius: 10px;
|
||||
padding: 12px 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.pmt__stat-label {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
.pmt__stat-value {
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
color: $navy;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.pmt__date {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pmt__section-label {
|
||||
font-size: 11.5px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: $slate;
|
||||
margin: 4px 0 10px;
|
||||
}
|
||||
|
||||
.pmt__options {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
|
||||
gap: 10px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.pmt__option {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
border: 1.5px solid $border;
|
||||
border-radius: 10px;
|
||||
padding: 12px 14px;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
background 0.15s,
|
||||
box-shadow 0.15s;
|
||||
}
|
||||
|
||||
.pmt__option:hover {
|
||||
border-color: #93c5fd;
|
||||
background: $blue-soft;
|
||||
}
|
||||
|
||||
.pmt__option--active {
|
||||
border-color: $blue;
|
||||
background: $blue-soft;
|
||||
box-shadow: 0 0 0 1px $blue;
|
||||
}
|
||||
|
||||
.pmt__option-ico {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
min-width: 30px;
|
||||
border-radius: 8px;
|
||||
background: $soft;
|
||||
color: $blue;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pmt__option--active .pmt__option-ico {
|
||||
background: $blue;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.pmt__option-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.pmt__option-title {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: $navy;
|
||||
}
|
||||
|
||||
.pmt__option-desc {
|
||||
font-size: 11px;
|
||||
color: $muted;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.pmt__option:focus-visible {
|
||||
outline: 2px solid $blue;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.pmt__option-check {
|
||||
margin-left: auto;
|
||||
color: $blue;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pmt__option-error {
|
||||
color: #b91c1c;
|
||||
font-size: 12px;
|
||||
margin: 4px 0 14px;
|
||||
}
|
||||
|
||||
.pmt__error {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
background: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
border-radius: 8px;
|
||||
color: #b91c1c;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.45;
|
||||
padding: 10px 14px;
|
||||
margin: 4px 0 8px;
|
||||
}
|
||||
|
||||
.pmt__hint {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
background: $soft;
|
||||
border: 1px solid $border;
|
||||
border-radius: 8px;
|
||||
color: $slate;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
padding: 9px 13px;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.pmt__hint--warn {
|
||||
background: #fffbeb;
|
||||
border-color: #fde68a;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.pmt__split {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
background: $soft;
|
||||
border: 1px dashed #cbd5e1;
|
||||
border-radius: 10px;
|
||||
padding: 14px 16px 0;
|
||||
margin: 4px 0 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.pmt__split-input {
|
||||
flex: 1 1 180px;
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
.pmt__split-arrow {
|
||||
color: $muted;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.pmt__split-remainder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
background: $green-soft;
|
||||
border: 1px solid #bbf7d0;
|
||||
border-radius: 8px;
|
||||
padding: 8px 14px;
|
||||
margin-bottom: 14px;
|
||||
flex: 1 1 180px;
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
.pmt__split-remainder-label {
|
||||
font-size: 10.5px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: $green;
|
||||
}
|
||||
|
||||
.pmt__split-remainder-value {
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
color: $green;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.pmt__content mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pmt__actions {
|
||||
padding: 14px 28px 20px !important;
|
||||
border-top: 1px solid $border;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
-288
@@ -1,288 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogRef,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose
|
||||
} from '@angular/material/dialog';
|
||||
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, UntypedFormControl, ValidatorFn, Validators } from '@angular/forms';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { FormatNumberPipe } from '../../../../../pipes/format-number.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* "Payment" dialog -- an always-available alternative to Premature Close (Active-only, no reinvest) and
|
||||
* Close (Matured-only, no partial option). Works on an FD in either state and offers a fourth choice,
|
||||
* Partial Reinvest, alongside the ones the backend's `DepositAccountOnClosureType` already had: the
|
||||
* entered amount renews on this same account, the rest transfers to a savings account picked here.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-payment-dialog',
|
||||
templateUrl: './payment-dialog.component.html',
|
||||
styleUrls: ['./payment-dialog.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
CdkScrollable,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
CdkTextareaAutosize,
|
||||
MatProgressSpinnerModule,
|
||||
FaIconComponent,
|
||||
FormatNumberPipe
|
||||
]
|
||||
})
|
||||
export class PaymentDialogComponent implements OnInit {
|
||||
/** The `onAccountClosureId` codes each closure type is registered under on the backend. */
|
||||
private static readonly WITHDRAW_DEPOSIT_ID = 100;
|
||||
private static readonly TRANSFER_TO_SAVINGS_ID = 200;
|
||||
private static readonly REINVEST_FULL_ID = 300;
|
||||
private static readonly REINVEST_PRINCIPAL_ID = 400;
|
||||
private static readonly PARTIAL_REINVEST_ID = 500;
|
||||
|
||||
private static readonly ACTION_ICONS: Record<number, string> = {
|
||||
[PaymentDialogComponent.WITHDRAW_DEPOSIT_ID]: 'money-bill-wave',
|
||||
[PaymentDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'wallet',
|
||||
[PaymentDialogComponent.REINVEST_FULL_ID]: 'sync-alt',
|
||||
[PaymentDialogComponent.REINVEST_PRINCIPAL_ID]: 'piggy-bank',
|
||||
[PaymentDialogComponent.PARTIAL_REINVEST_ID]: 'arrows-alt-h'
|
||||
};
|
||||
|
||||
private static readonly ACTION_DESCRIPTIONS: Record<number, string> = {
|
||||
[PaymentDialogComponent.WITHDRAW_DEPOSIT_ID]: 'Pay out the full balance in cash',
|
||||
[PaymentDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'Move the full balance to another savings account',
|
||||
[PaymentDialogComponent.REINVEST_FULL_ID]: 'Renew the full amount, same account number',
|
||||
[PaymentDialogComponent.REINVEST_PRINCIPAL_ID]:
|
||||
'Renew only the principal; interest transferred to a savings account',
|
||||
[PaymentDialogComponent.PARTIAL_REINVEST_ID]: 'Renew part of it here; transfer the rest'
|
||||
};
|
||||
|
||||
dialogRef = inject<MatDialogRef<PaymentDialogComponent>>(MatDialogRef);
|
||||
data: { accountId: number | string; accountBalance?: number; maturityDate?: any } = inject(MAT_DIALOG_DATA);
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
paymentForm: UntypedFormGroup;
|
||||
/** Loaded once, on open, from the same closure template the existing Close action already uses. */
|
||||
onAccountClosureOptions: any[] = [];
|
||||
savingsAccountsData: any[] = [];
|
||||
maturityAmount: number = null;
|
||||
loadingTemplate = true;
|
||||
loadFailed = false;
|
||||
submitting = false;
|
||||
submitError: string = null;
|
||||
maxDate: Date;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.paymentForm = this.formBuilder.group({
|
||||
closedOnDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
onAccountClosureId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
note: ['']
|
||||
});
|
||||
this.paymentForm.get('onAccountClosureId').valueChanges.subscribe((id: number) => this.onClosureTypeChange(id));
|
||||
// The cap depends on whether the chosen date is on or after maturity, so a date change can make an
|
||||
// already-entered amount valid or invalid. Without this the amount keeps its verdict from the old date.
|
||||
this.paymentForm
|
||||
.get('closedOnDate')
|
||||
.valueChanges.subscribe(() =>
|
||||
this.paymentForm.get('reinvestAmount')?.updateValueAndValidity({ emitEvent: false })
|
||||
);
|
||||
|
||||
this.fixedDepositsService.getFixedDepositsAccountPaymentTemplate(this.data.accountId as string).subscribe({
|
||||
next: (response: any) => {
|
||||
// Withdraw Deposit books cash out of the vault immediately, which isn't appropriate for a
|
||||
// staff-triggered Payment that may run well before or after the actual counter transaction --
|
||||
// Transfer to Savings or a Reinvest option covers every real case instead.
|
||||
this.onAccountClosureOptions = (response.onAccountClosureOptions ?? []).filter(
|
||||
(option: any) => option.id !== PaymentDialogComponent.WITHDRAW_DEPOSIT_ID
|
||||
);
|
||||
this.savingsAccountsData = response.savingsAccounts ?? [];
|
||||
this.maturityAmount = response.maturityAmount;
|
||||
this.loadingTemplate = false;
|
||||
},
|
||||
// Without this the spinner would run forever on a failed load, leaving Cancel as the only way out
|
||||
// and no indication of why the form never appeared.
|
||||
error: () => {
|
||||
this.loadingTemplate = false;
|
||||
this.loadFailed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount being split, and the bound the entered partial amount is checked against.
|
||||
* <p>
|
||||
* The server derives this from the account's balance AFTER it posts interest up to the chosen date, so which figure
|
||||
* matches depends on that date. On or after maturity it posts the remaining full-rate interest, landing on the
|
||||
* maturity amount. Before maturity it posts penalty-aware interest instead, which lands somewhere between the current
|
||||
* balance and the maturity amount -- unknowable here, so the current balance is used as a floor that can never accept
|
||||
* an amount the server would reject, and {@link remainderIsApproximate} tells the user the transfer will be larger.
|
||||
*/
|
||||
get reinvestCap(): number | null {
|
||||
if (this.processingOnOrAfterMaturity) {
|
||||
return this.maturityAmount ?? this.data.accountBalance ?? null;
|
||||
}
|
||||
return this.data.accountBalance ?? this.maturityAmount ?? null;
|
||||
}
|
||||
|
||||
/** Whether the chosen closure date is on or after the deposit's maturity date. */
|
||||
private get processingOnOrAfterMaturity(): boolean {
|
||||
const chosen = this.paymentForm?.get('closedOnDate')?.value;
|
||||
if (!chosen || !this.data.maturityDate) {
|
||||
return false;
|
||||
}
|
||||
return this.toTime(chosen) >= this.toTime(this.data.maturityDate);
|
||||
}
|
||||
|
||||
/** Dates arrive here either as a Date from the picker or as the API's [yyyy, mm, dd] array. */
|
||||
private toTime(value: any): number {
|
||||
if (value instanceof Date) {
|
||||
return new Date(value.getFullYear(), value.getMonth(), value.getDate()).getTime();
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
const [
|
||||
year,
|
||||
month,
|
||||
day
|
||||
] = value;
|
||||
return new Date(year, (month ?? 1) - 1, day ?? 1).getTime();
|
||||
}
|
||||
return new Date(value).getTime();
|
||||
}
|
||||
|
||||
/** True when the cap is the pre-maturity balance, so the figures shown are a floor rather than exact. */
|
||||
get remainderIsApproximate(): boolean {
|
||||
return !this.processingOnOrAfterMaturity;
|
||||
}
|
||||
|
||||
iconFor(id: number): string {
|
||||
return PaymentDialogComponent.ACTION_ICONS[id] ?? 'circle';
|
||||
}
|
||||
|
||||
descriptionFor(id: number): string {
|
||||
return PaymentDialogComponent.ACTION_DESCRIPTIONS[id] ?? '';
|
||||
}
|
||||
|
||||
selectClosureType(id: number): void {
|
||||
this.paymentForm.get('onAccountClosureId').setValue(id);
|
||||
this.paymentForm.get('onAccountClosureId').markAsTouched();
|
||||
}
|
||||
|
||||
/** Adds/removes the destination-account and partial-amount controls to match what the chosen type needs. */
|
||||
private onClosureTypeChange(id: number): void {
|
||||
const needsDestinationAccount =
|
||||
id === PaymentDialogComponent.TRANSFER_TO_SAVINGS_ID ||
|
||||
id === PaymentDialogComponent.PARTIAL_REINVEST_ID ||
|
||||
id === PaymentDialogComponent.REINVEST_PRINCIPAL_ID;
|
||||
if (needsDestinationAccount) {
|
||||
if (!this.paymentForm.contains('toSavingsAccountId')) {
|
||||
this.paymentForm.addControl('toSavingsAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.paymentForm.addControl('transferDescription', new UntypedFormControl(''));
|
||||
}
|
||||
} else {
|
||||
this.paymentForm.removeControl('toSavingsAccountId');
|
||||
this.paymentForm.removeControl('transferDescription');
|
||||
}
|
||||
|
||||
if (id === PaymentDialogComponent.PARTIAL_REINVEST_ID) {
|
||||
if (!this.paymentForm.contains('reinvestAmount')) {
|
||||
this.paymentForm.addControl(
|
||||
'reinvestAmount',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.min(0.01),
|
||||
this.belowMaturityAmountValidator()
|
||||
])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this.paymentForm.removeControl('reinvestAmount');
|
||||
}
|
||||
}
|
||||
|
||||
/** Mirrors the backend's own `0 < reinvestAmount < accountBalance` rule, so a bad amount fails before submit. */
|
||||
private belowMaturityAmountValidator(): ValidatorFn {
|
||||
return (control) => {
|
||||
const cap = Number(this.reinvestCap);
|
||||
if (!cap || control.value === null || control.value === '') {
|
||||
return null;
|
||||
}
|
||||
return Number(control.value) >= cap ? { belowMaturityAmount: true } : null;
|
||||
};
|
||||
}
|
||||
|
||||
get isPartialReinvest(): boolean {
|
||||
return this.paymentForm?.get('onAccountClosureId')?.value === PaymentDialogComponent.PARTIAL_REINVEST_ID;
|
||||
}
|
||||
|
||||
/** True when the chosen action needs a destination account but the customer has none to pick. */
|
||||
get noDestinationAccounts(): boolean {
|
||||
return (
|
||||
!this.loadingTemplate && this.paymentForm?.contains('toSavingsAccountId') && this.savingsAccountsData.length === 0
|
||||
);
|
||||
}
|
||||
|
||||
/** What leaves this FD when the entered partial amount is kept behind; null until both figures are known. */
|
||||
get remainderAmount(): number | null {
|
||||
const reinvestAmount = this.paymentForm?.get('reinvestAmount')?.value;
|
||||
if (!this.isPartialReinvest || reinvestAmount === null || reinvestAmount === '' || !this.reinvestCap) {
|
||||
return null;
|
||||
}
|
||||
return Number(this.reinvestCap) - Number(reinvestAmount);
|
||||
}
|
||||
|
||||
submit(): void {
|
||||
const formValue = { ...this.paymentForm.value };
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
if (formValue.closedOnDate instanceof Date) {
|
||||
formValue.closedOnDate = this.dateUtils.formatDate(formValue.closedOnDate, dateFormat);
|
||||
}
|
||||
const data = { ...formValue, dateFormat, locale };
|
||||
this.submitting = true;
|
||||
this.submitError = null;
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.data.accountId as string, 'payment', data)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.dialogRef.close({ confirm: true });
|
||||
},
|
||||
// Keep the dialog open with the entered values and say what went wrong, rather than leaving a
|
||||
// permanently disabled Confirm behind whatever modal the global interceptor threw up.
|
||||
error: (error: any) => {
|
||||
this.submitting = false;
|
||||
this.submitError =
|
||||
error?.error?.defaultUserMessage ??
|
||||
error?.error?.errors?.[0]?.defaultUserMessage ??
|
||||
'This payment could not be processed. Please review the details and try again.';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-24
@@ -37,7 +37,7 @@
|
||||
<span class="fd-hero__meta-item">
|
||||
<span class="fd-hero__meta-label">{{ 'labels.inputs.Account Number' | translate }}</span>
|
||||
<mifosx-account-number
|
||||
accountNo="{{ fixedDepositsAccountData.fdAccountNumber || fixedDepositsAccountData.accountNo }}"
|
||||
accountNo="{{ fixedDepositsAccountData.accountNo }}"
|
||||
display="left"
|
||||
></mifosx-account-number>
|
||||
</span>
|
||||
@@ -79,16 +79,6 @@
|
||||
|
||||
<!-- Action menu (kebab) -->
|
||||
<div class="fd-hero__actions">
|
||||
@if (!fixedDepositsAccountData.status.rejected && !fixedDepositsAccountData.status.submittedAndPendingApproval) {
|
||||
<button
|
||||
mat-icon-button
|
||||
matTooltip="Print Certificate"
|
||||
(click)="printCertificate()"
|
||||
aria-label="Print certificate"
|
||||
>
|
||||
<fa-icon icon="print"></fa-icon>
|
||||
</button>
|
||||
}
|
||||
<button mat-icon-button [matMenuTriggerFor]="accountMenu" aria-label="Account actions" yPosition="below">
|
||||
<fa-icon icon="ellipsis-v"></fa-icon>
|
||||
</button>
|
||||
@@ -230,19 +220,6 @@
|
||||
<span>{{ 'labels.inputs.Transactions' | translate }}</span>
|
||||
</a>
|
||||
}
|
||||
@if (fixedDepositsAccountData.renewalHistory?.length) {
|
||||
<a
|
||||
mat-tab-link
|
||||
class="fd-tab"
|
||||
[routerLink]="['./renewal-history']"
|
||||
routerLinkActive
|
||||
#renewalHistory="routerLinkActive"
|
||||
[active]="renewalHistory.isActive"
|
||||
>
|
||||
<fa-icon icon="history" class="fd-tab__ic"></fa-icon>
|
||||
<span>{{ 'labels.inputs.Renewal History' | translate }}</span>
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
mat-tab-link
|
||||
class="fd-tab"
|
||||
|
||||
-44
@@ -16,8 +16,6 @@ import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/conf
|
||||
import { CalculateInterestDialogComponent } from './custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||
import { PostInterestDialogComponent } from './custom-dialogs/post-interest-dialog/post-interest-dialog.component';
|
||||
import { ToggleWithholdTaxDialogComponent } from './custom-dialogs/toggle-withhold-tax-dialog/toggle-withhold-tax-dialog.component';
|
||||
import { PaymentDialogComponent } from './custom-dialogs/payment-dialog/payment-dialog.component';
|
||||
import { DepositCertificateDialogComponent } from 'app/shared/deposit-certificate-dialog/deposit-certificate-dialog.component';
|
||||
|
||||
/** Custom Button Config. */
|
||||
import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.config';
|
||||
@@ -100,7 +98,6 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
'Post Interest': 'interest',
|
||||
'Enable Withhold Tax': 'interest',
|
||||
'Disable Withhold Tax': 'interest',
|
||||
Payment: 'transact',
|
||||
'Premature Close': 'danger',
|
||||
'Undo Activation': 'admin',
|
||||
Close: 'danger',
|
||||
@@ -124,7 +121,6 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
'Post Interest': 'percentage',
|
||||
'Enable Withhold Tax': 'percentage',
|
||||
'Disable Withhold Tax': 'percentage',
|
||||
Payment: 'sync-alt',
|
||||
'Premature Close': 'times-circle',
|
||||
'Undo Activation': 'undo',
|
||||
Close: 'times-circle',
|
||||
@@ -264,35 +260,9 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
case 'Terminate':
|
||||
this.terminateFixedDepositsAccount();
|
||||
break;
|
||||
case 'Payment':
|
||||
this.openPaymentDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the Payment action -- unlike Premature Close/Close, works whether the account is Active or
|
||||
* Matured, and is the only place a Partial Reinvest can be done.
|
||||
*/
|
||||
private openPaymentDialog(): void {
|
||||
const paymentDialogRef = this.dialog.open(PaymentDialogComponent, {
|
||||
width: '640px',
|
||||
maxWidth: '95vw',
|
||||
data: {
|
||||
accountId: this.fixedDepositsAccountData.id,
|
||||
// The server bounds a partial reinvest by the balance AFTER it posts interest to the chosen date,
|
||||
// so the dialog needs both figures plus the maturity date to know which one that will be.
|
||||
accountBalance: this.fixedDepositsAccountData.summary?.accountBalance,
|
||||
maturityDate: this.fixedDepositsAccountData.maturityDate
|
||||
}
|
||||
});
|
||||
paymentDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
this.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes Fixed Deposits Account.
|
||||
*/
|
||||
@@ -388,20 +358,6 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a printable deposit certificate for this account.
|
||||
*/
|
||||
printCertificate() {
|
||||
this.dialog.open(DepositCertificateDialogComponent, {
|
||||
width: '900px',
|
||||
data: {
|
||||
accountType: 'FD',
|
||||
accountData: this.fixedDepositsAccountData,
|
||||
clientId: this.fixedDepositsAccountData.clientId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables withhold tax for fixed deposits account
|
||||
* Fixed deposits endpoint is not supported so using Savings endpoint.
|
||||
|
||||
-3
@@ -116,9 +116,6 @@ export class FixedDepositsButtonsConfiguration {
|
||||
},
|
||||
{
|
||||
name: 'Add Charge'
|
||||
},
|
||||
{
|
||||
name: 'Payment'
|
||||
}
|
||||
];
|
||||
break;
|
||||
|
||||
-16
@@ -83,22 +83,6 @@
|
||||
}}</span>
|
||||
</div>
|
||||
}
|
||||
@if (fixedDepositsAccountData.reinvestedFromAccountNo) {
|
||||
<div class="nx-row">
|
||||
<span class="nx-row__label">{{ 'labels.inputs.Reinvested From' | translate }}</span>
|
||||
<span class="nx-row__value">
|
||||
<a [routerLink]="reinvestedFromLink">{{ fixedDepositsAccountData.reinvestedFromAccountNo }}</a>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
@if (fixedDepositsAccountData.reinvestedIntoAccountNo) {
|
||||
<div class="nx-row">
|
||||
<span class="nx-row__label">{{ 'labels.inputs.Reinvested Into' | translate }}</span>
|
||||
<span class="nx-row__value">
|
||||
<a [routerLink]="reinvestedIntoLink">{{ fixedDepositsAccountData.reinvestedIntoAccountNo }}</a>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
-21
@@ -48,25 +48,4 @@ export class GeneralTabComponent {
|
||||
this.entityType = 'Center';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A reinvested FD always keeps the same client/group/center as the account it came from, so the
|
||||
* counterpart account's view page sits at the same route -- only the account-id segment differs.
|
||||
*/
|
||||
private siblingAccountLink(targetAccountId: number): string | null {
|
||||
const segments = this.router.url.split('?')[0].split('/').filter(Boolean);
|
||||
const idx = segments.indexOf('fixed-deposits-accounts');
|
||||
if (idx === -1) return null;
|
||||
return '/' + segments.slice(0, idx + 1).join('/') + '/' + targetAccountId + '/general';
|
||||
}
|
||||
|
||||
get reinvestedFromLink(): string | null {
|
||||
const id = this.fixedDepositsAccountData?.reinvestedFromAccountId;
|
||||
return id ? this.siblingAccountLink(id) : null;
|
||||
}
|
||||
|
||||
get reinvestedIntoLink(): string | null {
|
||||
const id = this.fixedDepositsAccountData?.reinvestedIntoAccountId;
|
||||
return id ? this.siblingAccountLink(id) : null;
|
||||
}
|
||||
}
|
||||
|
||||
-11
@@ -36,17 +36,6 @@
|
||||
<td mat-cell *matCellDef="let chartSlab">{{ chartSlab.annualInterestRate | formatNumber }} %</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="seniorCitizen">
|
||||
<th mat-header-cell *matHeaderCellDef><fa-icon icon="user-shield" class="m-r-5"></fa-icon>Senior Citizen</th>
|
||||
<td mat-cell *matCellDef="let chartSlab">
|
||||
{{
|
||||
chartSlab.seniorCitizenRate !== null && chartSlab.seniorCitizenRate !== undefined
|
||||
? (chartSlab.seniorCitizenRate | formatNumber) + ' %'
|
||||
: '-'
|
||||
}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Description' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let chartSlab">{{ chartSlab.description }}</td>
|
||||
|
||||
-1
@@ -71,7 +71,6 @@ export class InterestRateChartTabComponent {
|
||||
'period',
|
||||
'amountRange',
|
||||
'interest',
|
||||
'seniorCitizen',
|
||||
'description',
|
||||
'actions'
|
||||
];
|
||||
|
||||
-139
@@ -1,139 +0,0 @@
|
||||
<!--
|
||||
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="rh-container">
|
||||
@if (renewalHistory.length) {
|
||||
<!-- ─── Summary strip ──────────────────────────────────────────── -->
|
||||
<div class="rh-summary">
|
||||
<div class="rh-summary__item">
|
||||
<span class="rh-summary__label">FD Number</span>
|
||||
<span class="rh-summary__value">{{ fdNumber }}</span>
|
||||
</div>
|
||||
<div class="rh-summary__item">
|
||||
<span class="rh-summary__label">Terms So Far</span>
|
||||
<span class="rh-summary__value">{{ renewalHistory.length }}</span>
|
||||
</div>
|
||||
<div class="rh-summary__item">
|
||||
<span class="rh-summary__label">Original Principal</span>
|
||||
<span class="rh-summary__value">{{ originalPrincipal | currency: currency.code : 'symbol-narrow' }}</span>
|
||||
</div>
|
||||
<div class="rh-summary__item rh-summary__item--highlight">
|
||||
<span class="rh-summary__label">Current Value</span>
|
||||
<span class="rh-summary__value">{{ currentValue | currency: currency.code : 'symbol-narrow' }}</span>
|
||||
</div>
|
||||
<div class="rh-summary__item rh-summary__item--positive">
|
||||
<span class="rh-summary__label">Lifetime Interest</span>
|
||||
<span class="rh-summary__value">{{ lifetimeInterestEarned | currency: currency.code : 'symbol-narrow' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ─── Vertical timeline ──────────────────────────────────────── -->
|
||||
<div class="rh-timeline">
|
||||
@for (
|
||||
term of renewalHistory;
|
||||
track term.historyid ?? term.accountid + '-' + term.renewalcycleno;
|
||||
let last = $last
|
||||
) {
|
||||
<div class="rh-node">
|
||||
<div class="rh-node__rail">
|
||||
<span class="rh-node__dot" [class.rh-node__dot--active]="term.renewalstatus === 'ACTIVE'">
|
||||
@if (term.renewalstatus === 'ACTIVE') {
|
||||
<span class="rh-node__pulse"></span>
|
||||
}
|
||||
</span>
|
||||
@if (!last) {
|
||||
<span class="rh-node__line"></span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="rh-card" [class.rh-card--active]="term.renewalstatus === 'ACTIVE'">
|
||||
<div class="rh-card__head">
|
||||
<div class="rh-card__title-group">
|
||||
<h4 class="rh-card__title">
|
||||
{{ term.renewalcycleno === 0 ? 'Original Term' : 'Renewal ' + term.renewalcycleno }}
|
||||
</h4>
|
||||
<span class="rh-badge" [class.rh-badge--active]="term.renewalstatus === 'ACTIVE'">
|
||||
<fa-icon [icon]="term.renewalstatus === 'ACTIVE' ? 'check-circle' : 'clock'"></fa-icon>
|
||||
{{ term.renewalstatus === 'ACTIVE' ? 'Active' : 'Matured' }}
|
||||
</span>
|
||||
@if (renewalTypeLabel(term)) {
|
||||
<span class="rh-tag">
|
||||
<fa-icon [icon]="renewalTypeIcon(term)"></fa-icon>
|
||||
{{ renewalTypeLabel(term) }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<button type="button" class="rh-chart-btn" (click)="openRateChart(term)">
|
||||
<fa-icon icon="table"></fa-icon>
|
||||
View Rate Chart
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="rh-card__period">
|
||||
<fa-icon icon="calendar-alt" class="rh-card__period-ico"></fa-icon>
|
||||
<span>{{ term.activatedondate | dateFormat }}</span>
|
||||
<fa-icon icon="arrow-right" class="rh-card__period-arrow"></fa-icon>
|
||||
<span>{{ term.maturitydate | dateFormat }}</span>
|
||||
@if (tenureLabel(term)) {
|
||||
<span class="rh-card__tenure">({{ tenureLabel(term) }})</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="rh-stats">
|
||||
<div class="rh-stat">
|
||||
<span class="rh-stat__label">Principal</span>
|
||||
<span class="rh-stat__value">{{ term.depositamount | currency: currency.code : 'symbol-narrow' }}</span>
|
||||
</div>
|
||||
<div class="rh-stat">
|
||||
<span class="rh-stat__label">Rate</span>
|
||||
<span class="rh-stat__value">{{ term.interestrate }}%</span>
|
||||
</div>
|
||||
<div class="rh-stat">
|
||||
<span class="rh-stat__label">{{
|
||||
term.renewalstatus === 'ACTIVE' ? 'Interest So Far' : 'Interest Earned'
|
||||
}}</span>
|
||||
<span class="rh-stat__value rh-stat__value--positive">
|
||||
{{
|
||||
term.interestearned === null || term.interestearned === undefined
|
||||
? '—'
|
||||
: (term.interestearned | currency: currency.code : 'symbol-narrow')
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="rh-stat rh-stat--highlight">
|
||||
<span class="rh-stat__label">{{
|
||||
term.maturedamount === null || term.maturedamount === undefined ? 'Projected Maturity' : 'Matured At'
|
||||
}}</span>
|
||||
<span class="rh-stat__value">
|
||||
{{ maturityFor(term) | currency: currency.code : 'symbol-narrow' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rh-card__foot">
|
||||
<fa-icon icon="info-circle" class="rh-card__foot-ico"></fa-icon>
|
||||
<span>
|
||||
Ledger account:
|
||||
@if (term.accountid === fixedDepositsAccountData.id) {
|
||||
<strong>{{ term.accountno }}</strong>
|
||||
} @else {
|
||||
<a [routerLink]="siblingLink(term.accountid)">{{ term.accountno }}</a>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="rh-empty">
|
||||
<fa-icon icon="history" class="rh-empty__icon"></fa-icon>
|
||||
<p class="rh-empty__text">{{ 'labels.messages.No Renewal History Available' | translate }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
-364
@@ -1,364 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$navy: #0d1b2a;
|
||||
$slate: #475569;
|
||||
$muted: #64748b;
|
||||
$border: #e2e8f0;
|
||||
$soft: #f8fafc;
|
||||
$positive: #047857;
|
||||
$positive-soft: #ecfdf5;
|
||||
$accent: #2563eb;
|
||||
$accent-soft: #eff6ff;
|
||||
|
||||
.rh-container {
|
||||
max-width: 860px;
|
||||
margin: 0 auto;
|
||||
padding: 4px 0 24px;
|
||||
}
|
||||
|
||||
/* ─── Summary strip ─────────────────────────────────────────────────── */
|
||||
.rh-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 1px;
|
||||
background: $border;
|
||||
border: 1px solid $border;
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 28px;
|
||||
box-shadow: 0 1px 3px rgb(15 23 42 / 4%);
|
||||
|
||||
&__item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 14px 16px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
&__label {
|
||||
font-size: 10.5px;
|
||||
font-weight: 600;
|
||||
color: $muted;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
&__value {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: $navy;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&__item--highlight {
|
||||
background: $accent-soft;
|
||||
|
||||
.rh-summary__value {
|
||||
color: $accent;
|
||||
}
|
||||
}
|
||||
|
||||
&__item--positive {
|
||||
background: $positive-soft;
|
||||
|
||||
.rh-summary__value {
|
||||
color: $positive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 720px) {
|
||||
.rh-summary {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Timeline rail ──────────────────────────────────────────────────── */
|
||||
.rh-timeline {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.rh-node {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.rh-node__rail {
|
||||
flex: none;
|
||||
width: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.rh-node__dot {
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-top: 22px;
|
||||
border-radius: 50%;
|
||||
background: #cbd5e1;
|
||||
border: 3px solid #fff;
|
||||
box-shadow: 0 0 0 2px #cbd5e1;
|
||||
flex: none;
|
||||
|
||||
&--active {
|
||||
background: $positive;
|
||||
box-shadow: 0 0 0 2px $positive;
|
||||
}
|
||||
}
|
||||
|
||||
.rh-node__pulse {
|
||||
position: absolute;
|
||||
inset: -6px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid $positive;
|
||||
opacity: 0.6;
|
||||
animation: rh-pulse 1.8s ease-out infinite;
|
||||
}
|
||||
|
||||
@keyframes rh-pulse {
|
||||
0% {
|
||||
transform: scale(0.6);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1.6);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.rh-node__line {
|
||||
flex: 1;
|
||||
width: 2px;
|
||||
min-height: 24px;
|
||||
background: $border;
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
/* ─── Term card ──────────────────────────────────────────────────────── */
|
||||
.rh-card {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
background: #fff;
|
||||
border: 1px solid $border;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 1px 3px rgb(15 23 42 / 4%);
|
||||
padding: 16px 18px;
|
||||
margin-bottom: 20px;
|
||||
transition: box-shadow 0.15s ease;
|
||||
|
||||
&--active {
|
||||
border-color: rgb(4 120 87 / 20%);
|
||||
box-shadow: 0 2px 10px rgb(4 120 87 / 8%);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 14px rgb(15 23 42 / 8%);
|
||||
}
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__title-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: $navy;
|
||||
}
|
||||
|
||||
&__period {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
font-size: 12.5px;
|
||||
color: $slate;
|
||||
font-weight: 500;
|
||||
|
||||
&-ico {
|
||||
color: $muted;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&-arrow {
|
||||
color: $muted;
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&__tenure {
|
||||
color: $muted;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
&__foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 12px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px dashed $border;
|
||||
font-size: 11.5px;
|
||||
color: $muted;
|
||||
|
||||
&-ico {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: $accent;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Status badge / auto-renewed tag ───────────────────────────────── */
|
||||
.rh-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 2px 9px;
|
||||
border-radius: 999px;
|
||||
background: $soft;
|
||||
color: $muted;
|
||||
font-size: 10.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
|
||||
&--active {
|
||||
background: $positive-soft;
|
||||
color: $positive;
|
||||
}
|
||||
}
|
||||
|
||||
.rh-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 2px 9px;
|
||||
border-radius: 999px;
|
||||
background: $accent-soft;
|
||||
color: $accent;
|
||||
font-size: 10.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ─── View Rate Chart button ─────────────────────────────────────────── */
|
||||
.rh-chart-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
padding: 6px 14px;
|
||||
border: 1px solid $border;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: $accent;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
background: $accent-soft;
|
||||
border-color: $accent;
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Stat grid ──────────────────────────────────────────────────────── */
|
||||
.rh-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
@media (width <= 640px) {
|
||||
.rh-stats {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.rh-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 9px 12px;
|
||||
background: $soft;
|
||||
border-radius: 10px;
|
||||
|
||||
&__label {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: $muted;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
&__value {
|
||||
font-size: 13.5px;
|
||||
font-weight: 700;
|
||||
color: $navy;
|
||||
font-variant-numeric: tabular-nums;
|
||||
|
||||
&--positive {
|
||||
color: $positive;
|
||||
}
|
||||
}
|
||||
|
||||
&--highlight {
|
||||
background: $accent-soft;
|
||||
|
||||
.rh-stat__value {
|
||||
color: $accent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Empty state ────────────────────────────────────────────────────── */
|
||||
.rh-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 64px 16px;
|
||||
color: $muted;
|
||||
|
||||
&__icon {
|
||||
font-size: 30px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
&__text {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
/**
|
||||
* 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 { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
import { DateFormatPipe } from '../../../../pipes/date-format.pipe';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { TermRateChartDialogComponent } from './term-rate-chart-dialog/term-rate-chart-dialog.component';
|
||||
|
||||
/**
|
||||
* Every term of one FD, oldest first, as a vertical timeline -- one card per renewal cycle. Its own tab
|
||||
* rather than a card on General, since a long-lived FD can carry many terms and each one's full detail
|
||||
* (dates, rate, principal, interest, and its own rate chart) needs real room to read comfortably.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-renewal-history-tab',
|
||||
templateUrl: './renewal-history-tab.component.html',
|
||||
styleUrls: ['./renewal-history-tab.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
CurrencyPipe,
|
||||
DateFormatPipe
|
||||
]
|
||||
})
|
||||
export class RenewalHistoryTabComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private dialog = inject(MatDialog);
|
||||
private productsService = inject(ProductsService);
|
||||
|
||||
fixedDepositsAccountData: any;
|
||||
currency: Currency;
|
||||
|
||||
/**
|
||||
* The bank's currently published senior-citizen premium per tenure band, for this FD's type. Fetched once
|
||||
* from the same CBS Base Interest Rates screen staff maintain, so a term's rate-chart popup can show the
|
||||
* premium alongside the standard rate -- neither the account's own chart snapshot nor the archived history
|
||||
* carries a senior-citizen column, since that concept only exists on the base rate master.
|
||||
*/
|
||||
private activeBaseSlabs: any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.route.parent.data.subscribe((data: { fixedDepositsAccountData: any }) => {
|
||||
this.fixedDepositsAccountData = data.fixedDepositsAccountData;
|
||||
this.currency = this.fixedDepositsAccountData.currency;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
const fdType = this.fixedDepositsAccountData?.fdType;
|
||||
if (!fdType) {
|
||||
return;
|
||||
}
|
||||
this.productsService.getFdBaseInterestRates(fdType).subscribe({
|
||||
next: (rates: any[]) => {
|
||||
const active = (rates || []).find((r: any) => r.isActive);
|
||||
this.activeBaseSlabs = active?.slabs ?? [];
|
||||
},
|
||||
error: () => {}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The published senior-citizen rate for a tenure band, matched by period type and range against the active
|
||||
* base rate card. Returns null when nothing matches (no published base version for this FD type, or this
|
||||
* particular band isn't on it, or the matching band simply carries no premium) -- displayed as a blank
|
||||
* rather than a misleading zero.
|
||||
*/
|
||||
private seniorCitizenRateFor(periodTypeEnum: number, fromPeriod: number, toPeriod: number | null): number | null {
|
||||
const match = this.activeBaseSlabs.find(
|
||||
(s) =>
|
||||
s.periodTypeEnum === periodTypeEnum &&
|
||||
s.fromPeriod === fromPeriod &&
|
||||
(s.toPeriod ?? null) === (toPeriod ?? null)
|
||||
);
|
||||
return match?.seniorCitizenRate > 0 ? match.seniorCitizenRate : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A reinvested FD always keeps the same client/group/center as the account it came from, so the
|
||||
* counterpart account's view page sits at the same route -- only the account-id segment differs.
|
||||
*/
|
||||
private siblingAccountLink(targetAccountId: number): string | null {
|
||||
const segments = this.router.url.split('?')[0].split('/').filter(Boolean);
|
||||
const idx = segments.indexOf('fixed-deposits-accounts');
|
||||
if (idx === -1) return null;
|
||||
return '/' + segments.slice(0, idx + 1).join('/') + '/' + targetAccountId + '/general';
|
||||
}
|
||||
|
||||
siblingLink(targetAccountId: number): string | null {
|
||||
return this.siblingAccountLink(targetAccountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every term of this FD, oldest first, as resolved by the backend. Keys are lower-cased because they
|
||||
* arrive straight from the SQL result-set column labels.
|
||||
*/
|
||||
get renewalHistory(): any[] {
|
||||
return this.fixedDepositsAccountData?.renewalHistory ?? [];
|
||||
}
|
||||
|
||||
get fdNumber(): string {
|
||||
return this.fixedDepositsAccountData?.fdAccountNumber ?? this.fixedDepositsAccountData?.accountNo;
|
||||
}
|
||||
|
||||
/** The very first term's opening principal -- what the customer originally deposited. */
|
||||
get originalPrincipal(): number | null {
|
||||
return this.renewalHistory[0]?.depositamount ?? null;
|
||||
}
|
||||
|
||||
/** The latest term's settled or projected value -- what the FD is worth right now. */
|
||||
get currentValue(): number | null {
|
||||
const latest = this.renewalHistory[this.renewalHistory.length - 1];
|
||||
return latest ? this.maturityFor(latest) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total interest earned across every term, settled terms plus the running term's interest-to-date. Null
|
||||
* only when there is nothing to sum, so the summary strip can tell "no data yet" apart from "zero".
|
||||
*/
|
||||
get lifetimeInterestEarned(): number | null {
|
||||
if (!this.renewalHistory.length) {
|
||||
return null;
|
||||
}
|
||||
let total = 0;
|
||||
for (const term of this.renewalHistory) {
|
||||
if (term.interestearned != null) {
|
||||
total += Number(term.interestearned);
|
||||
} else {
|
||||
const projected = this.maturityFor(term);
|
||||
if (projected != null && term.depositamount != null) {
|
||||
total += Number(projected) - Number(term.depositamount);
|
||||
}
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* A term's settled maturity amount, or its projection while it is still running. Resolved here rather
|
||||
* than inline so the choice isn't left to operator precedence between `??` and the currency pipe.
|
||||
*/
|
||||
maturityFor(term: any): number | null {
|
||||
return term?.maturedamount ?? term?.projectedmaturityamount ?? null;
|
||||
}
|
||||
|
||||
/** periodTypeEnum values as archived -- same encoding as SavingsPeriodFrequencyType (DAYS=0 ... YEARS=3). */
|
||||
private static readonly PERIOD_TYPE_LABELS: Record<number, string> = {
|
||||
0: 'Days',
|
||||
1: 'Weeks',
|
||||
2: 'Months',
|
||||
3: 'Years'
|
||||
};
|
||||
|
||||
/** "10 Years" rather than a bare number, using the same period-type encoding the archived charts use. */
|
||||
tenureLabel(term: any): string {
|
||||
if (term?.tenure == null) {
|
||||
return '';
|
||||
}
|
||||
const unit = RenewalHistoryTabComponent.PERIOD_TYPE_LABELS[term.tenurefrequencyenum] ?? '';
|
||||
return unit ? `${term.tenure} ${unit}` : `${term.tenure}`;
|
||||
}
|
||||
|
||||
/** How the renewal happened, for display as a small tag -- null when the term hasn't renewed (yet). */
|
||||
renewalTypeLabel(term: any): string | null {
|
||||
if (term?.renewaltype === 'AUTO') return 'Auto-Renewed';
|
||||
if (term?.renewaltype === 'MANUAL') return 'Renewed by Staff';
|
||||
return null;
|
||||
}
|
||||
|
||||
renewalTypeIcon(term: any): string {
|
||||
return term?.renewaltype === 'MANUAL' ? 'user-cog' : 'robot';
|
||||
}
|
||||
|
||||
/**
|
||||
* The rate-by-tenure chart for one term of this FD's history, normalised to one shape regardless of source.
|
||||
*
|
||||
* A term's chart is only archived once it closes via an in-place renewal, so the term still running has no
|
||||
* archived rows -- for that one term (recognisable as the one matching this account's own id), the
|
||||
* account's own live chart is shown instead, since it is the same data. The two sources use different key
|
||||
* casing and represent the period type differently (a raw enum int here, an expanded {value} object on the
|
||||
* live chart), which this maps into one consistent shape the dialog can render without knowing which source
|
||||
* it came from.
|
||||
*/
|
||||
private chartSlabsFor(term: any): any[] {
|
||||
const raw = term?.chartSlabs?.length
|
||||
? term.chartSlabs
|
||||
: term?.accountid === this.fixedDepositsAccountData?.id
|
||||
? (this.fixedDepositsAccountData?.accountChart?.chartSlabs ?? [])
|
||||
: [];
|
||||
return raw.map((slab: any) => {
|
||||
const periodTypeEnum = slab.periodType?.id ?? slab.periodtypeenum;
|
||||
const fromPeriod = slab.fromperiod ?? slab.fromPeriod;
|
||||
const toPeriod = slab.toperiod ?? slab.toPeriod;
|
||||
// The archived/live row's own senior_citizen_rate is the true figure as published when this term
|
||||
// was actually priced -- preferred whenever present. The live lookup against today's base rate
|
||||
// card is only a fallback, for the currently-running term (not archived yet) or an older archive
|
||||
// row written before that column existed -- flagged as such so the dialog can say so.
|
||||
const persistedSeniorRate = slab.seniorcitizenrate ?? slab.seniorCitizenRate ?? null;
|
||||
return {
|
||||
description: slab.description,
|
||||
fromPeriod,
|
||||
toPeriod,
|
||||
periodTypeLabel: slab.periodType?.value ?? RenewalHistoryTabComponent.PERIOD_TYPE_LABELS[periodTypeEnum] ?? '',
|
||||
annualInterestRate: slab.annualinterestrate ?? slab.annualInterestRate,
|
||||
seniorCitizenRate:
|
||||
persistedSeniorRate ?? this.seniorCitizenRateFor(periodTypeEnum, fromPeriod, toPeriod ?? null),
|
||||
seniorCitizenRateIsLive: persistedSeniorRate == null
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** Opens the full rate chart for one term in a popup, rather than pushing every later term down the page. */
|
||||
openRateChart(term: any): void {
|
||||
this.dialog.open(TermRateChartDialogComponent, {
|
||||
width: '560px',
|
||||
data: {
|
||||
term,
|
||||
slabs: this.chartSlabsFor(term),
|
||||
isSeniorCitizen: !!this.fixedDepositsAccountData?.isSeniorCitizen
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
<!--
|
||||
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="trc-dialog">
|
||||
<h2 mat-dialog-title class="trc-header">
|
||||
<span class="trc-header__icon"><fa-icon icon="table"></fa-icon></span>
|
||||
<span class="trc-header__text">
|
||||
<span class="trc-header__title">{{ termLabel }} — Rate Chart</span>
|
||||
<span class="trc-header__sub"
|
||||
>{{ term.activatedondate | dateFormat }} → {{ term.maturitydate | dateFormat }}</span
|
||||
>
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
<div mat-dialog-content class="trc-content">
|
||||
@if (slabs.length) {
|
||||
<table class="trc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<th>Tenure</th>
|
||||
<th class="trc-table__rate-col">Rate</th>
|
||||
<th class="trc-table__rate-col">
|
||||
<fa-icon icon="user-shield" class="trc-table__sc-ico"></fa-icon>
|
||||
Senior Citizen
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (slab of slabs; track $index) {
|
||||
<tr [class.trc-table__row--applied]="isAppliedSlab(slab) || isAppliedSeniorSlab(slab)">
|
||||
<td>{{ slab.description }}</td>
|
||||
<td>{{ slab.fromPeriod }} – {{ slab.toPeriod || '∞' }} {{ slab.periodTypeLabel }}</td>
|
||||
<td class="trc-table__rate-col">
|
||||
{{ slab.annualInterestRate }}%
|
||||
@if (isAppliedSlab(slab)) {
|
||||
<span class="trc-applied-badge">Applied</span>
|
||||
}
|
||||
</td>
|
||||
<td class="trc-table__rate-col trc-table__sc-col">
|
||||
{{
|
||||
slab.seniorCitizenRate !== null && slab.seniorCitizenRate !== undefined
|
||||
? slab.seniorCitizenRate + '%'
|
||||
: '—'
|
||||
}}
|
||||
@if (isAppliedSeniorSlab(slab)) {
|
||||
<span class="trc-applied-badge">Applied</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (hasLiveSeniorRate) {
|
||||
<p class="trc-note">
|
||||
<fa-icon icon="info-circle"></fa-icon>
|
||||
Senior citizen rate for this term wasn't recorded at the time; the figure shown is today's published rate, for
|
||||
reference.
|
||||
</p>
|
||||
}
|
||||
} @else {
|
||||
<div class="trc-empty">
|
||||
<fa-icon icon="info-circle" class="trc-empty__icon"></fa-icon>
|
||||
<p>No rate chart was archived for this term.</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions align="end" class="trc-actions">
|
||||
<button mat-button mat-dialog-close>{{ 'labels.buttons.Close' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
-159
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$navy: #0d1b2a;
|
||||
$slate: #475569;
|
||||
$muted: #64748b;
|
||||
$border: #e2e8f0;
|
||||
$soft: #f8fafc;
|
||||
$positive: #047857;
|
||||
$positive-soft: #ecfdf5;
|
||||
|
||||
$accent: #b8860b;
|
||||
|
||||
.trc-dialog {
|
||||
min-width: 420px;
|
||||
max-width: 540px;
|
||||
}
|
||||
|
||||
.trc-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: 0 0 4px;
|
||||
|
||||
&__icon {
|
||||
flex: none;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
&__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: $navy;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
font-size: 12px;
|
||||
color: $muted;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.trc-content {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.trc-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
|
||||
th {
|
||||
padding: 8px 10px;
|
||||
background: $soft;
|
||||
color: $muted;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid $border;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 9px 10px;
|
||||
color: $slate;
|
||||
border-bottom: 1px solid $border;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&__rate-col {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&__row--applied {
|
||||
background: $positive-soft;
|
||||
|
||||
td {
|
||||
color: $positive;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
&__sc-ico {
|
||||
color: $accent;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
&__sc-col {
|
||||
color: $accent;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.trc-applied-badge {
|
||||
display: inline-block;
|
||||
margin-left: 6px;
|
||||
padding: 1px 7px;
|
||||
border-radius: 10px;
|
||||
background: $positive;
|
||||
color: #fff;
|
||||
font-size: 9.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.03em;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.trc-note {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
margin: 10px 2px 0;
|
||||
color: $muted;
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.trc-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 32px 8px;
|
||||
color: $muted;
|
||||
text-align: center;
|
||||
|
||||
&__icon {
|
||||
font-size: 22px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
.trc-actions {
|
||||
padding-top: 6px;
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
/**
|
||||
* 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, inject } from '@angular/core';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogRef,
|
||||
MatDialogTitle,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose
|
||||
} from '@angular/material/dialog';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* The full rate-by-tenure chart one term of an FD was priced on, in a popup rather than inline in the
|
||||
* timeline: a chart can run to several tenure bands, and showing it in place would push every later term
|
||||
* down the page every time one is opened.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-term-rate-chart-dialog',
|
||||
templateUrl: './term-rate-chart-dialog.component.html',
|
||||
styleUrls: ['./term-rate-chart-dialog.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatDialogTitle,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
MatButton,
|
||||
FaIconComponent
|
||||
]
|
||||
})
|
||||
export class TermRateChartDialogComponent {
|
||||
dialogRef = inject<MatDialogRef<TermRateChartDialogComponent>>(MatDialogRef);
|
||||
data = inject(MAT_DIALOG_DATA);
|
||||
|
||||
get term(): any {
|
||||
return this.data.term;
|
||||
}
|
||||
|
||||
get slabs(): any[] {
|
||||
return this.data.slabs ?? [];
|
||||
}
|
||||
|
||||
get termLabel(): string {
|
||||
return this.term?.renewalcycleno === 0 ? 'Original Term' : 'Renewal ' + this.term?.renewalcycleno;
|
||||
}
|
||||
|
||||
/** Whether the DEPOSITOR (not just the tenure band) was a senior citizen for this term. */
|
||||
get isSeniorCitizen(): boolean {
|
||||
return !!this.data.isSeniorCitizen;
|
||||
}
|
||||
|
||||
/**
|
||||
* True when at least one senior-citizen figure shown is a live lookup against today's base rate card rather than the
|
||||
* true rate persisted for this specific term -- only possible for the currently-running term (not archived yet) or an
|
||||
* older archive row that predates the persisted column. Drives whether the disclaimer note is shown at all.
|
||||
*/
|
||||
get hasLiveSeniorRate(): boolean {
|
||||
return this.slabs.some((s) => s.seniorCitizenRateIsLive && s.seniorCitizenRate != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* True for the STANDARD-rate cell that was actually applied to this term. Never true for a senior-citizen
|
||||
* term, since that term was priced off the senior column instead -- see {@link isAppliedSeniorSlab}.
|
||||
* Compared as numbers since one side arrives as a string from the currency-agnostic archive row.
|
||||
*/
|
||||
isAppliedSlab(slab: any): boolean {
|
||||
return (
|
||||
!this.isSeniorCitizen &&
|
||||
this.term?.interestrate != null &&
|
||||
Number(slab.annualInterestRate) === Number(this.term.interestrate)
|
||||
);
|
||||
}
|
||||
|
||||
/** True for the SENIOR-CITIZEN cell that was actually applied, for a term held by a senior-citizen depositor. */
|
||||
isAppliedSeniorSlab(slab: any): boolean {
|
||||
return (
|
||||
this.isSeniorCitizen &&
|
||||
slab.seniorCitizenRate != null &&
|
||||
this.term?.interestrate != null &&
|
||||
Number(slab.seniorCitizenRate) === Number(this.term.interestrate)
|
||||
);
|
||||
}
|
||||
}
|
||||
+25
-45
@@ -36,11 +36,7 @@
|
||||
[ngClass]="savingsTransactionColor(transaction)"
|
||||
(click)="showTransactions(transaction)"
|
||||
>
|
||||
@if (transaction.isRenewalEvent) {
|
||||
<fa-icon icon="sync-alt" class="txn-tab__renewal-ico"></fa-icon>
|
||||
} @else {
|
||||
{{ transaction.id }}
|
||||
}
|
||||
{{ transaction.id }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -76,13 +72,7 @@
|
||||
[ngClass]="savingsTransactionColor(transaction)"
|
||||
(click)="showTransactions(transaction)"
|
||||
>
|
||||
{{
|
||||
transaction.isRenewalEvent
|
||||
? '—'
|
||||
: isDebit(transaction.transactionType)
|
||||
? (transaction.amount | formatNumber)
|
||||
: 'N/A'
|
||||
}}
|
||||
{{ isDebit(transaction.transactionType) ? (transaction.amount | formatNumber) : 'N/A' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -94,13 +84,7 @@
|
||||
[ngClass]="savingsTransactionColor(transaction)"
|
||||
(click)="showTransactions(transaction)"
|
||||
>
|
||||
{{
|
||||
transaction.isRenewalEvent
|
||||
? '—'
|
||||
: !isDebit(transaction.transactionType)
|
||||
? (transaction.amount | formatNumber)
|
||||
: 'N/A'
|
||||
}}
|
||||
{{ !isDebit(transaction.transactionType) ? (transaction.amount | formatNumber) : 'N/A' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -112,40 +96,36 @@
|
||||
[ngClass]="savingsTransactionColor(transaction)"
|
||||
(click)="showTransactions(transaction)"
|
||||
>
|
||||
{{ transaction.isRenewalEvent ? '—' : (transaction.runningBalance | formatNumber) }}
|
||||
{{ transaction.runningBalance | formatNumber }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell class="center" *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
|
||||
<td mat-cell class="center" *matCellDef="let transaction; let idx = index">
|
||||
@if (transaction.isRenewalEvent) {
|
||||
<span class="txn-tab__renewal-tag">No ledger impact</span>
|
||||
} @else {
|
||||
<button mat-icon-button [matMenuTriggerFor]="transactionMenu" aria-label="" class="action-button">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
<button mat-icon-button [matMenuTriggerFor]="transactionMenu" aria-label="" class="action-button">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #transactionMenu="matMenu">
|
||||
<button mat-menu-item (click)="showTransactions(transaction)">
|
||||
<mat-icon><fa-icon icon="eye" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'labels.text.View Transaction' | translate }}</span>
|
||||
</button>
|
||||
<mat-menu #transactionMenu="matMenu">
|
||||
<button mat-menu-item (click)="showTransactions(transaction)">
|
||||
<mat-icon><fa-icon icon="eye" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'labels.text.View Transaction' | translate }}</span>
|
||||
@if (!isFirstTransaction(idx)) {
|
||||
<button mat-menu-item (click)="undoTransaction(transaction)">
|
||||
<mat-icon><fa-icon icon="undo" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'tooltips.Undo Transaction' | translate }}</span>
|
||||
</button>
|
||||
@if (!isFirstTransaction(idx)) {
|
||||
<button mat-menu-item (click)="undoTransaction(transaction)">
|
||||
<mat-icon><fa-icon icon="undo" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'tooltips.Undo Transaction' | translate }}</span>
|
||||
</button>
|
||||
}
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="routeEdit($event)"
|
||||
[routerLink]="['/', 'journal-entry', 'view', 'S' + transaction.id]"
|
||||
>
|
||||
<mat-icon><fa-icon icon="table-cells" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'tooltips.View Journal Entries' | translate }}</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
}
|
||||
}
|
||||
<button
|
||||
mat-menu-item
|
||||
(click)="routeEdit($event)"
|
||||
[routerLink]="['/', 'journal-entry', 'view', 'S' + transaction.id]"
|
||||
>
|
||||
<mat-icon><fa-icon icon="table-cells" size="sm"></fa-icon></mat-icon>
|
||||
<span>{{ 'tooltips.View Journal Entries' | translate }}</span>
|
||||
</button>
|
||||
</mat-menu>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
-28
@@ -97,32 +97,4 @@ table {
|
||||
color: $muted;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.mat-mdc-cell.renewal-marker {
|
||||
background: #eff6ff;
|
||||
color: $blue;
|
||||
font-style: italic;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.mat-mdc-row:has(.renewal-marker):hover {
|
||||
background: #eff6ff;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.txn-tab__renewal-ico {
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
.txn-tab__renewal-tag {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
background: #dbeafe;
|
||||
color: $blue;
|
||||
font-size: 10.5px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
+2
-66
@@ -113,71 +113,13 @@ export class TransactionsTabComponent implements OnInit {
|
||||
*/
|
||||
constructor() {
|
||||
this.route.parent.data.subscribe((data: { fixedDepositsAccountData: any }) => {
|
||||
this.transactionsData = this.withRenewalMarkers(
|
||||
data.fixedDepositsAccountData.transactions,
|
||||
data.fixedDepositsAccountData.renewalHistory
|
||||
);
|
||||
this.transactionsData = data.fixedDepositsAccountData.transactions;
|
||||
this.clientId = this.route.parent.snapshot.params['clientId'];
|
||||
this.accountId = this.route.parent.snapshot.params['fixedDepositAccountId'];
|
||||
this.status = data.fixedDepositsAccountData.status.value;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* An in-place renewal moves no money -- the matured balance simply becomes the new term's opening
|
||||
* principal -- so it posts no withdrawal, deposit, or journal entry (see
|
||||
* DepositAccountDomainServiceJpa#handleFDAccountMaturityClosure). Without something here, a renewal
|
||||
* would be invisible in this list even though the account's rate and term just changed. These rows
|
||||
* are synthesized purely for display from the renewal history already loaded for the Renewal History
|
||||
* tab -- never written anywhere, never matched against a real transaction id -- so undo, journal-entry
|
||||
* lookup, and every real transaction's running balance stay exactly as they were.
|
||||
*/
|
||||
private withRenewalMarkers(transactions: any[], renewalHistory: any[]): any[] {
|
||||
const markers: any[] = (renewalHistory ?? [])
|
||||
.filter((term: any) => term.renewalcycleno > 0)
|
||||
.map((term: any) => {
|
||||
const marker: any = {
|
||||
isRenewalEvent: true,
|
||||
id: null,
|
||||
date: term.activatedondate,
|
||||
amount: null,
|
||||
runningBalance: null,
|
||||
reversed: false,
|
||||
transfer: null,
|
||||
renewalCycleNo: term.renewalcycleno,
|
||||
transactionType: {
|
||||
value: term.renewaltype === 'MANUAL' ? 'FD Renewed (Staff)' : 'FD Auto-Renewed',
|
||||
accrual: false,
|
||||
withdrawal: false,
|
||||
feeDeduction: false,
|
||||
overdraftInterest: false,
|
||||
withholdTax: false
|
||||
}
|
||||
};
|
||||
return marker;
|
||||
});
|
||||
return [
|
||||
...(transactions ?? []),
|
||||
...markers
|
||||
].sort((a, b) => this.toEpoch(b.date) - this.toEpoch(a.date));
|
||||
}
|
||||
|
||||
/** Same [yyyy, MM, dd]-or-ISO-string shape DateFormatPipe already handles, resolved to a sortable epoch. */
|
||||
private toEpoch(value: any): number {
|
||||
if (!value) {
|
||||
return 0;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
const [
|
||||
year,
|
||||
month,
|
||||
day
|
||||
] = value;
|
||||
return new Date(year, (month ?? 1) - 1, day ?? 1).getTime();
|
||||
}
|
||||
return new Date(value).getTime();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.hideAccrualsParam = new UntypedFormControl(false);
|
||||
this.hideReversedParam = new UntypedFormControl(false);
|
||||
@@ -219,9 +161,6 @@ export class TransactionsTabComponent implements OnInit {
|
||||
* @param {any} transactionsData Transactions Data
|
||||
*/
|
||||
showTransactions(transactionsData: any) {
|
||||
if (transactionsData.isRenewalEvent) {
|
||||
return;
|
||||
}
|
||||
if (transactionsData.transfer) {
|
||||
this.router.navigate([`account-transfers/account-transfers/${transactionsData.transfer.id}`], {
|
||||
relativeTo: this.route
|
||||
@@ -252,10 +191,7 @@ export class TransactionsTabComponent implements OnInit {
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
savingsTransactionColor(transaction: any): string {
|
||||
if (transaction.isRenewalEvent) {
|
||||
return 'renewal-marker';
|
||||
}
|
||||
savingsTransactionColor(transaction: SavingsAccountTransaction): string {
|
||||
if (transaction.reversed) {
|
||||
return 'strike';
|
||||
} else if (transaction.transfer) {
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
<mat-card>
|
||||
<form [formGroup]="approveFixedDepositsAccountForm" (ngSubmit)="submit()">
|
||||
<mat-card-content>
|
||||
<p class="mat-body-2">This approves and activates the account in one step -- it goes straight to Active.</p>
|
||||
<div class="layout-column">
|
||||
<mat-form-field (click)="approvedOnDatePicker.open()">
|
||||
<mat-label>{{ 'labels.inputs.Approved On Date' | translate }}</mat-label>
|
||||
|
||||
+3
-13
@@ -81,9 +81,8 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form, approves the fixed deposit account, then immediately activates it on the
|
||||
* same date -- Approve and Activate are still two separate Fineract commands underneath (each
|
||||
* shows up in the audit trail), but the officer only sees and clicks through one step.
|
||||
* Submits the form and approves the fixed deposit account,
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
const approveFixedDepositsAccountFormData = this.approveFixedDepositsAccountForm.value;
|
||||
@@ -99,16 +98,7 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||
const activationData = {
|
||||
activatedOnDate: approveFixedDepositsAccountFormData.approvedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'activate', activationData)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import { FixedDepositsAccountActionsResolver } from './common-resolvers/fixed-de
|
||||
import { FixedDepositsAccountTemplateResolver } from './common-resolvers/fixed-deposit-account-template.resolver';
|
||||
import { FixedDepositsAccountAndTemplateResolver } from './common-resolvers/fixed-deposit-account-and-template.resolver';
|
||||
import { GeneralTabComponent } from './fixed-deposit-account-view/general-tab/general-tab.component';
|
||||
import { RenewalHistoryTabComponent } from './fixed-deposit-account-view/renewal-history-tab/renewal-history-tab.component';
|
||||
import { AccountNomineesTabComponent } from 'app/shared/account-nominees-tab/account-nominees-tab.component';
|
||||
|
||||
const routes: Routes = [
|
||||
@@ -81,15 +80,6 @@ const routes: Routes = [
|
||||
routeParamBreadcrumb: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'renewal-history',
|
||||
component: RenewalHistoryTabComponent,
|
||||
data: {
|
||||
title: 'Fixed Deposit Account Renewal History',
|
||||
breadcrumb: 'Renewal History',
|
||||
routeParamBreadcrumb: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'transactions',
|
||||
component: TransactionsTabComponent,
|
||||
|
||||
@@ -87,17 +87,6 @@ export class FixedDepositsService {
|
||||
return this.http.get(`/fixeddepositaccounts/${accountId}/template`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* Template for the Payment action. Same shape as the closure template, but its `onAccountClosureOptions` also
|
||||
* include Partial Re-Invest, which the closure commands exclude because only Payment implements it.
|
||||
* @param {string} accountId Fixed Deposits Account Id
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getFixedDepositsAccountPaymentTemplate(accountId: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', 'payment');
|
||||
return this.http.get(`/fixeddepositaccounts/${accountId}/template`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} accountId Fixed Deposits Account Id
|
||||
* @returns {Observable<any>}
|
||||
|
||||
@@ -0,0 +1,543 @@
|
||||
<!--
|
||||
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="pm-container">
|
||||
<div class="pm-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="pm-back">
|
||||
<i class="fas fa-arrow-left"></i> Deposits
|
||||
</button>
|
||||
<h2 class="pm-header__title">Party Master Entry</h2>
|
||||
</div>
|
||||
|
||||
<div class="pm-card">
|
||||
<form [formGroup]="partyForm">
|
||||
<mat-tab-group class="pm-tabs" [(selectedIndex)]="selectedTabIndex" animationDuration="200ms">
|
||||
<mat-tab label="Main Detail">
|
||||
<div class="pm-tab-content">
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-id-card"></i>
|
||||
<h3>Identity</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Client ID</mat-label>
|
||||
<input matInput required formControlName="clientId" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Sub Type</mat-label>
|
||||
<mat-select required formControlName="subType">
|
||||
@for (type of subTypes; track type) {
|
||||
<mat-option [value]="type">{{ type }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Agent ID</mat-label>
|
||||
<input matInput required formControlName="agentId" />
|
||||
</mat-form-field>
|
||||
|
||||
@if (linkedSavingsAccountId) {
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Savings Account</mat-label>
|
||||
<input matInput [value]="'Linked (id ' + linkedSavingsAccountId + ')'" disabled />
|
||||
</mat-form-field>
|
||||
} @else {
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Savings Account No (if any)</mat-label>
|
||||
<input matInput formControlName="savingsAccountNo" />
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Party Code</mat-label>
|
||||
<input matInput formControlName="partyCode" placeholder="Auto-generated" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Last A/c</mat-label>
|
||||
<input matInput formControlName="lastAccount" placeholder="—" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Nominal</mat-label>
|
||||
<mat-select required formControlName="nominal">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Party Name</mat-label>
|
||||
<input matInput required formControlName="partyName" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Party Name 1</mat-label>
|
||||
<input matInput formControlName="partyName1" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
<h3>Address & Contact</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Address 1</mat-label>
|
||||
<input matInput required formControlName="address1" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Address 2</mat-label>
|
||||
<input matInput formControlName="address2" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Address 3</mat-label>
|
||||
<input matInput formControlName="address3" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>City</mat-label>
|
||||
<input matInput required formControlName="city" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Pincode</mat-label>
|
||||
<input matInput required formControlName="pincode" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Gender</mat-label>
|
||||
<mat-select formControlName="gender">
|
||||
<mat-option value="Male">Male</mat-option>
|
||||
<mat-option value="Female">Female</mat-option>
|
||||
<mat-option value="Other">Other</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Telephone</mat-label>
|
||||
<input matInput formControlName="telephone" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Mobile No (SMS)</mat-label>
|
||||
<input matInput required formControlName="mobileNoSms" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-shield-alt"></i>
|
||||
<h3>KYC</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Aadhar No</mat-label>
|
||||
<input matInput formControlName="aadharNo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>PAN Card No</mat-label>
|
||||
<input matInput formControlName="panCardNo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>CKYC ID</mat-label>
|
||||
<input matInput formControlName="ckycId" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Operation</mat-label>
|
||||
<mat-select required formControlName="operation">
|
||||
@for (op of operations; track op) {
|
||||
<mat-option [value]="op">{{ op }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Birth Date</mat-label>
|
||||
<input matInput [matDatepicker]="birthPicker" formControlName="birthDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="birthPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #birthPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Occupation</mat-label>
|
||||
<mat-select formControlName="occupation">
|
||||
@for (occ of occupations; track occ) {
|
||||
<mat-option [value]="occ">{{ occ }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Risk</mat-label>
|
||||
<mat-select formControlName="risk">
|
||||
@for (r of riskLevels; track r) {
|
||||
<mat-option [value]="r">{{ r }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-user-friends"></i>
|
||||
<h3>Minor / Guardian</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Adult / Minor</mat-label>
|
||||
<mat-select required formControlName="adultMinor">
|
||||
@for (opt of adultMinorOptions; track opt) {
|
||||
<mat-option [value]="opt">{{ opt }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Minor Date</mat-label>
|
||||
<input matInput [matDatepicker]="minorPicker" formControlName="minorDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="minorPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #minorPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Guardian Client ID</mat-label>
|
||||
<input matInput formControlName="guardianClientId" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Min. A/c Opt</mat-label>
|
||||
<input matInput formControlName="minAccountOpt" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Relation</mat-label>
|
||||
<input matInput formControlName="relation" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-calendar-day"></i>
|
||||
<h3>Scheme Terms</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Opening Date</mat-label>
|
||||
<input matInput required [matDatepicker]="openingPicker" formControlName="openingDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="openingPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #openingPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Month</mat-label>
|
||||
<input matInput type="number" formControlName="month" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Maturity Date</mat-label>
|
||||
<input matInput formControlName="maturityDate" placeholder="Calculated" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Reopen Date</mat-label>
|
||||
<input matInput [matDatepicker]="reopenPicker" formControlName="reopenDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="reopenPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #reopenPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Deposit Amt</mat-label>
|
||||
<input matInput type="number" formControlName="depositAmount" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Daily Deposit Amt</mat-label>
|
||||
<input matInput required type="number" formControlName="dailyDepositAmount" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Days</mat-label>
|
||||
<input matInput required type="number" formControlName="days" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Ledger No</mat-label>
|
||||
<input matInput formControlName="ledgerNo" placeholder="Auto-generated" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Mat. Amt</mat-label>
|
||||
<input matInput formControlName="maturityAmount" placeholder="Calculated" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Interest Rate</mat-label>
|
||||
<input matInput formControlName="interestRate" placeholder="From product" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Withdraw Type</mat-label>
|
||||
<mat-select formControlName="withdrawType">
|
||||
@for (type of withdrawTypes; track type) {
|
||||
<mat-option [value]="type">{{ type }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<h3>Status & Overdue Flags</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<div class="pm-checkbox-field">
|
||||
<mat-checkbox formControlName="od1Flag">OD1 Flag</mat-checkbox>
|
||||
</div>
|
||||
<div class="pm-checkbox-field">
|
||||
<mat-checkbox formControlName="od2Flag">OD2 Flag</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Lien</mat-label>
|
||||
<mat-select formControlName="lien">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Pay Date</mat-label>
|
||||
<input matInput [matDatepicker]="payDatePicker" formControlName="payDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="payDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #payDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Payment Amount</mat-label>
|
||||
<input matInput type="number" formControlName="paymentAmount" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Current Bal</mat-label>
|
||||
<input matInput formControlName="currentBalance" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Opening Bal</mat-label>
|
||||
<input matInput type="number" formControlName="openingBalance" />
|
||||
</mat-form-field>
|
||||
|
||||
<div class="pm-checkbox-field">
|
||||
<mat-checkbox formControlName="isSmsActive">Is SMS Active</mat-checkbox>
|
||||
</div>
|
||||
<div class="pm-checkbox-field">
|
||||
<mat-checkbox formControlName="isEmailActive">Is Email Active</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Int.Calc</mat-label>
|
||||
<input matInput formControlName="interestCalc" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Interest Date</mat-label>
|
||||
<input matInput [matDatepicker]="interestDatePicker" formControlName="interestDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="interestDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #interestDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field pm-field--wide">
|
||||
<mat-label>Sp.Description</mat-label>
|
||||
<input matInput formControlName="spDescription" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Fr'z CD</mat-label>
|
||||
<mat-select formControlName="freezeCode">
|
||||
@for (code of freezeCodes; track code) {
|
||||
<mat-option [value]="code">{{ code }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Adv Code</mat-label>
|
||||
<mat-select formControlName="advCode">
|
||||
@for (code of advCodes; track code) {
|
||||
<mat-option [value]="code">{{ code }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (partyForm.get('advCode').value === 'Transfer To Saving') {
|
||||
<div class="pm-section">
|
||||
<div class="pm-section__header">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
<h3>Maturity Payout Routing</h3>
|
||||
</div>
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Credit To Branch</mat-label>
|
||||
<input matInput required formControlName="creditToBranch" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Credit To A/C Type</mat-label>
|
||||
<input matInput required formControlName="creditToAccountType" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Credit To A/C</mat-label>
|
||||
<input matInput required formControlName="creditToAccount" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Nominee's Detail">
|
||||
<div class="pm-tab-content">
|
||||
<div class="pm-section">
|
||||
<div class="pm-grid">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Nominee</mat-label>
|
||||
<mat-select formControlName="nomineeApplicable">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-radio-group formControlName="nomineeSplitMode" class="pm-radio-group">
|
||||
<mat-radio-button value="Percentage">Percentage</mat-radio-button>
|
||||
<mat-radio-button value="Sequence">Sequence</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
|
||||
<button mat-stroked-button type="button" class="pm-add-nominee" (click)="addNominee()">
|
||||
<i class="fas fa-plus"></i> Add Nominee
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (nominees.length === 0) {
|
||||
<p class="pm-empty">No nominees added yet.</p>
|
||||
}
|
||||
|
||||
@for (nominee of nominees.controls; track nominee; let i = $index) {
|
||||
<div class="pm-nominee-row" [formGroup]="$any(nominee)">
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Nom.Dt</mat-label>
|
||||
<input matInput required [matDatepicker]="nomDatePicker" formControlName="nominationDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="nomDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nomDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput required formControlName="name" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Mobile No</mat-label>
|
||||
<input matInput formControlName="mobileNo" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Birth Dt</mat-label>
|
||||
<input matInput [matDatepicker]="nomBirthPicker" formControlName="birthDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="nomBirthPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #nomBirthPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Minor</mat-label>
|
||||
<mat-select required formControlName="minor">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Relation</mat-label>
|
||||
<input matInput required formControlName="relation" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Gender</mat-label>
|
||||
<mat-select required formControlName="gender">
|
||||
<mat-option value="Male">Male</mat-option>
|
||||
<mat-option value="Female">Female</mat-option>
|
||||
<mat-option value="Other">Other</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="pm-field">
|
||||
<mat-label>Guar. Name</mat-label>
|
||||
<input matInput formControlName="guardianName" />
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
class="pm-remove-nominee"
|
||||
(click)="removeNominee(i)"
|
||||
matTooltip="Remove nominee"
|
||||
>
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
@if (isClosed) {
|
||||
<div class="pm-callout">
|
||||
<i class="fas fa-lock"></i>
|
||||
<span>This account is closed. No further collections or edits are possible.</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="pm-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-stroked-button type="button" (click)="cancel()">Cancel</button>
|
||||
<button mat-stroked-button type="button" (click)="retrieve()">Retrieve</button>
|
||||
@if (partyId && !isClosed) {
|
||||
<button
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
color="warn"
|
||||
matTooltip="Balance must be zero before closing"
|
||||
(click)="closeAccount()"
|
||||
>
|
||||
<i class="fas fa-lock" style="margin-right: 6px"></i> Close Account
|
||||
</button>
|
||||
}
|
||||
<button
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
type="button"
|
||||
[disabled]="partyForm.invalid || isClosed"
|
||||
(click)="save()"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.pm-container {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.pm-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.pm-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.pm-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
.pm-tabs {
|
||||
::ng-deep .mat-mdc-tab-body-wrapper {
|
||||
min-height: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
.pm-tab-content {
|
||||
padding: 20px 24px;
|
||||
}
|
||||
|
||||
.pm-section {
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid rgb(0 0 0 / 8%);
|
||||
|
||||
&:last-of-type {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
i {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pm-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 8px 16px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.pm-field {
|
||||
width: 100%;
|
||||
|
||||
&--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
.pm-checkbox-field {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.pm-radio-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.pm-add-nominee {
|
||||
color: $primary;
|
||||
height: fit-content;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.pm-empty {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.pm-nominee-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr) auto;
|
||||
gap: 8px 12px;
|
||||
align-items: start;
|
||||
padding: 10px 0;
|
||||
border-top: 1px dashed rgb(0 0 0 / 10%);
|
||||
|
||||
&:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
.pm-remove-nominee {
|
||||
color: #b91c1c;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.pm-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
padding: 16px 24px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
.pm-callout {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 0 24px;
|
||||
padding: 12px 16px;
|
||||
background: rgb(185 28 28 / 8%);
|
||||
border: 1px solid rgb(185 28 28 / 25%);
|
||||
border-radius: 6px;
|
||||
color: #b91c1c;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
@media (width <= 1000px) {
|
||||
.pm-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.pm-nominee-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,527 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, UntypedFormArray, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Party Master Entry component.
|
||||
*
|
||||
* The customer's DDS account — linked to an Agent for daily collection,
|
||||
* carrying its own scheme terms, KYC, two-stage overdue flags, and a
|
||||
* nominee list. Modelled directly on the legacy Party Master Entry screen
|
||||
* this replaces.
|
||||
*
|
||||
* Backed by its own DDS Party API (`/dds/parties`). The underlying account
|
||||
* does not yet reuse the Recurring Deposit account engine (see Product
|
||||
* Setup) — that linkage is a follow-up once the RD-account-specific fields
|
||||
* this screen doesn't collect (interest/compounding periods, chart
|
||||
* selection, ...) have a home. Until then the scheme/balance fields here
|
||||
* are the Party's own.
|
||||
*
|
||||
* "Close Account" (command=close) permanently closes the Party once its
|
||||
* balance is zero - the backend rejects the command otherwise. A closed
|
||||
* Party can no longer be edited or receive new Party Tran collections.
|
||||
*
|
||||
* savingsAccountNo optionally links this Party to an existing, non-closed real Savings Account of
|
||||
* the same client (resolved by account number, since that's what an officer has to hand) -
|
||||
* clarified with the business (2026-08-24) as "link it if the client already has one, otherwise
|
||||
* leave it". There is no unlink once linked.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-party-master',
|
||||
templateUrl: './party-master.component.html',
|
||||
styleUrls: ['./party-master.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatTabsModule,
|
||||
MatCheckbox,
|
||||
MatRadioModule
|
||||
]
|
||||
})
|
||||
export class PartyMasterComponent {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private organizationService = inject(OrganizationService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
partyId: number | null = null;
|
||||
selectedTabIndex = 0;
|
||||
partyStatus = 'ACTIVE';
|
||||
linkedSavingsAccountId: number | null = null;
|
||||
|
||||
get isClosed(): boolean {
|
||||
return this.partyStatus === 'CLOSED';
|
||||
}
|
||||
|
||||
subTypes = [
|
||||
'Daily Deposit Scheme',
|
||||
'Masik Dhan Varsha Deposit'
|
||||
];
|
||||
operations = [
|
||||
'Self',
|
||||
'Guardian',
|
||||
'Joint'
|
||||
];
|
||||
occupations = [
|
||||
'Business',
|
||||
'Service',
|
||||
'Agriculture',
|
||||
'Homemaker',
|
||||
'Student',
|
||||
'Retired',
|
||||
'Other'
|
||||
];
|
||||
riskLevels = [
|
||||
'Low',
|
||||
'Medium',
|
||||
'High'
|
||||
];
|
||||
adultMinorOptions = [
|
||||
'Adult',
|
||||
'Minor'
|
||||
];
|
||||
withdrawTypes = [
|
||||
'Cash',
|
||||
'Transfer',
|
||||
'Clearing'
|
||||
];
|
||||
freezeCodes = [
|
||||
'Normal',
|
||||
'Debit Freeze',
|
||||
'Credit Freeze',
|
||||
'Total Freeze'
|
||||
];
|
||||
advCodes = [
|
||||
'None',
|
||||
'Transfer To Saving',
|
||||
'Renew'
|
||||
];
|
||||
|
||||
partyForm: UntypedFormGroup = this.formBuilder.group({
|
||||
clientId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
subType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
savingsAccountNo: [''],
|
||||
lastAccount: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
partyCode: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
nominal: [
|
||||
'No',
|
||||
Validators.required
|
||||
],
|
||||
aadharNo: [''],
|
||||
partyName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
partyName1: [''],
|
||||
address1: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
address2: [''],
|
||||
address3: [''],
|
||||
city: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
pincode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
gender: [''],
|
||||
panCardNo: [''],
|
||||
telephone: [''],
|
||||
mobileNoSms: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
operation: [
|
||||
'Self',
|
||||
Validators.required
|
||||
],
|
||||
birthDate: [''],
|
||||
occupation: [''],
|
||||
risk: [''],
|
||||
ckycId: [''],
|
||||
adultMinor: [
|
||||
'Adult',
|
||||
Validators.required
|
||||
],
|
||||
minorDate: [''],
|
||||
guardianClientId: [''],
|
||||
minAccountOpt: [''],
|
||||
relation: [''],
|
||||
openingDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
month: [''],
|
||||
maturityDate: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
reopenDate: [''],
|
||||
depositAmount: [0],
|
||||
dailyDepositAmount: [
|
||||
0,
|
||||
Validators.required
|
||||
],
|
||||
days: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
ledgerNo: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
maturityAmount: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
interestRate: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
withdrawType: [''],
|
||||
od1Flag: [
|
||||
{
|
||||
value: false,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
od2Flag: [
|
||||
{
|
||||
value: false,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
lien: ['No'],
|
||||
payDate: [''],
|
||||
paymentAmount: [0],
|
||||
currentBalance: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
openingBalance: [0],
|
||||
isSmsActive: [true],
|
||||
isEmailActive: [false],
|
||||
interestCalc: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
interestDate: [''],
|
||||
spDescription: [''],
|
||||
freezeCode: ['Normal'],
|
||||
advCode: ['None'],
|
||||
creditToBranch: [''],
|
||||
creditToAccountType: [''],
|
||||
creditToAccount: [''],
|
||||
nomineeApplicable: ['No'],
|
||||
nomineeSplitMode: ['Percentage'],
|
||||
nominees: this.formBuilder.array([])
|
||||
});
|
||||
|
||||
get nominees(): UntypedFormArray {
|
||||
return this.partyForm.get('nominees') as UntypedFormArray;
|
||||
}
|
||||
|
||||
private buildNomineeGroup(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
nominationDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
mobileNo: [''],
|
||||
birthDate: [''],
|
||||
minor: [
|
||||
'No',
|
||||
Validators.required
|
||||
],
|
||||
relation: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
gender: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
guardianName: ['']
|
||||
});
|
||||
}
|
||||
|
||||
addNominee(): void {
|
||||
this.nominees.push(this.buildNomineeGroup());
|
||||
}
|
||||
|
||||
removeNominee(index: number): void {
|
||||
this.nominees.removeAt(index);
|
||||
}
|
||||
|
||||
retrieve(): void {
|
||||
const clientId = this.partyForm.get('clientId')?.value;
|
||||
if (!clientId) {
|
||||
return;
|
||||
}
|
||||
this.organizationService.getParties().subscribe((parties: any[]) => {
|
||||
const match = (parties || []).find((party) => String(party.clientId) === String(clientId));
|
||||
if (match) {
|
||||
this.patchFormFromParty(match);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
this.partyId = null;
|
||||
this.partyStatus = 'ACTIVE';
|
||||
this.linkedSavingsAccountId = null;
|
||||
this.partyForm.reset();
|
||||
this.partyForm.patchValue({
|
||||
nominal: 'No',
|
||||
operation: 'Self',
|
||||
adultMinor: 'Adult',
|
||||
lien: 'No',
|
||||
isSmsActive: true,
|
||||
isEmailActive: false,
|
||||
freezeCode: 'Normal',
|
||||
advCode: 'None',
|
||||
nomineeApplicable: 'No',
|
||||
nomineeSplitMode: 'Percentage',
|
||||
currentBalance: 0,
|
||||
maturityAmount: 0,
|
||||
interestRate: 0
|
||||
});
|
||||
this.nominees.clear();
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['/accounts/savings']);
|
||||
}
|
||||
|
||||
save(): void {
|
||||
const raw = this.partyForm.getRawValue();
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const asDate = (value: any) => (value ? this.dateUtils.formatDate(value, dateFormat) : undefined);
|
||||
|
||||
const payload: any = {
|
||||
clientId: Number(raw.clientId),
|
||||
agentId: Number(raw.agentId),
|
||||
savingsAccountNo: this.linkedSavingsAccountId ? undefined : raw.savingsAccountNo || undefined,
|
||||
subType: raw.subType,
|
||||
lastAccount: raw.lastAccount || undefined,
|
||||
nominal: raw.nominal === 'Yes',
|
||||
aadharNo: raw.aadharNo || undefined,
|
||||
partyName: raw.partyName,
|
||||
partyName1: raw.partyName1 || undefined,
|
||||
address1: raw.address1,
|
||||
address2: raw.address2 || undefined,
|
||||
address3: raw.address3 || undefined,
|
||||
city: raw.city,
|
||||
pincode: raw.pincode,
|
||||
gender: raw.gender || undefined,
|
||||
panCardNo: raw.panCardNo || undefined,
|
||||
telephone: raw.telephone || undefined,
|
||||
mobileNoSms: raw.mobileNoSms,
|
||||
operation: raw.operation,
|
||||
birthDate: asDate(raw.birthDate),
|
||||
occupation: raw.occupation || undefined,
|
||||
risk: raw.risk || undefined,
|
||||
ckycId: raw.ckycId || undefined,
|
||||
adultMinor: raw.adultMinor,
|
||||
minorDate: asDate(raw.minorDate),
|
||||
guardianClientId: raw.guardianClientId ? Number(raw.guardianClientId) : undefined,
|
||||
minAccountOpt: raw.minAccountOpt || undefined,
|
||||
relation: raw.relation || undefined,
|
||||
openingDate: asDate(raw.openingDate),
|
||||
month: raw.month || undefined,
|
||||
reopenDate: asDate(raw.reopenDate),
|
||||
depositAmount: raw.depositAmount || undefined,
|
||||
dailyDepositAmount: raw.dailyDepositAmount,
|
||||
days: raw.days,
|
||||
withdrawType: raw.withdrawType || undefined,
|
||||
lien: raw.lien === 'Yes',
|
||||
payDate: asDate(raw.payDate),
|
||||
paymentAmount: raw.paymentAmount || undefined,
|
||||
openingBalance: raw.openingBalance || 0,
|
||||
isSmsActive: !!raw.isSmsActive,
|
||||
isEmailActive: !!raw.isEmailActive,
|
||||
interestDate: asDate(raw.interestDate),
|
||||
spDescription: raw.spDescription || undefined,
|
||||
freezeCode: raw.freezeCode || undefined,
|
||||
advCode: raw.advCode || undefined,
|
||||
creditToBranch: raw.creditToBranch || undefined,
|
||||
creditToAccountType: raw.creditToAccountType || undefined,
|
||||
creditToAccount: raw.creditToAccount || undefined,
|
||||
nomineeApplicable: raw.nomineeApplicable === 'Yes',
|
||||
nomineeSplitMode: raw.nomineeSplitMode || undefined,
|
||||
dateFormat,
|
||||
locale,
|
||||
nominees: (raw.nominees || []).map((nominee: any) => ({
|
||||
nominationDate: this.dateUtils.getDate(nominee.nominationDate),
|
||||
name: nominee.name,
|
||||
mobileNo: nominee.mobileNo || undefined,
|
||||
birthDate: nominee.birthDate ? this.dateUtils.getDate(nominee.birthDate) : undefined,
|
||||
minor: nominee.minor === 'Yes',
|
||||
relation: nominee.relation,
|
||||
gender: nominee.gender,
|
||||
guardianName: nominee.guardianName || undefined
|
||||
}))
|
||||
};
|
||||
|
||||
if (this.partyId) {
|
||||
this.organizationService.updateParty(this.partyId, payload).subscribe(() => this.exit());
|
||||
} else {
|
||||
this.organizationService.createParty(payload).subscribe(() => this.exit());
|
||||
}
|
||||
}
|
||||
|
||||
closeAccount(): void {
|
||||
if (!this.partyId) {
|
||||
return;
|
||||
}
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
this.organizationService
|
||||
.closeParty(this.partyId, {
|
||||
closeDate: this.dateUtils.formatDate(new Date(), dateFormat),
|
||||
dateFormat,
|
||||
locale
|
||||
})
|
||||
.subscribe(() => this.exit());
|
||||
}
|
||||
|
||||
private patchFormFromParty(party: any): void {
|
||||
this.partyId = party.id;
|
||||
this.partyStatus = party.status || 'ACTIVE';
|
||||
this.linkedSavingsAccountId = party.savingsAccountId || null;
|
||||
this.partyForm.patchValue({
|
||||
clientId: party.clientId,
|
||||
subType: party.subType,
|
||||
agentId: party.agentId,
|
||||
partyCode: party.partyCode,
|
||||
lastAccount: party.lastAccount,
|
||||
nominal: party.nominal ? 'Yes' : 'No',
|
||||
aadharNo: party.aadharNo,
|
||||
partyName: party.partyName,
|
||||
partyName1: party.partyName1,
|
||||
address1: party.address1,
|
||||
address2: party.address2,
|
||||
address3: party.address3,
|
||||
city: party.city,
|
||||
pincode: party.pincode,
|
||||
gender: party.gender,
|
||||
panCardNo: party.panCardNo,
|
||||
telephone: party.telephone,
|
||||
mobileNoSms: party.mobileNoSms,
|
||||
operation: party.operation,
|
||||
birthDate: party.birthDate ? new Date(party.birthDate) : null,
|
||||
occupation: party.occupation,
|
||||
risk: party.risk,
|
||||
ckycId: party.ckycId,
|
||||
adultMinor: party.adultMinor,
|
||||
minorDate: party.minorDate ? new Date(party.minorDate) : null,
|
||||
guardianClientId: party.guardianClientId,
|
||||
minAccountOpt: party.minAccountOpt,
|
||||
relation: party.relation,
|
||||
openingDate: party.openingDate ? new Date(party.openingDate) : null,
|
||||
month: party.month,
|
||||
maturityDate: party.maturityDate,
|
||||
reopenDate: party.reopenDate ? new Date(party.reopenDate) : null,
|
||||
depositAmount: party.depositAmount,
|
||||
dailyDepositAmount: party.dailyDepositAmount,
|
||||
days: party.days,
|
||||
ledgerNo: party.ledgerNo,
|
||||
maturityAmount: party.maturityAmount,
|
||||
interestRate: party.interestRate,
|
||||
withdrawType: party.withdrawType,
|
||||
od1Flag: party.od1Flag,
|
||||
od2Flag: party.od2Flag,
|
||||
lien: party.lien ? 'Yes' : 'No',
|
||||
payDate: party.payDate ? new Date(party.payDate) : null,
|
||||
paymentAmount: party.paymentAmount,
|
||||
currentBalance: party.currentBalance,
|
||||
openingBalance: party.openingBalance,
|
||||
isSmsActive: party.isSmsActive,
|
||||
isEmailActive: party.isEmailActive,
|
||||
interestCalc: party.interestCalc,
|
||||
interestDate: party.interestDate ? new Date(party.interestDate) : null,
|
||||
spDescription: party.spDescription,
|
||||
freezeCode: party.freezeCode,
|
||||
advCode: party.advCode,
|
||||
creditToBranch: party.creditToBranch,
|
||||
creditToAccountType: party.creditToAccountType,
|
||||
creditToAccount: party.creditToAccount,
|
||||
nomineeApplicable: party.nomineeApplicable ? 'Yes' : 'No',
|
||||
nomineeSplitMode: party.nomineeSplitMode
|
||||
});
|
||||
|
||||
this.nominees.clear();
|
||||
(party.nominees || []).forEach((nominee: any) => {
|
||||
const group = this.buildNomineeGroup();
|
||||
group.patchValue({
|
||||
nominationDate: nominee.nominationDate ? new Date(nominee.nominationDate) : null,
|
||||
name: nominee.name,
|
||||
mobileNo: nominee.mobileNo,
|
||||
birthDate: nominee.birthDate ? new Date(nominee.birthDate) : null,
|
||||
minor: nominee.minor ? 'Yes' : 'No',
|
||||
relation: nominee.relation,
|
||||
gender: nominee.gender,
|
||||
guardianName: nominee.guardianName
|
||||
});
|
||||
this.nominees.push(group);
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-36
@@ -33,7 +33,6 @@
|
||||
<mifosx-recurring-deposits-account-details-step
|
||||
[recurringDepositsAccountTemplate]="recurringDepositsAccountTemplate"
|
||||
(recurringDepositsAccountProductTemplate)="setTemplate($event)"
|
||||
[externalLinkedAccountId]="recurringDepositsAccountMaturityTermsStep?.selectedTransferAccount?.id ?? null"
|
||||
>
|
||||
</mifosx-recurring-deposits-account-details-step>
|
||||
|
||||
@@ -112,40 +111,7 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 4: Terms -->
|
||||
<mat-tab [disabled]="!recurringDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="file-alt" class="cra-tab__icon"></fa-icon>
|
||||
Terms
|
||||
</ng-template>
|
||||
<div class="cra-tab-body">
|
||||
@if (recurringDepositsAccountProductTemplate) {
|
||||
<mifosx-recurring-deposits-account-maturity-terms-step
|
||||
[recurringDepositsAccountTemplate]="recurringDepositsAccountTemplate"
|
||||
[recurringDepositsAccountProductTemplate]="recurringDepositsAccountProductTemplate"
|
||||
[linkedSavingsAccountId]="
|
||||
recurringDepositsAccountDetailsStep?.selectedLinkedAccount?.accountType === 'SAVINGS'
|
||||
? recurringDepositsAccountDetailsStep?.selectedLinkedAccount?.id
|
||||
: null
|
||||
"
|
||||
></mifosx-recurring-deposits-account-maturity-terms-step>
|
||||
}
|
||||
|
||||
<div class="cra-actions">
|
||||
<button mat-stroked-button (click)="prev()">
|
||||
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Previous' | translate }}
|
||||
</button>
|
||||
<span class="cra-actions__spacer"></span>
|
||||
<button mat-raised-button color="primary" (click)="next()">
|
||||
{{ 'labels.buttons.Next' | translate }}
|
||||
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 5: Preview -->
|
||||
<!-- Tab 4: Preview -->
|
||||
<mat-tab [disabled]="!recurringDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="eye" class="cra-tab__icon"></fa-icon>
|
||||
@@ -166,7 +132,6 @@
|
||||
[rdDaysInYear]="rdDaysInYear"
|
||||
[rdAppliedRate]="rdAppliedRate"
|
||||
[rdIsSeniorCitizen]="rdIsSeniorCitizen"
|
||||
[closureSettings]="recurringDepositsAccountMaturityTermsStep?.closureSettings ?? {}"
|
||||
[hideButtons]="true"
|
||||
(submitEvent)="submit()"
|
||||
>
|
||||
|
||||
+1
-10
@@ -24,7 +24,6 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { RecurringDepositsAccountCurrencyStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component';
|
||||
import { RecurringDepositsAccountInterestRateChartStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component';
|
||||
import { RecurringDepositsAccountPreviewStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component';
|
||||
import { RecurringDepositsAccountMaturityTermsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-maturity-terms-step/recurring-deposits-account-maturity-terms-step.component';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
@@ -41,7 +40,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
RecurringDepositsAccountDetailsStepComponent,
|
||||
RecurringDepositsAccountCurrencyStepComponent,
|
||||
RecurringDepositsAccountInterestRateChartStepComponent,
|
||||
RecurringDepositsAccountMaturityTermsStepComponent,
|
||||
RecurringDepositsAccountPreviewStepComponent
|
||||
]
|
||||
})
|
||||
@@ -63,12 +61,6 @@ export class CreateRecurringDepositsAccountComponent {
|
||||
@ViewChild(RecurringDepositsAccountInterestRateChartStepComponent)
|
||||
recurringDepositsAccountChartStep: RecurringDepositsAccountInterestRateChartStepComponent;
|
||||
|
||||
@ViewChild(RecurringDepositsAccountPreviewStepComponent)
|
||||
recurringDepositsAccountPreviewStep: RecurringDepositsAccountPreviewStepComponent;
|
||||
|
||||
@ViewChild(RecurringDepositsAccountMaturityTermsStepComponent)
|
||||
recurringDepositsAccountMaturityTermsStep: RecurringDepositsAccountMaturityTermsStepComponent;
|
||||
|
||||
/** Recurring Deposits Account Template */
|
||||
recurringDepositsAccountTemplate: any;
|
||||
/** Recurring Deposit Account Product Template */
|
||||
@@ -76,7 +68,7 @@ export class CreateRecurringDepositsAccountComponent {
|
||||
/** Currently visible wizard tab (0-indexed). */
|
||||
selectedTabIndex = 0;
|
||||
/** Total wizard tabs — Product, Currency, Chart, Preview. */
|
||||
private readonly totalTabs = 5;
|
||||
private readonly totalTabs = 4;
|
||||
/** Active CBS base interest rate versions */
|
||||
cbsBaseRates: any[] = [];
|
||||
/** Selected tenure value and frequency from calculator */
|
||||
@@ -266,7 +258,6 @@ export class CreateRecurringDepositsAccountComponent {
|
||||
...details,
|
||||
...terms,
|
||||
...settings,
|
||||
...(this.recurringDepositsAccountMaturityTermsStep?.closureSettings ?? {}),
|
||||
...productDefaults,
|
||||
clientId: this.recurringDepositsAccountTemplate.clientId,
|
||||
mandatoryRecommendedDepositAmount: pt?.minDepositAmount ?? 0,
|
||||
|
||||
+1
-36
@@ -35,7 +35,6 @@
|
||||
<mifosx-recurring-deposits-account-details-step
|
||||
[recurringDepositsAccountTemplate]="recurringDepositsAccountAndTemplate"
|
||||
(recurringDepositsAccountProductTemplate)="setTemplate($event)"
|
||||
[externalLinkedAccountId]="recurringDepositsAccountMaturityTermsStep?.selectedTransferAccount?.id ?? null"
|
||||
>
|
||||
</mifosx-recurring-deposits-account-details-step>
|
||||
|
||||
@@ -116,40 +115,7 @@
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 4: Terms -->
|
||||
<mat-tab [disabled]="!recurringDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="file-alt" class="cra-tab__icon"></fa-icon>
|
||||
Terms
|
||||
</ng-template>
|
||||
<div class="cra-tab-body">
|
||||
@if (recurringDepositsAccountProductTemplate) {
|
||||
<mifosx-recurring-deposits-account-maturity-terms-step
|
||||
[recurringDepositsAccountTemplate]="recurringDepositsAccountAndTemplate"
|
||||
[recurringDepositsAccountProductTemplate]="recurringDepositsAccountProductTemplate"
|
||||
[linkedSavingsAccountId]="
|
||||
recurringDepositsAccountDetailsStep?.selectedLinkedAccount?.accountType === 'SAVINGS'
|
||||
? recurringDepositsAccountDetailsStep?.selectedLinkedAccount?.id
|
||||
: null
|
||||
"
|
||||
></mifosx-recurring-deposits-account-maturity-terms-step>
|
||||
}
|
||||
|
||||
<div class="cra-actions">
|
||||
<button mat-stroked-button (click)="prev()">
|
||||
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Previous' | translate }}
|
||||
</button>
|
||||
<span class="cra-actions__spacer"></span>
|
||||
<button mat-raised-button color="primary" (click)="next()">
|
||||
{{ 'labels.buttons.Next' | translate }}
|
||||
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<!-- Tab 5: Preview -->
|
||||
<!-- Tab 4: Preview -->
|
||||
<mat-tab [disabled]="!recurringDepositsAccountProductTemplate">
|
||||
<ng-template mat-tab-label>
|
||||
<fa-icon icon="eye" class="cra-tab__icon"></fa-icon>
|
||||
@@ -170,7 +136,6 @@
|
||||
[rdDaysInYear]="rdDaysInYear"
|
||||
[rdAppliedRate]="rdAppliedRate"
|
||||
[rdIsSeniorCitizen]="rdIsSeniorCitizen"
|
||||
[closureSettings]="recurringDepositsAccountMaturityTermsStep?.closureSettings ?? {}"
|
||||
[hideButtons]="true"
|
||||
(submitEvent)="submit()"
|
||||
>
|
||||
|
||||
+1
-10
@@ -25,7 +25,6 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { RecurringDepositsAccountCurrencyStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component';
|
||||
import { RecurringDepositsAccountInterestRateChartStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component';
|
||||
import { RecurringDepositsAccountPreviewStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component';
|
||||
import { RecurringDepositsAccountMaturityTermsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-maturity-terms-step/recurring-deposits-account-maturity-terms-step.component';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
RecurringDepositsAccountDetailsStepComponent,
|
||||
RecurringDepositsAccountCurrencyStepComponent,
|
||||
RecurringDepositsAccountInterestRateChartStepComponent,
|
||||
RecurringDepositsAccountMaturityTermsStepComponent,
|
||||
RecurringDepositsAccountPreviewStepComponent
|
||||
]
|
||||
})
|
||||
@@ -65,19 +63,13 @@ export class EditRecurringDepositAccountComponent {
|
||||
@ViewChild(RecurringDepositsAccountInterestRateChartStepComponent)
|
||||
recurringDepositsAccountChartStep: RecurringDepositsAccountInterestRateChartStepComponent;
|
||||
|
||||
@ViewChild(RecurringDepositsAccountPreviewStepComponent)
|
||||
recurringDepositsAccountPreviewStep: RecurringDepositsAccountPreviewStepComponent;
|
||||
|
||||
@ViewChild(RecurringDepositsAccountMaturityTermsStepComponent)
|
||||
recurringDepositsAccountMaturityTermsStep: RecurringDepositsAccountMaturityTermsStepComponent;
|
||||
|
||||
/** Full account data + template from resolver */
|
||||
recurringDepositsAccountAndTemplate: any;
|
||||
/** Product template emitted by details step */
|
||||
recurringDepositsAccountProductTemplate: any;
|
||||
/** Currently visible wizard tab (0-indexed). */
|
||||
selectedTabIndex = 0;
|
||||
private readonly totalTabs = 5;
|
||||
private readonly totalTabs = 4;
|
||||
/** Active CBS base interest rate versions */
|
||||
cbsBaseRates: any[] = [];
|
||||
/** Selected tenure value and frequency from calculator */
|
||||
@@ -285,7 +277,6 @@ export class EditRecurringDepositAccountComponent {
|
||||
...details,
|
||||
...terms,
|
||||
...settings,
|
||||
...(this.recurringDepositsAccountMaturityTermsStep?.closureSettings ?? {}),
|
||||
...productDefaults,
|
||||
clientId: this.recurringDepositsAccountAndTemplate.clientId,
|
||||
mandatoryRecommendedDepositAmount: pt?.minDepositAmount ?? 0,
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
<mat-card>
|
||||
<form [formGroup]="approveRecurringDepositsAccountForm" (ngSubmit)="submit()">
|
||||
<mat-card-content>
|
||||
<p class="mat-body-2">This approves and activates the account in one step -- it goes straight to Active.</p>
|
||||
<div class="layout-column">
|
||||
<mat-form-field (click)="approvedOnDatePicker.open()">
|
||||
<mat-label>{{ 'labels.inputs.Approved On Date' | translate }}</mat-label>
|
||||
|
||||
+3
-13
@@ -81,9 +81,8 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form, approves the recurring deposit account, then immediately activates it on
|
||||
* the same date -- Approve and Activate are still two separate Fineract commands underneath
|
||||
* (each shows up in the audit trail), but the officer only sees and clicks through one step.
|
||||
* Submits the form and approves the recurring deposit account,
|
||||
* if successful redirects to the recurring deposit account.
|
||||
*/
|
||||
submit() {
|
||||
const approveRecurringDepositsAccountFormData = this.approveRecurringDepositsAccountForm.value;
|
||||
@@ -104,16 +103,7 @@ export class ApproveRecurringDepositsAccountComponent implements OnInit {
|
||||
this.recurringDepositsService
|
||||
.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data)
|
||||
.subscribe(() => {
|
||||
const activationData = {
|
||||
activatedOnDate: approveRecurringDepositsAccountFormData.approvedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.recurringDepositsService
|
||||
.executeRecurringDepositsAccountCommand(this.accountId, 'activate', activationData)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+2
-33
@@ -7,17 +7,7 @@
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter,
|
||||
inject,
|
||||
ChangeDetectorRef
|
||||
} from '@angular/core';
|
||||
import { Component, OnInit, Input, Output, EventEmitter, inject, ChangeDetectorRef } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, FormsModule } from '@angular/forms';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
@@ -53,7 +43,7 @@ import { IntroducerSearchComponent } from 'app/shared/introducer-search/introduc
|
||||
IntroducerSearchComponent
|
||||
]
|
||||
})
|
||||
export class RecurringDepositsAccountDetailsStepComponent implements OnInit, OnChanges {
|
||||
export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private recurringDepositsService = inject(RecurringDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
@@ -66,10 +56,6 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit, OnC
|
||||
/** Recurring Deposits Account Template */
|
||||
@Input() recurringDepositsAccountTemplate: any;
|
||||
|
||||
/** Linked-account id picked elsewhere in the wizard (e.g. the Terms step's Transfer to Savings
|
||||
* account) -- pre-fills this card so the officer doesn't have to pick the same account twice. */
|
||||
@Input() externalLinkedAccountId: number | null = null;
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -212,23 +198,6 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit, OnC
|
||||
this.dalSearch = '';
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (!changes.externalLinkedAccountId || this.selectedLinkedAccount) {
|
||||
return;
|
||||
}
|
||||
const id = this.externalLinkedAccountId;
|
||||
if (!id) return;
|
||||
const savings = this.dalAllSavings.find((a: any) => a.id === id);
|
||||
const current = this.dalAllCurrent.find((a: any) => a.id === id);
|
||||
if (savings) {
|
||||
this.dalSelectedType = 'SAVINGS';
|
||||
this.selectedLinkedAccount = savings;
|
||||
} else if (current) {
|
||||
this.dalSelectedType = 'CURRENT';
|
||||
this.selectedLinkedAccount = current;
|
||||
}
|
||||
}
|
||||
|
||||
private loadClientAccounts(): void {
|
||||
const clientId = String(this.recurringDepositsAccountTemplate?.clientId);
|
||||
if (!clientId) return;
|
||||
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<form [formGroup]="closureSettingsForm" class="layout-row-wrap gap-2px responsive-column">
|
||||
<h4 class="mat-h4 flex-98">{{ 'labels.heading.For Pre-mature closure' | translate }}</h4>
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Maturity Instructions' | translate }}</mat-label>
|
||||
<mat-select formControlName="maturityInstructionId">
|
||||
@for (maturityInstruction of maturityInstructionOptions; track maturityInstruction) {
|
||||
<mat-option [value]="maturityInstruction.id">
|
||||
{{ maturityInstruction.value | translateKey: 'catalogs' }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@if (closureSettingsForm.contains('transferToSavingsId')) {
|
||||
<div class="dal-card flex-98">
|
||||
<div class="dal-card__header">
|
||||
<div class="dal-card__header-left">
|
||||
<div class="dal-card__icon">
|
||||
<mat-icon>savings</mat-icon>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="dal-card__title">{{ 'labels.inputs.Transfer to savings account' | translate }}</h3>
|
||||
<span class="dal-card__sub">Maturity proceeds will be credited to this account</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dal-card__body">
|
||||
@if (selectedTransferAccount) {
|
||||
<div class="dal-selected">
|
||||
<div class="dal-selected__info">
|
||||
<span class="dal-type-badge dal-type-badge--savings">
|
||||
<mat-icon>savings</mat-icon>
|
||||
Savings
|
||||
</span>
|
||||
<div class="dal-selected__details">
|
||||
<span class="dal-selected__accno">{{ selectedTransferAccount.accountNo }}</span>
|
||||
<span class="dal-selected__product">{{ selectedTransferAccount.savingsProductName }}</span>
|
||||
</div>
|
||||
@if (selectedTransferAccount.summary?.accountBalance != null) {
|
||||
<div class="dal-selected__balance">
|
||||
<span class="dal-selected__bal-label">Balance</span>
|
||||
<span class="dal-selected__bal-amount">
|
||||
{{ selectedTransferAccount.currency?.code }}
|
||||
{{ selectedTransferAccount.summary.accountBalance | number: '1.2-2' }}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button
|
||||
mat-stroked-button
|
||||
color="primary"
|
||||
type="button"
|
||||
class="dal-change-btn"
|
||||
(click)="clearTransferAccount()"
|
||||
>
|
||||
<mat-icon>swap_horiz</mat-icon>
|
||||
Change
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<mat-form-field appearance="outline" class="flex-98">
|
||||
<mat-label>{{ 'labels.inputs.Transfer to savings account' | translate }}</mat-label>
|
||||
<mat-select formControlName="transferToSavingsId" required>
|
||||
@for (account of savingsAccountsData; track account) {
|
||||
<mat-option [value]="account.id">
|
||||
({{ account.accountNo }}) {{ account.savingsProductName }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-error>Transfer to savings account is required</mat-error>
|
||||
</mat-form-field>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-checkbox class="flex-98 margin-v" labelPosition="before" formControlName="preClosurePenalApplicable">
|
||||
{{ 'labels.inputs.Apply Penal Interest (less)' | translate }}
|
||||
</mat-checkbox>
|
||||
|
||||
@if (closureSettingsForm.value.preClosurePenalApplicable) {
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Penal Interest' | translate }} (%)</mat-label>
|
||||
<input type="number" matInput formControlName="preClosurePenalInterest" min="0" step="0.01" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Period' | translate }}</mat-label>
|
||||
<mat-select formControlName="preClosurePenalInterestOnTypeId">
|
||||
@for (preClosurePenalInterestOnType of preClosurePenalInterestOnTypeData; track preClosurePenalInterestOnType) {
|
||||
<mat-option [value]="preClosurePenalInterestOnType.id">
|
||||
{{ preClosurePenalInterestOnType.value | translateKey: 'catalogs' }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
}
|
||||
</form>
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
// ── Transfer-to-Savings account card (mirrors the Deposit Account Link card) ──
|
||||
|
||||
.dal-card {
|
||||
margin-top: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
||||
}
|
||||
|
||||
&__header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 10px;
|
||||
background: #0ea5e9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
}
|
||||
|
||||
&__sub {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 20px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.dal-selected {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 20px;
|
||||
border: 2px solid #0ea5e9;
|
||||
border-radius: 12px;
|
||||
background: #f0f9ff;
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex: 1;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__accno {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
&__product {
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
&__balance {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&__bal-label {
|
||||
font-size: 10px;
|
||||
color: #94a3b8;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
&__bal-amount {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0c4a6e;
|
||||
}
|
||||
}
|
||||
|
||||
.dal-change-btn {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dal-type-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
border: 1px solid #e2e8f0;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&--savings {
|
||||
background: #eff6ff;
|
||||
color: #1d4ed8;
|
||||
border-color: #bfdbfe;
|
||||
|
||||
mat-icon {
|
||||
color: #2563eb;
|
||||
}
|
||||
}
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, Input, OnChanges, SimpleChanges, inject } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* Recurring Deposit Account Maturity Terms Step -- what happens to this account at maturity
|
||||
* (Withdraw / Transfer to Savings / Reinvest) and the pre-mature-closure penalty, decided
|
||||
* per account rather than silently inherited from the product.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-recurring-deposits-account-maturity-terms-step',
|
||||
templateUrl: './recurring-deposits-account-maturity-terms-step.component.html',
|
||||
styleUrls: ['./recurring-deposits-account-maturity-terms-step.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatCheckbox,
|
||||
MatIcon
|
||||
]
|
||||
})
|
||||
export class RecurringDepositsAccountMaturityTermsStepComponent implements OnChanges {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
|
||||
@Input() recurringDepositsAccountTemplate: any;
|
||||
@Input() recurringDepositsAccountProductTemplate: any;
|
||||
/** Account already linked elsewhere in the wizard (the Details step's Deposit Account Link) --
|
||||
* pre-fills Transfer to Savings so the officer doesn't have to pick the same account twice. */
|
||||
@Input() linkedSavingsAccountId: number | null = null;
|
||||
|
||||
closureSettingsForm: UntypedFormGroup;
|
||||
maturityInstructionOptions: any[] = [];
|
||||
savingsAccountsData: any[] = [];
|
||||
preClosurePenalInterestOnTypeData: any[] = [];
|
||||
|
||||
constructor() {
|
||||
this.closureSettingsForm = this.formBuilder.group({
|
||||
maturityInstructionId: [''],
|
||||
preClosurePenalApplicable: [false],
|
||||
preClosurePenalInterest: [
|
||||
'',
|
||||
Validators.min(0)
|
||||
],
|
||||
preClosurePenalInterestOnTypeId: ['']
|
||||
});
|
||||
this.closureSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
|
||||
// 200 = Transfer to Savings -- Withdraw Deposit (100) needs no target account, and both
|
||||
// Reinvest options (300/400) open a brand-new RD instead, so they ignore this field too.
|
||||
if (value === 200) {
|
||||
this.closureSettingsForm.addControl(
|
||||
'transferToSavingsId',
|
||||
new UntypedFormControl(this.linkedSavingsAccountId ?? '', Validators.required)
|
||||
);
|
||||
} else {
|
||||
this.closureSettingsForm.removeControl('transferToSavingsId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.linkedSavingsAccountId) {
|
||||
const control = this.closureSettingsForm.get('transferToSavingsId');
|
||||
if (control && !control.value && this.linkedSavingsAccountId) {
|
||||
control.setValue(this.linkedSavingsAccountId);
|
||||
}
|
||||
}
|
||||
const template = this.recurringDepositsAccountProductTemplate || this.recurringDepositsAccountTemplate;
|
||||
if (template) {
|
||||
// Withdraw Deposit (id 100) books the maturity proceeds out of the bank's cash/vault the moment
|
||||
// the account matures, before the customer has actually collected it -- disabled everywhere.
|
||||
this.maturityInstructionOptions = (template.maturityInstructionOptions ?? []).filter(
|
||||
(option: any) => option.id !== 100
|
||||
);
|
||||
this.savingsAccountsData = template.savingsAccounts ?? [];
|
||||
this.preClosurePenalInterestOnTypeData = template.preClosurePenalInterestOnTypeOptions ?? [];
|
||||
if (!this.closureSettingsForm.get('preClosurePenalApplicable').dirty) {
|
||||
this.closureSettingsForm.patchValue({
|
||||
preClosurePenalApplicable: template.preClosurePenalApplicable ?? false,
|
||||
preClosurePenalInterest: template.preClosurePenalInterest ?? '',
|
||||
preClosurePenalInterestOnTypeId: template.preClosurePenalInterestOnType?.id ?? ''
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The linked-savings account for the transfer-to-savings maturity instruction, once picked. */
|
||||
get selectedTransferAccount(): any {
|
||||
const id = this.closureSettingsForm.value.transferToSavingsId;
|
||||
if (!id) return null;
|
||||
return this.savingsAccountsData.find((account: any) => account.id === id) ?? null;
|
||||
}
|
||||
|
||||
clearTransferAccount(): void {
|
||||
this.closureSettingsForm.get('transferToSavingsId')?.setValue('');
|
||||
}
|
||||
|
||||
/** Chosen maturity/closure settings, ready to merge into the submit payload. */
|
||||
get closureSettings() {
|
||||
const settings = this.closureSettingsForm.getRawValue();
|
||||
for (const key in settings) {
|
||||
if (settings[key] === '') {
|
||||
delete settings[key];
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
-35
@@ -853,41 +853,6 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="preview-section">
|
||||
<div class="preview-section__header">
|
||||
<i class="fas fa-flag-checkered preview-section__icon"></i>
|
||||
<span class="preview-section__title">Maturity & Pre-mature Closure</span>
|
||||
</div>
|
||||
<div class="preview-body">
|
||||
<div class="preview-grid preview-grid--three">
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Maturity Instructions' | translate }}</span>
|
||||
<span class="preview-value">{{ closureMaturityInstructionLabel }}</span>
|
||||
</div>
|
||||
@if (closureSettings?.transferToSavingsId) {
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Transfer to savings account' | translate }}</span>
|
||||
<span class="preview-value">{{ closureTransferToSavingsLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Apply Penal Interest (less)' | translate }}</span>
|
||||
<span class="preview-value">{{ closureSettings?.preClosurePenalApplicable | yesNo }}</span>
|
||||
</div>
|
||||
@if (closureSettings?.preClosurePenalApplicable) {
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Penal Interest' | translate }} (%)</span>
|
||||
<span class="preview-value">{{ closureSettings?.preClosurePenalInterest }}%</span>
|
||||
</div>
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">{{ 'labels.inputs.Period' | translate }}</span>
|
||||
<span class="preview-value">{{ closurePenalInterestOnTypeLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!hideButtons) {
|
||||
<div class="layout-row responsive-column align-center gap-2px margin-t">
|
||||
<button mat-raised-button matStepperPrevious>
|
||||
|
||||
+1
-23
@@ -201,29 +201,7 @@ export class RecurringDepositsAccountPreviewStepComponent implements OnChanges {
|
||||
/** Expand Chart Slab Index used in the view */
|
||||
expandChartSlabIndex: number;
|
||||
|
||||
/** Maturity/pre-mature-closure choices made in the Terms step -- shown here read-only. */
|
||||
@Input() closureSettings: any = {};
|
||||
|
||||
get closureMaturityInstructionLabel(): string {
|
||||
const template = this.recurringDepositsAccountProductTemplate || this.recurringDepositsAccountTemplate;
|
||||
const options = template?.maturityInstructionOptions ?? [];
|
||||
const match = options.find((o: any) => o.id === this.closureSettings?.maturityInstructionId);
|
||||
return match?.value ?? '—';
|
||||
}
|
||||
|
||||
get closureTransferToSavingsLabel(): string {
|
||||
const template = this.recurringDepositsAccountProductTemplate || this.recurringDepositsAccountTemplate;
|
||||
const accounts = template?.savingsAccounts ?? [];
|
||||
const match = accounts.find((a: any) => a.id === this.closureSettings?.transferToSavingsId);
|
||||
return match ? `(${match.accountNo}) ${match.savingsProductName}` : '—';
|
||||
}
|
||||
|
||||
get closurePenalInterestOnTypeLabel(): string {
|
||||
const template = this.recurringDepositsAccountProductTemplate || this.recurringDepositsAccountTemplate;
|
||||
const options = template?.preClosurePenalInterestOnTypeOptions ?? [];
|
||||
const match = options.find((o: any) => o.id === this.closureSettings?.preClosurePenalInterestOnTypeId);
|
||||
return match?.value ?? '—';
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
ngOnChanges() {
|
||||
const template = this.recurringDepositsAccountProductTemplate || this.recurringDepositsAccountTemplate;
|
||||
|
||||
-19
@@ -17,7 +17,6 @@ import {
|
||||
} from '@angular/forms';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { OptionData } from 'app/shared/models/option-data.model';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { InputAmountComponent } from '../../../../shared/input-amount/input-amount.component';
|
||||
import { MatDivider } from '@angular/material/divider';
|
||||
@@ -62,10 +61,6 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
|
||||
periodFrequencyTypeData: any[] = [];
|
||||
/** Preclosure Penal Interest Type on Data */
|
||||
preClosurePenalInterestOnTypeData: any[] = [];
|
||||
/** Options for what happens to the account at maturity */
|
||||
maturityInstructionOptions: OptionData[];
|
||||
/** Savings accounts eligible as a maturity-proceeds transfer target */
|
||||
savingsAccountsData: any;
|
||||
/** Tax Group */
|
||||
taxGroup: any;
|
||||
currency: Currency | null = null;
|
||||
@@ -96,7 +91,6 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
|
||||
: '',
|
||||
maturityInstructions: recurringDepositsAccount.maturityInstructions ?? false,
|
||||
creditMaturityProceeds: recurringDepositsAccount.creditMaturityProceeds ?? false,
|
||||
maturityInstructionId: recurringDepositsAccount.maturityInstructionId ?? '',
|
||||
penaltyGracePeriodMissedInstallments: recurringDepositsAccount.penaltyGracePeriodMissedInstallments ?? false,
|
||||
panelRequestApplicable: recurringDepositsAccount.panelRequestApplicable ?? false,
|
||||
noPenaltyNomineeHeirClosure: recurringDepositsAccount.noPenaltyNomineeHeirClosure ?? false,
|
||||
@@ -188,7 +182,6 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
|
||||
lockinPeriodFrequencyType: [''],
|
||||
maturityInstructions: [false],
|
||||
creditMaturityProceeds: [false],
|
||||
maturityInstructionId: [''],
|
||||
penaltyGracePeriodMissedInstallments: [false],
|
||||
panelRequestApplicable: [false],
|
||||
noPenaltyNomineeHeirClosure: [false],
|
||||
@@ -224,8 +217,6 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
|
||||
this.lockinPeriodFrequencyTypeData = recurringDepositsAccount.lockinPeriodFrequencyTypeOptions;
|
||||
this.periodFrequencyTypeData = recurringDepositsAccount.periodFrequencyTypeOptions;
|
||||
this.preClosurePenalInterestOnTypeData = recurringDepositsAccount.preClosurePenalInterestOnTypeOptions;
|
||||
this.maturityInstructionOptions = recurringDepositsAccount.maturityInstructionOptions;
|
||||
this.savingsAccountsData = recurringDepositsAccount.savingsAccounts;
|
||||
}
|
||||
|
||||
buildDependencies() {
|
||||
@@ -242,16 +233,6 @@ export class RecurringDepositsAccountSettingsStepComponent implements OnInit, On
|
||||
this.recurringDepositAccountSettingsForm.addControl('recurringFrequencyType', new UntypedFormControl(''));
|
||||
}
|
||||
});
|
||||
this.recurringDepositAccountSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
|
||||
if (value > 100) {
|
||||
this.recurringDepositAccountSettingsForm.addControl(
|
||||
'transferToSavingsId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
} else {
|
||||
this.recurringDepositAccountSettingsForm.removeControl('transferToSavingsId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get recurringDepositAccountSettings() {
|
||||
|
||||
-13
@@ -87,19 +87,6 @@
|
||||
|
||||
<!-- Action menu (kebab) -->
|
||||
<div class="rd-hero__actions">
|
||||
@if (
|
||||
!recurringDepositsAccountData.status.rejected &&
|
||||
!recurringDepositsAccountData.status.submittedAndPendingApproval
|
||||
) {
|
||||
<button
|
||||
mat-icon-button
|
||||
matTooltip="Print Certificate"
|
||||
(click)="printCertificate()"
|
||||
aria-label="Print certificate"
|
||||
>
|
||||
<fa-icon icon="print"></fa-icon>
|
||||
</button>
|
||||
}
|
||||
<button mat-icon-button [matMenuTriggerFor]="accountMenu" aria-label="Account actions" yPosition="below">
|
||||
<fa-icon icon="ellipsis-v"></fa-icon>
|
||||
</button>
|
||||
|
||||
-15
@@ -22,7 +22,6 @@ import { RecurringDepositsButtonsConfiguration } from './recurring-deposits-butt
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { RecurringDepositConfirmationDialogComponent } from './custom-dialogs/recurring-deposit-confirmation-dialog/recurring-deposit-confirmation-dialog.component';
|
||||
import { DepositCertificateDialogComponent } from 'app/shared/deposit-certificate-dialog/deposit-certificate-dialog.component';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AccountsService } from 'app/accounts/accounts.service';
|
||||
@@ -427,20 +426,6 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a printable deposit certificate for this account.
|
||||
*/
|
||||
printCertificate() {
|
||||
this.dialog.open(DepositCertificateDialogComponent, {
|
||||
width: '900px',
|
||||
data: {
|
||||
accountType: 'RD',
|
||||
accountData: this.recurringDepositsAccountData,
|
||||
clientId: this.recurringDepositsAccountData.clientId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables withhold tax for recurring deposits account
|
||||
* Recurring deposits endpoint is not supported so using Savings endpoint.
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
<!--
|
||||
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="am-container">
|
||||
<div class="am-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="am-back">
|
||||
<i class="fas fa-arrow-left"></i> {{ 'labels.heading.Organization' | translate }}
|
||||
</button>
|
||||
<h2 class="am-header__title">Agent Master Entry</h2>
|
||||
</div>
|
||||
|
||||
<div class="am-card">
|
||||
<form [formGroup]="agentForm">
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-id-card"></i>
|
||||
<h3>Agent Details</h3>
|
||||
</div>
|
||||
<div class="am-grid">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Client ID</mat-label>
|
||||
<input matInput required formControlName="clientId" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Code</mat-label>
|
||||
<input matInput formControlName="agentCode" placeholder="Auto-generated" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field am-field--wide">
|
||||
<mat-label>Agent Name ID</mat-label>
|
||||
<input matInput required formControlName="agentNameId" placeholder="Person or institution name" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field am-field--wide">
|
||||
<mat-label>Agent Address (Line 1)</mat-label>
|
||||
<input matInput required formControlName="agentAddress1" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field am-field--wide">
|
||||
<mat-label>Agent Address (Line 2)</mat-label>
|
||||
<input matInput formControlName="agentAddress2" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent City</mat-label>
|
||||
<input matInput required formControlName="agentCity" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent PinCode</mat-label>
|
||||
<input matInput required formControlName="agentPinCode" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Telephone</mat-label>
|
||||
<input matInput formControlName="agentTelephone" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Home Branch</mat-label>
|
||||
<input matInput required formControlName="homeBranch" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-percent"></i>
|
||||
<h3>Collection & Commission Settings</h3>
|
||||
</div>
|
||||
<div class="am-grid">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Com. Calculation</mat-label>
|
||||
<mat-select required formControlName="commissionCalculation">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>TDS</mat-label>
|
||||
<mat-select required formControlName="tdsApplicable">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>TDS %</mat-label>
|
||||
<input matInput type="number" formControlName="tdsPercent" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Cur.TDS</mat-label>
|
||||
<input matInput formControlName="currentTds" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>TDS Amt</mat-label>
|
||||
<input matInput formControlName="tdsAmount" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Limit</mat-label>
|
||||
<input matInput type="number" formControlName="limit" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Machine Rent</mat-label>
|
||||
<input matInput type="number" formControlName="machineRent" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-piggy-bank"></i>
|
||||
<h3>Settlement & Security Accounts</h3>
|
||||
</div>
|
||||
<div class="am-grid">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Saving Branch</mat-label>
|
||||
<input matInput required formControlName="savingBranch" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Saving A/C Type</mat-label>
|
||||
<mat-select required formControlName="agentSavingAccountType">
|
||||
@for (accountType of agentSavingAccountTypes; track accountType) {
|
||||
<mat-option [value]="accountType">{{ accountType }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Saving A/C No</mat-label>
|
||||
<input matInput required formControlName="agentSavingAccountNo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Trf Branch</mat-label>
|
||||
<input matInput formControlName="transferBranch" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Trf.Amt A/C Type</mat-label>
|
||||
<input matInput formControlName="transferAmountAccountType" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Trf.Amt A/C No</mat-label>
|
||||
<input matInput formControlName="transferAccountNo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Security Branch</mat-label>
|
||||
<input matInput formControlName="agentSecurityBranch" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Security A/C Type</mat-label>
|
||||
<mat-select formControlName="agentSecurityAccountType">
|
||||
@for (accountType of agentSavingAccountTypes; track accountType) {
|
||||
<mat-option [value]="accountType">{{ accountType }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Security A/C No</mat-label>
|
||||
<input matInput formControlName="agentSecurityAccountNo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Opening Date</mat-label>
|
||||
<input matInput required [matDatepicker]="openingDatePicker" formControlName="agentOpeningDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="openingDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #openingDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Birth Date</mat-label>
|
||||
<input
|
||||
matInput
|
||||
required
|
||||
[max]="maxDate"
|
||||
[matDatepicker]="birthDatePicker"
|
||||
formControlName="agentBirthDate"
|
||||
/>
|
||||
<mat-datepicker-toggle matIconSuffix [for]="birthDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #birthDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Current Balance</mat-label>
|
||||
<input matInput formControlName="agentCurrentBalance" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Agent Opening Balance</mat-label>
|
||||
<input matInput formControlName="agentOpeningBalance" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-clock"></i>
|
||||
<h3>Collection Limit History</h3>
|
||||
<button mat-stroked-button type="button" class="am-add-guarantor" (click)="addLimit()">
|
||||
<i class="fas fa-plus"></i> Add Limit
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (limits.length === 0) {
|
||||
<p class="am-empty-guarantors">No limit periods added yet.</p>
|
||||
}
|
||||
|
||||
@for (limitRow of limits.controls; track limitRow; let i = $index) {
|
||||
<div class="am-limit-row" [formGroup]="$any(limitRow)">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>From Date</mat-label>
|
||||
<input matInput required [matDatepicker]="fromPicker" formControlName="fromDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="fromPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #fromPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>To Date</mat-label>
|
||||
<input matInput required [matDatepicker]="toPicker" formControlName="toDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="toPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #toPicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Limit</mat-label>
|
||||
<input matInput required type="number" formControlName="limit" />
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
class="am-remove-guarantor"
|
||||
(click)="removeLimit(i)"
|
||||
matTooltip="Remove limit period"
|
||||
>
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-user-shield"></i>
|
||||
<h3>Guarantor's Detail</h3>
|
||||
<button mat-stroked-button type="button" class="am-add-guarantor" (click)="addGuarantor()">
|
||||
<i class="fas fa-plus"></i> Add Guarantor
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (guarantors.length === 0) {
|
||||
<p class="am-empty-guarantors">No guarantors added yet.</p>
|
||||
}
|
||||
|
||||
@for (guarantor of guarantors.controls; track guarantor; let i = $index) {
|
||||
<div class="am-guarantor-row" [formGroup]="$any(guarantor)">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Client ID</mat-label>
|
||||
<input matInput required formControlName="clientId" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Guarantor Name</mat-label>
|
||||
<input matInput required formControlName="guarantorName" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Address 1</mat-label>
|
||||
<input matInput required formControlName="address1" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Address 2</mat-label>
|
||||
<input matInput formControlName="address2" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>City</mat-label>
|
||||
<input matInput required formControlName="city" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Pin Code</mat-label>
|
||||
<input matInput required formControlName="pinCode" />
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Telephone</mat-label>
|
||||
<input matInput formControlName="telephone" />
|
||||
</mat-form-field>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
class="am-remove-guarantor"
|
||||
(click)="removeGuarantor(i)"
|
||||
matTooltip="Remove guarantor"
|
||||
>
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="am-section">
|
||||
<div class="am-section__header">
|
||||
<i class="fas fa-wallet"></i>
|
||||
<h3>Deductions & Deposits</h3>
|
||||
</div>
|
||||
<div class="am-grid">
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Comm</mat-label>
|
||||
<input matInput formControlName="commission" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Other Comm</mat-label>
|
||||
<input matInput type="number" formControlName="otherCommission" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Ag.Deposit</mat-label>
|
||||
<input matInput type="number" formControlName="agentDeposit" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Adv.Festival</mat-label>
|
||||
<input matInput type="number" formControlName="festivalAdvance" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="am-field">
|
||||
<mat-label>Other Deduction</mat-label>
|
||||
<input matInput type="number" formControlName="otherDeduction" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-stroked-button type="button" (click)="cancel()">Cancel</button>
|
||||
<button mat-stroked-button type="button" (click)="retrieve()">Retrieve</button>
|
||||
<button mat-raised-button color="primary" type="button" [disabled]="agentForm.invalid" (click)="save()">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.am-container {
|
||||
max-width: 1040px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.am-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.am-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.am-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
padding: 8px 24px 24px;
|
||||
}
|
||||
|
||||
.am-section {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid rgb(0 0 0 / 8%);
|
||||
|
||||
&:last-of-type {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
i {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.am-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.am-field {
|
||||
width: 100%;
|
||||
|
||||
&--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
.am-add-guarantor {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.am-empty-guarantors {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.am-guarantor-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr) auto;
|
||||
gap: 8px 12px;
|
||||
align-items: start;
|
||||
padding: 10px 0;
|
||||
border-top: 1px dashed rgb(0 0 0 / 10%);
|
||||
|
||||
&:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
.am-limit-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr) auto;
|
||||
gap: 8px 12px;
|
||||
align-items: start;
|
||||
padding: 10px 0;
|
||||
border-top: 1px dashed rgb(0 0 0 / 10%);
|
||||
|
||||
&:first-of-type {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
.am-remove-guarantor {
|
||||
color: #b91c1c;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.am-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (width <= 900px) {
|
||||
.am-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.am-guarantor-row,
|
||||
.am-limit-row {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, UntypedFormArray, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Agent Master Entry component.
|
||||
*
|
||||
* A DDS collection agent — either a person or an institution — registered
|
||||
* with its own settlement savings account and one or more guarantors. As of
|
||||
* 2026-08-24 the Agent also does the daily collection work directly (the
|
||||
* SubAgent tier was removed): it carries the collection-limit history,
|
||||
* TDS/commission settings and security account SubAgent used to own.
|
||||
*
|
||||
* Backed by its own DDS Agent API (`/dds/agents`) - independent of Staff/
|
||||
* Client CRUD, per the DDS agent/commission hierarchy being genuinely new
|
||||
* feature work.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-agent-master',
|
||||
templateUrl: './agent-master.component.html',
|
||||
styleUrls: ['./agent-master.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class AgentMasterComponent {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private organizationService = inject(OrganizationService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
maxDate = new Date();
|
||||
agentId: number | null = null;
|
||||
|
||||
agentSavingAccountTypes = [
|
||||
'Savings Deposit Individual A/C',
|
||||
'Savings Deposit Joint A/C',
|
||||
'Current Account'
|
||||
];
|
||||
|
||||
agentForm: UntypedFormGroup = this.formBuilder.group({
|
||||
clientId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentCode: [
|
||||
{
|
||||
value: '',
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
agentNameId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentAddress1: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentAddress2: [''],
|
||||
agentCity: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentPinCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentTelephone: [''],
|
||||
agentSavingAccountType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentSavingAccountNo: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentOpeningDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentBirthDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
agentCurrentBalance: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
agentOpeningBalance: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
homeBranch: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
tdsApplicable: [
|
||||
'No',
|
||||
Validators.required
|
||||
],
|
||||
tdsPercent: [0],
|
||||
currentTds: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
tdsAmount: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
savingBranch: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transferBranch: [''],
|
||||
transferAmountAccountType: [''],
|
||||
transferAccountNo: [''],
|
||||
commissionCalculation: [
|
||||
'Yes',
|
||||
Validators.required
|
||||
],
|
||||
limit: [0],
|
||||
machineRent: [0],
|
||||
agentSecurityBranch: [''],
|
||||
agentSecurityAccountType: [''],
|
||||
agentSecurityAccountNo: [''],
|
||||
commission: [
|
||||
{
|
||||
value: 0,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
otherCommission: [0],
|
||||
agentDeposit: [0],
|
||||
festivalAdvance: [0],
|
||||
otherDeduction: [0],
|
||||
limits: this.formBuilder.array([]),
|
||||
guarantors: this.formBuilder.array([])
|
||||
});
|
||||
|
||||
get limits(): UntypedFormArray {
|
||||
return this.agentForm.get('limits') as UntypedFormArray;
|
||||
}
|
||||
|
||||
get guarantors(): UntypedFormArray {
|
||||
return this.agentForm.get('guarantors') as UntypedFormArray;
|
||||
}
|
||||
|
||||
private buildLimitGroup(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
toDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
limit: [
|
||||
0,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
private buildGuarantorGroup(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
clientId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
guarantorName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
address1: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
address2: [''],
|
||||
city: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
pinCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
telephone: ['']
|
||||
});
|
||||
}
|
||||
|
||||
addLimit(): void {
|
||||
this.limits.push(this.buildLimitGroup());
|
||||
}
|
||||
|
||||
removeLimit(index: number): void {
|
||||
this.limits.removeAt(index);
|
||||
}
|
||||
|
||||
addGuarantor(): void {
|
||||
this.guarantors.push(this.buildGuarantorGroup());
|
||||
}
|
||||
|
||||
removeGuarantor(index: number): void {
|
||||
this.guarantors.removeAt(index);
|
||||
}
|
||||
|
||||
retrieve(): void {
|
||||
const clientId = this.agentForm.get('clientId')?.value;
|
||||
if (!clientId) {
|
||||
return;
|
||||
}
|
||||
this.organizationService.getAgents().subscribe((agents: any[]) => {
|
||||
const match = (agents || []).find((agent) => String(agent.clientId) === String(clientId));
|
||||
if (match) {
|
||||
this.patchFormFromAgent(match);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
this.agentId = null;
|
||||
this.agentForm.reset();
|
||||
this.agentForm.patchValue({
|
||||
agentCurrentBalance: 0,
|
||||
agentOpeningBalance: 0,
|
||||
tdsApplicable: 'No',
|
||||
commissionCalculation: 'Yes',
|
||||
currentTds: 0,
|
||||
tdsAmount: 0,
|
||||
commission: 0
|
||||
});
|
||||
this.limits.clear();
|
||||
this.guarantors.clear();
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
save(): void {
|
||||
const raw = this.agentForm.getRawValue();
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
|
||||
const payload: any = {
|
||||
clientId: Number(raw.clientId),
|
||||
agentNameId: raw.agentNameId,
|
||||
agentAddress1: raw.agentAddress1,
|
||||
agentAddress2: raw.agentAddress2 || undefined,
|
||||
agentCity: raw.agentCity,
|
||||
agentPinCode: raw.agentPinCode,
|
||||
agentTelephone: raw.agentTelephone || undefined,
|
||||
agentSavingAccountType: raw.agentSavingAccountType,
|
||||
agentSavingAccountNo: raw.agentSavingAccountNo,
|
||||
agentOpeningDate: this.dateUtils.formatDate(raw.agentOpeningDate, dateFormat),
|
||||
agentBirthDate: this.dateUtils.formatDate(raw.agentBirthDate, dateFormat),
|
||||
agentOpeningBalance: raw.agentOpeningBalance || 0,
|
||||
homeBranch: raw.homeBranch,
|
||||
tdsApplicable: raw.tdsApplicable === 'Yes',
|
||||
tdsPercent: raw.tdsPercent || undefined,
|
||||
savingBranch: raw.savingBranch,
|
||||
transferBranch: raw.transferBranch || undefined,
|
||||
transferAmountAccountType: raw.transferAmountAccountType || undefined,
|
||||
transferAccountNo: raw.transferAccountNo || undefined,
|
||||
commissionCalculation: raw.commissionCalculation === 'Yes',
|
||||
limit: raw.limit || undefined,
|
||||
machineRent: raw.machineRent || undefined,
|
||||
agentSecurityBranch: raw.agentSecurityBranch || undefined,
|
||||
agentSecurityAccountType: raw.agentSecurityAccountType || undefined,
|
||||
agentSecurityAccountNo: raw.agentSecurityAccountNo || undefined,
|
||||
otherCommission: raw.otherCommission || undefined,
|
||||
agentDeposit: raw.agentDeposit || undefined,
|
||||
festivalAdvance: raw.festivalAdvance || undefined,
|
||||
otherDeduction: raw.otherDeduction || undefined,
|
||||
dateFormat,
|
||||
locale,
|
||||
limits: (raw.limits || []).map((limit: any) => ({
|
||||
fromDate: this.dateUtils.getDate(limit.fromDate),
|
||||
toDate: this.dateUtils.getDate(limit.toDate),
|
||||
limit: limit.limit
|
||||
})),
|
||||
guarantors: (raw.guarantors || []).map((guarantor: any) => ({
|
||||
clientId: Number(guarantor.clientId),
|
||||
guarantorName: guarantor.guarantorName,
|
||||
address1: guarantor.address1,
|
||||
address2: guarantor.address2 || undefined,
|
||||
city: guarantor.city,
|
||||
pinCode: guarantor.pinCode,
|
||||
telephone: guarantor.telephone || undefined
|
||||
}))
|
||||
};
|
||||
|
||||
if (this.agentId) {
|
||||
this.organizationService.updateAgent(this.agentId, payload).subscribe(() => this.exit());
|
||||
} else {
|
||||
this.organizationService.createAgent(payload).subscribe(() => this.exit());
|
||||
}
|
||||
}
|
||||
|
||||
private patchFormFromAgent(agent: any): void {
|
||||
this.agentId = agent.id;
|
||||
this.agentForm.patchValue({
|
||||
clientId: agent.clientId,
|
||||
agentCode: agent.agentCode,
|
||||
agentNameId: agent.agentNameId,
|
||||
agentAddress1: agent.agentAddress1,
|
||||
agentAddress2: agent.agentAddress2,
|
||||
agentCity: agent.agentCity,
|
||||
agentPinCode: agent.agentPinCode,
|
||||
agentTelephone: agent.agentTelephone,
|
||||
agentSavingAccountType: agent.agentSavingAccountType,
|
||||
agentSavingAccountNo: agent.agentSavingAccountNo,
|
||||
agentOpeningDate: agent.agentOpeningDate ? new Date(agent.agentOpeningDate) : null,
|
||||
agentBirthDate: agent.agentBirthDate ? new Date(agent.agentBirthDate) : null,
|
||||
agentCurrentBalance: agent.agentCurrentBalance,
|
||||
agentOpeningBalance: agent.agentOpeningBalance,
|
||||
homeBranch: agent.homeBranch,
|
||||
tdsApplicable: agent.tdsApplicable ? 'Yes' : 'No',
|
||||
tdsPercent: agent.tdsPercent,
|
||||
currentTds: agent.currentTds,
|
||||
tdsAmount: agent.tdsAmount,
|
||||
savingBranch: agent.savingBranch,
|
||||
transferBranch: agent.transferBranch,
|
||||
transferAmountAccountType: agent.transferAmountAccountType,
|
||||
transferAccountNo: agent.transferAccountNo,
|
||||
commissionCalculation: agent.commissionCalculation ? 'Yes' : 'No',
|
||||
limit: agent.limit,
|
||||
machineRent: agent.machineRent,
|
||||
agentSecurityBranch: agent.agentSecurityBranch,
|
||||
agentSecurityAccountType: agent.agentSecurityAccountType,
|
||||
agentSecurityAccountNo: agent.agentSecurityAccountNo,
|
||||
commission: agent.commission,
|
||||
otherCommission: agent.otherCommission,
|
||||
agentDeposit: agent.agentDeposit,
|
||||
festivalAdvance: agent.festivalAdvance,
|
||||
otherDeduction: agent.otherDeduction
|
||||
});
|
||||
|
||||
this.limits.clear();
|
||||
(agent.limits || []).forEach((limit: any) => {
|
||||
const group = this.buildLimitGroup();
|
||||
group.patchValue({
|
||||
fromDate: limit.fromDate ? new Date(limit.fromDate) : null,
|
||||
toDate: limit.toDate ? new Date(limit.toDate) : null,
|
||||
limit: limit.limit
|
||||
});
|
||||
this.limits.push(group);
|
||||
});
|
||||
|
||||
this.guarantors.clear();
|
||||
(agent.guarantors || []).forEach((guarantor: any) => {
|
||||
const group = this.buildGuarantorGroup();
|
||||
group.patchValue(guarantor);
|
||||
this.guarantors.push(group);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<!--
|
||||
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="csm-container">
|
||||
<div class="csm-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="csm-back">
|
||||
<i class="fas fa-arrow-left"></i> {{ 'labels.heading.Organization' | translate }}
|
||||
</button>
|
||||
<h2 class="csm-header__title">Commission Slab Master</h2>
|
||||
</div>
|
||||
|
||||
<div class="csm-card">
|
||||
<table class="csm-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Slab Type</th>
|
||||
<th>Slab From</th>
|
||||
<th>Slab To</th>
|
||||
<th>Comm Per</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (slab of slabs; track slab; let i = $index) {
|
||||
<tr>
|
||||
<td>{{ slab.slabType }}</td>
|
||||
<td>{{ slab.slabFrom }}</td>
|
||||
<td>{{ slab.slabTo }}</td>
|
||||
<td>{{ slab.commissionPercent }}%</td>
|
||||
<td class="csm-row-actions">
|
||||
<button mat-icon-button type="button" (click)="removeSlab(i)" matTooltip="Remove slab">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
<tr [formGroup]="newSlabForm" class="csm-new-row">
|
||||
<td>
|
||||
<mat-form-field appearance="outline" class="csm-inline-field">
|
||||
<mat-select required formControlName="slabType" placeholder="Slab Type">
|
||||
@for (type of slabTypes; track type) {
|
||||
<mat-option [value]="type">{{ type }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</td>
|
||||
<td>
|
||||
<mat-form-field appearance="outline" class="csm-inline-field">
|
||||
<input matInput required type="number" formControlName="slabFrom" />
|
||||
</mat-form-field>
|
||||
</td>
|
||||
<td>
|
||||
<mat-form-field appearance="outline" class="csm-inline-field">
|
||||
<input matInput required type="number" formControlName="slabTo" />
|
||||
</mat-form-field>
|
||||
</td>
|
||||
<td>
|
||||
<mat-form-field appearance="outline" class="csm-inline-field">
|
||||
<input matInput required type="number" formControlName="commissionPercent" />
|
||||
</mat-form-field>
|
||||
</td>
|
||||
<td class="csm-row-actions">
|
||||
<button
|
||||
mat-icon-button
|
||||
color="primary"
|
||||
type="button"
|
||||
[disabled]="newSlabForm.invalid"
|
||||
(click)="addSlab()"
|
||||
matTooltip="Add slab"
|
||||
>
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (slabs.length === 0) {
|
||||
<p class="csm-empty">No commission slabs defined yet — add one using the row above.</p>
|
||||
}
|
||||
|
||||
<div class="csm-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-raised-button color="primary" type="button" (click)="save()">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.csm-container {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.csm-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.csm-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.csm-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
padding: 16px 24px 24px;
|
||||
}
|
||||
|
||||
.csm-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: rgb(0 0 0 / 55%);
|
||||
padding: 8px 10px;
|
||||
border-bottom: 2px solid rgb(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid rgb(0 0 0 / 6%);
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.csm-inline-field {
|
||||
width: 100%;
|
||||
|
||||
::ng-deep .mat-mdc-text-field-wrapper {
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
.csm-row-actions {
|
||||
text-align: center;
|
||||
width: 48px;
|
||||
}
|
||||
|
||||
.csm-new-row {
|
||||
background: rgb(15 118 110 / 4%);
|
||||
}
|
||||
|
||||
.csm-empty {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 12px 0 0;
|
||||
}
|
||||
|
||||
.csm-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/**
|
||||
* Commission Slab Master component.
|
||||
*
|
||||
* Two kinds of slab: ACCOUNT (commission percentage on collection volume)
|
||||
* and COMMISSION (a senior-agent override on another agent's commission -
|
||||
* deferred: there is no agent hierarchy modelled yet, see the DDS punch
|
||||
* list). Modelled directly on the legacy Commission Slab Master screen this
|
||||
* replaces.
|
||||
*
|
||||
* Backed by its own DDS Commission Slab API (`/dds/commissionslabs`) - an
|
||||
* append-only chart, same as the legacy screen: existing rows load on open,
|
||||
* newly-added rows post on Save, and there is no edit/delete of a
|
||||
* previously-saved row.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-commission-slab-master',
|
||||
templateUrl: './commission-slab-master.component.html',
|
||||
styleUrls: ['./commission-slab-master.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class CommissionSlabMasterComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private organizationService = inject(OrganizationService);
|
||||
|
||||
private static readonly SLAB_TYPE_CODES: Record<string, string> = {
|
||||
Account: 'ACCOUNT',
|
||||
Commission: 'COMMISSION'
|
||||
};
|
||||
private static readonly SLAB_TYPE_LABELS: Record<string, string> = {
|
||||
ACCOUNT: 'Account',
|
||||
COMMISSION: 'Commission'
|
||||
};
|
||||
|
||||
slabTypes = [
|
||||
'Account',
|
||||
'Commission'
|
||||
];
|
||||
|
||||
displayedColumns: string[] = [
|
||||
'slabType',
|
||||
'slabFrom',
|
||||
'slabTo',
|
||||
'commissionPercent',
|
||||
'actions'
|
||||
];
|
||||
|
||||
slabs: Array<{ id?: number; slabType: string; slabFrom: number; slabTo: number; commissionPercent: number }> = [];
|
||||
|
||||
newSlabForm: UntypedFormGroup = this.formBuilder.group({
|
||||
slabType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
slabFrom: [
|
||||
0,
|
||||
Validators.required
|
||||
],
|
||||
slabTo: [
|
||||
0,
|
||||
Validators.required
|
||||
],
|
||||
commissionPercent: [
|
||||
0,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSlabs();
|
||||
}
|
||||
|
||||
private loadSlabs(): void {
|
||||
this.organizationService.getCommissionSlabs().subscribe((slabs: any[]) => {
|
||||
this.slabs = (slabs || []).map((slab) => ({
|
||||
id: slab.id,
|
||||
slabType: CommissionSlabMasterComponent.SLAB_TYPE_LABELS[slab.slabType] || slab.slabType,
|
||||
slabFrom: slab.slabFrom,
|
||||
slabTo: slab.slabTo,
|
||||
commissionPercent: slab.commissionPercent
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
addSlab(): void {
|
||||
if (this.newSlabForm.invalid) {
|
||||
return;
|
||||
}
|
||||
this.slabs.push(this.newSlabForm.getRawValue());
|
||||
this.newSlabForm.reset({
|
||||
slabType: '',
|
||||
slabFrom: 0,
|
||||
slabTo: 0,
|
||||
commissionPercent: 0
|
||||
});
|
||||
}
|
||||
|
||||
removeSlab(index: number): void {
|
||||
this.slabs.splice(index, 1);
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
save(): void {
|
||||
const newSlabs = this.slabs.filter((slab) => !slab.id);
|
||||
if (newSlabs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = newSlabs.map((slab) => ({
|
||||
slabType: CommissionSlabMasterComponent.SLAB_TYPE_CODES[slab.slabType] || slab.slabType,
|
||||
slabFrom: slab.slabFrom,
|
||||
slabTo: slab.slabTo,
|
||||
commissionPercent: slab.commissionPercent
|
||||
}));
|
||||
|
||||
this.organizationService.createCommissionSlabs(payload).subscribe(() => this.loadSlabs());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
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="bp-container">
|
||||
<div class="bp-header">
|
||||
<button mat-stroked-button [routerLink]="['../']" class="bp-back">
|
||||
<i class="fas fa-arrow-left"></i> {{ 'labels.heading.Organization' | translate }}
|
||||
</button>
|
||||
<h2 class="bp-header__title">DDS Interest & Commission Batch Processing</h2>
|
||||
</div>
|
||||
|
||||
<div class="bp-card">
|
||||
<form [formGroup]="batchForm">
|
||||
<div class="bp-grid">
|
||||
<mat-form-field appearance="outline" class="bp-field bp-field--wide">
|
||||
<mat-label>Job Type</mat-label>
|
||||
<mat-select required formControlName="jobType">
|
||||
@for (type of jobTypes; track type) {
|
||||
<mat-option [value]="type">{{ type }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>Branch</mat-label>
|
||||
<mat-select required formControlName="branchScope">
|
||||
@for (scope of branchScopes; track scope) {
|
||||
<mat-option [value]="scope">{{ scope }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@if (isBranchSelected) {
|
||||
<div class="bp-field bp-field--wide bp-branch-checklist">
|
||||
@for (office of offices; track office.id) {
|
||||
<mat-checkbox [checked]="selectedOfficeNames.has(office.name)" (change)="toggleOffice(office.name)">
|
||||
{{ office.name }}
|
||||
</mat-checkbox>
|
||||
}
|
||||
@if (offices.length === 0) {
|
||||
<span class="bp-empty">Loading branches...</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>{{ isPostingJob ? 'Posting Date' : 'As-On Date' }}</mat-label>
|
||||
<input matInput required [matDatepicker]="jobDatePicker" formControlName="jobDate" />
|
||||
<mat-datepicker-toggle matIconSuffix [for]="jobDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #jobDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>Agent From</mat-label>
|
||||
<input matInput required type="number" formControlName="agentFrom" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>Agent To</mat-label>
|
||||
<input matInput required type="number" formControlName="agentTo" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>Party From</mat-label>
|
||||
<input matInput required type="number" formControlName="partyFrom" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="bp-field">
|
||||
<mat-label>Party To</mat-label>
|
||||
<input matInput required type="number" formControlName="partyTo" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="bp-callout">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
<span>
|
||||
<strong>Generate</strong> runs a preview only — nothing is applied to any account. <strong>Post</strong> is a
|
||||
separate, explicit step that commits the previewed amounts.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@if (hasGenerated) {
|
||||
<div class="bp-section">
|
||||
<div class="bp-section__header">
|
||||
<i class="fas fa-table"></i>
|
||||
<h3>Preview</h3>
|
||||
</div>
|
||||
@if (previewRows.length === 0) {
|
||||
<p class="bp-empty">
|
||||
No calculation preview available yet — this appears once the backend batch-job endpoint for "{{
|
||||
batchForm.get('jobType').value
|
||||
}}" is connected.
|
||||
</p>
|
||||
} @else {
|
||||
<table class="bp-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Agent</th>
|
||||
<th>Party</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of previewRows; track row) {
|
||||
<tr>
|
||||
<td>{{ row.agent }}</td>
|
||||
<td>{{ row.party }}</td>
|
||||
<td>{{ row.amount | number: '1.2-2' }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="bp-action-bar">
|
||||
<button mat-raised-button type="button" (click)="exit()">Exit</button>
|
||||
<button mat-stroked-button type="button" [disabled]="batchForm.invalid" (click)="generate()">
|
||||
<i class="fas fa-play" style="margin-right: 6px"></i> Generate
|
||||
</button>
|
||||
<button mat-raised-button color="primary" type="button" [disabled]="!hasGenerated" (click)="post()">
|
||||
<i class="fas fa-check" style="margin-right: 6px"></i> Post
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.bp-container {
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.bp-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.bp-back {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
.bp-card {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
padding: 20px 24px 24px;
|
||||
}
|
||||
|
||||
.bp-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px 16px;
|
||||
}
|
||||
|
||||
.bp-field {
|
||||
width: 100%;
|
||||
|
||||
&--wide {
|
||||
grid-column: span 3;
|
||||
}
|
||||
}
|
||||
|
||||
.bp-branch-checklist {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 20px;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.bp-callout {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: flex-start;
|
||||
background: rgb(15 118 110 / 6%);
|
||||
border-left: 3px solid $primary;
|
||||
border-radius: 0 8px 8px 0;
|
||||
padding: 12px 16px;
|
||||
margin: 16px 0;
|
||||
font-size: 13px;
|
||||
|
||||
i {
|
||||
color: $primary;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.bp-section {
|
||||
padding: 16px 0;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
i {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bp-empty {
|
||||
color: rgb(0 0 0 / 50%);
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.bp-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: rgb(0 0 0 / 55%);
|
||||
padding: 8px 10px;
|
||||
border-bottom: 2px solid rgb(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid rgb(0 0 0 / 6%);
|
||||
}
|
||||
}
|
||||
|
||||
.bp-action-bar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
@media (width <= 900px) {
|
||||
.bp-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.bp-field--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* DDS Interest & Commission Batch Processing component.
|
||||
*
|
||||
* Six batch job types, each following the same deliberate two-step
|
||||
* pattern from the legacy system: Calculate first (a dry-run preview),
|
||||
* then Post as a separate, explicit confirmation — so a wrong calculation
|
||||
* is never applied by accident. Modelled on the legacy Interest
|
||||
* Calculation screen this replaces.
|
||||
*
|
||||
* Backed by the DDS Batch Run API (`/dds/batchruns`). Only the three
|
||||
* "Calculation" job types can actually be generated - the three "Posting"
|
||||
* entries exist in the dropdown for parity with the legacy menu, but Post
|
||||
* always applies whatever run was most recently generated in this session,
|
||||
* regardless of which dropdown entry is currently selected (matching how
|
||||
* the Post button here is only ever gated on hasGenerated, not on jobType).
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-dds-batch-processing',
|
||||
templateUrl: './dds-batch-processing.component.html',
|
||||
styleUrls: ['./dds-batch-processing.component.scss'],
|
||||
imports: [...STANDALONE_SHARED_IMPORTS]
|
||||
})
|
||||
export class DdsBatchProcessingComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private organizationService = inject(OrganizationService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
private static readonly JOB_TYPE_CODES: Record<string, string> = {
|
||||
'Interest Calculation': 'INTEREST_CALCULATION',
|
||||
'OD Interest Calculation': 'OD_INTEREST_CALCULATION',
|
||||
'Commission Calculation': 'COMMISSION_CALCULATION'
|
||||
};
|
||||
|
||||
private currentBatchRunId: number | null = null;
|
||||
|
||||
offices: any[] = [];
|
||||
selectedOfficeNames = new Set<string>();
|
||||
|
||||
jobTypes = [
|
||||
'Interest Calculation',
|
||||
'Interest Posting',
|
||||
'OD Interest Calculation',
|
||||
'OD Interest Posting',
|
||||
'Commission Calculation',
|
||||
'Commission Posting'
|
||||
];
|
||||
|
||||
branchScopes = [
|
||||
'All',
|
||||
'Selected'
|
||||
];
|
||||
|
||||
hasGenerated = false;
|
||||
previewRows: Array<{ agent: string; party: string; amount: number }> = [];
|
||||
|
||||
batchForm: UntypedFormGroup = this.formBuilder.group({
|
||||
jobType: [
|
||||
'Interest Calculation',
|
||||
Validators.required
|
||||
],
|
||||
branchScope: [
|
||||
'All',
|
||||
Validators.required
|
||||
],
|
||||
jobDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
agentFrom: [
|
||||
1,
|
||||
Validators.required
|
||||
],
|
||||
agentTo: [
|
||||
99999,
|
||||
Validators.required
|
||||
],
|
||||
partyFrom: [
|
||||
1,
|
||||
Validators.required
|
||||
],
|
||||
partyTo: [
|
||||
99999999,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
|
||||
get isPostingJob(): boolean {
|
||||
return (this.batchForm.get('jobType').value as string).includes('Posting');
|
||||
}
|
||||
|
||||
get isBranchSelected(): boolean {
|
||||
return this.batchForm.get('branchScope')?.value === 'Selected';
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.organizationService.getOffices().subscribe((offices: any[]) => {
|
||||
this.offices = offices || [];
|
||||
});
|
||||
}
|
||||
|
||||
toggleOffice(officeName: string): void {
|
||||
if (this.selectedOfficeNames.has(officeName)) {
|
||||
this.selectedOfficeNames.delete(officeName);
|
||||
} else {
|
||||
this.selectedOfficeNames.add(officeName);
|
||||
}
|
||||
}
|
||||
|
||||
generate(): void {
|
||||
const raw = this.batchForm.getRawValue();
|
||||
const jobType = DdsBatchProcessingComponent.JOB_TYPE_CODES[raw.jobType];
|
||||
|
||||
if (!jobType) {
|
||||
// A "Posting" entry was selected - there is nothing to calculate for
|
||||
// it, only to post (see class-level note on how Post is wired).
|
||||
this.hasGenerated = true;
|
||||
this.previewRows = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const payload: any = {
|
||||
jobType,
|
||||
branchScope: raw.branchScope,
|
||||
jobDate: this.dateUtils.formatDate(raw.jobDate, dateFormat),
|
||||
agentFrom: raw.agentFrom,
|
||||
agentTo: raw.agentTo,
|
||||
partyFrom: raw.partyFrom,
|
||||
partyTo: raw.partyTo,
|
||||
dateFormat,
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
|
||||
if (raw.branchScope === 'Selected') {
|
||||
payload.officeNames = Array.from(this.selectedOfficeNames);
|
||||
}
|
||||
|
||||
this.organizationService.generateDdsBatchRun(payload).subscribe((result: any) => {
|
||||
this.currentBatchRunId = result.resourceId;
|
||||
this.organizationService.getDdsBatchRun(this.currentBatchRunId).subscribe((batchRun: any) => {
|
||||
this.previewRows = (batchRun.rows || []).map((row: any) => ({
|
||||
agent: row.agentCode,
|
||||
party: row.partyCode || '—',
|
||||
amount: row.amount
|
||||
}));
|
||||
this.hasGenerated = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
post(): void {
|
||||
if (!this.currentBatchRunId) {
|
||||
return;
|
||||
}
|
||||
this.organizationService.postDdsBatchRun(this.currentBatchRunId).subscribe(() => {
|
||||
this.currentBatchRunId = null;
|
||||
this.hasGenerated = false;
|
||||
this.previewRows = [];
|
||||
});
|
||||
}
|
||||
|
||||
exit(): void {
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import { Route } from '../core/route/route.service';
|
||||
import { OrganizationComponent } from './organization.component';
|
||||
import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/loan-provisioning-criteria.component';
|
||||
import { OfficesComponent } from './offices/offices.component';
|
||||
import { AgentMasterComponent } from './agent-master/agent-master.component';
|
||||
import { CommissionSlabMasterComponent } from './commission-slab-master/commission-slab-master.component';
|
||||
import { DdsBatchProcessingComponent } from './dds-batch-processing/dds-batch-processing.component';
|
||||
import { EmployeesComponent } from './employees/employees.component';
|
||||
import { CreateEmployeeComponent } from './employees/create-employee/create-employee.component';
|
||||
import { ViewEmployeeComponent } from './employees/view-employee/view-employee.component';
|
||||
@@ -237,6 +240,21 @@ const routes: Routes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'agent-master',
|
||||
component: AgentMasterComponent,
|
||||
data: { title: 'Agent Master', breadcrumb: 'Agent Master' }
|
||||
},
|
||||
{
|
||||
path: 'commission-slab-master',
|
||||
component: CommissionSlabMasterComponent,
|
||||
data: { title: 'Commission Slab Master', breadcrumb: 'Commission Slab Master' }
|
||||
},
|
||||
{
|
||||
path: 'dds-batch-processing',
|
||||
component: DdsBatchProcessingComponent,
|
||||
data: { title: 'DDS Interest & Commission Batch', breadcrumb: 'DDS Batch Processing' }
|
||||
},
|
||||
{
|
||||
path: 'employees',
|
||||
data: { title: 'Manage Employees', breadcrumb: 'Manage Employees' },
|
||||
|
||||
@@ -90,6 +90,47 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div #agentMaster>
|
||||
<a class="org-card" [routerLink]="['agent-master']">
|
||||
<div class="org-card__icon org-card__icon--teal">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
</div>
|
||||
<div class="org-card__body">
|
||||
<h3 class="org-card__title">Agent Master</h3>
|
||||
<p class="org-card__desc">
|
||||
Register Daily Deposit Scheme collection agents, their commission/TDS settings, limits and guarantors
|
||||
</p>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right org-card__arrow"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div #commissionSlabMaster>
|
||||
<a class="org-card" [routerLink]="['commission-slab-master']">
|
||||
<div class="org-card__icon org-card__icon--teal">
|
||||
<i class="fas fa-percentage"></i>
|
||||
</div>
|
||||
<div class="org-card__body">
|
||||
<h3 class="org-card__title">Commission Slab Master</h3>
|
||||
<p class="org-card__desc">Define collection-volume and override commission percentage slabs</p>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right org-card__arrow"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div #ddsBatchProcessing>
|
||||
<a class="org-card" [routerLink]="['dds-batch-processing']">
|
||||
<div class="org-card__icon org-card__icon--teal">
|
||||
<i class="fas fa-cogs"></i>
|
||||
</div>
|
||||
<div class="org-card__body">
|
||||
<h3 class="org-card__title">DDS Interest & Commission Batch</h3>
|
||||
<p class="org-card__desc">Calculate then post interest, OD interest, and commission for DDS accounts</p>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right org-card__arrow"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Manage Loan Originators -->
|
||||
<div #manageLoanOriginators>
|
||||
<a class="org-card" [routerLink]="['manage-loan-originators']" *mifosxHasPermission="'READ_LOAN_ORIGINATOR'">
|
||||
|
||||
@@ -233,6 +233,141 @@ export class OrganizationService {
|
||||
return this.http.get('/currencies');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} DDS Agents data
|
||||
*/
|
||||
getAgents(): Observable<any> {
|
||||
return this.http.get('/dds/agents');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} agentId Agent ID.
|
||||
* @returns {Observable<any>} DDS Agent.
|
||||
*/
|
||||
getAgent(agentId: string | number): Observable<any> {
|
||||
return this.http.get(`/dds/agents/${agentId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} agent Agent to be created.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createAgent(agent: any): Observable<any> {
|
||||
return this.http.post('/dds/agents', agent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} agentId Agent ID.
|
||||
* @param {any} agent Agent changes to apply.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
updateAgent(agentId: string | number, agent: any): Observable<any> {
|
||||
return this.http.put(`/dds/agents/${agentId}`, agent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} DDS Parties data
|
||||
*/
|
||||
getParties(): Observable<any> {
|
||||
return this.http.get('/dds/parties');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} partyId Party ID.
|
||||
* @returns {Observable<any>} DDS Party.
|
||||
*/
|
||||
getParty(partyId: string | number): Observable<any> {
|
||||
return this.http.get(`/dds/parties/${partyId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} party Party to be created.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createParty(party: any): Observable<any> {
|
||||
return this.http.post('/dds/parties', party);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} partyId Party ID.
|
||||
* @param {any} party Party changes to apply.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
updateParty(partyId: string | number, party: any): Observable<any> {
|
||||
return this.http.put(`/dds/parties/${partyId}`, party);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} partyId Party ID.
|
||||
* @param {any} closeCommand { closeDate }
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
closeParty(partyId: string | number, closeCommand: any): Observable<any> {
|
||||
return this.http.post(`/dds/parties/${partyId}?command=close`, closeCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} transaction Daily transaction batch (PARTY_TRAN collections or a WITHDRAW_DEPOSITE transfer) to post.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createPartyTransaction(transaction: any): Observable<any> {
|
||||
return this.http.post('/dds/partytransactions', transaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} DDS Commission Slabs data
|
||||
*/
|
||||
getCommissionSlabs(): Observable<any> {
|
||||
return this.http.get('/dds/commissionslabs');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} slabs New commission slab rows to add to the chart.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
createCommissionSlabs(slabs: any[]): Observable<any> {
|
||||
return this.http.post('/dds/commissionslabs', { slabs });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} batch Batch run filters (jobType, branchScope, jobDate, agentFrom/To, partyFrom/To) to generate a preview for.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
generateDdsBatchRun(batch: any): Observable<any> {
|
||||
return this.http.post('/dds/batchruns', batch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} batchRunId Batch run ID.
|
||||
* @returns {Observable<any>} Batch run, including its previewed/posted rows.
|
||||
*/
|
||||
getDdsBatchRun(batchRunId: string | number): Observable<any> {
|
||||
return this.http.get(`/dds/batchruns/${batchRunId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | number} batchRunId Batch run ID to post - applies exactly the rows it previewed.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
postDdsBatchRun(batchRunId: string | number): Observable<any> {
|
||||
return this.http.post(`/dds/batchruns/${batchRunId}`, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} reportKey One of the backend DDS report keys.
|
||||
* @param {any} filters fromDate, toDate (ISO strings), agentFrom/To, partyFrom/To.
|
||||
* @returns {Observable<any>} { reportKey, available, message, columns, rows }
|
||||
*/
|
||||
runDdsReport(reportKey: string, filters: any): Observable<any> {
|
||||
let httpParams = new HttpParams();
|
||||
Object.keys(filters || {}).forEach((key) => {
|
||||
if (filters[key] !== undefined && filters[key] !== null && filters[key] !== '') {
|
||||
httpParams = httpParams.set(key, filters[key]);
|
||||
}
|
||||
});
|
||||
return this.http.get(`/dds/reports/${reportKey}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any[]} currencies
|
||||
* @returns {Observable<any>} Currencies data
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
<!--
|
||||
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="rdp-container">
|
||||
<div class="rdp-header">
|
||||
<i class="fas fa-calendar-day rdp-header__icon"></i>
|
||||
<h2 class="rdp-header__title">{{ 'labels.heading.Create Daily Deposit Scheme Product' | translate }}</h2>
|
||||
</div>
|
||||
|
||||
<!-- Currency/Terms/Settings/Charges/Accounting still run underneath (the account-creation
|
||||
engine needs them) but are pre-filled with fixed defaults in ngAfterViewInit() rather than
|
||||
shown - the legacy Account Type Creation screen never asked for any of this either. Kept
|
||||
mounted (just hidden) so their forms exist for the "product" payload to read from. -->
|
||||
<div hidden>
|
||||
<mifosx-daily-deposit-scheme-product-currency-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
></mifosx-daily-deposit-scheme-product-currency-step>
|
||||
<mifosx-daily-deposit-scheme-product-terms-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
></mifosx-daily-deposit-scheme-product-terms-step>
|
||||
<mifosx-daily-deposit-scheme-product-settings-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
></mifosx-daily-deposit-scheme-product-settings-step>
|
||||
<mifosx-daily-deposit-scheme-product-charges-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
[currencyCode]="currencyForm.get('currencyCode')"
|
||||
></mifosx-daily-deposit-scheme-product-charges-step>
|
||||
<mifosx-daily-deposit-scheme-product-accounting-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
[accountingRuleData]="accountingRuleData"
|
||||
[DailyDepositSchemeProductFormValid]="productFormValid"
|
||||
[isDormancyTrackingActive]="currencyForm.get('dormancyAlert')"
|
||||
></mifosx-daily-deposit-scheme-product-accounting-step>
|
||||
</div>
|
||||
|
||||
<mat-tab-group
|
||||
class="rdp-tabs"
|
||||
animationDuration="200ms"
|
||||
[preserveContent]="true"
|
||||
[(selectedIndex)]="selectedTabIndex"
|
||||
>
|
||||
<mat-tab>
|
||||
<ng-template mat-tab-label>
|
||||
<i class="fas fa-info-circle rdp-tab-icon"></i>
|
||||
{{ 'labels.inputs.DETAILS' | translate }}
|
||||
</ng-template>
|
||||
<div class="rdp-tab-content">
|
||||
<mifosx-daily-deposit-scheme-product-details-step
|
||||
[DailyDepositSchemeProductsTemplate]="productsTemplate"
|
||||
></mifosx-daily-deposit-scheme-product-details-step>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab>
|
||||
<ng-template mat-tab-label>
|
||||
<i class="fas fa-chart-area rdp-tab-icon"></i>
|
||||
CBS Base Chart
|
||||
</ng-template>
|
||||
<div class="rdp-tab-content">
|
||||
@if (activeBaseVersion) {
|
||||
<div class="base-rate-card">
|
||||
<div class="base-rate-header">
|
||||
<div>
|
||||
<h3 class="base-rate-title">{{ activeBaseVersion.versionLabel }}</h3>
|
||||
<p class="base-rate-meta">
|
||||
Active CBS base chart
|
||||
<span>Effective from {{ activeBaseVersion.effectiveFromDate }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<span class="base-rate-badge">Active</span>
|
||||
</div>
|
||||
|
||||
@if (activeBaseVersion.remarks) {
|
||||
<p class="base-rate-remarks">{{ activeBaseVersion.remarks }}</p>
|
||||
}
|
||||
|
||||
<table class="base-rate-table" mat-table [dataSource]="activeBaseVersion.slabs">
|
||||
<ng-container matColumnDef="srNo">
|
||||
<th mat-header-cell *matHeaderCellDef>Sr.</th>
|
||||
<td mat-cell *matCellDef="let slab">{{ slab.srNo }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="description">
|
||||
<th mat-header-cell *matHeaderCellDef>Particular</th>
|
||||
<td mat-cell *matCellDef="let slab">{{ slab.description }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="fromPeriod">
|
||||
<th mat-header-cell *matHeaderCellDef>From</th>
|
||||
<td mat-cell *matCellDef="let slab">{{ slab.fromPeriod }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="toPeriod">
|
||||
<th mat-header-cell *matHeaderCellDef>To</th>
|
||||
<td mat-cell *matCellDef="let slab">{{ slab.toPeriod ?? 'N/A' }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="periodTypeLabel">
|
||||
<th mat-header-cell *matHeaderCellDef>Period Type</th>
|
||||
<td mat-cell *matCellDef="let slab">{{ slab.periodTypeLabel }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="annualInterestRate">
|
||||
<th mat-header-cell *matHeaderCellDef>Annual Rate (%)</th>
|
||||
<td mat-cell *matCellDef="let slab">
|
||||
<strong>{{ slab.annualInterestRate | number: '1.2-2' }}</strong>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="rdSlabColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: rdSlabColumns"></tr>
|
||||
</table>
|
||||
</div>
|
||||
} @else {
|
||||
<p>Loading CBS base chart...</p>
|
||||
}
|
||||
</div>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
<div class="rdp-action-bar">
|
||||
<button mat-raised-button [routerLink]="['../']" class="rdp-action-bar__cancel">
|
||||
{{ 'labels.buttons.Cancel' | translate }}
|
||||
</button>
|
||||
<div class="rdp-action-bar__right">
|
||||
<button mat-raised-button color="primary" [disabled]="!productFormValid" (click)="submit()">
|
||||
<i class="fas fa-check" style="margin-right: 8px"></i>
|
||||
{{ 'labels.buttons.Submit' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$primary: #0f766e;
|
||||
|
||||
.rdp-container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.rdp-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
&__icon {
|
||||
font-size: 20px;
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.rdp-tabs {
|
||||
background: var(--md-sys-color-surface, #fff);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
|
||||
|
||||
::ng-deep {
|
||||
.mat-mdc-tab-header {
|
||||
border-bottom: 1px solid rgb(0 0 0 / 8%);
|
||||
}
|
||||
|
||||
.mat-mdc-tab {
|
||||
min-width: 100px;
|
||||
padding: 0 12px;
|
||||
height: 52px;
|
||||
}
|
||||
|
||||
.mat-mdc-tab-body-wrapper {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.mat-mdc-tab-body {
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.mat-mdc-tab-body-content {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rdp-tab-icon {
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.rdp-tab-content {
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.base-rate-card {
|
||||
padding: 16px;
|
||||
border: 1px solid #dbe4f0;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
|
||||
}
|
||||
|
||||
.base-rate-header {
|
||||
display: flex;
|
||||
align-items: start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.base-rate-title {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.base-rate-meta {
|
||||
margin: 6px 0 0;
|
||||
color: #5b6b7f;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.base-rate-badge {
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.base-rate-remarks {
|
||||
margin: 0 0 12px;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.base-rate-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.rdp-action-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
padding: 16px 0;
|
||||
border-top: 1px solid rgb(0 0 0 / 8%);
|
||||
|
||||
&__cancel {
|
||||
color: rgb(0 0 0 / 60%);
|
||||
}
|
||||
|
||||
&__right {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
+346
@@ -0,0 +1,346 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { AfterViewInit, Component, ViewChild, inject } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Components — Daily Deposit Scheme's own stepper, kept independent
|
||||
* of Recurring Deposit Products so future changes to either never cross over. */
|
||||
import { DailyDepositSchemeProductDetailsStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-details-step/daily-deposit-scheme-product-details-step.component';
|
||||
import { DailyDepositSchemeProductCurrencyStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-currency-step/daily-deposit-scheme-product-currency-step.component';
|
||||
import { DailyDepositSchemeProductTermsStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-terms-step/daily-deposit-scheme-product-terms-step.component';
|
||||
import { DailyDepositSchemeProductSettingsStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-settings-step/daily-deposit-scheme-product-settings-step.component';
|
||||
import { DailyDepositSchemeProductChargesStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-charges-step/daily-deposit-scheme-product-charges-step.component';
|
||||
import { DailyDepositSchemeProductAccountingStepComponent } from '../daily-deposit-scheme-product-stepper/daily-deposit-scheme-product-accounting-step/daily-deposit-scheme-product-accounting-step.component';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow
|
||||
} from '@angular/material/table';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Accounting } from 'app/core/utils/accounting';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-daily-deposit-scheme-product',
|
||||
templateUrl: './create-daily-deposit-scheme-product.component.html',
|
||||
styleUrls: ['./create-daily-deposit-scheme-product.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatTabsModule,
|
||||
DailyDepositSchemeProductDetailsStepComponent,
|
||||
DailyDepositSchemeProductCurrencyStepComponent,
|
||||
DailyDepositSchemeProductTermsStepComponent,
|
||||
DailyDepositSchemeProductSettingsStepComponent,
|
||||
DailyDepositSchemeProductChargesStepComponent,
|
||||
DailyDepositSchemeProductAccountingStepComponent,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow
|
||||
]
|
||||
})
|
||||
export class CreateDailyDepositSchemeProductComponent implements AfterViewInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private productsService = inject(ProductsService);
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
private accounting = inject(Accounting);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
@ViewChild(DailyDepositSchemeProductDetailsStepComponent, { static: true })
|
||||
detailsStep: DailyDepositSchemeProductDetailsStepComponent;
|
||||
@ViewChild(DailyDepositSchemeProductCurrencyStepComponent, { static: true })
|
||||
currencyStep: DailyDepositSchemeProductCurrencyStepComponent;
|
||||
@ViewChild(DailyDepositSchemeProductTermsStepComponent, { static: true })
|
||||
termsStep: DailyDepositSchemeProductTermsStepComponent;
|
||||
@ViewChild(DailyDepositSchemeProductSettingsStepComponent, { static: true })
|
||||
settingsStep: DailyDepositSchemeProductSettingsStepComponent;
|
||||
@ViewChild(DailyDepositSchemeProductChargesStepComponent, { static: true })
|
||||
chargesStep: DailyDepositSchemeProductChargesStepComponent;
|
||||
@ViewChild(DailyDepositSchemeProductAccountingStepComponent, { static: true })
|
||||
accountingStep: DailyDepositSchemeProductAccountingStepComponent;
|
||||
|
||||
productsTemplate: any;
|
||||
accountingRuleData: string[] = [];
|
||||
selectedTabIndex = 0;
|
||||
rdInterestRates: any[] = [];
|
||||
readonly rdSlabColumns = [
|
||||
'srNo',
|
||||
'description',
|
||||
'fromPeriod',
|
||||
'toPeriod',
|
||||
'periodTypeLabel',
|
||||
'annualInterestRate'
|
||||
];
|
||||
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { dailyDepositSchemeProductsTemplate: any }) => {
|
||||
this.productsTemplate = data.dailyDepositSchemeProductsTemplate;
|
||||
});
|
||||
this.accountingRuleData = this.accounting.getAccountingRulesForSavings();
|
||||
this.productsService.getFdBaseInterestRates().subscribe({
|
||||
next: (rates: any[]) => {
|
||||
this.rdInterestRates = rates || [];
|
||||
},
|
||||
error: () => {
|
||||
this.rdInterestRates = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
// The DDS product screen only shows the legacy Account Type Creation fields (Details tab) -
|
||||
// currency/terms/settings/charges/accounting still exist underneath (the account-creation
|
||||
// engine needs them), but they're filled in here with fixed sensible defaults rather than
|
||||
// asked of the user, since the legacy screen never asked for them either.
|
||||
const template = this.productsTemplate || {};
|
||||
|
||||
this.currencyForm.patchValue({
|
||||
currencyCode: this.currencyForm.value.currencyCode || 'INR',
|
||||
digitsAfterDecimal: this.currencyForm.value.digitsAfterDecimal ?? 2
|
||||
});
|
||||
|
||||
const firstOptionId = (options: any[]) => options?.[0]?.id ?? '';
|
||||
this.termsForm.patchValue({
|
||||
interestCompoundingPeriodType: firstOptionId(template.interestCompoundingPeriodTypeOptions),
|
||||
interestCalculationDaysInYearType: firstOptionId(template.interestCalculationDaysInYearTypeOptions),
|
||||
minDepositAmount: this.termsForm.value.minDepositAmount || 1,
|
||||
maxDepositAmount: this.termsForm.value.maxDepositAmount || 999999999
|
||||
});
|
||||
|
||||
// accountingRule 1 = None, matching the legacy screen (which never asked for GL mappings) -
|
||||
// this also clears every accounting-tab required-field validator, since those only apply
|
||||
// under Cash/Accrual accounting.
|
||||
this.accountingForm.patchValue({ accountingRule: 1 });
|
||||
|
||||
this.detailsForm.get('autoInterestPost')?.valueChanges.subscribe(() => this.syncAutoInterestPost());
|
||||
this.detailsForm.get('autoInterestPostWhen')?.valueChanges.subscribe(() => this.syncAutoInterestPost());
|
||||
this.syncAutoInterestPost();
|
||||
}
|
||||
|
||||
/** Mirrors the simple "Auto Interest Post" / "Auto Interest Post When" / "Auto Interest Post
|
||||
* Day" fields onto the (hidden) terms-step fields that the account-creation engine actually
|
||||
* reads. */
|
||||
private syncAutoInterestPost(): void {
|
||||
const autoPost = this.detailsForm?.value.autoInterestPost ?? true;
|
||||
const postingPeriodType = this.detailsForm?.value.autoInterestPostWhen;
|
||||
const postingDay = this.detailsForm?.value.autoInterestPostDay;
|
||||
this.termsForm?.patchValue({
|
||||
autoPost,
|
||||
interestPostingPeriodType: postingPeriodType || this.termsForm.value.interestPostingPeriodType,
|
||||
frequencyFixDay: postingDay || this.termsForm.value.frequencyFixDay
|
||||
});
|
||||
}
|
||||
|
||||
get detailsForm() {
|
||||
return this.detailsStep?.DailyDepositSchemeProductDetailsForm;
|
||||
}
|
||||
|
||||
get currencyForm() {
|
||||
return this.currencyStep?.DailyDepositSchemeProductCurrencyForm;
|
||||
}
|
||||
|
||||
get termsForm() {
|
||||
return this.termsStep?.DailyDepositSchemeProductTermsForm;
|
||||
}
|
||||
|
||||
get settingsForm() {
|
||||
return this.settingsStep?.DailyDepositSchemeProductSettingsForm;
|
||||
}
|
||||
|
||||
get accountingForm() {
|
||||
return this.accountingStep?.DailyDepositSchemeProductAccountingForm;
|
||||
}
|
||||
|
||||
get productFormValid() {
|
||||
return !!this.detailsForm?.valid;
|
||||
}
|
||||
|
||||
get activeBaseVersion() {
|
||||
const chart =
|
||||
this.rdInterestRates.find((version: any) => version.fdType === 'DOUBLE' && version.isActive) ??
|
||||
this.rdInterestRates.find((version: any) => version.fdType === 'DOUBLE') ??
|
||||
this.rdInterestRates[0];
|
||||
if (chart) {
|
||||
return {
|
||||
...chart,
|
||||
versionLabel: chart.versionLabel?.replace('FD', 'DDS'),
|
||||
remarks: chart.remarks?.replace('FD', 'DDS')
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
get activeBaseSlabs() {
|
||||
// The base chart is borrowed from an FD product purely for its period/amount-range
|
||||
// *structure* - the account-creation engine needs some chart to exist. Its actual rate is
|
||||
// never used: every slab's annualInterestRate is overridden with the Details tab's own
|
||||
// Interest Rate field, so DDS never depends on FD's real interest figures.
|
||||
const rate = this.detailsForm?.value.interestRate;
|
||||
return (this.activeBaseVersion?.slabs || []).map((slab: any) => ({
|
||||
...slab,
|
||||
annualInterestRate: rate ?? slab.annualInterestRate
|
||||
}));
|
||||
}
|
||||
|
||||
get product() {
|
||||
// accountTypeGroup / autoInterestPost / autoInterestPostWhen / autoInterestPostDay are the
|
||||
// legacy Account Type Creation screen's own fields - not real product API parameters. The
|
||||
// auto-interest-post trio is already mirrored onto termsStep (autoPost /
|
||||
// interestPostingPeriodType / frequencyFixDay) via syncAutoInterestPost(); accountTypeGroup
|
||||
// is folded into the description here instead.
|
||||
const {
|
||||
accountTypeGroup,
|
||||
autoInterestPost,
|
||||
autoInterestPostWhen,
|
||||
autoInterestPostDay,
|
||||
interestRate,
|
||||
...detailsPayload
|
||||
} = this.detailsStep.DailyDepositSchemeProductDetails;
|
||||
const description = [
|
||||
accountTypeGroup,
|
||||
detailsPayload.description
|
||||
]
|
||||
.filter((part) => !!part)
|
||||
.join(' - ');
|
||||
|
||||
return {
|
||||
...detailsPayload,
|
||||
description,
|
||||
...this.currencyStep.DailyDepositSchemeProductCurrency,
|
||||
...this.termsStep.DailyDepositSchemeProductTerms,
|
||||
...this.settingsStep.DailyDepositSchemeProductSettings,
|
||||
...this.chargesStep.DailyDepositSchemeProductCharges,
|
||||
...this.accountingStep.DailyDepositSchemeProductAccounting,
|
||||
charts: this.productCharts,
|
||||
rdSlabs: this.activeBaseSlabs
|
||||
};
|
||||
}
|
||||
|
||||
get productCharts() {
|
||||
const activeBaseVersion = this.activeBaseVersion;
|
||||
if (!activeBaseVersion?.slabs?.length) {
|
||||
return [];
|
||||
}
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
|
||||
return [
|
||||
{
|
||||
name: activeBaseVersion.versionLabel || 'CBS Base Chart',
|
||||
description: activeBaseVersion.remarks || activeBaseVersion.versionLabel || 'CBS base chart',
|
||||
fromDate:
|
||||
this.dateUtils.formatDate(activeBaseVersion.effectiveFromDate, dateFormat) ||
|
||||
activeBaseVersion.effectiveFromDate,
|
||||
...(activeBaseVersion.effectiveToDate
|
||||
? {
|
||||
endDate:
|
||||
this.dateUtils.formatDate(activeBaseVersion.effectiveToDate, dateFormat) ||
|
||||
activeBaseVersion.effectiveToDate
|
||||
}
|
||||
: {}),
|
||||
isPrimaryGroupingByAmount: false,
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat,
|
||||
chartSlabs: this.activeBaseSlabs.map((slab: any) => {
|
||||
const chartSlab: any = {
|
||||
periodType: slab.periodTypeEnum,
|
||||
fromPeriod: slab.fromPeriod,
|
||||
toPeriod: slab.toPeriod,
|
||||
annualInterestRate: slab.annualInterestRate,
|
||||
description: slab.description || '',
|
||||
incentives: [] as any[]
|
||||
};
|
||||
|
||||
if (slab.amountRangeFrom !== null && slab.amountRangeFrom !== undefined && slab.amountRangeFrom !== '') {
|
||||
chartSlab.amountRangeFrom = slab.amountRangeFrom;
|
||||
}
|
||||
|
||||
if (slab.amountRangeTo !== null && slab.amountRangeTo !== undefined && slab.amountRangeTo !== '') {
|
||||
chartSlab.amountRangeTo = slab.amountRangeTo;
|
||||
}
|
||||
|
||||
return chartSlab;
|
||||
})
|
||||
}
|
||||
] as any[];
|
||||
}
|
||||
|
||||
submit() {
|
||||
const product: any = this.pruneEmptyValues({
|
||||
...this.product,
|
||||
charts: this.productCharts,
|
||||
charges: (this.product.charges ?? []).map((charge: any) => ({ id: charge.id })),
|
||||
locale: this.settingsService.language.code,
|
||||
productCategory: 'DDS'
|
||||
});
|
||||
if (!product.description) {
|
||||
product.description = '';
|
||||
}
|
||||
delete product.advancedAccountingRules;
|
||||
this.productsService.createRecurringDepositProduct(product).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private pruneEmptyValues<T>(value: T): T {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((item) => this.pruneEmptyValues(item)).filter((item) => item !== undefined) as T;
|
||||
}
|
||||
|
||||
if (value && typeof value === 'object') {
|
||||
return Object.entries(value as Record<string, any>).reduce(
|
||||
(acc, [
|
||||
key,
|
||||
currentValue
|
||||
]) => {
|
||||
const cleanedValue = this.pruneEmptyValues(currentValue);
|
||||
if (cleanedValue === undefined) {
|
||||
return acc;
|
||||
}
|
||||
return {
|
||||
...acc,
|
||||
[key]: cleanedValue
|
||||
};
|
||||
},
|
||||
{} as Record<string, any>
|
||||
) as T;
|
||||
}
|
||||
|
||||
if (value === '' || value === null || value === undefined) {
|
||||
return undefined as T;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { ProductsService } from '../../products.service';
|
||||
|
||||
/**
|
||||
* Daily Deposit Scheme Products template resolver.
|
||||
*
|
||||
* Reuses the Recurring Deposit product template — a Daily Deposit Scheme
|
||||
* product is created through the same underlying product-creation engine.
|
||||
*/
|
||||
@Injectable()
|
||||
export class DailyDepositSchemeProductsTemplateResolver {
|
||||
private productsService = inject(ProductsService);
|
||||
|
||||
/**
|
||||
* Returns the Daily Deposit Scheme products template.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getRecurringDepositProductsTemplate();
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<form [formGroup]="DailyDepositSchemeProductAccountingForm">
|
||||
<div class="rdpa-section">
|
||||
<div class="rdpa-section__header">
|
||||
<span class="rdpa-section__icon">
|
||||
<i class="fas fa-book"></i>
|
||||
</span>
|
||||
<h3>Accounting</h3>
|
||||
</div>
|
||||
|
||||
<div class="rdpa-section__body">
|
||||
<div class="rdpa-group">
|
||||
<div class="rdpa-group__header">
|
||||
<h4>Accounting Rule</h4>
|
||||
</div>
|
||||
<div class="rdpa-radio-group">
|
||||
<mat-radio-button [value]="2" [checked]="true" [disabled]="true">Cash</mat-radio-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (isCashOrAccrualAccounting()) {
|
||||
@for (section of accountingSectionConfigs; track section.key) {
|
||||
<div class="rdpa-group">
|
||||
<div class="rdpa-group__header">
|
||||
<h4>{{ section.title }}</h4>
|
||||
<button type="button" class="rdpa-add-btn" (click)="addOtherGlMapping(section.otherMappingsControlName)">
|
||||
+ Add Other
|
||||
</button>
|
||||
</div>
|
||||
<div class="rdpa-list">
|
||||
@for (row of section.rows; track row.key) {
|
||||
@if (
|
||||
(!row.accrualOnly || isAccrualAccounting()) && (!row.dormancyOnly || isDormancyTrackingEnabled())
|
||||
) {
|
||||
<div class="rdpa-row">
|
||||
<div class="rdpa-row__meta">
|
||||
<span
|
||||
class="rdpa-pill"
|
||||
[class.rdpa-pill--green]="section.pillClass === 'green'"
|
||||
[class.rdpa-pill--amber]="section.pillClass === 'amber'"
|
||||
[class.rdpa-pill--blue]="section.pillClass === 'blue'"
|
||||
>
|
||||
{{ section.pillLabel }}
|
||||
</span>
|
||||
<span class="rdpa-row__label">{{ row.label }}</span>
|
||||
</div>
|
||||
<mifosx-gl-account-selector
|
||||
class="rdpa-row__input"
|
||||
[inputFormControl]="DailyDepositSchemeProductAccountingForm.get(row.controlName)"
|
||||
[glAccountList]="row.options"
|
||||
[required]="row.required"
|
||||
[inputLabel]="row.inputLabel"
|
||||
></mifosx-gl-account-selector>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="rdpa-list" [formArrayName]="section.otherMappingsControlName">
|
||||
@for (
|
||||
otherRow of getOtherGlMappingsArray(section.otherMappingsControlName).controls;
|
||||
track $index;
|
||||
let i = $index
|
||||
) {
|
||||
<div class="rdpa-other-row-wrap">
|
||||
<div class="rdpa-row rdpa-row--other" [formGroupName]="i">
|
||||
<div class="rdpa-row__meta rdpa-row__meta--other">
|
||||
<span
|
||||
class="rdpa-pill"
|
||||
[class.rdpa-pill--green]="section.pillClass === 'green'"
|
||||
[class.rdpa-pill--amber]="section.pillClass === 'amber'"
|
||||
[class.rdpa-pill--blue]="section.pillClass === 'blue'"
|
||||
>
|
||||
{{ section.pillLabel }}
|
||||
</span>
|
||||
<input
|
||||
class="rdpa-row__name rdpa-row__name--other-account"
|
||||
formControlName="accountName"
|
||||
placeholder="Enter account name..."
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="rdpa-row__actions rdpa-row__actions--other">
|
||||
<mat-form-field class="rdpa-row__other-field" appearance="outline" subscriptSizing="dynamic">
|
||||
<mat-label>GL Code</mat-label>
|
||||
<mat-select
|
||||
[formControl]="getOtherGlMappingControl(section.otherMappingsControlName, i, 'glAccountId')"
|
||||
>
|
||||
@for (glAccount of section.otherAccountOptions; track glAccount.id) {
|
||||
<mat-option [value]="glAccount.id">
|
||||
{{ '(' + glAccount.glCode + ') ' + glAccount.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rdpa-remove-btn rdpa-remove-btn--side"
|
||||
(click)="removeOtherGlMapping(section.otherMappingsControlName, i)"
|
||||
>
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
$border: #e2e8f0;
|
||||
$gray-50: #f8f9fa;
|
||||
$gray-200: #e8eaed;
|
||||
$gray-700: #334155;
|
||||
$gray-900: #202124;
|
||||
|
||||
.rdpa-section {
|
||||
border: 1px solid $border;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.rdpa-section__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 24px;
|
||||
background: $gray-50;
|
||||
border-bottom: 1px solid $gray-200;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: $gray-900;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-section__icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 6px;
|
||||
background: #eff6ff;
|
||||
color: #2563eb;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.rdpa-section__body {
|
||||
padding: 16px 24px 20px;
|
||||
}
|
||||
|
||||
.rdpa-group {
|
||||
& + & {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin: 0 0 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: #94a3b8;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-add-btn {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #2563eb;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rdpa-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.rdpa-list + .rdpa-list {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.rdpa-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid $border;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
|
||||
@media (width <= 900px) {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-row:has(mifosx-gl-account-selector) {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.rdpa-row--other {
|
||||
border-style: dashed;
|
||||
border-color: #cbd5e1;
|
||||
background: #f8fafc;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
|
||||
@media (width <= 1100px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-other-row-wrap {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
@media (width <= 1100px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-row__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.rdpa-row__meta--other {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.rdpa-row__label {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: $gray-700;
|
||||
}
|
||||
|
||||
.rdpa-row__input {
|
||||
flex: 0 0 22rem;
|
||||
max-width: 22rem;
|
||||
min-width: 18rem;
|
||||
|
||||
@media (width <= 900px) {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-row__input :is(mifosx-gl-account-selector) {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rdpa-row__input :is(mifosx-gl-account-selector) :is(.layout-column) {
|
||||
width: 100%;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.rdpa-row__input :is(mifosx-gl-account-selector) :is(mat-form-field) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rdpa-row__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rdpa-row__actions--other {
|
||||
justify-content: flex-end;
|
||||
align-self: stretch;
|
||||
width: 100%;
|
||||
|
||||
@media (width <= 1100px) {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-row__name {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 24rem;
|
||||
height: 40px;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
padding: 0 12px;
|
||||
font-size: 14px;
|
||||
background: #fff;
|
||||
|
||||
@media (width <= 900px) {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-row__name--other-account {
|
||||
max-width: 100%;
|
||||
flex: 1 1 auto;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
.rdpa-row__other-field {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rdpa-row__other-field :is(mat-form-field) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rdpa-row__other-field :is(.mat-mdc-form-field-required-marker) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rdpa-remove-btn {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #ef4444;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.rdpa-remove-btn--side {
|
||||
place-self: center end;
|
||||
margin-right: 4px;
|
||||
|
||||
@media (width <= 1100px) {
|
||||
justify-self: start;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpa-radio-group {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.rdpa-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
|
||||
&--green {
|
||||
background: #dcfce7;
|
||||
color: #16a34a;
|
||||
}
|
||||
|
||||
&--amber {
|
||||
background: #fef3c7;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
&--blue {
|
||||
background: #dbeafe;
|
||||
color: #2563eb;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 900px) {
|
||||
.rdpa-row__meta {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.rdpa-row__input {
|
||||
flex: 1 1 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
+423
@@ -0,0 +1,423 @@
|
||||
/**
|
||||
* 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, Input, OnInit, inject } from '@angular/core';
|
||||
import {
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
UntypedFormArray,
|
||||
UntypedFormBuilder,
|
||||
UntypedFormControl,
|
||||
UntypedFormGroup,
|
||||
Validators
|
||||
} from '@angular/forms';
|
||||
import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
|
||||
import { GlAccountSelectorComponent } from 'app/shared/accounting/gl-account-selector/gl-account-selector.component';
|
||||
import { Accounting } from 'app/core/utils/accounting';
|
||||
import { GLAccount } from 'app/shared/models/general.model';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
type AccountingSectionKey = 'assets' | 'liabilities' | 'expenses' | 'income';
|
||||
|
||||
type AccountingRowConfig = {
|
||||
key: string;
|
||||
label: string;
|
||||
inputLabel: string;
|
||||
controlName: string;
|
||||
options: GLAccount[];
|
||||
required?: boolean;
|
||||
accrualOnly?: boolean;
|
||||
dormancyOnly?: boolean;
|
||||
};
|
||||
|
||||
type AccountingSectionConfig = {
|
||||
key: AccountingSectionKey;
|
||||
title: string;
|
||||
pillLabel: string;
|
||||
pillClass: 'green' | 'amber' | 'blue';
|
||||
rows: AccountingRowConfig[];
|
||||
otherMappingsControlName: string;
|
||||
otherAccountOptions: GLAccount[];
|
||||
};
|
||||
|
||||
type OtherGlMappingValue = {
|
||||
accountName: string;
|
||||
glAccountId: number | null;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-daily-deposit-scheme-product-accounting-step',
|
||||
templateUrl: './daily-deposit-scheme-product-accounting-step.component.html',
|
||||
styleUrls: ['./daily-deposit-scheme-product-accounting-step.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatRadioGroup,
|
||||
MatRadioButton,
|
||||
GlAccountSelectorComponent
|
||||
]
|
||||
})
|
||||
export class DailyDepositSchemeProductAccountingStepComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private accounting = inject(Accounting);
|
||||
|
||||
@Input() DailyDepositSchemeProductsTemplate: any;
|
||||
@Input() accountingRuleData: any;
|
||||
@Input() DailyDepositSchemeProductFormValid: boolean;
|
||||
@Input() isDormancyTrackingActive: any;
|
||||
|
||||
DailyDepositSchemeProductAccountingForm: UntypedFormGroup;
|
||||
assetAccountOptions: GLAccount[] = [];
|
||||
liabilityAccountOptions: GLAccount[] = [];
|
||||
expenseAccountOptions: GLAccount[] = [];
|
||||
incomeAccountOptions: GLAccount[] = [];
|
||||
accountingSectionConfigs: AccountingSectionConfig[] = [];
|
||||
|
||||
constructor() {
|
||||
this.createDailyDepositSchemeProductAccountingForm();
|
||||
this.setConditionalControls();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const accountingMappings = this.DailyDepositSchemeProductsTemplate?.accountingMappings || {};
|
||||
const mappings = {
|
||||
...accountingMappings,
|
||||
otherGlMappingsMap: this.DailyDepositSchemeProductsTemplate?.otherGlMappingsMap
|
||||
};
|
||||
const accountingMappingOptions = this.DailyDepositSchemeProductsTemplate?.accountingMappingOptions || {};
|
||||
// Defaults to Cash (2) for a brand-new product (no existing accountingRule yet), but preserves
|
||||
// the product's own current accounting rule when editing - previously this was hardcoded to 2
|
||||
// unconditionally, which silently forced every edited product onto Cash-based accounting (and
|
||||
// its required GL mappings) even for products that were and should remain "None".
|
||||
const accountingRuleId = this.DailyDepositSchemeProductsTemplate?.accountingRule?.id ?? 2;
|
||||
|
||||
this.assetAccountOptions = accountingMappingOptions.assetAccountOptions || [];
|
||||
this.liabilityAccountOptions = accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.expenseAccountOptions = accountingMappingOptions.expenseAccountOptions || [];
|
||||
this.incomeAccountOptions = accountingMappingOptions.incomeAccountOptions || [];
|
||||
|
||||
this.buildAccountingSectionConfigs();
|
||||
|
||||
this.DailyDepositSchemeProductAccountingForm.patchValue({ accountingRule: accountingRuleId });
|
||||
this.syncAccountingControls(accountingRuleId);
|
||||
this.patchAccountingValues(mappings);
|
||||
this.setDormancyControl();
|
||||
}
|
||||
|
||||
createDailyDepositSchemeProductAccountingForm() {
|
||||
this.DailyDepositSchemeProductAccountingForm = this.formBuilder.group({
|
||||
accountingRule: [2],
|
||||
savingsReferenceAccountId: [''],
|
||||
savingsControlAccountId: [''],
|
||||
transfersInSuspenseAccountId: [''],
|
||||
interestOnSavingsAccountId: [''],
|
||||
incomeFromFeeAccountId: [''],
|
||||
incomeFromPenaltyAccountId: [''],
|
||||
feesReceivableAccountId: [''],
|
||||
penaltiesReceivableAccountId: [''],
|
||||
interestPayableAccountId: [''],
|
||||
escheatLiabilityId: [''],
|
||||
assetsOtherGlMappings: this.formBuilder.array([]),
|
||||
liabilitiesOtherGlMappings: this.formBuilder.array([]),
|
||||
expensesOtherGlMappings: this.formBuilder.array([]),
|
||||
incomeOtherGlMappings: this.formBuilder.array([])
|
||||
});
|
||||
}
|
||||
|
||||
private setConditionalControls() {
|
||||
this.DailyDepositSchemeProductAccountingForm.get('accountingRule')?.valueChanges.subscribe((rule: number) => {
|
||||
this.syncAccountingControls(rule);
|
||||
});
|
||||
}
|
||||
|
||||
private patchAccountingValues(mappings: any) {
|
||||
this.DailyDepositSchemeProductAccountingForm.patchValue({
|
||||
savingsReferenceAccountId: mappings.savingsReferenceAccount?.id || '',
|
||||
savingsControlAccountId: mappings.savingsControlAccount?.id || '',
|
||||
transfersInSuspenseAccountId: mappings.transfersInSuspenseAccount?.id || '',
|
||||
interestOnSavingsAccountId: mappings.interestOnSavingsAccount?.id || '',
|
||||
incomeFromFeeAccountId: mappings.incomeFromFeeAccount?.id || '',
|
||||
incomeFromPenaltyAccountId: mappings.incomeFromPenaltyAccount?.id || '',
|
||||
feesReceivableAccountId: mappings.feeReceivableAccount?.id || '',
|
||||
penaltiesReceivableAccountId: mappings.penaltyReceivableAccount?.id || '',
|
||||
interestPayableAccountId: mappings.interestPayableAccount?.id || '',
|
||||
escheatLiabilityId: mappings.escheatLiabilityAccount?.id || ''
|
||||
});
|
||||
|
||||
if (this.isCashOrAccrualAccounting()) {
|
||||
const glMappings = mappings.otherGlMappingsMap || mappings.otherGlMappings;
|
||||
this.setOtherGlMappings('assetsOtherGlMappings', glMappings?.assets || [], this.assetAccountOptions);
|
||||
this.setOtherGlMappings(
|
||||
'liabilitiesOtherGlMappings',
|
||||
glMappings?.liabilities || [],
|
||||
this.liabilityAccountOptions
|
||||
);
|
||||
this.setOtherGlMappings('expensesOtherGlMappings', glMappings?.expenses || [], this.expenseAccountOptions);
|
||||
this.setOtherGlMappings('incomeOtherGlMappings', glMappings?.income || [], this.incomeAccountOptions);
|
||||
}
|
||||
}
|
||||
|
||||
private createOtherGlMappingGroup(otherGlMapping: Partial<OtherGlMappingValue> = {}) {
|
||||
return this.formBuilder.group({
|
||||
accountName: [
|
||||
otherGlMapping.accountName || '',
|
||||
Validators.required
|
||||
],
|
||||
glAccountId: [
|
||||
otherGlMapping.glAccountId || '',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
getOtherGlMappingsArray(controlName: string): UntypedFormArray {
|
||||
return this.DailyDepositSchemeProductAccountingForm.get(controlName) as UntypedFormArray;
|
||||
}
|
||||
|
||||
private setOtherGlMappings(controlName: string, otherGlMappings: any[], options: GLAccount[]) {
|
||||
const arr = this.getOtherGlMappingsArray(controlName);
|
||||
arr.clear();
|
||||
(otherGlMappings || []).forEach((m) => {
|
||||
arr.push(
|
||||
this.createOtherGlMappingGroup({
|
||||
accountName: m.accountName,
|
||||
glAccountId: m.glAccountId || options.find((o) => o.glCode === m.glCode)?.id || null
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
addOtherGlMapping(controlName: string) {
|
||||
this.getOtherGlMappingsArray(controlName).push(this.createOtherGlMappingGroup());
|
||||
}
|
||||
|
||||
removeOtherGlMapping(controlName: string, index: number) {
|
||||
this.getOtherGlMappingsArray(controlName).removeAt(index);
|
||||
}
|
||||
|
||||
getOtherGlMappingControl(controlName: string, index: number, fieldName: string): UntypedFormControl {
|
||||
return this.getOtherGlMappingsArray(controlName).at(index).get(fieldName) as UntypedFormControl;
|
||||
}
|
||||
|
||||
private clearOtherGlMappings() {
|
||||
[
|
||||
'assetsOtherGlMappings',
|
||||
'liabilitiesOtherGlMappings',
|
||||
'expensesOtherGlMappings',
|
||||
'incomeOtherGlMappings'
|
||||
].forEach((c) => this.getOtherGlMappingsArray(c).clear());
|
||||
}
|
||||
|
||||
private getOtherGlMappings() {
|
||||
const map = (controlName: string, options: GLAccount[]) =>
|
||||
this.getOtherGlMappingsArray(controlName)
|
||||
.value.filter((item: OtherGlMappingValue) => !!item.accountName || !!item.glAccountId)
|
||||
.map((item: OtherGlMappingValue) => ({
|
||||
accountName: item.accountName,
|
||||
glCode: options.find((o) => o.id === item.glAccountId)?.glCode || ''
|
||||
}))
|
||||
.filter((item: { accountName: string; glCode: string }) => !!item.accountName || !!item.glCode);
|
||||
|
||||
const otherGlMappings = {
|
||||
assets: map('assetsOtherGlMappings', this.assetAccountOptions),
|
||||
liabilities: map('liabilitiesOtherGlMappings', this.liabilityAccountOptions),
|
||||
expenses: map('expensesOtherGlMappings', this.expenseAccountOptions),
|
||||
income: map('incomeOtherGlMappings', this.incomeAccountOptions)
|
||||
};
|
||||
return Object.values(otherGlMappings).some((v) => v.length) ? otherGlMappings : null;
|
||||
}
|
||||
|
||||
private setDormancyControl() {
|
||||
this.isDormancyTrackingActive?.valueChanges?.subscribe(() => {
|
||||
this.syncAccountingControls(this.DailyDepositSchemeProductAccountingForm.value.accountingRule);
|
||||
});
|
||||
}
|
||||
|
||||
isDormancyTrackingEnabled(): boolean {
|
||||
return this.isDormancyTrackingActive?.value ?? this.isDormancyTrackingActive ?? false;
|
||||
}
|
||||
|
||||
private syncAccountingControls(accountingRule: number) {
|
||||
const setRequired = (name: string, required: boolean) => {
|
||||
const ctrl = this.DailyDepositSchemeProductAccountingForm.get(name);
|
||||
if (!ctrl) return;
|
||||
if (required) {
|
||||
ctrl.setValidators(Validators.required);
|
||||
} else {
|
||||
ctrl.clearValidators();
|
||||
}
|
||||
ctrl.updateValueAndValidity({ emitEvent: false });
|
||||
};
|
||||
|
||||
const cashOrAccrual = this.accounting.isCashOrAccrualAccountingRuleId(accountingRule);
|
||||
const accrualOnly = this.accounting.isAccrualAccountingRuleId(accountingRule);
|
||||
|
||||
setRequired('savingsReferenceAccountId', cashOrAccrual);
|
||||
setRequired('savingsControlAccountId', cashOrAccrual);
|
||||
setRequired('transfersInSuspenseAccountId', cashOrAccrual);
|
||||
setRequired('interestOnSavingsAccountId', cashOrAccrual);
|
||||
setRequired('incomeFromFeeAccountId', cashOrAccrual);
|
||||
setRequired('incomeFromPenaltyAccountId', cashOrAccrual);
|
||||
setRequired('feesReceivableAccountId', accrualOnly);
|
||||
setRequired('penaltiesReceivableAccountId', accrualOnly);
|
||||
setRequired('interestPayableAccountId', accrualOnly);
|
||||
setRequired('escheatLiabilityId', cashOrAccrual && this.isDormancyTrackingEnabled());
|
||||
|
||||
if (!cashOrAccrual) {
|
||||
this.clearOtherGlMappings();
|
||||
}
|
||||
}
|
||||
|
||||
buildAccountingSectionConfigs() {
|
||||
this.accountingSectionConfigs = [
|
||||
{
|
||||
key: 'assets',
|
||||
title: 'Assets',
|
||||
pillLabel: 'Asset',
|
||||
pillClass: 'green',
|
||||
rows: [
|
||||
{
|
||||
key: 'savingsReferenceAccountId',
|
||||
label: 'Savings Reference Account',
|
||||
inputLabel: 'Savings reference account',
|
||||
controlName: 'savingsReferenceAccountId',
|
||||
options: this.assetAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'feesReceivableAccountId',
|
||||
label: 'Fees Receivable Account',
|
||||
inputLabel: 'Fees receivable account',
|
||||
controlName: 'feesReceivableAccountId',
|
||||
options: this.assetAccountOptions,
|
||||
accrualOnly: true
|
||||
},
|
||||
{
|
||||
key: 'penaltiesReceivableAccountId',
|
||||
label: 'Penalties Receivable Account',
|
||||
inputLabel: 'Penalties receivable account',
|
||||
controlName: 'penaltiesReceivableAccountId',
|
||||
options: this.assetAccountOptions,
|
||||
accrualOnly: true
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'assetsOtherGlMappings',
|
||||
otherAccountOptions: this.assetAccountOptions
|
||||
},
|
||||
{
|
||||
key: 'liabilities',
|
||||
title: 'Liabilities',
|
||||
pillLabel: 'Liability',
|
||||
pillClass: 'green',
|
||||
rows: [
|
||||
{
|
||||
key: 'savingsControlAccountId',
|
||||
label: 'Savings Control Account',
|
||||
inputLabel: 'Savings control account',
|
||||
controlName: 'savingsControlAccountId',
|
||||
options: this.liabilityAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'transfersInSuspenseAccountId',
|
||||
label: 'Transfers In Suspense Account',
|
||||
inputLabel: 'Transfers in suspense account',
|
||||
controlName: 'transfersInSuspenseAccountId',
|
||||
options: this.liabilityAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'interestPayableAccountId',
|
||||
label: 'Interest Payable Account',
|
||||
inputLabel: 'Interest payable account',
|
||||
controlName: 'interestPayableAccountId',
|
||||
options: this.liabilityAccountOptions,
|
||||
accrualOnly: true
|
||||
},
|
||||
{
|
||||
key: 'escheatLiabilityId',
|
||||
label: 'Escheat Liability Account',
|
||||
inputLabel: 'Escheat liability account',
|
||||
controlName: 'escheatLiabilityId',
|
||||
options: this.liabilityAccountOptions,
|
||||
dormancyOnly: true
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'liabilitiesOtherGlMappings',
|
||||
otherAccountOptions: this.liabilityAccountOptions
|
||||
},
|
||||
{
|
||||
key: 'expenses',
|
||||
title: 'Expenses',
|
||||
pillLabel: 'Expense',
|
||||
pillClass: 'amber',
|
||||
rows: [
|
||||
{
|
||||
key: 'interestOnSavingsAccountId',
|
||||
label: 'Interest On Savings Account',
|
||||
inputLabel: 'Interest on savings account',
|
||||
controlName: 'interestOnSavingsAccountId',
|
||||
options: this.expenseAccountOptions,
|
||||
required: true
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'expensesOtherGlMappings',
|
||||
otherAccountOptions: this.expenseAccountOptions
|
||||
},
|
||||
{
|
||||
key: 'income',
|
||||
title: 'Income',
|
||||
pillLabel: 'Income',
|
||||
pillClass: 'blue',
|
||||
rows: [
|
||||
{
|
||||
key: 'incomeFromFeeAccountId',
|
||||
label: 'Income From Fees',
|
||||
inputLabel: 'Income from fees',
|
||||
controlName: 'incomeFromFeeAccountId',
|
||||
options: this.incomeAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'incomeFromPenaltyAccountId',
|
||||
label: 'Income From Penalties',
|
||||
inputLabel: 'Income from penalties',
|
||||
controlName: 'incomeFromPenaltyAccountId',
|
||||
options: this.incomeAccountOptions,
|
||||
required: true
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'incomeOtherGlMappings',
|
||||
otherAccountOptions: this.incomeAccountOptions
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
get DailyDepositSchemeProductAccounting() {
|
||||
const {
|
||||
assetsOtherGlMappings,
|
||||
liabilitiesOtherGlMappings,
|
||||
expensesOtherGlMappings,
|
||||
incomeOtherGlMappings,
|
||||
...accounting
|
||||
} = this.DailyDepositSchemeProductAccountingForm.value;
|
||||
const otherGlMappings = this.getOtherGlMappings();
|
||||
return { ...accounting, ...(otherGlMappings ? { otherGlMappings } : {}) };
|
||||
}
|
||||
|
||||
isCashOrAccrualAccounting(): boolean {
|
||||
return this.accounting.isCashOrAccrualAccountingRuleId(
|
||||
this.DailyDepositSchemeProductAccountingForm.value.accountingRule
|
||||
);
|
||||
}
|
||||
|
||||
isAccrualAccounting(): boolean {
|
||||
return this.accounting.isAccrualAccountingRuleId(this.DailyDepositSchemeProductAccountingForm.value.accountingRule);
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<!--
|
||||
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="rdpch-section">
|
||||
<div class="rdpch-section__header">
|
||||
<i class="fa fa-file-invoice-dollar"></i>
|
||||
<h3>{{ 'labels.heading.Charges' | translate }}</h3>
|
||||
</div>
|
||||
<div class="rdpch-section__body">
|
||||
<div class="rdpch-add-row">
|
||||
<mat-form-field appearance="outline" class="rdpch-add-row__select">
|
||||
<mat-label>{{ 'labels.inputs.Charge' | translate }}</mat-label>
|
||||
<mat-select #charge>
|
||||
@for (charge of chargeData | chargesFilter: chargesDataSource : currencyCode.value; track charge) {
|
||||
<mat-option [value]="charge">
|
||||
{{ charge.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<button
|
||||
type="button"
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
class="rdpch-add-btn"
|
||||
(click)="addCharge(charge)"
|
||||
[disabled]="!charge.value"
|
||||
>
|
||||
<fa-icon icon="plus" class="m-r-10"></fa-icon>
|
||||
{{ 'labels.buttons.Add' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (chargesDataSource.length > 0) {
|
||||
<div class="rdpch-table-wrapper">
|
||||
<table mat-table [dataSource]="chargesDataSource">
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Name' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
{{ charge.name + ', ' + charge.currency.displaySymbol }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="chargeCalculationType">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Type' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
{{ charge.chargeCalculationType.value }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="amount">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
{{ charge.amount }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="chargeTimeType">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Collected On' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
{{ charge.chargeTimeType.value }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="action">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let charge">
|
||||
<button mat-icon-button color="warn" (click)="deleteCharge(charge)">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
.rdpch-section {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 24px;
|
||||
background: #f8f9fa;
|
||||
border-bottom: 1px solid #e8eaed;
|
||||
|
||||
i {
|
||||
font-size: 14px;
|
||||
color: #0ea5e9;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #202124;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
padding: 16px 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpch-add-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&__select {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.rdpch-add-btn {
|
||||
height: 36px;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.rdpch-table-wrapper {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin-top: 12px;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* 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, Input, OnInit, inject } from '@angular/core';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { MatButton, MatIconButton } from '@angular/material/button';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow
|
||||
} from '@angular/material/table';
|
||||
import { ChargesFilterPipe } from '../../../../pipes/charges-filter.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-daily-deposit-scheme-product-charges-step',
|
||||
templateUrl: './daily-deposit-scheme-product-charges-step.component.html',
|
||||
styleUrls: ['./daily-deposit-scheme-product-charges-step.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatIconButton,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
ChargesFilterPipe
|
||||
]
|
||||
})
|
||||
export class DailyDepositSchemeProductChargesStepComponent implements OnInit {
|
||||
dialog = inject(MatDialog);
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
@Input() DailyDepositSchemeProductsTemplate: any;
|
||||
@Input() currencyCode: UntypedFormControl;
|
||||
|
||||
chargeData: any;
|
||||
|
||||
chargesDataSource: {}[];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'chargeTimeType',
|
||||
'action'
|
||||
];
|
||||
|
||||
ngOnInit() {
|
||||
this.chargeData = this.DailyDepositSchemeProductsTemplate.chargeOptions;
|
||||
if (!(this.DailyDepositSchemeProductsTemplate === undefined) && this.DailyDepositSchemeProductsTemplate.id) {
|
||||
this.chargesDataSource = this.DailyDepositSchemeProductsTemplate.charges;
|
||||
} else {
|
||||
this.chargesDataSource = [];
|
||||
}
|
||||
this.currencyCode.valueChanges.subscribe(() => (this.chargesDataSource = []));
|
||||
}
|
||||
|
||||
addCharge(charge: any) {
|
||||
this.chargesDataSource = this.chargesDataSource.concat([charge.value]);
|
||||
charge.value = '';
|
||||
}
|
||||
|
||||
deleteCharge(charge: any) {
|
||||
const deleteChargeDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Charge') + ' ' + charge.name }
|
||||
});
|
||||
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1);
|
||||
this.chargesDataSource = this.chargesDataSource.concat([]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get DailyDepositSchemeProductCharges() {
|
||||
return {
|
||||
charges: this.chargesDataSource
|
||||
};
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<!--
|
||||
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/.
|
||||
-->
|
||||
|
||||
<form [formGroup]="DailyDepositSchemeProductCurrencyForm">
|
||||
<div class="rdpc-section">
|
||||
<div class="rdpc-section__header">
|
||||
<i class="fas fa-coins"></i>
|
||||
<span>Currency & Account Status Configuration</span>
|
||||
</div>
|
||||
<div class="rdpc-body">
|
||||
<div class="rdpc-grid">
|
||||
<mat-form-field appearance="outline" class="rdpc-field">
|
||||
<mat-label>{{ 'labels.inputs.Currency' | translate }}</mat-label>
|
||||
<mat-select
|
||||
formControlName="currencyCode"
|
||||
matTooltip="{{ 'tooltips.The currency in which the deposit will be disbursed' | translate }}"
|
||||
required
|
||||
>
|
||||
@for (currency of currencyData; track currency) {
|
||||
<mat-option [value]="currency.code">
|
||||
{{ currency.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-hint>Default: Indian Rupee - auto-set for domestic products</mat-hint>
|
||||
<mat-error>
|
||||
{{ 'labels.inputs.Currency' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="rdpc-field">
|
||||
<mat-label>{{ 'labels.inputs.Decimal Places' | translate }}</mat-label>
|
||||
<mat-select
|
||||
formControlName="digitsAfterDecimal"
|
||||
matTooltip="{{ 'tooltips.Decimal places to be used to track and report' | translate }}"
|
||||
required
|
||||
>
|
||||
@for (places of decimalPlacesData; track places) {
|
||||
<mat-option [value]="places">{{ places }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
<mat-error>
|
||||
{{ 'labels.inputs.Decimal Places' | translate }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="rdpc-alert">
|
||||
<div class="rdpc-alert__content">
|
||||
<h4>Dormancy Alert</h4>
|
||||
<p>Enable automated notifications when an account becomes inactive based on product rules.</p>
|
||||
</div>
|
||||
<mat-radio-group class="rdpc-alert__choices" formControlName="dormancyAlert">
|
||||
<mat-radio-button [value]="true">yes</mat-radio-button>
|
||||
<mat-radio-button [value]="false">no</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
|
||||
<div class="rdpc-alert">
|
||||
<div class="rdpc-alert__content">
|
||||
<h4>Nomination Facility</h4>
|
||||
<p>Allow account holders to designate individuals to receive funds in the event of account holder's death.</p>
|
||||
</div>
|
||||
<mat-radio-group class="rdpc-alert__choices" formControlName="nominationFacility">
|
||||
<mat-radio-button [value]="true">yes</mat-radio-button>
|
||||
<mat-radio-button [value]="false">no</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
|
||||
<div class="rdpc-alert">
|
||||
<div class="rdpc-alert__content">
|
||||
<h4>Auto Debit Facility</h4>
|
||||
<p>Enable automatic deduction of funds for recurring payments, utility bills, or EMI obligations.</p>
|
||||
</div>
|
||||
<mat-radio-group class="rdpc-alert__choices" formControlName="autoDebitFacility">
|
||||
<mat-radio-button [value]="true">yes</mat-radio-button>
|
||||
<mat-radio-button [value]="false">no</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user