implemented a Maker-Checker workflow for Products, with approval-based updates and product locking to prevent concurrent edits

This commit is contained in:
keshav898966
2026-07-03 15:08:47 +05:30
parent d00eac0aa1
commit 1ea4cfe8d8
25 changed files with 838 additions and 36 deletions
@@ -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') {
@@ -595,7 +595,13 @@
<button mat-stroked-button [routerLink]="['../..']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button mat-raised-button color="primary" class="preview-submit-row__primary" (click)="submitEvent.emit()">
<button
mat-raised-button
color="primary"
class="preview-submit-row__primary"
[disabled]="submitting"
(click)="submitEvent.emit()"
>
<fa-icon icon="check" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Submit' | translate }}
</button>
@@ -94,6 +94,8 @@ export class SavingsAccountPreviewStepComponent implements OnChanges {
@Input() activeClientMembers?: any;
/** Hide internal Cancel/Submit buttons when parent provides its own action bar */
@Input() hideButtons = false;
/** Disables the Submit button while a submission is in flight, preventing duplicate double-click requests */
@Input() submitting = false;
/** Table Data Source */
dataSource: any;