implemented a Maker-Checker workflow for Products, with approval-based updates and product locking to prevent concurrent edits
This commit is contained in:
@@ -117,6 +117,7 @@
|
||||
[savingsAccount]="savingsAccount"
|
||||
[savingsAccountDigital]="savingsAccountDigital"
|
||||
[savingsAccountNominees]="savingsAccountCurrencyStep?.nominees ?? []"
|
||||
[submitting]="submitting"
|
||||
(submitEvent)="submit()"
|
||||
>
|
||||
</mifosx-savings-account-preview-step>
|
||||
|
||||
@@ -64,6 +64,8 @@ export class CreateSavingsAccountComponent {
|
||||
selectedTabIndex = 0;
|
||||
/** Total wizard tabs — Product, Currency, Digital, Preview. */
|
||||
private readonly totalTabs = 4;
|
||||
/** Guards against duplicate submissions from a double-click while the create request is in flight. */
|
||||
submitting = false;
|
||||
|
||||
@ViewChild(SavingsAccountDetailsStepComponent, { static: true })
|
||||
savingsAccountDetailsStep: SavingsAccountDetailsStepComponent;
|
||||
@@ -116,6 +118,9 @@ export class CreateSavingsAccountComponent {
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (this.submitting) {
|
||||
return;
|
||||
}
|
||||
const detailsStep = this.savingsAccountDetailsStep;
|
||||
if (detailsStep.selectedAccountStatus === 'JOINT' && detailsStep.totalJointSharePercentage !== 100) {
|
||||
this.alertService.alert({
|
||||
@@ -177,6 +182,7 @@ export class CreateSavingsAccountComponent {
|
||||
}));
|
||||
}
|
||||
|
||||
this.submitting = true;
|
||||
this.savingsService.createSavingsAccount(savingsAccount).subscribe({
|
||||
next: (response: any) => {
|
||||
this.router.navigate(
|
||||
@@ -188,6 +194,7 @@ export class CreateSavingsAccountComponent {
|
||||
);
|
||||
},
|
||||
error: (error: any) => {
|
||||
this.submitting = false;
|
||||
const errorCode =
|
||||
error?.error?.errors?.[0]?.userMessageGlobalisationCode ?? error?.error?.userMessageGlobalisationCode;
|
||||
if (errorCode === 'error.msg.savings.account.duplicate.product.for.client') {
|
||||
|
||||
Reference in New Issue
Block a user