DDS: approvals tab, vouchers, payout & close, Sundry GL search, closure tab, fixes
This commit is contained in:
@@ -15,6 +15,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { announceHeldForApproval, heldForApproval } from 'app/deposits/dds-approvals/dds-approval-notice';
|
||||
|
||||
/**
|
||||
* Commission Slab Master component.
|
||||
@@ -144,9 +145,9 @@ export class CommissionSlabMasterComponent implements OnInit {
|
||||
private clashingSlab(candidate: { slabType: string; slabFrom: number; slabTo: number }): any {
|
||||
return this.slabs.find(
|
||||
(slab) =>
|
||||
slab.slabType === candidate.slabType
|
||||
&& Number(candidate.slabFrom) <= Number(slab.slabTo)
|
||||
&& Number(candidate.slabTo) >= Number(slab.slabFrom)
|
||||
slab.slabType === candidate.slabType &&
|
||||
Number(candidate.slabFrom) <= Number(slab.slabTo) &&
|
||||
Number(candidate.slabTo) >= Number(slab.slabFrom)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -257,8 +258,12 @@ export class CommissionSlabMasterComponent implements OnInit {
|
||||
locale: 'en'
|
||||
})
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.alertService.alert({ type: 'Success', message: 'Slab corrected' });
|
||||
next: (response: any) => {
|
||||
if (heldForApproval(response)) {
|
||||
announceHeldForApproval(response, 'The slab correction', this.organizationService, this.alertService);
|
||||
} else {
|
||||
this.alertService.alert({ type: 'Success', message: 'Slab corrected' });
|
||||
}
|
||||
this.editingIndex = -1;
|
||||
this.loadSlabs();
|
||||
},
|
||||
@@ -268,7 +273,9 @@ export class CommissionSlabMasterComponent implements OnInit {
|
||||
this.alertService.alert({
|
||||
type: 'Error',
|
||||
message:
|
||||
error?.error?.errors?.[0]?.defaultUserMessage || error?.error?.defaultUserMessage || 'Could not correct the slab'
|
||||
error?.error?.errors?.[0]?.defaultUserMessage ||
|
||||
error?.error?.defaultUserMessage ||
|
||||
'Could not correct the slab'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -298,11 +305,20 @@ export class CommissionSlabMasterComponent implements OnInit {
|
||||
}));
|
||||
|
||||
this.organizationService.createCommissionSlabs(payload).subscribe({
|
||||
next: () => {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: `${newSlabs.length} ${newSlabs.length === 1 ? 'slab' : 'slabs'} saved`
|
||||
});
|
||||
next: (response: any) => {
|
||||
if (heldForApproval(response)) {
|
||||
announceHeldForApproval(
|
||||
response,
|
||||
`${newSlabs.length} ${newSlabs.length === 1 ? 'slab' : 'slabs'}`,
|
||||
this.organizationService,
|
||||
this.alertService
|
||||
);
|
||||
} else {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: `${newSlabs.length} ${newSlabs.length === 1 ? 'slab' : 'slabs'} saved`
|
||||
});
|
||||
}
|
||||
this.loadSlabs();
|
||||
},
|
||||
// The backend refuses an overlapping range; the officer needs to read why, not watch nothing
|
||||
@@ -311,7 +327,9 @@ export class CommissionSlabMasterComponent implements OnInit {
|
||||
this.alertService.alert({
|
||||
type: 'Error',
|
||||
message:
|
||||
error?.error?.errors?.[0]?.defaultUserMessage || error?.error?.defaultUserMessage || 'Could not save the slabs'
|
||||
error?.error?.errors?.[0]?.defaultUserMessage ||
|
||||
error?.error?.defaultUserMessage ||
|
||||
'Could not save the slabs'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user