Implement organization maker-checker workflows
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@
|
||||
"ng": "ng",
|
||||
"build": "node version.js && npm run env -s && ng build --configuration production --output-hashing=none",
|
||||
"build:prod": "node version.js && node --max-old-space-size=16384 ./node_modules/@angular/cli/bin/ng build --configuration production --output-hashing=none --base-href=/web-app/",
|
||||
"start": "npm run env -s && cross-env NODE_OPTIONS=\"--max_old_space_size=16384\" ng serve --proxy-config proxy.localhost.conf.js",
|
||||
"start": "npm run env -s && cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" ng serve --proxy-config proxy.localhost.conf.js",
|
||||
"start:share": "npm run env -s && cross-env NODE_OPTIONS=\"--max_old_space_size=16384\" ng serve --host 0.0.0.0 --proxy-config proxy.localhost.conf.js",
|
||||
"start:demo": "npm run env -s && cross-env NODE_OPTIONS=\"--max_old_space_size=16384\" ng serve --proxy-config proxy.conf.js",
|
||||
"serve:dev": "npm run env -s && cross-env NODE_OPTIONS=\"--max_old_space_size=16384\" ng serve --source-map --proxy-config proxy.localhost.conf.js",
|
||||
|
||||
@@ -438,7 +438,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
.split(',')
|
||||
.map((id) => id.trim())
|
||||
.filter((id) => id.length > 0);
|
||||
if (tenantIds.length === 0 || (tenantIds.length === 1 && tenantIds[0] === 'default')) {
|
||||
if (tenantIds.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -143,11 +143,25 @@ export class BranchProfileComponent implements OnInit {
|
||||
.subscribe((res: any) => {
|
||||
this.saving = false;
|
||||
if (!res) return;
|
||||
if (res.rollbackTransaction) {
|
||||
// Parked for checker approval - the branch profile has not actually changed yet.
|
||||
this.successMsg = 'Branch profile update has been submitted for approval.';
|
||||
this.form.markAsPristine();
|
||||
return;
|
||||
}
|
||||
this.successMsg = 'Branch profile saved.';
|
||||
this.form.markAsPristine();
|
||||
this.lastUpdated = res.updatedByUsername ? { by: res.updatedByUsername, at: res.updatedAt } : null;
|
||||
const idx = this.offices.findIndex((o) => o.officeId === this.selectedOfficeId);
|
||||
if (idx >= 0) this.offices[idx] = res;
|
||||
// The response is now a CommandProcessingResult, not the updated row (the write goes through
|
||||
// the command pipeline) - reload the saved row from the server instead of patching state from
|
||||
// this response.
|
||||
this.organizationService.getBranchProfile(this.selectedOfficeId!).subscribe((updated: any) => {
|
||||
if (!updated) return;
|
||||
this.lastUpdated = updated.updatedByUsername
|
||||
? { by: updated.updatedByUsername, at: updated.updatedAt }
|
||||
: null;
|
||||
const idx = this.offices.findIndex((o) => o.officeId === this.selectedOfficeId);
|
||||
if (idx >= 0) this.offices[idx] = updated;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +182,18 @@ export class InstitutionProfileComponent implements OnInit {
|
||||
.subscribe((res: any) => {
|
||||
this.saving = false;
|
||||
if (!res) return;
|
||||
if (res.rollbackTransaction) {
|
||||
// Parked for checker approval - the profile has not actually changed yet, so the form must
|
||||
// not be patched with the submitted (not-yet-applied) values as if it had.
|
||||
this.successMsg = 'Bank profile update has been submitted for approval.';
|
||||
this.form.markAsPristine();
|
||||
return;
|
||||
}
|
||||
this.successMsg = 'Bank profile saved.';
|
||||
this.applyResult(res);
|
||||
this.form.markAsPristine();
|
||||
// The response is now a CommandProcessingResult, not the updated row (the write goes through
|
||||
// the command pipeline) - reload the saved row from the server instead of patching the form
|
||||
// from this response.
|
||||
this.load();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -16,6 +16,7 @@ import { OrganizationService } from '../../organization.service';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Create Payment Type Component.
|
||||
@@ -35,6 +36,7 @@ export class CreatePaymentTypeComponent implements OnInit {
|
||||
private organizationService = inject(OrganizationService);
|
||||
private router = inject(Router);
|
||||
private route = inject(ActivatedRoute);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Payment Type form. */
|
||||
paymentTypeForm: UntypedFormGroup;
|
||||
@@ -73,7 +75,13 @@ export class CreatePaymentTypeComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const paymentType = this.paymentTypeForm.value;
|
||||
this.organizationService.createPaymentType(paymentType).subscribe((response) => {
|
||||
this.organizationService.createPaymentType(paymentType).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Payment Type creation has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Edit Payment Type component.
|
||||
@@ -35,6 +36,7 @@ export class EditPaymentTypeComponent implements OnInit {
|
||||
private organizationService = inject(OrganizationService);
|
||||
private router = inject(Router);
|
||||
private route = inject(ActivatedRoute);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Payment Type form. */
|
||||
paymentTypeForm: UntypedFormGroup;
|
||||
@@ -88,7 +90,13 @@ export class EditPaymentTypeComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const paymentType = this.paymentTypeForm.value;
|
||||
this.organizationService.updatePaymentType(this.paymentTypeData.id, paymentType).subscribe((response) => {
|
||||
this.organizationService.updatePaymentType(this.paymentTypeData.id, paymentType).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Payment Type update has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import { DeleteDialogComponent } from '../../shared/delete-dialog/delete-dialog.
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Payment Types component.
|
||||
@@ -65,6 +66,7 @@ export class PaymentTypesComponent implements OnInit {
|
||||
private organizationService = inject(OrganizationService);
|
||||
private route = inject(ActivatedRoute);
|
||||
private dialog = inject(MatDialog);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Payment Types data. */
|
||||
paymentTypesData: any;
|
||||
@@ -132,9 +134,20 @@ export class PaymentTypesComponent implements OnInit {
|
||||
});
|
||||
deletePaymentTypeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deletePaymentType(paymentTypeId).subscribe(() => {
|
||||
this.paymentTypesData = this.paymentTypesData.filter((paymentType: any) => paymentType.id !== paymentTypeId);
|
||||
this.setPaymentTypes();
|
||||
this.organizationService.deletePaymentType(paymentTypeId).subscribe((deleteResponse: any) => {
|
||||
if (deleteResponse?.rollbackTransaction) {
|
||||
// Parked for checker approval - the record has not actually been removed yet, so the
|
||||
// list must not drop it (that would falsely show the deletion as already applied).
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Payment Type deletion has been submitted for approval.'
|
||||
});
|
||||
} else {
|
||||
this.paymentTypesData = this.paymentTypesData.filter(
|
||||
(paymentType: any) => paymentType.id !== paymentTypeId
|
||||
);
|
||||
this.setPaymentTypes();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,6 +23,7 @@ import { OrganizationService } from '../organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Dialog Components */
|
||||
import { NextStepDialogComponent } from '../../configuration-wizard/next-step-dialog/next-step-dialog.component';
|
||||
@@ -53,6 +54,7 @@ export class WorkingDaysComponent implements OnInit, AfterViewInit {
|
||||
private dialog = inject(MatDialog);
|
||||
private configurationWizardService = inject(ConfigurationWizardService);
|
||||
private popoverService = inject(PopoverService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Working days form. */
|
||||
workingDaysForm: UntypedFormGroup;
|
||||
@@ -152,7 +154,13 @@ export class WorkingDaysComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
workingDays.recurrence = recurrence;
|
||||
this.organizationService.updateWorkingDays(workingDays).subscribe((response) => {
|
||||
this.organizationService.updateWorkingDays(workingDays).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Working Days update has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
if (this.configurationWizardService.showDefineWorkingDays) {
|
||||
this.configurationWizardService.showDefineWorkingDays = false;
|
||||
this.openNextStepDialog();
|
||||
|
||||
@@ -226,8 +226,10 @@
|
||||
<mat-spinner diameter="16"></mat-spinner>
|
||||
<span>Submitting…</span>
|
||||
} @else {
|
||||
<mat-icon>check</mat-icon>
|
||||
<span>Submit Request</span>
|
||||
<ng-container>
|
||||
<mat-icon>check</mat-icon>
|
||||
<span>Submit Request</span>
|
||||
</ng-container>
|
||||
}
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
+4
-2
@@ -275,8 +275,10 @@
|
||||
<mat-spinner diameter="16"></mat-spinner>
|
||||
<span>Applying…</span>
|
||||
} @else {
|
||||
<mat-icon>check</mat-icon>
|
||||
<span>Apply Collection</span>
|
||||
<ng-container>
|
||||
<mat-icon>check</mat-icon>
|
||||
<span>Apply Collection</span>
|
||||
</ng-container>
|
||||
}
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
@@ -297,8 +297,14 @@ export class GlSettingsDialogComponent implements OnInit {
|
||||
ddLimitAmount: val.ddLimitAmount
|
||||
})
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open('Sponsor DD GL Mapping & GST Settings saved successfully!', 'Close', { duration: 3000 });
|
||||
next: (res: any) => {
|
||||
// A save submitted for approval comes back HTTP 200 with rollbackTransaction: true - the
|
||||
// mapping has not actually been applied yet, so this must not claim success the same way an
|
||||
// immediate save does.
|
||||
const message = res?.rollbackTransaction
|
||||
? 'Sponsor DD GL Mapping & GST Settings submitted for approval'
|
||||
: 'Sponsor DD GL Mapping & GST Settings saved successfully!';
|
||||
this.snackBar.open(message, 'Close', { duration: res?.rollbackTransaction ? 4000 : 3000 });
|
||||
this.dialogRef.close(true);
|
||||
},
|
||||
error: (err) => {
|
||||
|
||||
@@ -20,6 +20,7 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-sponsor-bank-list',
|
||||
@@ -356,6 +357,7 @@ export class AddSponsorBankDialogComponent implements OnInit {
|
||||
private http = inject(HttpClient);
|
||||
private dialogRef = inject(MatDialogRef<AddSponsorBankDialogComponent>);
|
||||
private snackBar = inject(MatSnackBar);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** The bank being edited, or null when adding a new one. */
|
||||
data = inject(MAT_DIALOG_DATA, { optional: true }) as any;
|
||||
@@ -419,10 +421,24 @@ export class AddSponsorBankDialogComponent implements OnInit {
|
||||
? this.http.put<any>(`/sponsorbanks/${this.data.bank.id}`, this.form.value)
|
||||
: this.http.post<any>('/sponsorbanks', this.form.value);
|
||||
request$.subscribe({
|
||||
next: () => {
|
||||
this.snackBar.open(this.isEdit ? 'Sponsor Bank updated' : 'Sponsor Bank added successfully', 'Close', {
|
||||
duration: 3000
|
||||
});
|
||||
next: (res: any) => {
|
||||
// A create/update submitted for approval comes back HTTP 200 with rollbackTransaction: true -
|
||||
// the bank has not actually been created/changed yet, so this must not claim success the same
|
||||
// way an immediate create/update does. Routed through AlertService (not the local snackBar)
|
||||
// so it uses the same top-right notification as the Payment Type/Working Days Maker-Checker
|
||||
// flows, instead of the bottom-positioned snackbar used for this dialog's other messages.
|
||||
if (res?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: this.isEdit
|
||||
? 'Sponsor Bank update has been submitted for approval'
|
||||
: 'Sponsor Bank creation has been submitted for approval'
|
||||
});
|
||||
} else {
|
||||
this.snackBar.open(this.isEdit ? 'Sponsor Bank updated' : 'Sponsor Bank added successfully', 'Close', {
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
this.dialogRef.close(true);
|
||||
},
|
||||
error: (err) => {
|
||||
|
||||
+28
-2
@@ -7,6 +7,26 @@
|
||||
-->
|
||||
|
||||
<div class="layout-row align-end gap-2px responsive-column container m-b-20">
|
||||
<mat-form-field class="mc-search-field">
|
||||
<input
|
||||
matInput
|
||||
type="text"
|
||||
placeholder="Search permissions..."
|
||||
[value]="searchTerm"
|
||||
(input)="onSearchTermChange($any($event.target).value)"
|
||||
/>
|
||||
@if (isSearchActive) {
|
||||
<button
|
||||
class="mc-clear-search"
|
||||
matSuffix
|
||||
type="button"
|
||||
(click)="clearSearch()"
|
||||
[attr.aria-label]="'Clear search'"
|
||||
>
|
||||
<fa-icon icon="times"></fa-icon>
|
||||
</button>
|
||||
}
|
||||
</mat-form-field>
|
||||
<div #buttonEdit class="in-block">
|
||||
<button
|
||||
mat-raised-button
|
||||
@@ -41,14 +61,20 @@
|
||||
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div class="list-permission layout-column flex-70">
|
||||
@if (isSearchActive && displayedPermissions.length === 0) {
|
||||
<p class="no-results">No permissions found.</p>
|
||||
}
|
||||
<form [formGroup]="formGroup" (submit)="submit()">
|
||||
<div formArrayName="roster">
|
||||
@for (permission of permissions.permissions; track permission; let i = $index) {
|
||||
@for (permission of displayedPermissions; track permission.code) {
|
||||
<div class="display-permissions">
|
||||
<div [formGroupName]="i">
|
||||
<div [formGroupName]="permission.globalIndex">
|
||||
<mat-checkbox name="cp" id="{{ permission.code }}" formControlName="selected">
|
||||
{{ permissionName(permission.code) }}
|
||||
</mat-checkbox>
|
||||
@if (isSearchActive) {
|
||||
<span class="search-result-grouping">({{ formatName(permission.grouping || '') }})</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
+29
@@ -46,3 +46,32 @@ mat-list-item {
|
||||
.inactive:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.mc-search-field {
|
||||
width: 260px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.mc-clear-search {
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
color: inherit;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.mc-clear-search:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.no-results {
|
||||
padding-top: 15px;
|
||||
font-style: italic;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.search-result-grouping {
|
||||
padding-left: 6px;
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
+54
-3
@@ -27,6 +27,11 @@ interface Permission {
|
||||
id: number;
|
||||
selected: boolean;
|
||||
grouping?: string;
|
||||
/** Index of this permission's control within the `roster` FormArray (which is built from the
|
||||
* full, globally-ordered permission list). Needed because the checkbox list on screen is
|
||||
* rendered from a per-grouping filtered subset, whose own local index does not match the
|
||||
* roster's global index. */
|
||||
globalIndex?: number;
|
||||
}
|
||||
|
||||
interface PermissionGroup {
|
||||
@@ -70,6 +75,12 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
currentGrouping = '';
|
||||
tempPermissionUIData: PermissionData = {};
|
||||
permissions: PermissionGroup = { permissions: [] };
|
||||
/** Flat list of every permission across all groupings, built once alongside
|
||||
* tempPermissionUIData. Used only for global search - it is a read-only view over the same
|
||||
* Permission objects (each still carrying its correct globalIndex), never a separate copy
|
||||
* that could drift out of sync with the roster FormArray. */
|
||||
allPermissions: Permission[] = [];
|
||||
searchTerm = '';
|
||||
|
||||
formData = {};
|
||||
isDisabled = true;
|
||||
@@ -137,22 +148,30 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
|
||||
setMakerCheckerTask(): void {
|
||||
this.tempPermissionUIData = {};
|
||||
this.allPermissions = [];
|
||||
|
||||
for (const permission of this.permissionsData) {
|
||||
this.permissionsData.forEach((permission: any, globalIndex: number) => {
|
||||
if (permission.grouping !== this.currentGrouping) {
|
||||
this.currentGrouping = permission.grouping || '';
|
||||
this.groupings.push(this.currentGrouping);
|
||||
this.tempPermissionUIData[this.currentGrouping] = { permissions: [] };
|
||||
}
|
||||
|
||||
// globalIndex matches this permission's position in `this.formGroup.controls.roster`,
|
||||
// since both this list and `roster` are built from the same `this.permissionsData` array
|
||||
// in the same order (see createForm()). The checkbox must address the roster control by
|
||||
// this global index, never by its local position within the current grouping's filtered view.
|
||||
const temp: Permission = {
|
||||
code: permission.code,
|
||||
id: permission.id,
|
||||
selected: permission.selected
|
||||
selected: permission.selected,
|
||||
grouping: this.currentGrouping,
|
||||
globalIndex
|
||||
};
|
||||
|
||||
this.tempPermissionUIData[this.currentGrouping].permissions.push(temp);
|
||||
}
|
||||
this.allPermissions.push(temp);
|
||||
});
|
||||
}
|
||||
|
||||
showPermissions(grouping: string): void {
|
||||
@@ -164,6 +183,38 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The permissions currently rendered as checkboxes. While a search term is active this is a
|
||||
* global, cross-grouping match over `allPermissions`; otherwise it is the normal per-grouping
|
||||
* view. Either way each item still carries its original globalIndex, so the checkbox template
|
||||
* always resolves the same roster control regardless of which list produced it.
|
||||
*/
|
||||
get displayedPermissions(): Permission[] {
|
||||
if (!this.isSearchActive) {
|
||||
return this.permissions.permissions;
|
||||
}
|
||||
const term = this.searchTerm.trim().toLowerCase();
|
||||
return this.allPermissions.filter((permission) => this.matchesSearch(permission, term));
|
||||
}
|
||||
|
||||
get isSearchActive(): boolean {
|
||||
return this.searchTerm.trim().length > 0;
|
||||
}
|
||||
|
||||
onSearchTermChange(value: string): void {
|
||||
this.searchTerm = value;
|
||||
}
|
||||
|
||||
clearSearch(): void {
|
||||
this.searchTerm = '';
|
||||
}
|
||||
|
||||
private matchesSearch(permission: Permission, term: string): boolean {
|
||||
const readableName = permission.code.replace(/_/g, ' ').toLowerCase();
|
||||
const haystack = `${permission.code.toLowerCase()} ${readableName}`;
|
||||
return haystack.includes(term);
|
||||
}
|
||||
|
||||
permissionName = function (name: any) {
|
||||
name = name || '';
|
||||
// replace '_' with ' '
|
||||
|
||||
+100
-1
@@ -127,7 +127,106 @@
|
||||
<div class="empty-state">
|
||||
<i class="fas fa-clock empty-icon"></i>
|
||||
<p class="empty-title">No pending accounts</p>
|
||||
<p class="empty-text">There are no savings accounts awaiting approval at this time.</p>
|
||||
<p class="empty-text">There are no accounts awaiting approval at this time.</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Share accounts awaiting approval render here too, rather than on their own tab. Own table,
|
||||
own per-row approve/reject/view actions - unchanged from their previous standalone screen. -->
|
||||
<h3 class="pa-section-heading">Pending Share Accounts</h3>
|
||||
@if (showShareData) {
|
||||
<div class="psa-action-bar">
|
||||
<mat-form-field appearance="outline" class="psa-search-field">
|
||||
<mat-icon matPrefix>search</mat-icon>
|
||||
<input
|
||||
#shareFilterInput
|
||||
matInput
|
||||
placeholder="Search by account number, member or product"
|
||||
(keyup)="applyShareFilter(shareFilterInput.value)"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table mat-table [dataSource]="shareDataSource" class="modern-table">
|
||||
<ng-container matColumnDef="accountNo">
|
||||
<th mat-header-cell *matHeaderCellDef>Account No.</th>
|
||||
<td mat-cell *matCellDef="let account" class="psa-mono">{{ account.accountNo }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="clientName">
|
||||
<th mat-header-cell *matHeaderCellDef>Member</th>
|
||||
<td mat-cell *matCellDef="let account">
|
||||
{{ account.clientName }}
|
||||
@if (account.officeName) {
|
||||
<div class="psa-sub">{{ account.officeName }}</div>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="productName">
|
||||
<th mat-header-cell *matHeaderCellDef>Product</th>
|
||||
<td mat-cell *matCellDef="let account">{{ account.productName }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="requestedShares">
|
||||
<th mat-header-cell *matHeaderCellDef class="ta-right">Shares</th>
|
||||
<td mat-cell *matCellDef="let account" class="ta-right psa-num">{{ account.requestedShares }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="requestedAmount">
|
||||
<th mat-header-cell *matHeaderCellDef class="ta-right">Amount</th>
|
||||
<td mat-cell *matCellDef="let account" class="ta-right psa-num">
|
||||
{{ account.requestedAmount | number: '1.2-2' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="resolution">
|
||||
<th mat-header-cell *matHeaderCellDef>Resolution</th>
|
||||
<td mat-cell *matCellDef="let account">
|
||||
{{ account.resolutionNumber || '—' }}
|
||||
@if (account.resolutionDate) {
|
||||
<div class="psa-sub">{{ formatShareDate(account.resolutionDate) }}</div>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="submittedDate">
|
||||
<th mat-header-cell *matHeaderCellDef>Submitted</th>
|
||||
<td mat-cell *matCellDef="let account">
|
||||
{{ formatShareDate(account.submittedDate) }}
|
||||
@if (account.submittedByUsername) {
|
||||
<div class="psa-sub">by {{ account.submittedByUsername }}</div>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||
<td mat-cell *matCellDef="let account">
|
||||
<button mat-stroked-button class="psa-btn psa-btn-view" (click)="viewShareAccount(account)">
|
||||
<fa-icon icon="eye" class="m-r-10"></fa-icon>View
|
||||
</button>
|
||||
<button mat-stroked-button class="psa-btn psa-btn-approve" (click)="approveShareAccount(account)">
|
||||
<fa-icon icon="check" class="m-r-10"></fa-icon>Approve
|
||||
</button>
|
||||
<button mat-stroked-button class="psa-btn psa-btn-reject" (click)="rejectShareAccount(account)">
|
||||
<fa-icon icon="ban" class="m-r-10"></fa-icon>Reject
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="shareDisplayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: shareDisplayedColumns" class="table-row"></tr>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!showShareData) {
|
||||
<div class="empty-state">
|
||||
<fa-icon icon="hourglass-half" class="empty-icon"></fa-icon>
|
||||
<p class="empty-title">No pending share accounts</p>
|
||||
<p class="empty-text">There are no share accounts awaiting approval at this time.</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
+10
@@ -14,6 +14,16 @@ $text-muted: #64748b;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
/* Marks where the Share Account section begins below the normal-account table on this same screen. */
|
||||
.pa-section-heading {
|
||||
margin: 28px 0 12px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #0d1b2a;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid $border;
|
||||
}
|
||||
|
||||
.cv-action-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
+120
-3
@@ -29,17 +29,24 @@ import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
|
||||
import { TasksService } from '../../tasks.service';
|
||||
import { SharesService } from 'app/shares/shares.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-pending-account',
|
||||
templateUrl: './pending-account.component.html',
|
||||
styleUrls: ['./pending-account.component.scss'],
|
||||
styleUrls: [
|
||||
'./pending-account.component.scss',
|
||||
'../pending-share-accounts/pending-share-accounts.component.scss'
|
||||
],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
@@ -54,7 +61,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatIcon
|
||||
MatIcon,
|
||||
DecimalPipe
|
||||
]
|
||||
})
|
||||
export class PendingAccountComponent {
|
||||
@@ -64,6 +72,7 @@ export class PendingAccountComponent {
|
||||
private dateUtils = inject(Dates);
|
||||
private settingsService = inject(SettingsService);
|
||||
private tasksService = inject(TasksService);
|
||||
private sharesService = inject(SharesService);
|
||||
|
||||
dataSource: MatTableDataSource<any>;
|
||||
selection: SelectionModel<any>;
|
||||
@@ -81,8 +90,26 @@ export class PendingAccountComponent {
|
||||
'status'
|
||||
];
|
||||
|
||||
/** Share accounts awaiting approval - rendered as their own section on this same screen rather
|
||||
* than a separate tab. Kept out of `dataSource`/`selection` (bulk-select + date-picker approve)
|
||||
* since a share subscription is approved/rejected one at a time against today's business date,
|
||||
* exactly as it always was on its own page - only where it's shown has changed. */
|
||||
shareDataSource: MatTableDataSource<any>;
|
||||
showShareData = false;
|
||||
|
||||
shareDisplayedColumns: string[] = [
|
||||
'accountNo',
|
||||
'clientName',
|
||||
'productName',
|
||||
'requestedShares',
|
||||
'requestedAmount',
|
||||
'resolution',
|
||||
'submittedDate',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { pendingAccountsData: any }) => {
|
||||
this.route.data.subscribe((data: { pendingAccountsData: any; pendingShareAccountsData: any }) => {
|
||||
// status 100 = submitted and pending approval only; exclude terminated accounts
|
||||
const items = (data.pendingAccountsData?.pageItems || []).filter(
|
||||
(a: any) => a.status?.id === 100 && !a.terminateTrue
|
||||
@@ -90,6 +117,10 @@ export class PendingAccountComponent {
|
||||
this.showData = items.length > 0;
|
||||
this.dataSource = new MatTableDataSource(items);
|
||||
this.selection = new SelectionModel(true, []);
|
||||
|
||||
const shareItems = data.pendingShareAccountsData || [];
|
||||
this.showShareData = shareItems.length > 0;
|
||||
this.shareDataSource = new MatTableDataSource(shareItems);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -283,6 +314,92 @@ export class PendingAccountComponent {
|
||||
return date;
|
||||
}
|
||||
|
||||
applyShareFilter(filterValue: string = '') {
|
||||
this.shareDataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/** A date from the share account API rendered readably, whether it arrives as a string or as
|
||||
* Fineract's {@code [yyyy, m, d]} array. Kept separate from `formatDate()` above, which the
|
||||
* normal-account table already relies on with its own date-array handling. */
|
||||
formatShareDate(date: any): string {
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
const d = Array.isArray(date) ? new Date(date[0], date[1] - 1, date[2]) : new Date(date);
|
||||
return isNaN(d.getTime()) ? String(date) : d.toLocaleDateString('en-IN');
|
||||
}
|
||||
|
||||
/** Opens the share account itself, for a checker who wants more than the row shows. */
|
||||
viewShareAccount(account: any): void {
|
||||
this.router.navigate([
|
||||
'/clients',
|
||||
account.clientId,
|
||||
'shares-accounts',
|
||||
account.shareAccountId
|
||||
]);
|
||||
}
|
||||
|
||||
approveShareAccount(account: any): void {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Approve Share Account',
|
||||
dialogContext:
|
||||
`Approve share account "${account.accountNo}" for ${account.clientName} — ` +
|
||||
`${account.requestedShares} shares at ${account.requestedAmount}?`,
|
||||
type: 'basic'
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
// The approval date is the business date rather than the checker's choice, same as this
|
||||
// queue's original standalone screen: clearing a submission is a decision, not a backdated
|
||||
// transaction, so a date field per row would be extra clicks for no benefit.
|
||||
const data = {
|
||||
approvedDate: this.dateUtils.formatDate(this.settingsService.businessDate, this.settingsService.dateFormat),
|
||||
dateFormat: this.settingsService.dateFormat,
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
this.sharesService
|
||||
.executeSharesAccountCommand(account.shareAccountId, 'approve', data)
|
||||
.subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
rejectShareAccount(account: any): void {
|
||||
const formfields: FormfieldBase[] = [
|
||||
new InputBase({
|
||||
controlName: 'rejectReason',
|
||||
label: 'Reason for rejection',
|
||||
value: '',
|
||||
type: 'text',
|
||||
required: false
|
||||
})
|
||||
];
|
||||
const dialogRef = this.dialog.open(FormDialogComponent, {
|
||||
data: {
|
||||
title: `Reject Share Account ${account.accountNo}`,
|
||||
formfields
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.data) {
|
||||
const data: any = {
|
||||
rejectedDate: this.dateUtils.formatDate(this.settingsService.businessDate, this.settingsService.dateFormat),
|
||||
dateFormat: this.settingsService.dateFormat,
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
const reason = response.data.value?.rejectReason?.trim();
|
||||
if (reason) {
|
||||
data.note = reason;
|
||||
}
|
||||
this.sharesService
|
||||
.executeSharesAccountCommand(account.shareAccountId, 'reject', data)
|
||||
.subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
reload() {
|
||||
const url = this.router.url;
|
||||
this.router
|
||||
|
||||
+1
@@ -117,6 +117,7 @@
|
||||
[class.status-badge--current]="edit.accountType === 'Current'"
|
||||
[class.status-badge--fd]="edit.accountType === 'Fixed Deposit'"
|
||||
[class.status-badge--rd]="edit.accountType === 'Recurring Deposit'"
|
||||
[class.status-badge--share]="edit.accountType === 'Share'"
|
||||
>
|
||||
{{ edit.accountType }}
|
||||
</span>
|
||||
|
||||
+5
@@ -412,6 +412,11 @@ $text-muted: #64748b;
|
||||
background: #ecfdf5;
|
||||
color: #065f46;
|
||||
}
|
||||
|
||||
&--share {
|
||||
background: #eef2ff;
|
||||
color: #3730a3;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
|
||||
+96
-16
@@ -29,16 +29,20 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { CurrentAccountsService } from 'app/current-accounts/current-accounts.service';
|
||||
import { SharesService } from 'app/shares/shares.service';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { SavingsAccountEditCompareDialogComponent } from './savings-account-edit-compare-dialog/savings-account-edit-compare-dialog.component';
|
||||
import { ShareAccountEditCompareDialogComponent } from '../pending-share-account-edits/share-account-edit-compare-dialog/share-account-edit-compare-dialog.component';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
* Checker-facing list of savings account Nominee / Digital-Feature edits awaiting approval.
|
||||
* Mirrors PendingSavingsProductsComponent's list + compare + approve/reject pattern.
|
||||
* Checker-facing list of savings/current/share account Nominee, Digital-Feature and details edits
|
||||
* awaiting approval. Mirrors PendingSavingsProductsComponent's list + compare + approve/reject
|
||||
* pattern; Share Account edits are folded in here (rather than kept on their own tab) the same way
|
||||
* Current Account edits already are, via `accountType` as the discriminator.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-pending-savings-account-edits',
|
||||
@@ -67,6 +71,7 @@ export class PendingSavingsAccountEditsComponent {
|
||||
private dialog = inject(MatDialog);
|
||||
private savingsService = inject(SavingsService);
|
||||
private currentAccountsService = inject(CurrentAccountsService);
|
||||
private sharesService = inject(SharesService);
|
||||
|
||||
dataSource: MatTableDataSource<any>;
|
||||
showData = false;
|
||||
@@ -104,13 +109,23 @@ export class PendingSavingsAccountEditsComponent {
|
||||
|
||||
constructor() {
|
||||
this.maxDate = new Date();
|
||||
this.route.data.subscribe((data: { pendingSavingsAccountEditsData: any; pendingCurrentAccountEditsData: any }) => {
|
||||
this.allItems = this.mergeItems(data.pendingSavingsAccountEditsData, data.pendingCurrentAccountEditsData);
|
||||
this.applyFilters();
|
||||
});
|
||||
this.route.data.subscribe(
|
||||
(data: {
|
||||
pendingSavingsAccountEditsData: any;
|
||||
pendingCurrentAccountEditsData: any;
|
||||
pendingShareAccountEditsData: any;
|
||||
}) => {
|
||||
this.allItems = this.mergeItems(
|
||||
data.pendingSavingsAccountEditsData,
|
||||
data.pendingCurrentAccountEditsData,
|
||||
data.pendingShareAccountEditsData
|
||||
);
|
||||
this.applyFilters();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private mergeItems(savingsData: any, currentData: any): any[] {
|
||||
private mergeItems(savingsData: any, currentData: any, shareData?: any): any[] {
|
||||
const savingsItems = (savingsData || []).map((item: any) => {
|
||||
let type = 'Savings';
|
||||
if (item.depositAccountType === 'FIXED_DEPOSIT') {
|
||||
@@ -127,9 +142,14 @@ export class PendingSavingsAccountEditsComponent {
|
||||
...item,
|
||||
accountType: 'Current'
|
||||
}));
|
||||
const shareItems = (shareData || []).map((item: any) => ({
|
||||
...item,
|
||||
accountType: 'Share'
|
||||
}));
|
||||
return [
|
||||
...savingsItems,
|
||||
...currentItems
|
||||
...currentItems,
|
||||
...shareItems
|
||||
];
|
||||
}
|
||||
|
||||
@@ -211,10 +231,11 @@ export class PendingSavingsAccountEditsComponent {
|
||||
this.loading = true;
|
||||
forkJoin({
|
||||
savings: this.savingsService.getAllPendingSavingsAccountEdits(),
|
||||
current: this.currentAccountsService.getAllPendingCurrentAccountEdits()
|
||||
current: this.currentAccountsService.getAllPendingCurrentAccountEdits(),
|
||||
share: this.sharesService.getAllPendingShareAccountEdits()
|
||||
}).subscribe({
|
||||
next: ({ savings, current }) => {
|
||||
this.allItems = this.mergeItems(savings, current);
|
||||
next: ({ savings, current, share }) => {
|
||||
this.allItems = this.mergeItems(savings, current, share);
|
||||
this.applyFilters();
|
||||
this.loading = false;
|
||||
},
|
||||
@@ -234,13 +255,35 @@ export class PendingSavingsAccountEditsComponent {
|
||||
|
||||
/**
|
||||
* Fetches the account's current Digital & Account Feature config so the popup can show it next to
|
||||
* what's proposed, then opens the compare dialog. The maker's edit form already submits only the
|
||||
* toggles it actually changed (see EditSavingsAccountFeaturesComponent#buildFacilityDiff), so
|
||||
* proposedFacilityConfig only ever carries changed fields -- the dialog still diffs against this
|
||||
* current config defensively, so an unchanged value can never appear in the popup.
|
||||
* what's proposed, then opens the compare dialog. The maker's edit form (AccountNomineesTabComponent)
|
||||
* already submits only the fields it actually touched, so proposedFacilityConfig/proposedNominee only
|
||||
* ever carry changed keys -- the dialog still diffs facility values against this current config
|
||||
* defensively, so an unchanged value can never appear in the popup. `clientId`/`nomineeAccountType`
|
||||
* are also passed through so the dialog can look up the nominee's actual "before" state for an
|
||||
* UPDATE/DELETE (the pending-edit record itself only ever stores the proposed side).
|
||||
*/
|
||||
viewCompare(edit: any): void {
|
||||
this.loadingCompareFor = edit;
|
||||
if (edit.accountType === 'Share') {
|
||||
this.sharesService.getSharesAccountData(String(edit.shareAccountId), false).subscribe({
|
||||
next: (account: any) => {
|
||||
this.loadingCompareFor = null;
|
||||
this.dialog.open(ShareAccountEditCompareDialogComponent, {
|
||||
width: '640px',
|
||||
data: {
|
||||
accountNo: edit.accountNo,
|
||||
currentAccount: account,
|
||||
edit,
|
||||
rejectReason: edit.rejectReason
|
||||
}
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
this.loadingCompareFor = null;
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
const isCurrent = edit.accountType === 'Current';
|
||||
const account$ = isCurrent
|
||||
? this.currentAccountsService.getCurrentAccountAndTemplate(edit.currentAccountId, false)
|
||||
@@ -255,6 +298,8 @@ export class PendingSavingsAccountEditsComponent {
|
||||
currentFacilityConfig: account?.accountFacilityConfig ?? {},
|
||||
proposedFacilityConfig: edit.proposedFacilityConfig ?? {},
|
||||
proposedNominee: edit.proposedNominee ?? {},
|
||||
clientId: account?.clientId,
|
||||
nomineeAccountType: this.nomineeAccountTypeFor(edit.accountType),
|
||||
rejectReason: edit.rejectReason
|
||||
}
|
||||
});
|
||||
@@ -265,7 +310,38 @@ export class PendingSavingsAccountEditsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
/** `m_client_nominee.account_type` code for this row's deposit type - matches exactly what
|
||||
* AccountNomineesTabComponent/the write services use when a nominee is added, updated or deleted
|
||||
* against this account, so the compare dialog's live nominee lookup queries the same rows. */
|
||||
private nomineeAccountTypeFor(accountType: string): string {
|
||||
switch (accountType) {
|
||||
case 'Current':
|
||||
return 'CB';
|
||||
case 'Fixed Deposit':
|
||||
return 'FD';
|
||||
case 'Recurring Deposit':
|
||||
return 'RD';
|
||||
default:
|
||||
return 'SB';
|
||||
}
|
||||
}
|
||||
|
||||
approve(edit: any): void {
|
||||
if (edit.accountType === 'Share') {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Approve Share Account Edit',
|
||||
dialogContext: `Apply the pending details edit for account "${edit.accountNo}"? This cannot be undone.`,
|
||||
type: 'basic'
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
this.sharesService.approveShareAccountEdit(edit.shareAccountId).subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
const isCurrent = edit.accountType === 'Current';
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
@@ -286,7 +362,6 @@ export class PendingSavingsAccountEditsComponent {
|
||||
}
|
||||
|
||||
reject(edit: any): void {
|
||||
const isCurrent = edit.accountType === 'Current';
|
||||
const formfields: FormfieldBase[] = [
|
||||
new InputBase({
|
||||
controlName: 'rejectReason',
|
||||
@@ -306,6 +381,11 @@ export class PendingSavingsAccountEditsComponent {
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.data) {
|
||||
const rejectReason = response.data.value.rejectReason || '';
|
||||
if (edit.accountType === 'Share') {
|
||||
this.sharesService.rejectShareAccountEdit(edit.shareAccountId, rejectReason).subscribe(() => this.reload());
|
||||
return;
|
||||
}
|
||||
const isCurrent = edit.accountType === 'Current';
|
||||
if (isCurrent) {
|
||||
this.currentAccountsService
|
||||
.rejectCurrentAccountEdit(edit.currentAccountId, rejectReason)
|
||||
|
||||
+3
-1
@@ -49,6 +49,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Current</th>
|
||||
<th>Proposed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -56,7 +57,8 @@
|
||||
@for (row of nomineeRows; track row.label) {
|
||||
<tr>
|
||||
<td class="saecd-table__label">{{ row.label }}</td>
|
||||
<td class="saecd-table__new" colspan="2">{{ row.proposed }}</td>
|
||||
<td class="saecd-table__old">{{ row.current }}</td>
|
||||
<td class="saecd-table__new">{{ row.proposed }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
+103
-11
@@ -18,6 +18,7 @@ import {
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { ClientsService } from 'app/clients/clients.service';
|
||||
|
||||
interface DiffRow {
|
||||
label: string;
|
||||
@@ -60,10 +61,18 @@ const NOMINEE_LABELS: Record<string, string> = {
|
||||
|
||||
/**
|
||||
* Shows what a pending savings/current account Nominee & Digital-Feature edit actually changes, as a
|
||||
* popup instead of an inline panel. The maker's edit form already submits only the toggles that were
|
||||
* actually flipped (see EditSavingsAccountFeaturesComponent#buildFacilityDiff), so proposedFacilityConfig
|
||||
* only ever carries changed fields -- this still diffs against the account's current config defensively,
|
||||
* popup instead of an inline panel. The maker's edit form (AccountNomineesTabComponent for nominees;
|
||||
* the account's own Digital & Account Features screen for facility toggles) already submits only the
|
||||
* fields that were actually touched, so `proposedFacilityConfig`/`proposedNominee` only ever carry
|
||||
* changed keys -- this still diffs facility values against the account's current config defensively,
|
||||
* so an unchanged value can never appear here even if that ever stops being true upstream.
|
||||
*
|
||||
* The pending-edit record itself never stores what the nominee looked like *before* an UPDATE/DELETE
|
||||
* (only the proposed new state) -- `SavingsAccountPendingEditData`/`CurrentAccountPendingEditData` have
|
||||
* no such field. For those two operations this dialog fetches the account's nominees live (the same
|
||||
* `ClientsService.getClientNominees` call `AccountNomineesTabComponent` itself uses) and matches on
|
||||
* `nomineeId` to recover a real "before" value; an ADD has no "before" by definition and keeps showing
|
||||
* '—'. If the lookup fails or finds no match, the proposed-only view already rendered is left as is.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-savings-account-edit-compare-dialog',
|
||||
@@ -82,6 +91,7 @@ const NOMINEE_LABELS: Record<string, string> = {
|
||||
export class SavingsAccountEditCompareDialogComponent implements OnInit {
|
||||
dialogRef = inject<MatDialogRef<SavingsAccountEditCompareDialogComponent>>(MatDialogRef);
|
||||
data = inject(MAT_DIALOG_DATA);
|
||||
private clientsService = inject(ClientsService);
|
||||
|
||||
accountNo = '';
|
||||
facilityRows: DiffRow[] = [];
|
||||
@@ -103,14 +113,89 @@ export class SavingsAccountEditCompareDialogComponent implements OnInit {
|
||||
}))
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
|
||||
const proposedNominee = this.data.proposedNominee ?? {};
|
||||
this.nomineeRows = Object.keys(proposedNominee)
|
||||
.filter((key) => proposedNominee[key] !== null && proposedNominee[key] !== undefined)
|
||||
.map((key) => ({
|
||||
label: NOMINEE_LABELS[key] ?? this.humanizeKey(key),
|
||||
current: '—',
|
||||
proposed: this.displayValue(proposedNominee[key])
|
||||
}));
|
||||
this.buildNomineeRows(this.data.proposedNominee ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the nominee rows from the proposed side alone first (matches what was always shown), then
|
||||
* - for UPDATE/DELETE only - looks up the account's actual nominees to fill in a real "before" value
|
||||
* and re-filters to genuine changes. ADD has nothing to look up and keeps '—' on the current side.
|
||||
*/
|
||||
private buildNomineeRows(proposedNominee: Record<string, any>): void {
|
||||
this.nomineeRows = this.nomineeRowsFrom(proposedNominee, null);
|
||||
|
||||
const operation = proposedNominee.operation;
|
||||
const nomineeId = proposedNominee.nomineeId;
|
||||
const canLookUp =
|
||||
(operation === 'UPDATE' || operation === 'DELETE') &&
|
||||
nomineeId !== null &&
|
||||
nomineeId !== undefined &&
|
||||
this.data.clientId !== null &&
|
||||
this.data.clientId !== undefined &&
|
||||
!!this.data.nomineeAccountType;
|
||||
if (!canLookUp) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.clientsService
|
||||
.getClientNominees(String(this.data.clientId), this.accountNo, this.data.nomineeAccountType)
|
||||
.subscribe({
|
||||
next: (nominees: any[]) => {
|
||||
const before = (nominees || []).find((n: any) => n?.id === nomineeId);
|
||||
if (!before) {
|
||||
// No match found (e.g. already actioned elsewhere) - the proposed-only rows already
|
||||
// rendered stay as they are rather than showing a misleading blank lookup.
|
||||
return;
|
||||
}
|
||||
if (operation === 'DELETE') {
|
||||
this.nomineeRows = [
|
||||
{
|
||||
label: 'Nominee',
|
||||
current: this.displayValue(before.nomineeDisplayName),
|
||||
proposed: 'Removed'
|
||||
}
|
||||
];
|
||||
return;
|
||||
}
|
||||
this.nomineeRows = this.nomineeRowsFrom(proposedNominee, before);
|
||||
},
|
||||
// Lookup failed - the proposed-only rows already on screen stay as they are.
|
||||
error: () => undefined
|
||||
});
|
||||
}
|
||||
|
||||
/** A proposed-nominee key mapped to the matching field on the account's live `ClientNomineeData`,
|
||||
* preferring an already-resolved display name (`relationshipName`/`guardianRelationshipName`) over
|
||||
* the raw code-value id so the "before" side reads the same way `AccountNomineesTabComponent` does. */
|
||||
private beforeValueFor(before: Record<string, any> | null, key: string): any {
|
||||
if (!before) {
|
||||
return undefined;
|
||||
}
|
||||
if (key === 'relationshipId') {
|
||||
return before.relationshipName ?? before.relationshipId;
|
||||
}
|
||||
if (key === 'guardianRelationshipId') {
|
||||
return before.guardianRelationshipName ?? before.guardianRelationshipId;
|
||||
}
|
||||
return before[key];
|
||||
}
|
||||
|
||||
private nomineeRowsFrom(proposed: Record<string, any>, before: Record<string, any> | null): DiffRow[] {
|
||||
return Object.keys(proposed)
|
||||
.filter((key) => proposed[key] !== null && proposed[key] !== undefined)
|
||||
.map((key) => {
|
||||
// "Operation"/"Nominee Id" describe the request, not a value that was itself changed - always
|
||||
// shown, never filtered by the current-vs-proposed comparison below.
|
||||
const isMeta = key === 'operation' || key === 'nomineeId';
|
||||
return {
|
||||
label: NOMINEE_LABELS[key] ?? this.humanizeKey(key),
|
||||
current: isMeta ? '—' : this.displayValue(this.beforeValueFor(before, key)),
|
||||
proposed: this.displayValue(proposed[key]),
|
||||
isMeta
|
||||
};
|
||||
})
|
||||
.filter((row) => row.isMeta || row.current !== row.proposed)
|
||||
.map(({ label, current, proposed: proposedValue }) => ({ label, current, proposed: proposedValue }));
|
||||
}
|
||||
|
||||
private sameValue(a: any, b: any): boolean {
|
||||
@@ -130,6 +215,13 @@ export class SavingsAccountEditCompareDialogComponent implements OnInit {
|
||||
if (typeof value === 'boolean') {
|
||||
return value ? 'Yes' : 'No';
|
||||
}
|
||||
// effectiveDate (the one date field in this dialog, on both the current and proposed nominee
|
||||
// side) arrives as Fineract's [yyyy, M, d] array, not a string - read it the same way every other
|
||||
// date in this app is, so identical dates compare equal and different ones read as dates.
|
||||
if (Array.isArray(value) && value.length >= 3 && value.every((part) => typeof part === 'number')) {
|
||||
const d = new Date(value[0], value[1] - 1, value[2]);
|
||||
return isNaN(d.getTime()) ? String(value) : d.toLocaleDateString('en-IN');
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -48,7 +48,6 @@ const USER_FIELD_LABELS: Record<string, string> = {
|
||||
officeName: 'Office Name',
|
||||
staffId: 'Staff Member',
|
||||
roles: 'Assigned Roles',
|
||||
roleNames: 'Assigned Roles',
|
||||
otpDeliveryMethod: '2FA / OTP Channel',
|
||||
sendPasswordToEmail: 'Send Password To Email',
|
||||
passwordNeverExpires: 'Password Never Expires',
|
||||
|
||||
+2
-2
@@ -59,10 +59,10 @@
|
||||
<tr>
|
||||
<td class="col-field">{{ r.label }}</td>
|
||||
@if (data.requestType === 'UPDATE_USER') {
|
||||
<td class="col-curr">{{ r.current != null && r.current !== '' ? r.current : '—' }}</td>
|
||||
<td class="col-curr">{{ displayValue(r.current) }}</td>
|
||||
}
|
||||
<td class="col-prop" [class.highlight-change]="data.requestType === 'UPDATE_USER' && r.current !== r.value">
|
||||
{{ r.value != null && r.value !== '' ? r.value : '—' }}
|
||||
{{ displayValue(r.value) }}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
+4
@@ -17,6 +17,7 @@ import {
|
||||
} from '@angular/material/dialog';
|
||||
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { displayScalar } from 'app/tasks/command-diff.util';
|
||||
|
||||
export interface UserEditCompareRow {
|
||||
key: string;
|
||||
@@ -54,4 +55,7 @@ export interface UserEditCompareDialogData {
|
||||
export class UserEditCompareDialogComponent {
|
||||
dialogRef = inject<MatDialogRef<UserEditCompareDialogComponent>>(MatDialogRef);
|
||||
data = inject<UserEditCompareDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
/** Shared with the generic maker-checker diff screens so booleans/nulls render the same way everywhere. */
|
||||
displayValue = displayScalar;
|
||||
}
|
||||
|
||||
@@ -90,26 +90,6 @@
|
||||
<fa-icon icon="edit" class="ac-tab__ic"></fa-icon>
|
||||
<span>Pending Account Edits</span>
|
||||
</a>
|
||||
<!-- New share accounts awaiting approval. Next to Pending Share Account Edits, since the two are
|
||||
the share equivalents of Pending Account and Pending Account Edits. -->
|
||||
<a
|
||||
class="ac-tab"
|
||||
routerLink="./pending-share-accounts"
|
||||
routerLinkActive="ac-tab--active"
|
||||
*mifosxHasPermission="'ALL_FUNCTIONS_READ'"
|
||||
>
|
||||
<fa-icon icon="hourglass-half" class="ac-tab__ic"></fa-icon>
|
||||
<span>Pending Share Accounts</span>
|
||||
</a>
|
||||
<a
|
||||
class="ac-tab"
|
||||
routerLink="./pending-share-account-edits"
|
||||
routerLinkActive="ac-tab--active"
|
||||
*mifosxHasPermission="'ALL_FUNCTIONS_READ'"
|
||||
>
|
||||
<fa-icon icon="edit" class="ac-tab__ic"></fa-icon>
|
||||
<span>Pending Share Account Edits</span>
|
||||
</a>
|
||||
<a
|
||||
class="ac-tab"
|
||||
routerLink="./pending-client-edits"
|
||||
|
||||
@@ -16,6 +16,7 @@ import { RecurringDepositsService } from 'app/deposits/recurring-deposits/recurr
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
import { AccountingService } from 'app/accounting/accounting.service';
|
||||
import { UsersService } from 'app/users/users.service';
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/**
|
||||
* The services a maker-checker review screen needs in order to read an entity's current state.
|
||||
@@ -30,8 +31,17 @@ export interface EntityFetchServices {
|
||||
system: SystemService;
|
||||
accounting: AccountingService;
|
||||
users: UsersService;
|
||||
organization: OrganizationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entities with exactly one row in the whole tenant (a global settings screen, not a record with an
|
||||
* id) - Working Days being the first. These commands carry no resourceId at all, so the normal
|
||||
* "no id, no lookup" guard below is relaxed for exactly this set; every other entity's behavior is
|
||||
* unchanged.
|
||||
*/
|
||||
const SINGLETON_ENTITIES: ReadonlySet<string> = new Set(['WORKINGDAYS']);
|
||||
|
||||
/**
|
||||
* Maps a maker-checker `entityName` to the existing API that returns that entity as it stands today,
|
||||
* so an UPDATE can be shown as OLD -> NEW and a DELETE can show what is about to be removed.
|
||||
@@ -66,7 +76,11 @@ const ENTITY_FETCHERS: Record<string, (id: string, s: EntityFetchServices) => Ob
|
||||
CLIENT: (id, s) => s.clients.getClientData(id, true),
|
||||
ROLE: (id, s) => s.system.getRole(id),
|
||||
USER: (id, s) => s.users.getUser(id),
|
||||
GLACCOUNT: (id, s) => s.accounting.getGlAccount(id, true)
|
||||
GLACCOUNT: (id, s) => s.accounting.getGlAccount(id, true),
|
||||
|
||||
// ---- Singleton settings screens ----------------------------------------------
|
||||
// No resourceId - the command applies to the one Working Days row the tenant has.
|
||||
WORKINGDAYS: (id, s) => s.organization.getWorkingDays()
|
||||
};
|
||||
|
||||
/** Whether this screen can read the entity's current state, and therefore produce a real diff. */
|
||||
@@ -83,11 +97,16 @@ export function fetchCurrentEntity(
|
||||
resourceId: string | number | undefined | null,
|
||||
services: EntityFetchServices
|
||||
): Observable<any> | null {
|
||||
const fetcher = ENTITY_FETCHERS[(entityName ?? '').toUpperCase()];
|
||||
if (!fetcher || resourceId === null || resourceId === undefined || resourceId === '') {
|
||||
const key = (entityName ?? '').toUpperCase();
|
||||
const fetcher = ENTITY_FETCHERS[key];
|
||||
if (!fetcher) {
|
||||
return null;
|
||||
}
|
||||
return fetcher(String(resourceId), services);
|
||||
const hasResourceId = resourceId !== null && resourceId !== undefined && resourceId !== '';
|
||||
if (!hasResourceId && !SINGLETON_ENTITIES.has(key)) {
|
||||
return null;
|
||||
}
|
||||
return fetcher(String(resourceId ?? ''), services);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,10 @@ const routes: Routes = [
|
||||
component: PendingAccountComponent,
|
||||
data: { title: 'Pending Account' },
|
||||
resolve: {
|
||||
pendingAccountsData: GetPendingAccounts
|
||||
pendingAccountsData: GetPendingAccounts,
|
||||
// Share accounts awaiting approval now render inside this same screen instead of their
|
||||
// own tab - reuses the same resolver the standalone route below still uses.
|
||||
pendingShareAccountsData: GetPendingShareAccounts
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -147,7 +150,10 @@ const routes: Routes = [
|
||||
data: { title: 'Pending Account Edits' },
|
||||
resolve: {
|
||||
pendingSavingsAccountEditsData: GetPendingSavingsAccountEdits,
|
||||
pendingCurrentAccountEditsData: GetPendingCurrentAccountEdits
|
||||
pendingCurrentAccountEditsData: GetPendingCurrentAccountEdits,
|
||||
// Share account edits awaiting approval now render inside this same screen instead of
|
||||
// their own tab - reuses the same resolver the standalone route below still uses.
|
||||
pendingShareAccountEditsData: GetPendingShareAccountEdits
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ import { AccountingService } from 'app/accounting/accounting.service';
|
||||
import { UsersService } from 'app/users/users.service';
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
import { RecurringDepositsService } from 'app/deposits/recurring-deposits/recurring-deposits.service';
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/**
|
||||
* One row of the rendered Command payload. The dialog turns the parsed command JSON into a tree of
|
||||
@@ -148,6 +149,7 @@ export class ViewCheckerInboxComponent {
|
||||
private usersService = inject(UsersService);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private recurringDepositsService = inject(RecurringDepositsService);
|
||||
private organizationService = inject(OrganizationService);
|
||||
|
||||
/** Bundle handed to the shared entity lookup, so that table stays free of Angular injection. */
|
||||
private get entityFetchServices(): EntityFetchServices {
|
||||
@@ -159,7 +161,8 @@ export class ViewCheckerInboxComponent {
|
||||
accounting: this.accountingService,
|
||||
users: this.usersService,
|
||||
fixedDeposits: this.fixedDepositsService,
|
||||
recurringDeposits: this.recurringDepositsService
|
||||
recurringDeposits: this.recurringDepositsService,
|
||||
organization: this.organizationService
|
||||
};
|
||||
}
|
||||
/** Present only when opened as a popup from the Checker Inbox list; absent when reached by direct
|
||||
@@ -375,6 +378,9 @@ export class ViewCheckerInboxComponent {
|
||||
this.loadDeleteSummary(detail);
|
||||
} else if (action === 'CREATE') {
|
||||
this.createSections = this.buildCreateSections(this.jsondata);
|
||||
if ((detail?.entityName ?? '').toUpperCase() === 'GLACCOUNT') {
|
||||
this.resolveGlAccountCreateLabels(detail, this.jsondata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,6 +467,91 @@ export class ViewCheckerInboxComponent {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* GL Account CREATE: `type`, `usage`, `parentId` and `tagId` arrive as raw numeric ids - meaningless
|
||||
* to a checker without the chart-of-accounts template, which is the same lookup data the create-GL
|
||||
* form itself already uses (`create-gl-account.component.ts`). Fetched once, purely for display: the
|
||||
* stored command payload (`jsondata`) and the already-rendered raw sections are left as they are
|
||||
* unless the lookup succeeds, so a slow or failed template call never blocks or breaks this screen.
|
||||
*/
|
||||
private resolveGlAccountCreateLabels(detail: any, payload: Record<string, any>): void {
|
||||
this.accountingService.getChartOfAccountsTemplate().subscribe({
|
||||
next: (template: any) => {
|
||||
// A slow response for a request the checker has already navigated away from must not overwrite
|
||||
// whatever is now on screen.
|
||||
if (!this.isCurrent(detail)) {
|
||||
return;
|
||||
}
|
||||
const resolved = { ...payload };
|
||||
const typeId = payload.type;
|
||||
|
||||
const typeOption = (template?.accountTypeOptions ?? []).find((option: any) => option.id === typeId);
|
||||
if (typeOption) {
|
||||
resolved.type = this.translateService.instant(`labels.inputs.accounting.${typeOption.value}`);
|
||||
}
|
||||
|
||||
const usageOption = (template?.usageOptions ?? []).find((option: any) => option.id === payload.usage);
|
||||
if (usageOption) {
|
||||
resolved.usage = usageOption.value;
|
||||
}
|
||||
|
||||
const parentAccount = this.glHeaderAccountOptions(template, typeId).find(
|
||||
(account: any) => account.id === payload.parentId
|
||||
);
|
||||
if (parentAccount) {
|
||||
resolved.parentId = parentAccount.glCode
|
||||
? `${parentAccount.name} (${parentAccount.glCode})`
|
||||
: parentAccount.name;
|
||||
}
|
||||
|
||||
const tagOption = this.glTagOptions(template, typeId).find((tag: any) => tag.id === payload.tagId);
|
||||
if (tagOption) {
|
||||
resolved.tagId = tagOption.name;
|
||||
}
|
||||
|
||||
this.createSections = this.buildCreateSections(resolved);
|
||||
},
|
||||
// Lookup failed - the raw ids already on screen from buildCreateSections() above stay as they are.
|
||||
error: () => undefined
|
||||
});
|
||||
}
|
||||
|
||||
/** Header/parent account options are partitioned by GL account type, same as the create-GL form. */
|
||||
private glHeaderAccountOptions(template: any, typeId: number): any[] {
|
||||
switch (typeId) {
|
||||
case 1:
|
||||
return template?.assetHeaderAccountOptions ?? [];
|
||||
case 2:
|
||||
return template?.liabilityHeaderAccountOptions ?? [];
|
||||
case 3:
|
||||
return template?.equityHeaderAccountOptions ?? [];
|
||||
case 4:
|
||||
return template?.incomeHeaderAccountOptions ?? [];
|
||||
case 5:
|
||||
return template?.expenseHeaderAccountOptions ?? [];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/** Allowed tag options are partitioned by GL account type, same as the create-GL form. */
|
||||
private glTagOptions(template: any, typeId: number): any[] {
|
||||
switch (typeId) {
|
||||
case 1:
|
||||
return template?.allowedAssetsTagOptions ?? [];
|
||||
case 2:
|
||||
return template?.allowedLiabilitiesTagOptions ?? [];
|
||||
case 3:
|
||||
return template?.allowedEquityTagOptions ?? [];
|
||||
case 4:
|
||||
return template?.allowedIncomeTagOptions ?? [];
|
||||
case 5:
|
||||
return template?.allowedExpensesTagOptions ?? [];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A role permission update posts the role's *entire* permission map - over 1,100 entries, of which
|
||||
* a handful are actually being changed. Rendering that as-is buries the change completely, so this
|
||||
|
||||
Reference in New Issue
Block a user