Skip to content

Commit f3478d9

Browse files
fix: add null-guards to dialog close callbacks and refactor annual fee charges by chargeTimeType ID
Also: update shares account view component (squashed changes from two commits)
1 parent ad493a1 commit f3478d9

6 files changed

Lines changed: 45 additions & 6 deletions

File tree

src/app/clients/clients-view/clients-view.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ export class ClientsViewComponent implements OnInit {
276276
data: { deleteContext: `client with id: ${this.clientViewData.id}` }
277277
});
278278
deleteClientDialogRef.afterClosed().subscribe((response: any) => {
279+
if (!response) {
280+
return;
281+
}
279282
if (response.delete) {
280283
this.clientsService.deleteClient(this.clientViewData.id).subscribe(() => {
281284
this.router.navigate(['/clients'], { relativeTo: this.route });
@@ -290,6 +293,9 @@ export class ClientsViewComponent implements OnInit {
290293
private unassignStaff() {
291294
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
292295
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
296+
if (!response) {
297+
return;
298+
}
293299
if (response.confirm) {
294300
this.clientsService
295301
.executeClientCommand(this.clientViewData.id, 'unassignStaff', { staffId: this.clientViewData.staffId })
@@ -312,6 +318,9 @@ export class ClientsViewComponent implements OnInit {
312318
}
313319
});
314320
viewSignatureDialogRef.afterClosed().subscribe((response: any) => {
321+
if (!response) {
322+
return;
323+
}
315324
if (response.upload) {
316325
this.uploadSignature();
317326
} else if (response.draw) {
@@ -360,6 +369,9 @@ export class ClientsViewComponent implements OnInit {
360369
data: documents
361370
});
362371
deleteSignatureDialogRef.afterClosed().subscribe((response: any) => {
372+
if (!response) {
373+
return;
374+
}
363375
if (response.delete) {
364376
this.clientsService.deleteClientDocument(this.clientViewData.id, response.id).subscribe(() => {
365377
this.reload();

src/app/deposits/recurring-deposits/recurring-deposits-account-view/recurring-deposits-account-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
139139

140140
if (this.recurringDepositsAccountData.charges && this.recurringDepositsAccountData.status.value === 'Matured') {
141141
this.charges.forEach((element: any) => {
142-
if (element.name === 'Annual fee - INR') {
142+
if (element.chargeTimeType?.id === 7) {
143143
this.buttonConfig.addOption({
144144
name: 'Apply Annual Fees',
145145
taskPermissionName: 'APPLYANNUALFEE_SAVINGSACCOUNT'
@@ -157,7 +157,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
157157
}
158158
if (this.recurringDepositsAccountData.charges) {
159159
this.charges.forEach((element: any) => {
160-
if (element.name === 'Annual fee - INR') {
160+
if (element.chargeTimeType?.id === 7) {
161161
this.buttonConfig.addOption({
162162
name: 'Apply Annual Fees',
163163
taskPermissionName: 'APPLYANNUALFEE_SAVINGSACCOUNT'

src/app/loans/loans-view/loans-view.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ export class LoansViewComponent extends LoanProductBaseComponent implements OnIn
469469
}
470470
});
471471
recoverFromGuarantorDialogRef.afterClosed().subscribe((response: any) => {
472+
if (!response) {
473+
return;
474+
}
472475
if (response.confirm) {
473476
this.loansService.loanActionButtons(this.loanId, 'recoverGuarantees').subscribe(() => {
474477
this.reload();
@@ -500,6 +503,9 @@ export class LoansViewComponent extends LoanProductBaseComponent implements OnIn
500503
}
501504
});
502505
undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => {
506+
if (!response) {
507+
return;
508+
}
503509
if (response.confirm) {
504510
let undoCommand: string = '';
505511
switch (actionName) {
@@ -564,6 +570,9 @@ export class LoansViewComponent extends LoanProductBaseComponent implements OnIn
564570
data: { deleteContext: `with loan id: ${this.loanId}` }
565571
});
566572
deleteGuarantorDialogRef.afterClosed().subscribe((response: any) => {
573+
if (!response) {
574+
return;
575+
}
567576
if (response.delete) {
568577
this.loansService.deleteLoanAccount(this.loanId).subscribe(() => {
569578
this.router.navigate(['../../'], { relativeTo: this.route });

src/app/savings/saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
9292
applyCharge() {
9393
const charges: any[] = this.savingsAccountData.charges;
9494
charges.forEach((charge: any) => {
95-
if (charge.name === 'Annual fee - INR') {
95+
if (charge.chargeTimeType?.id === 7) {
9696
this.chargeId = charge.id;
9797
this.applyAnnualFeesForm.get('amount').patchValue(charge.amount);
9898
}

src/app/savings/savings-account-view/savings-account-view.component.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class SavingsAccountViewComponent implements OnInit {
156156
if (this.savingsAccountData.charges) {
157157
const charges: any[] = this.savingsAccountData.charges;
158158
charges.forEach((charge: any) => {
159-
if (charge.name === 'Annual fee - INR') {
159+
if (charge.chargeTimeType?.id === 7) {
160160
this.buttonConfig.addOption({
161161
name: 'Apply Annual Fees',
162162
taskPermissionName: 'APPLYANNUALFEE_SAVINGSACCOUNT'
@@ -281,6 +281,9 @@ export class SavingsAccountViewComponent implements OnInit {
281281
data: { deleteContext: `savings account with id: ${this.savingsAccountData.id}` }
282282
});
283283
deleteSavingsAccountDialogRef.afterClosed().subscribe((response: any) => {
284+
if (!response) {
285+
return;
286+
}
284287
if (response.delete) {
285288
this.savingsService.deleteSavingsAccount(this.savingsAccountData.id).subscribe(() => {
286289
this.router.navigate(['../../'], { relativeTo: this.route });
@@ -295,6 +298,9 @@ export class SavingsAccountViewComponent implements OnInit {
295298
private calculateInterest() {
296299
const calculateInterestAccountDialogRef = this.dialog.open(CalculateInterestDialogComponent);
297300
calculateInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
301+
if (!response) {
302+
return;
303+
}
298304
if (response.confirm) {
299305
this.savingsService
300306
.executeSavingsAccountCommand(this.savingsAccountData.id, 'calculateInterest', {})
@@ -311,6 +317,9 @@ export class SavingsAccountViewComponent implements OnInit {
311317
private postInterest() {
312318
const postInterestAccountDialogRef = this.dialog.open(PostInterestDialogComponent);
313319
postInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
320+
if (!response) {
321+
return;
322+
}
314323
if (response.confirm) {
315324
this.savingsService
316325
.executeSavingsAccountCommand(this.savingsAccountData.id, 'postInterest', {})
@@ -329,6 +338,9 @@ export class SavingsAccountViewComponent implements OnInit {
329338
data: { isEnable: true }
330339
});
331340
deleteSavingsAccountDialogRef.afterClosed().subscribe((response: any) => {
341+
if (!response) {
342+
return;
343+
}
332344
if (response.confirm) {
333345
this.savingsService
334346
.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: true })
@@ -347,6 +359,9 @@ export class SavingsAccountViewComponent implements OnInit {
347359
data: { isEnable: false }
348360
});
349361
disableWithHoldTaxDialogRef.afterClosed().subscribe((response: any) => {
362+
if (!response) {
363+
return;
364+
}
350365
if (response.confirm) {
351366
this.savingsService
352367
.executeSavingsAccountUpdateCommand(this.savingsAccountData.id, 'updateWithHoldTax', { withHoldTax: false })
@@ -378,6 +393,9 @@ export class SavingsAccountViewComponent implements OnInit {
378393
command = 'unblockDebit';
379394
}
380395
unblockSavingsAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
396+
if (!response) {
397+
return;
398+
}
381399
if (response.confirm) {
382400
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, command, {}).subscribe(() => {
383401
this.reload();

src/app/shares/shares-account-view/shares-account-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ export class SharesAccountViewComponent implements OnInit {
118118
if (this.sharesAccountData.charges) {
119119
const charges: any[] = this.sharesAccountData.charges;
120120
charges.forEach((charge: any) => {
121-
if (charge.name === 'Annual fee - INR') {
121+
if (charge.chargeTimeType?.id === 7) {
122122
this.buttonConfig.addOption({
123-
name: 'Apply Anuual Fees',
123+
name: 'Apply Annual Fees',
124124
taskPermissionName: 'APPLYANNUALFEE_SAVINGSACCOUNT'
125125
});
126126
}

0 commit comments

Comments
 (0)