From 76bdff35dcfbc65fff2af2125248a865e1cb3369 Mon Sep 17 00:00:00 2001 From: Jose Alberto Hernandez Date: Mon, 11 Dec 2023 20:07:34 -0600 Subject: [PATCH] Fixed Deposit account request fixes --- ...reate-fixed-deposit-account.component.html | 16 ++-------- .../create-fixed-deposit-account.component.ts | 10 ------- .../edit-fixed-deposit-account.component.html | 14 +-------- .../edit-fixed-deposit-account.component.ts | 6 +++- ...eposit-account-charges-step.component.html | 2 +- ...-deposit-account-charges-step.component.ts | 29 +++++++++++-------- ...eposit-account-details-step.component.html | 9 ++++-- ...-deposit-account-details-step.component.ts | 10 +++++-- ...eposit-account-preview-step.component.html | 5 ++++ ...posit-account-settings-step.component.html | 2 +- ...-deposit-account-terms-step.component.html | 4 +-- ...ed-deposit-account-terms-step.component.ts | 13 ++++++++- .../general-tab/general-tab.component.html | 9 ++++++ src/app/shared/models/general.model.ts | 8 ++--- src/app/tasks/tasks.service.ts | 2 +- 15 files changed, 75 insertions(+), 64 deletions(-) diff --git a/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.html b/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.html index 54045ca41..bac9b3511 100644 --- a/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.html +++ b/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.html @@ -1,7 +1,7 @@
- + @@ -33,17 +33,6 @@ - - - {{"labels.inputs.CURRENCY" | translate }} - - - - - - {{"labels.inputs.TERMS" | translate }} @@ -84,8 +73,7 @@ + [fixedDepositAccountFormValid]="fixedDepositAccountFormValid"> diff --git a/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.ts b/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.ts index 9d3b465c6..2173a92ea 100644 --- a/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.ts +++ b/src/app/deposits/fixed-deposits/create-fixed-deposit-account/create-fixed-deposit-account.component.ts @@ -8,7 +8,6 @@ import { SettingsService } from 'app/settings/settings.service'; /** Custom Components */ import { FixedDepositAccountDetailsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component'; -import { FixedDepositAccountCurrencyStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-currency-step/fixed-deposit-account-currency-step.component'; import { FixedDepositAccountTermsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component'; import { FixedDepositAccountSettingsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component'; import { FixedDepositAccountChargesStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component'; @@ -26,8 +25,6 @@ export class CreateFixedDepositAccountComponent { /** Fixed Deposits Account Details Step */ @ViewChild(FixedDepositAccountDetailsStepComponent, { static: true }) fixedDepositsAccountDetailsStep: FixedDepositAccountDetailsStepComponent; - /** Fixed Deposits Account Currency Step */ - @ViewChild(FixedDepositAccountCurrencyStepComponent, { static: true }) fixedDepositAccountCurrencyStep: FixedDepositAccountCurrencyStepComponent; /** Fixed Deposits Account Terms Step */ @ViewChild(FixedDepositAccountTermsStepComponent, { static: true }) fixedDepositAccountTermsStep: FixedDepositAccountTermsStepComponent; /** Fixed Deposits Account Settings Step */ @@ -73,13 +70,6 @@ export class CreateFixedDepositAccountComponent { return this.fixedDepositsAccountDetailsStep.fixedDepositAccountDetailsForm; } - /** - * Retrieves Fixed Deposit Account Currency Form Data - */ - get fixedDepositAccountCurrencyForm() { - return this.fixedDepositAccountCurrencyStep.fixedDepositAccountCurrencyForm; - } - /** * Retrieves Fixed Deposit Account Terms Form Data */ diff --git a/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.html b/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.html index f962550b5..28fa211e0 100644 --- a/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.html +++ b/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.html @@ -33,17 +33,6 @@ - - - {{"labels.inputs.CURRENCY" | translate }} - - - - - - {{"labels.inputs.TERMS" | translate }} @@ -84,8 +73,7 @@ + [fixedDepositAccountFormValid]="fixedDepositAccountFormValidAndNotPristine"> diff --git a/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.ts b/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.ts index 5059e652b..32e9a3cfc 100644 --- a/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.ts +++ b/src/app/deposits/fixed-deposits/edit-fixed-deposit-account/edit-fixed-deposit-account.component.ts @@ -13,6 +13,7 @@ import { FixedDepositAccountTermsStepComponent } from '../fixed-deposit-account- import { FixedDepositAccountSettingsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component'; import { FixedDepositAccountChargesStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component'; import { Dates } from 'app/core/utils/dates'; +import { Currency } from 'app/shared/models/general.model'; /** * Edit Fixed Deposit Account Component @@ -40,6 +41,8 @@ export class EditFixedDepositAccountComponent { /** Fixed Deposit Account Product Template */ fixedDepositsAccountProductTemplate: any; + currency: Currency; + /** * Fetches FD account template from `resolve` * @param {ActivatedRoute} route Activated Route @@ -64,6 +67,7 @@ export class EditFixedDepositAccountComponent { */ setTemplate($event: any) { this.fixedDepositsAccountProductTemplate = $event; + this.currency = this.fixedDepositsAccountAndTemplate.currency; } /** @@ -119,7 +123,7 @@ export class EditFixedDepositAccountComponent { ...this.fixedDepositsAccountDetailsStep.fixedDepositAccountDetails, ...this.fixedDepositAccountTermsStep.fixedDepositAccountTerms, ...this.fixedDepositAccountSettingsStep.fixedDepositAccountSettings, - ...this.fixedDepositAccountChargesStep.fixedDepositAccountCharges, + ...this.fixedDepositAccountChargesStep?.fixedDepositAccountCharges }; } diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.html index 6f6269286..504646464 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.html @@ -3,7 +3,7 @@ {{"labels.inputs.Charge" | translate }} - {{ charge.name }} diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.ts b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.ts index 1c943d22b..4f3e8ee72 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.ts +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component.ts @@ -12,6 +12,7 @@ import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicke import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; import { Dates } from 'app/core/utils/dates'; +import { Charge, Currency } from 'app/shared/models/general.model'; /** * Fixed Deposit Account Charges Step @@ -30,7 +31,7 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange /** Validity of fixed depsits account form */ @Input() fixedDepositAccountFormValid: boolean; /** Currency Code */ - @Input() currencyCode: UntypedFormControl; + currency: Currency | null = null; /** Charges Data */ chargeData: any; @@ -53,21 +54,25 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange private settingsService: SettingsService) { } ngOnInit() { - this.currencyCode.valueChanges.subscribe(() => { - if (!this.isChargesPatched && this.fixedDepositsAccountTemplate.charges) { - this.chargesDataSource = this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || []; - this.isChargesPatched = true; - } else { - this.chargesDataSource = []; - } - }); + this.chargesDataSource = []; + if (this.fixedDepositsAccountTemplate.id && this.fixedDepositsAccountTemplate.charges) { + this.chargesDataSource = this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || []; + } } ngOnChanges() { - if (this.fixedDepositsAccountProductTemplate) { - this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions; + if (this.currency == null) { + if (this.fixedDepositsAccountTemplate.currency) { + this.currency = this.fixedDepositsAccountTemplate.currency; + } else if (this.fixedDepositsAccountProductTemplate && this.fixedDepositsAccountProductTemplate.currency) { + this.currency = this.fixedDepositsAccountProductTemplate.currency; + } } - } + if (this.fixedDepositsAccountProductTemplate) { + this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions + .filter((c: Charge) => c.currency.code === this.currency.code); + } + } /** * Add a charge diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.html index 37e229fb9..6ffe77013 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.html @@ -14,7 +14,7 @@ - + {{"labels.inputs.Submitted On" | translate }} @@ -25,7 +25,7 @@ - + {{"labels.inputs.Field Officer" | translate }} @@ -34,6 +34,11 @@ + + {{"labels.inputs.External id" | translate}} + + +
diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.ts b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.ts index 6f08a03a6..99f48361f 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.ts +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component.ts @@ -32,6 +32,8 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit { /** Fixed Deposits Account Details Form */ fixedDepositAccountDetailsForm: UntypedFormGroup; + isProductSelected = false; + /** Fixed Deposits Account Template with product data */ @Output() fixedDepositsAccountProductTemplate = new EventEmitter(); @@ -55,7 +57,9 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit { if (this.fixedDepositsAccountTemplate.depositProductId) { this.fixedDepositAccountDetailsForm.patchValue({ 'productId': this.fixedDepositsAccountTemplate.depositProductId, - 'submittedOnDate': this.fixedDepositsAccountTemplate.timeline.submittedOnDate && new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate) + 'submittedOnDate': this.fixedDepositsAccountTemplate.timeline.submittedOnDate + && new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate), + 'externalId': this.fixedDepositsAccountTemplate.externalId || '', }); } } @@ -68,7 +72,8 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit { this.fixedDepositAccountDetailsForm = this.formBuilder.group({ 'productId': ['', Validators.required], 'submittedOnDate': ['', Validators.required], - 'fieldOfficerId': [''] + 'fieldOfficerId': [''], + 'externalId': [''] }); } @@ -80,6 +85,7 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit { this.fixedDepositAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => { this.fixedDepositsService.getFixedDepositsAccountTemplate(clientId, productId).subscribe((response: any) => { this.fixedDepositsAccountProductTemplate.emit(response); + this.isProductSelected = true; this.fieldOfficerData = response.fieldOfficerOptions; if (!this.isFieldOfficerPatched && this.fixedDepositsAccountTemplate.fieldOfficerId) { this.fixedDepositAccountDetailsForm.get('fieldOfficerId').patchValue(this.fixedDepositsAccountTemplate.fieldOfficerId); diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component.html index 0411a3974..518ce4a77 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component.html @@ -14,6 +14,11 @@ {{ fixedDepositAccountData.submittedOnDate | dateFormat }}
+
+ {{"labels.inputs.External Id" | translate }} + {{ fixedDepositAccountData.externalId }} +
+
{{"labels.inputs.Field Officer" | translate }} {{ (fixedDepositAccountData.fieldOfficerId | find:fixedDepositsAccountProductTemplate.fieldOfficerOptions:'id':'displayName') || 'Unassigned' }} diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.html index 523f79001..a6c60113f 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component.html @@ -82,7 +82,7 @@ - {{"labels.inputs.Link Savings Account" | translate }} + {{"labels.inputs.Linked Savings Account" | translate }} {{ account.accountNo }} diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.html index 93f9ca407..5cca7ce79 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.html @@ -13,10 +13,10 @@ - {{"labels.inputs.Deposit Period Frequency" | translate }} + {{"labels.inputs.Deposit Period" | translate }} - {{"labels.inputs.Deposit Period Frequency" | translate }} {{ "labels.commons.is" |translate}} {{ "labels.commons.required" | translate}} + {{"labels.inputs.Deposit Period" | translate }} {{ "labels.commons.is" |translate}} {{ "labels.commons.required" | translate}} diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.ts b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.ts index 93c0bb693..932aefdc3 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.ts +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component.ts @@ -52,7 +52,7 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges ngOnInit() { this.maxDate = this.settingsService.businessDate; - if (this.fixedDepositsAccountTemplate.interestCompoundingPeriodType) { + if (this.fixedDepositsAccountTemplate.id) { this.fixedDepositAccountTermsForm.patchValue({ 'interestCompoundingPeriodType': this.fixedDepositsAccountTemplate.interestCompoundingPeriodType.id, 'interestPostingPeriodType': this.fixedDepositsAccountTemplate.interestPostingPeriodType.id, @@ -89,6 +89,17 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges this.interestCalculationTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationTypeOptions; this.interestCalculationDaysInYearTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions; this.periodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.periodFrequencyTypeOptions; + if (!this.fixedDepositsAccountTemplate.id) { + this.fixedDepositAccountTermsForm.patchValue({ + 'interestCompoundingPeriodType': this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodType.id, + 'interestPostingPeriodType': this.fixedDepositsAccountProductTemplate.interestPostingPeriodType.id, + 'interestCalculationType': this.fixedDepositsAccountProductTemplate.interestCalculationType.id, + 'interestCalculationDaysInYearType': this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearType.id, + 'depositAmount': this.fixedDepositsAccountProductTemplate.depositAmount, + 'depositPeriod': this.fixedDepositsAccountProductTemplate.minDepositTerm, + 'depositPeriodFrequencyId': this.fixedDepositsAccountProductTemplate.minDepositTermType.id, + }); + } } /** diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/general-tab/general-tab.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/general-tab/general-tab.component.html index 12c3a0f81..5d0599094 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/general-tab/general-tab.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/general-tab/general-tab.component.html @@ -7,6 +7,15 @@

{{"labels.heading.Fixed Deposit Details" | translate }}

+ + + + diff --git a/src/app/shared/models/general.model.ts b/src/app/shared/models/general.model.ts index 281470240..3cbf3a59e 100644 --- a/src/app/shared/models/general.model.ts +++ b/src/app/shared/models/general.model.ts @@ -64,8 +64,8 @@ export interface Charge { isPaymentType?: boolean; currency?: Currency; amount?: number; - chargeTimeType?: Charge; - chargeAppliesTo?: Charge; - chargeCalculationType?: Charge; - chargePaymentMode?: Charge; + chargeTimeType?: OptionData; + chargeAppliesTo?: OptionData; + chargeCalculationType?: OptionData; + chargePaymentMode?: OptionData; } diff --git a/src/app/tasks/tasks.service.ts b/src/app/tasks/tasks.service.ts index 0dc8ab5f0..b511ec494 100644 --- a/src/app/tasks/tasks.service.ts +++ b/src/app/tasks/tasks.service.ts @@ -67,7 +67,7 @@ export class TasksService { .set('status', '100'); return this.http.get('/loans', { params: httpParams }); } - + /** * Get all loans to be created */
{{"labels.inputs.External Id" | translate }} + + + + {{"labels.inputs.Not Available" | translate}} +
{{"labels.inputs.Activated On" | translate }} {{fixedDepositsAccountData.timeline.activatedOnDate ? (fixedDepositsAccountData.timeline.activatedOnDate | dateFormat) : 'Not Activated'}}