Merge remote-tracking branch 'origin/dev-latest' into dev-latest
This commit is contained in:
@@ -279,7 +279,7 @@
|
||||
<div class="gl-fgroup">
|
||||
<label class="gl-flabel"><fa-icon icon="calendar-alt"></fa-icon> From Date</label>
|
||||
<mat-form-field appearance="outline" class="gl-ffield">
|
||||
<input matInput [matDatepicker]="dpFrom" [min]="minDate" [max]="maxDate" [formControl]="transactionDateFrom" />
|
||||
<input matInput [matDatepicker]="dpFrom" [min]="minDate" [formControl]="transactionDateFrom" />
|
||||
<mat-datepicker-toggle matSuffix [for]="dpFrom"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dpFrom></mat-datepicker>
|
||||
</mat-form-field>
|
||||
@@ -288,7 +288,7 @@
|
||||
<div class="gl-fgroup">
|
||||
<label class="gl-flabel"><fa-icon icon="calendar-alt"></fa-icon> To Date</label>
|
||||
<mat-form-field appearance="outline" class="gl-ffield">
|
||||
<input matInput [matDatepicker]="dpTo" [min]="minDate" [max]="maxDate" [formControl]="transactionDateTo" />
|
||||
<input matInput [matDatepicker]="dpTo" [min]="minDate" [formControl]="transactionDateTo" />
|
||||
<mat-datepicker-toggle matSuffix [for]="dpTo"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dpTo></mat-datepicker>
|
||||
</mat-form-field>
|
||||
@@ -353,13 +353,7 @@
|
||||
<div class="gl-fgroup">
|
||||
<label class="gl-flabel"><fa-icon icon="calendar-check"></fa-icon> Submitted From</label>
|
||||
<mat-form-field appearance="outline" class="gl-ffield">
|
||||
<input
|
||||
matInput
|
||||
[matDatepicker]="dpSubFrom"
|
||||
[min]="minDate"
|
||||
[max]="maxDate"
|
||||
[formControl]="submittedOnDateFrom"
|
||||
/>
|
||||
<input matInput [matDatepicker]="dpSubFrom" [min]="minDate" [formControl]="submittedOnDateFrom" />
|
||||
<mat-datepicker-toggle matSuffix [for]="dpSubFrom"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dpSubFrom></mat-datepicker>
|
||||
</mat-form-field>
|
||||
@@ -368,7 +362,7 @@
|
||||
<div class="gl-fgroup">
|
||||
<label class="gl-flabel"><fa-icon icon="calendar-check"></fa-icon> Submitted To</label>
|
||||
<mat-form-field appearance="outline" class="gl-ffield">
|
||||
<input matInput [matDatepicker]="dpSubTo" [min]="minDate" [max]="maxDate" [formControl]="submittedOnDateTo" />
|
||||
<input matInput [matDatepicker]="dpSubTo" [min]="minDate" [formControl]="submittedOnDateTo" />
|
||||
<mat-datepicker-toggle matSuffix [for]="dpSubTo"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dpSubTo></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -90,7 +90,7 @@ export class SearchJournalEntryComponent implements OnInit, OnDestroy, AfterView
|
||||
|
||||
// ── Misc ──────────────────────────────────────────────────────────────────
|
||||
minDate = new Date(2000, 0, 1);
|
||||
maxDate = new Date();
|
||||
maxDate: Date = null;
|
||||
/** Accounting features switched off for this installation — see disabled-features.ts. */
|
||||
disabledFeatures = DISABLED_ACCOUNTING_FEATURES;
|
||||
|
||||
@@ -208,7 +208,7 @@ export class SearchJournalEntryComponent implements OnInit, OnDestroy, AfterView
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.maxDate = null;
|
||||
this.paginator.pageSize = 10;
|
||||
this.restoreState();
|
||||
this.setFilteredOffices();
|
||||
|
||||
+12
-1
@@ -24,6 +24,7 @@ import { UntypedFormBuilder, UntypedFormGroup, UntypedFormControl, ValidatorFn,
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { FormatNumberPipe } from '../../../../../pipes/format-number.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
@@ -97,6 +98,7 @@ export class PaymentDialogComponent implements OnInit {
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
paymentForm: UntypedFormGroup;
|
||||
/** Loaded once, on open, from the same closure template the existing Close action already uses. */
|
||||
@@ -375,7 +377,16 @@ export class PaymentDialogComponent implements OnInit {
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.data.accountId as string, 'payment', data)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
next: (response: any) => {
|
||||
// Parked in the Checker Inbox rather than executed -- see the same handling in
|
||||
// PrematureCloseDialogComponent for why an HTTP 200 here can still mean "not applied yet".
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'This payment has been submitted for approval. The deposit is unchanged until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.dialogRef.close({ confirm: true });
|
||||
},
|
||||
// Keep the dialog open with the entered values and say what went wrong, rather than leaving a
|
||||
|
||||
+15
-3
@@ -140,7 +140,9 @@
|
||||
<span class="pcd__preview-label"
|
||||
>Interest Earned (to {{ 'labels.inputs.Premature Close Date' | translate }})</span
|
||||
>
|
||||
<span class="pcd__preview-value">+ {{ interestEarned | formatNumber }}</span>
|
||||
<span class="pcd__preview-value"
|
||||
>{{ interestEarned >= 0 ? '+' : '' }} {{ interestEarned | formatNumber }}</span
|
||||
>
|
||||
</div>
|
||||
}
|
||||
<div class="pcd__preview-row pcd__preview-row--total">
|
||||
@@ -205,8 +207,8 @@
|
||||
@if (noDestinationAccounts) {
|
||||
<p class="pcd__hint pcd__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
|
||||
pays out in cash instead.
|
||||
This customer has no active savings account to transfer into. Premature closure has to be paid into a
|
||||
savings account, so open one for this customer before closing this deposit.
|
||||
</p>
|
||||
}
|
||||
|
||||
@@ -229,6 +231,16 @@
|
||||
</mat-form-field>
|
||||
}
|
||||
|
||||
@if (prematureCloseForm.contains('toGlAccountId')) {
|
||||
<mifosx-gl-account-selector
|
||||
[inputFormControl]="toGlAccountControl"
|
||||
[glAccountList]="glAccountsData"
|
||||
[required]="true"
|
||||
[inputLabel]="'Transfer to GL Account'"
|
||||
>
|
||||
</mifosx-gl-account-selector>
|
||||
}
|
||||
|
||||
@if (prematureCloseForm.contains('transferDescription')) {
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ 'labels.inputs.Transfer Description' | translate }}</mat-label>
|
||||
|
||||
+68
-12
@@ -23,13 +23,19 @@ import { UntypedFormBuilder, UntypedFormGroup, UntypedFormControl, Validators }
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { AccountingService } from 'app/accounting/accounting.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { FormatNumberPipe } from '../../../../../pipes/format-number.pipe';
|
||||
import { GlAccountSelectorComponent } from 'app/shared/accounting/gl-account-selector/gl-account-selector.component';
|
||||
import { GLAccount } from 'app/shared/models/general.model';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* "Premature Close" dialog -- Active-only, no reinvest option (the deposit hasn't matured, so there's
|
||||
* nothing to renew): pay out in cash, or transfer the pre-maturity balance to a savings account. Same
|
||||
* nothing to renew): transfer the pre-maturity balance to a savings account, or post it to a GL account.
|
||||
* There is deliberately no cash payout -- the backend does not offer or accept one for a premature
|
||||
* closure, so the proceeds always stay traceable to an account. Same
|
||||
* `.pcd__*` visual language as the Payment dialog ({@link PaymentDialogComponent}), in this Danger Zone
|
||||
* action's own red accent rather than Payment's blue, since it's an irreversible, usually
|
||||
* penalty-bearing action rather than a routine one.
|
||||
@@ -49,22 +55,26 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
MatDialogClose,
|
||||
CdkTextareaAutosize,
|
||||
FaIconComponent,
|
||||
FormatNumberPipe
|
||||
FormatNumberPipe,
|
||||
GlAccountSelectorComponent
|
||||
]
|
||||
})
|
||||
export class PrematureCloseDialogComponent implements OnInit {
|
||||
/** The `onAccountClosureId` codes Premature Close can offer -- same codes Payment/Close use. */
|
||||
private static readonly WITHDRAW_DEPOSIT_ID = 100;
|
||||
private static readonly TRANSFER_TO_SAVINGS_ID = 200;
|
||||
private static readonly TRANSFER_TO_GL_ID = 600;
|
||||
|
||||
private static readonly ACTION_ICONS: Record<number, string> = {
|
||||
[PrematureCloseDialogComponent.WITHDRAW_DEPOSIT_ID]: 'money-bill-wave',
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'wallet'
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'wallet',
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_GL_ID]: 'book'
|
||||
};
|
||||
|
||||
private static readonly ACTION_DESCRIPTIONS: Record<number, string> = {
|
||||
[PrematureCloseDialogComponent.WITHDRAW_DEPOSIT_ID]: 'Pay out the full balance in cash',
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'Move the full balance to another savings account'
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID]: 'Move the full balance to another savings account',
|
||||
[PrematureCloseDialogComponent.TRANSFER_TO_GL_ID]: 'Post the full balance to a GL account'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -108,11 +118,15 @@ export class PrematureCloseDialogComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private accountingService = inject(AccountingService);
|
||||
private alertService = inject(AlertService);
|
||||
private dateUtils = inject(Dates);
|
||||
|
||||
prematureCloseForm: UntypedFormGroup;
|
||||
onAccountClosureOptions: any[] = [];
|
||||
savingsAccountsData: any[] = [];
|
||||
/** Postable GL accounts, loaded once -- only read when the GL action is chosen. */
|
||||
glAccountsData: GLAccount[] = [];
|
||||
maturityAmount: number = null;
|
||||
/** The rate actually resolved for THIS preview by the backend (actual-period vs contracted,
|
||||
* penalty-deducted or not) -- distinct from data.nominalAnnualInterestRate, which is always the
|
||||
@@ -228,19 +242,50 @@ export class PrematureCloseDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/** Adds/removes the destination-account control to match what the chosen type needs. */
|
||||
/** Adds/removes the destination control to match what the chosen type needs. */
|
||||
private onClosureTypeChange(id: number): void {
|
||||
if (id === PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID) {
|
||||
if (!this.prematureCloseForm.contains('toSavingsAccountId')) {
|
||||
this.prematureCloseForm.addControl('toSavingsAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.prematureCloseForm.addControl('transferDescription', new UntypedFormControl(''));
|
||||
}
|
||||
} else {
|
||||
const toSavings = id === PrematureCloseDialogComponent.TRANSFER_TO_SAVINGS_ID;
|
||||
const toGl = id === PrematureCloseDialogComponent.TRANSFER_TO_GL_ID;
|
||||
|
||||
if (toSavings && !this.prematureCloseForm.contains('toSavingsAccountId')) {
|
||||
this.prematureCloseForm.addControl('toSavingsAccountId', new UntypedFormControl('', Validators.required));
|
||||
} else if (!toSavings) {
|
||||
this.prematureCloseForm.removeControl('toSavingsAccountId');
|
||||
}
|
||||
|
||||
if (toGl) {
|
||||
if (!this.prematureCloseForm.contains('toGlAccountId')) {
|
||||
this.prematureCloseForm.addControl('toGlAccountId', new UntypedFormControl('', Validators.required));
|
||||
}
|
||||
this.loadGlAccounts();
|
||||
} else {
|
||||
this.prematureCloseForm.removeControl('toGlAccountId');
|
||||
}
|
||||
|
||||
// Both destinations carry the description through -- to the account transfer, or to the narration on
|
||||
// the journal entry that credits the GL account.
|
||||
if ((toSavings || toGl) && !this.prematureCloseForm.contains('transferDescription')) {
|
||||
this.prematureCloseForm.addControl('transferDescription', new UntypedFormControl(''));
|
||||
} else if (!toSavings && !toGl) {
|
||||
this.prematureCloseForm.removeControl('transferDescription');
|
||||
}
|
||||
}
|
||||
|
||||
/** Fetched on first use rather than with the dialog, since most closures never pick the GL action. */
|
||||
private loadGlAccounts(): void {
|
||||
if (this.glAccountsData.length) {
|
||||
return;
|
||||
}
|
||||
this.accountingService.getGlAccounts().subscribe((accounts: GLAccount[]) => {
|
||||
this.glAccountsData = accounts ?? [];
|
||||
});
|
||||
}
|
||||
|
||||
/** The GL selector takes a control instance, not a control name. */
|
||||
get toGlAccountControl(): UntypedFormControl {
|
||||
return this.prematureCloseForm.get('toGlAccountId') as UntypedFormControl;
|
||||
}
|
||||
|
||||
/** The gap between the deposit and the computed maturity amount -- the actual interest this premature
|
||||
* closure earns, at whatever rate (contracted, or the lower pre-closure-penalty one below) applied. */
|
||||
get interestEarned(): number | null {
|
||||
@@ -373,7 +418,18 @@ export class PrematureCloseDialogComponent implements OnInit {
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.data.accountId as string, 'prematureClose', data)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
next: (response: any) => {
|
||||
// A command on a maker-checker permission is parked in the Checker Inbox, not executed:
|
||||
// the platform rolls its transaction back and still answers HTTP 200 with
|
||||
// rollbackTransaction: true. Without saying so, the dialog closes and the account reloads
|
||||
// unchanged -- which reads as "nothing happened" rather than "waiting for approval".
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'Premature closure has been submitted for approval. The deposit is unchanged until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.dialogRef.close({ confirm: true });
|
||||
},
|
||||
// Keep the dialog open with the entered values and say what went wrong, rather than leaving a
|
||||
|
||||
+12
-1
@@ -30,6 +30,7 @@ import { AccountsService } from 'app/accounts/accounts.service';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { AuthenticationService } from '../../../core/authentication/authentication.service';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { NgClass, CurrencyPipe } from '@angular/common';
|
||||
@@ -74,6 +75,7 @@ import { DormancyAlertPanelComponent } from 'app/shared/dormancy-alert-panel/dor
|
||||
export class FixedDepositAccountViewComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private alertService = inject(AlertService);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private savingsService = inject(SavingsService);
|
||||
private accountsService = inject(AccountsService);
|
||||
@@ -419,7 +421,16 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
if (response.confirm) {
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.fixedDepositsAccountData.id, 'postInterest', {})
|
||||
.subscribe(() => {
|
||||
.subscribe((commandResponse: any) => {
|
||||
// Parked in the Checker Inbox rather than executed (HTTP 200 with
|
||||
// rollbackTransaction: true), so the reload below shows no new interest posting.
|
||||
if (commandResponse?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'Interest posting has been sent for checker approval. No interest is posted until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
|
||||
+27
-11
@@ -11,6 +11,7 @@ import { Component, OnInit, 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';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -37,6 +38,7 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -98,17 +100,31 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
dateFormat,
|
||||
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.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'approve', data)
|
||||
.subscribe((response: any) => {
|
||||
// Parked in the Checker Inbox rather than executed (HTTP 200 with rollbackTransaction: true).
|
||||
// The account is therefore still pending, so chaining activation onto it would be applied to an
|
||||
// unapproved account -- stop here and say what is actually waiting.
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'This approval has been sent for checker approval. The account stays pending until a checker approves it.'
|
||||
});
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
const activationData = {
|
||||
activatedOnDate: approveFixedDepositsAccountFormData.approvedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'activate', activationData)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+15
-3
@@ -21,6 +21,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { FixedDepositsService } from '../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@@ -43,6 +44,7 @@ export class CloseFixedDepositsAccountComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -139,8 +141,18 @@ export class CloseFixedDepositsAccountComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'close', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'close', data)
|
||||
.subscribe((response: any) => {
|
||||
// Parked in the Checker Inbox rather than executed (HTTP 200 with rollbackTransaction: true),
|
||||
// so the deposit reloads unchanged -- say so instead of letting that read as "nothing happened".
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Closure has been sent for checker approval. The deposit is unchanged until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+16
-3
@@ -11,6 +11,7 @@ import { Component, OnInit, 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';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -37,6 +38,7 @@ export class RejectFixedDepositsAccountComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -97,8 +99,19 @@ export class RejectFixedDepositsAccountComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'reject', data)
|
||||
.subscribe((response: any) => {
|
||||
// Parked in the Checker Inbox rather than executed (HTTP 200 with rollbackTransaction: true),
|
||||
// so the application is still open -- say so instead of letting that read as "nothing happened".
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'Rejection has been sent for checker approval. The application is unchanged until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+23
-3
@@ -12,6 +12,7 @@ import { UntypedFormGroup, UntypedFormBuilder, ReactiveFormsModule } from '@angu
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { FixedDepositsService } from '../../fixed-deposits.service';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
@@ -35,6 +36,7 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Undo Approval Fixed Deposits Account form. */
|
||||
undoApprovalFixedDepositsAccountForm: UntypedFormGroup;
|
||||
@@ -87,12 +89,30 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
|
||||
if (this.undoAction === 'Undo Activation') {
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, this.undoCommand, data)
|
||||
.subscribe(() => {
|
||||
.subscribe((response: any) => {
|
||||
this.notifyIfSentForApproval(response);
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
} else {
|
||||
this.savingsService.executeSavingsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
this.savingsService
|
||||
.executeSavingsAccountCommand(this.accountId, this.undoCommand, data)
|
||||
.subscribe((response: any) => {
|
||||
this.notifyIfSentForApproval(response);
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Both undo commands sit on maker-checker permissions, so either can come back parked in the
|
||||
* Checker Inbox rather than executed -- HTTP 200 with rollbackTransaction: true, and the account
|
||||
* reloaded unchanged. Without this the navigation away reads as "it worked".
|
||||
*/
|
||||
private notifyIfSentForApproval(response: any): void {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: `${this.undoAction} has been sent for checker approval. The account is unchanged until a checker approves it.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+12
-1
@@ -11,6 +11,7 @@ import { Component, OnInit, 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';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -37,6 +38,7 @@ export class WithdrawByClientFixedDepositsAccountComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -99,7 +101,16 @@ export class WithdrawByClientFixedDepositsAccountComponent implements OnInit {
|
||||
};
|
||||
this.fixedDepositsService
|
||||
.executeFixedDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data)
|
||||
.subscribe(() => {
|
||||
.subscribe((response: any) => {
|
||||
// Parked in the Checker Inbox rather than executed (HTTP 200 with rollbackTransaction: true),
|
||||
// so the application is still open -- say so instead of letting that read as "nothing happened".
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message:
|
||||
'Withdrawal has been sent for checker approval. The application is unchanged until a checker approves it.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
+56
-2
@@ -24,6 +24,10 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
type AccountingSectionKey = 'assets' | 'liabilities' | 'expenses' | 'income';
|
||||
|
||||
const SAVINGS_INTEREST_PAYABLE_ACCOUNT_NAME = 'Savings Interest Payable';
|
||||
const FIXED_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME = 'Fixed Deposit Interest Paid';
|
||||
const SAVINGS_INTEREST_PAID_ACCOUNT_NAME = 'Savings Interest Paid';
|
||||
|
||||
type AccountingRowConfig = {
|
||||
key: string;
|
||||
label: string;
|
||||
@@ -128,6 +132,7 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
feesReceivableAccountId: [''],
|
||||
penaltiesReceivableAccountId: [''],
|
||||
interestPayableAccountId: [''],
|
||||
savingsInterestPaidAccountId: [''],
|
||||
escheatLiabilityId: [''],
|
||||
assetsOtherGlMappings: this.formBuilder.array([]),
|
||||
liabilitiesOtherGlMappings: this.formBuilder.array([]),
|
||||
@@ -158,6 +163,20 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
return '';
|
||||
}
|
||||
|
||||
private extractNamedGlMapping(
|
||||
otherGlMappings: any[],
|
||||
accountName: string,
|
||||
controlName: string,
|
||||
options: GLAccount[]
|
||||
): any[] {
|
||||
const match = (otherGlMappings || []).find((mapping) => mapping?.accountName === accountName);
|
||||
if (match) {
|
||||
const glAccountId = match.glAccountId || options.find((option) => option.glCode === match.glCode)?.id || '';
|
||||
this.fixedDepositProductAccountingForm.get(controlName)?.patchValue(glAccountId);
|
||||
}
|
||||
return (otherGlMappings || []).filter((mapping) => mapping?.accountName !== accountName);
|
||||
}
|
||||
|
||||
private patchAccountingValues(mappings: any) {
|
||||
this.fixedDepositProductAccountingForm.patchValue({
|
||||
savingsReferenceAccountId: this.extractAccountId(
|
||||
@@ -200,7 +219,18 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
glMappings?.liabilities || [],
|
||||
this.liabilityAccountOptions
|
||||
);
|
||||
this.setOtherGlMappings('expensesOtherGlMappings', glMappings?.expenses || [], this.expenseAccountOptions);
|
||||
const fromExpenses = this.extractNamedGlMapping(
|
||||
this.extractNamedGlMapping(
|
||||
glMappings?.expenses || [],
|
||||
FIXED_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME,
|
||||
'savingsInterestPaidAccountId',
|
||||
this.expenseAccountOptions
|
||||
),
|
||||
SAVINGS_INTEREST_PAID_ACCOUNT_NAME,
|
||||
'savingsInterestPaidAccountId',
|
||||
this.expenseAccountOptions
|
||||
);
|
||||
this.setOtherGlMappings('expensesOtherGlMappings', fromExpenses, this.expenseAccountOptions);
|
||||
this.setOtherGlMappings('incomeOtherGlMappings', glMappings?.income || [], this.incomeAccountOptions);
|
||||
}
|
||||
}
|
||||
@@ -266,10 +296,26 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
}))
|
||||
.filter((item: { accountName: string; glCode: string }) => !!item.accountName || !!item.glCode);
|
||||
|
||||
const namedAsOtherGlMapping = (controlName: string, accountName: string, options: GLAccount[]) => {
|
||||
const glAccountId = this.fixedDepositProductAccountingForm.get(controlName)?.value;
|
||||
if (!glAccountId) {
|
||||
return [];
|
||||
}
|
||||
const glCode = options.find((o) => o.id === glAccountId)?.glCode || '';
|
||||
return glCode ? [{ accountName, glCode }] : [];
|
||||
};
|
||||
|
||||
const otherGlMappings = {
|
||||
assets: map('assetsOtherGlMappings', this.assetAccountOptions),
|
||||
liabilities: map('liabilitiesOtherGlMappings', this.liabilityAccountOptions),
|
||||
expenses: map('expensesOtherGlMappings', this.expenseAccountOptions),
|
||||
expenses: [
|
||||
...namedAsOtherGlMapping(
|
||||
'savingsInterestPaidAccountId',
|
||||
FIXED_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME,
|
||||
this.expenseAccountOptions
|
||||
),
|
||||
...map('expensesOtherGlMappings', this.expenseAccountOptions)
|
||||
],
|
||||
income: map('incomeOtherGlMappings', this.incomeAccountOptions)
|
||||
};
|
||||
return Object.values(otherGlMappings).some((v) => v.length) ? otherGlMappings : null;
|
||||
@@ -416,6 +462,13 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
controlName: 'interestOnSavingsAccountId',
|
||||
options: this.expenseAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'savingsInterestPaidAccountId',
|
||||
label: 'Fixed Deposit Interest Paid',
|
||||
inputLabel: 'Fixed deposit interest paid',
|
||||
controlName: 'savingsInterestPaidAccountId',
|
||||
options: this.expenseAccountOptions
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'expensesOtherGlMappings',
|
||||
@@ -456,6 +509,7 @@ export class FixedDepositProductAccountingStepComponent implements OnInit, OnCha
|
||||
liabilitiesOtherGlMappings,
|
||||
expensesOtherGlMappings,
|
||||
incomeOtherGlMappings,
|
||||
savingsInterestPaidAccountId,
|
||||
...accounting
|
||||
} = this.fixedDepositProductAccountingForm.value;
|
||||
const otherGlMappings = this.getOtherGlMappings();
|
||||
|
||||
+58
-4
@@ -24,6 +24,10 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
type AccountingSectionKey = 'assets' | 'liabilities' | 'expenses' | 'income';
|
||||
|
||||
const SAVINGS_INTEREST_PAYABLE_ACCOUNT_NAME = 'Savings Interest Payable';
|
||||
const RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME = 'Recurring Deposit Interest Paid';
|
||||
const SAVINGS_INTEREST_PAID_ACCOUNT_NAME = 'Savings Interest Paid';
|
||||
|
||||
type AccountingRowConfig = {
|
||||
key: string;
|
||||
label: string;
|
||||
@@ -122,6 +126,7 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
feesReceivableAccountId: [''],
|
||||
penaltiesReceivableAccountId: [''],
|
||||
interestPayableAccountId: [''],
|
||||
savingsInterestPaidAccountId: [''],
|
||||
escheatLiabilityId: [''],
|
||||
assetsOtherGlMappings: this.formBuilder.array([]),
|
||||
liabilitiesOtherGlMappings: this.formBuilder.array([]),
|
||||
@@ -136,6 +141,20 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private extractNamedGlMapping(
|
||||
otherGlMappings: any[],
|
||||
accountName: string,
|
||||
controlName: string,
|
||||
options: GLAccount[]
|
||||
): any[] {
|
||||
const match = (otherGlMappings || []).find((mapping) => mapping?.accountName === accountName);
|
||||
if (match) {
|
||||
const glAccountId = match.glAccountId || options.find((option) => option.glCode === match.glCode)?.id || '';
|
||||
this.recurringDepositProductAccountingForm.get(controlName)?.patchValue(glAccountId);
|
||||
}
|
||||
return (otherGlMappings || []).filter((mapping) => mapping?.accountName !== accountName);
|
||||
}
|
||||
|
||||
private patchAccountingValues(mappings: any) {
|
||||
this.recurringDepositProductAccountingForm.patchValue({
|
||||
savingsReferenceAccountId: mappings.savingsReferenceAccount?.id || '',
|
||||
@@ -158,7 +177,18 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
glMappings?.liabilities || [],
|
||||
this.liabilityAccountOptions
|
||||
);
|
||||
this.setOtherGlMappings('expensesOtherGlMappings', glMappings?.expenses || [], this.expenseAccountOptions);
|
||||
const fromExpenses = this.extractNamedGlMapping(
|
||||
this.extractNamedGlMapping(
|
||||
glMappings?.expenses || [],
|
||||
RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME,
|
||||
'savingsInterestPaidAccountId',
|
||||
this.expenseAccountOptions
|
||||
),
|
||||
SAVINGS_INTEREST_PAID_ACCOUNT_NAME,
|
||||
'savingsInterestPaidAccountId',
|
||||
this.expenseAccountOptions
|
||||
);
|
||||
this.setOtherGlMappings('expensesOtherGlMappings', fromExpenses, this.expenseAccountOptions);
|
||||
this.setOtherGlMappings('incomeOtherGlMappings', glMappings?.income || [], this.incomeAccountOptions);
|
||||
}
|
||||
}
|
||||
@@ -224,10 +254,26 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
}))
|
||||
.filter((item: { accountName: string; glCode: string }) => !!item.accountName || !!item.glCode);
|
||||
|
||||
const namedAsOtherGlMapping = (controlName: string, accountName: string, options: GLAccount[]) => {
|
||||
const glAccountId = this.recurringDepositProductAccountingForm.get(controlName)?.value;
|
||||
if (!glAccountId) {
|
||||
return [];
|
||||
}
|
||||
const glCode = options.find((o) => o.id === glAccountId)?.glCode || '';
|
||||
return glCode ? [{ accountName, glCode }] : [];
|
||||
};
|
||||
|
||||
const otherGlMappings = {
|
||||
assets: map('assetsOtherGlMappings', this.assetAccountOptions),
|
||||
liabilities: map('liabilitiesOtherGlMappings', this.liabilityAccountOptions),
|
||||
expenses: map('expensesOtherGlMappings', this.expenseAccountOptions),
|
||||
expenses: [
|
||||
...namedAsOtherGlMapping(
|
||||
'savingsInterestPaidAccountId',
|
||||
RECURRING_DEPOSIT_INTEREST_PAID_ACCOUNT_NAME,
|
||||
this.expenseAccountOptions
|
||||
),
|
||||
...map('expensesOtherGlMappings', this.expenseAccountOptions)
|
||||
],
|
||||
income: map('incomeOtherGlMappings', this.incomeAccountOptions)
|
||||
};
|
||||
return Object.values(otherGlMappings).some((v) => v.length) ? otherGlMappings : null;
|
||||
@@ -360,11 +406,18 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
rows: [
|
||||
{
|
||||
key: 'interestOnSavingsAccountId',
|
||||
label: 'Interest On Savings Account',
|
||||
inputLabel: 'Interest on savings account',
|
||||
label: 'Interest On Recurring Deposits',
|
||||
inputLabel: 'Interest on recurring deposits',
|
||||
controlName: 'interestOnSavingsAccountId',
|
||||
options: this.expenseAccountOptions,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'savingsInterestPaidAccountId',
|
||||
label: 'Recurring Deposit Interest Paid',
|
||||
inputLabel: 'Recurring deposit interest paid',
|
||||
controlName: 'savingsInterestPaidAccountId',
|
||||
options: this.expenseAccountOptions
|
||||
}
|
||||
],
|
||||
otherMappingsControlName: 'expensesOtherGlMappings',
|
||||
@@ -405,6 +458,7 @@ export class RecurringDepositProductAccountingStepComponent implements OnInit {
|
||||
liabilitiesOtherGlMappings,
|
||||
expensesOtherGlMappings,
|
||||
incomeOtherGlMappings,
|
||||
savingsInterestPaidAccountId,
|
||||
...accounting
|
||||
} = this.recurringDepositProductAccountingForm.value;
|
||||
const otherGlMappings = this.getOtherGlMappings();
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
// in the tenants table of the tenant-store database, or the platform rejects the request as an
|
||||
// unknown tenant.
|
||||
window["env"]["fineractPlatformTenantId"] = 'utkarshbank';
|
||||
window["env"]["fineractPlatformTenantIds"] = 'utkarshbank';
|
||||
window["env"]["fineractPlatformTenantIds"] = 'utkarshbank,lincpay';
|
||||
|
||||
window['env']['tenantLogoUrl'] = '';
|
||||
window['env']['tenantLogoUrlDark'] = '';
|
||||
|
||||
@@ -2971,6 +2971,7 @@
|
||||
"Transfer Interest to Savings Account": "Transfer Interest to Savings Account",
|
||||
"Transfer Type": "Transfer Type",
|
||||
"Transfer in suspense": "Transfer in suspense",
|
||||
"Transfer to GL Account": "Transfer to GL Account",
|
||||
"Transfer to Savings": "Transfer to Savings",
|
||||
"Transfer to savings account": "Transfer to savings account",
|
||||
"Trigger Type": "Trigger Type",
|
||||
|
||||
@@ -20,7 +20,7 @@ export const environment = {
|
||||
hash: env.mifos_x.hash,
|
||||
// For connecting to server running elsewhere update the tenant identifier
|
||||
fineractPlatformTenantId: loadedEnv['fineractPlatformTenantId'] || 'utkarshbank',
|
||||
fineractPlatformTenantIds: loadedEnv['fineractPlatformTenantIds'] || 'utkarshbank',
|
||||
fineractPlatformTenantIds: loadedEnv['fineractPlatformTenantIds'] || 'utkarshbank,lincpay',
|
||||
// For connecting to others servers running elsewhere update the base API URL
|
||||
baseApiUrls:
|
||||
loadedEnv['fineractApiUrls'] || 'https://demo.mifos.community,https://localhost:8443,' + window.location.origin,
|
||||
|
||||
@@ -23,7 +23,7 @@ export const environment = {
|
||||
hash: env.mifos_x.hash,
|
||||
// For connecting to server running elsewhere update the tenant identifier
|
||||
fineractPlatformTenantId: loadedEnv.fineractPlatformTenantId || 'utkarshbank',
|
||||
fineractPlatformTenantIds: loadedEnv.fineractPlatformTenantIds || 'utkarshbank',
|
||||
fineractPlatformTenantIds: loadedEnv.fineractPlatformTenantIds || 'utkarshbank,lincpay',
|
||||
// For connecting to others servers running elsewhere update the base API URL
|
||||
baseApiUrls:
|
||||
loadedEnv.fineractApiUrls || 'https://demo.mifos.community,https://localhost:8443,' + window.location.origin,
|
||||
|
||||
Reference in New Issue
Block a user