From c53870e5400bc9036c5d51cee60b74bd71c1be94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Alberto=20Hern=C3=A1ndez?= <44206706+josehernandezfintecheandomx@users.noreply.github.com> Date: Thu, 24 Aug 2023 00:06:17 -0600 Subject: [PATCH] Display Fineract version and build (#1848) Co-authored-by: Jose Alberto Hernandez --- .../create-loan-product.component.html | 11 +++ .../create-loan-product.component.ts | 14 +++- ...oduct-payment-strategy-step.component.html | 48 ++++++++++++ ...oduct-payment-strategy-step.component.scss | 0 ...ct-payment-strategy-step.component.spec.ts | 25 +++++++ ...product-payment-strategy-step.component.ts | 73 +++++++++++++++++++ src/app/products/products.module.ts | 2 + src/app/shared/footer/footer.component.html | 26 +++++-- src/app/shared/footer/footer.component.scss | 19 ++++- src/app/shared/footer/footer.component.ts | 8 +- 10 files changed, 213 insertions(+), 13 deletions(-) create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.html create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.scss create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.spec.ts create mode 100644 src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html index 5db925be8..4cbc584c0 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html @@ -58,6 +58,17 @@ + + + PAYMENT STRATEGY + + + + + + CHARGES diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts index 5f7981a7f..d86b1e8f7 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts @@ -8,11 +8,11 @@ import { LoanProductCurrencyStepComponent } from '../loan-product-stepper/loan-p import { LoanProductTermsStepComponent } from '../loan-product-stepper/loan-product-terms-step/loan-product-terms-step.component'; import { LoanProductSettingsStepComponent } from '../loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component'; import { LoanProductChargesStepComponent } from '../loan-product-stepper/loan-product-charges-step/loan-product-charges-step.component'; +import { LoanProductPaymentStrategyStepComponent } from '../loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component'; import { LoanProductAccountingStepComponent } from '../loan-product-stepper/loan-product-accounting-step/loan-product-accounting-step.component'; /** Custom Services */ import { ProductsService } from 'app/products/products.service'; -import { GlobalConfiguration } from 'app/system/configurations/global-configurations-tab/configuration.model'; import { LoanProducts } from '../loan-products'; @Component({ @@ -26,6 +26,7 @@ export class CreateLoanProductComponent implements OnInit { @ViewChild(LoanProductCurrencyStepComponent, { static: true }) loanProductCurrencyStep: LoanProductCurrencyStepComponent; @ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent; @ViewChild(LoanProductSettingsStepComponent, { static: true }) loanProductSettingsStep: LoanProductSettingsStepComponent; + @ViewChild(LoanProductPaymentStrategyStepComponent, { static: true }) loanProductPaymentStrategyStep: LoanProductPaymentStrategyStepComponent; @ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent; @ViewChild(LoanProductAccountingStepComponent, { static: true }) loanProductAccountingStep: LoanProductAccountingStepComponent; @@ -33,6 +34,8 @@ export class CreateLoanProductComponent implements OnInit { accountingRuleData = ['None', 'Cash', 'Accrual (periodic)', 'Accrual (upfront)']; itemsByDefault: any[] = []; + isAdvancePaymentStrategy = false; + /** * @param {ActivatedRoute} route Activated Route. * @param {ProductsService} productsService Product Service. @@ -63,7 +66,9 @@ export class CreateLoanProductComponent implements OnInit { } get loanProductCurrencyForm() { - return this.loanProductCurrencyStep.loanProductCurrencyForm; + if (this.loanProductCurrencyStep != null) { + return this.loanProductCurrencyStep.loanProductCurrencyForm; + } } get loanProductTermsForm() { @@ -78,7 +83,12 @@ export class CreateLoanProductComponent implements OnInit { return this.loanProductAccountingStep.loanProductAccountingForm; } + get loanProductPaymentStrategyForm() { + return this.loanProductPaymentStrategyStep.loanProductPaymentStrategyForm; + } + get loanProductFormValid() { + this.isAdvancePaymentStrategy = (this.loanProductSettingsStep.loanProductSettings.transactionProcessingStrategyCode === 'advanced-payment-allocation-strategy'); return ( this.loanProductDetailsForm.valid && this.loanProductCurrencyForm.valid && diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.html new file mode 100644 index 000000000..18341eca4 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.html @@ -0,0 +1,48 @@ +
+ + + Transaction Type + + + {{ transactionType }} + + + + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
Transaction Type {{ jobStep.stepName }} Order {{ jobStep.order }} Actions + +
+
+ +
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.scss b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.spec.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.spec.ts new file mode 100644 index 000000000..4f4aae7dc --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LoanProductPaymentStrategyStepComponent } from './loan-product-payment-strategy-step.component'; + +describe('LoanProductPaymentStrategyStepComponent', () => { + let component: LoanProductPaymentStrategyStepComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ LoanProductPaymentStrategyStepComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(LoanProductPaymentStrategyStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts new file mode 100644 index 000000000..b28feea81 --- /dev/null +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component.ts @@ -0,0 +1,73 @@ +import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; +import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; +import { MatDialog } from '@angular/material/dialog'; +import { MatTable } from '@angular/material/table'; +import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; + +@Component({ + selector: 'mifosx-loan-product-payment-strategy-step', + templateUrl: './loan-product-payment-strategy-step.component.html', + styleUrls: ['./loan-product-payment-strategy-step.component.scss'] +}) +export class LoanProductPaymentStrategyStepComponent implements OnInit { + + @Input() loanProductsTemplate: any; + loanProductPaymentStrategyForm: FormGroup; + + transactionTypesData: any = []; + transactionTypeOptions: any = []; + + transactionType = new FormControl('', Validators.required); + + stepOrderHasChanged = false; + @ViewChild('table') table: MatTable; + + /** Columns to be displayed in the table. */ + displayedColumns: string[] = ['transactionName', 'transactionOrder', 'actions']; + + constructor(private formBuilder: FormBuilder, + private dialog: MatDialog) { + this.createForm(); + } + + ngOnInit(): void { + this.transactionTypesData = []; + } + + createForm(): void { + this.loanProductPaymentStrategyForm = this.formBuilder.group({ + 'transactionType': ['', Validators.required], + }); + } + + addTransactionType(): void { + console.log(this.transactionType.value); + this.transactionTypesData.append(this.transactionType.value); + } + + removeTransactionType(index: number) { + const dialogRef = this.dialog.open(DeleteDialogComponent, { + data: { deleteContext: `this` } + }); + dialogRef.afterClosed().subscribe((response: any) => { + if (response.delete) { + this.transactionTypesData.splice(index, 1); + this.transactionTypesData = this.transactionTypesData.concat([]); + this.transactionTypesData = [...this.transactionTypesData]; + this.stepOrderHasChanged = true; + } + }); + } + + + dropTable(event: CdkDragDrop) { + const prevIndex = this.transactionTypesData.findIndex((d: any) => d === event.item.data); + moveItemInArray(this.transactionTypesData, prevIndex, event.currentIndex); + this.transactionTypesData = [...this.transactionTypesData]; + this.table.renderRows(); + this.stepOrderHasChanged = true; + } + + +} diff --git a/src/app/products/products.module.ts b/src/app/products/products.module.ts index ed66d801c..4c4b6ca8a 100644 --- a/src/app/products/products.module.ts +++ b/src/app/products/products.module.ts @@ -116,6 +116,7 @@ import { RecurringDepositDatatableTabComponent } from './recurring-deposit-produ import { RecurringDepositGeneralTabComponent } from './recurring-deposit-products/view-recurring-deposit-product/recurring-deposit-general-tab/recurring-deposit-general-tab.component'; import { ShareProductGeneralTabComponent } from './share-products/view-share-product/share-product-general-tab/share-product-general-tab.component'; import { ShareProductDatatableTabComponent } from './share-products/view-share-product/share-product-datatable-tab/share-product-datatable-tab.component'; +import { LoanProductPaymentStrategyStepComponent } from './loan-products/loan-product-stepper/loan-product-payment-strategy-step/loan-product-payment-strategy-step.component'; /** * Products Module @@ -136,6 +137,7 @@ import { ShareProductDatatableTabComponent } from './share-products/view-share-p LoanProductCurrencyStepComponent, LoanProductTermsStepComponent, LoanProductSettingsStepComponent, + LoanProductPaymentStrategyStepComponent, LoanProductChargesStepComponent, LoanProductAccountingStepComponent, LoanProductPreviewStepComponent, diff --git a/src/app/shared/footer/footer.component.html b/src/app/shared/footer/footer.component.html index cdfa99577..bb511beb0 100644 --- a/src/app/shared/footer/footer.component.html +++ b/src/app/shared/footer/footer.component.html @@ -1,11 +1,25 @@