diff --git a/angular.json b/angular.json index d79ff946e..d2a94faea 100644 --- a/angular.json +++ b/angular.json @@ -11,6 +11,9 @@ "schematics": { "@schematics/angular:component": { "style": "scss" + }, + "@schematics/angular:application": { + "strict": true } }, "architect": { @@ -72,28 +75,35 @@ "configurations": { "production": { "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, { "type": "anyComponentStyle", - "maximumWarning": "6kb" + "maximumWarning": "2kb", + "maximumError": "4kb" } ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "namedChunks": false, - "aot": true, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "serviceWorker": false, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } - ] + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true } - } + }, + "defaultConfiguration": "production" }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", @@ -101,10 +111,14 @@ "browserTarget": "mifosx-web-app:build" }, "configurations": { + "development": { + "browserTarget": "mifosx-web-app:build:development" + }, "production": { "browserTarget": "mifosx-web-app:build:production" } - } + }, + "defaultConfiguration": "development" }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", @@ -259,4 +273,4 @@ } }, "defaultProject": "mifosx-web-app" -} \ No newline at end of file +} diff --git a/src/app/clients/clients.component.html b/src/app/clients/clients.component.html index 91fc69970..983974fb9 100644 --- a/src/app/clients/clients.component.html +++ b/src/app/clients/clients.component.html @@ -1,41 +1,47 @@
- -
+ +
- + - - - + + + - - + + @@ -43,43 +49,40 @@ - - - - - - - - - - - - - - + + - + - +
Name {{row.displayName}} {{row.entityName}} Account # {{row.accountNo}} Account No. {{row.entityAccountNo}} ExternalID External Id - + Status -
+
+ + {{ row.entityStatus.value | translate }} +
Mobile Number {{ client.mobileNo }} Gender {{ client.gender.name }} OfficeName {{row.officeName}} Office Name {{row.parentName}} StaffName Staff Name {{row.staffName}}
-
+
+
+ + No client was found +
+
diff --git a/src/app/clients/clients.component.scss b/src/app/clients/clients.component.scss index 1d6a876d2..76043013c 100644 --- a/src/app/clients/clients.component.scss +++ b/src/app/clients/clients.component.scss @@ -6,6 +6,12 @@ min-width: 30px; margin: 4px; } + .search-box { + min-width: 320px; + } + .filter-box { + min-width: 280px; + } } table { @@ -16,3 +22,7 @@ table { color : black; } } + +.status { + color: black; +} diff --git a/src/app/clients/clients.component.ts b/src/app/clients/clients.component.ts index 911e61481..63fd450c4 100644 --- a/src/app/clients/clients.component.ts +++ b/src/app/clients/clients.component.ts @@ -1,72 +1,34 @@ /** Angular Imports. */ -import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { MatCheckbox } from '@angular/material/checkbox'; import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; -import { ClientsDataSource } from './clients.datasource'; - -/** rxjs Imports */ -import { merge } from 'rxjs'; -import { tap } from 'rxjs/operators'; +import { MatTableDataSource } from '@angular/material/table'; /** Custom Services */ -import { ClientsService } from './clients.service'; +import { SearchService } from 'app/search/search.service'; @Component({ selector: 'mifosx-clients', templateUrl: './clients.component.html', styleUrls: ['./clients.component.scss'], }) -export class ClientsComponent implements OnInit, AfterViewInit { +export class ClientsComponent implements OnInit { @ViewChild('showClosedAccounts', { static: true }) showClosedAccounts: MatCheckbox; + displayedColumns = ['name', 'clientNo', 'externalId', 'status', 'office', 'staff']; + dataSource: MatTableDataSource; - displayedColumns = ['name', 'clientno', 'externalid', 'status', 'mobileNo', 'gender', 'office', 'staff']; - dataSource: ClientsDataSource; - /** Get the required filter value. */ - searchValue = ''; + existsClientsToFilter = false; + notExistsClientsToFilter = false; + moreClientsToFilter = false; @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @ViewChild(MatSort, { static: true }) sort: MatSort; - constructor(private clientsService: ClientsService) { - - } + constructor(private searchService: SearchService) { } ngOnInit() { - this.getClients(); - } - - ngAfterViewInit() { - this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0); - merge(this.sort.sortChange, this.paginator.page, this.showClosedAccounts.change) - .pipe( - tap(() => this.loadClientsPage()) - ) - .subscribe(); - } - - /** - * Loads a page of journal entries. - */ - loadClientsPage() { - if (!this.sort.direction) { - delete this.sort.active; - } - - if (this.searchValue !== '') { - this.applyFilter(this.searchValue); - } else { - this.dataSource.getClients(this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize, this.showClosedAccounts.checked); - } - } - - /** - * Initializes the data source for clients table and loads the first page. - */ - getClients() { - this.dataSource = new ClientsDataSource(this.clientsService); - this.dataSource.getClients(this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize, this.showClosedAccounts.checked); } /** @@ -74,8 +36,18 @@ export class ClientsComponent implements OnInit, AfterViewInit { * @param {string} filterValue Value to filter data. */ applyFilter(filterValue: string = '') { - this.searchValue = filterValue; - this.dataSource.filterClients(filterValue.trim().toLowerCase(), this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize, this.showClosedAccounts.checked); + this.dataSource.filter = filterValue.trim().toLowerCase(); } + /** + * Searches server for query and resource. + */ + search(value: string) { + this.searchService.getSearchResults(value, 'clients').subscribe((data: any) => { + this.dataSource = new MatTableDataSource(data); + this.existsClientsToFilter = (data.length > 0); + this.notExistsClientsToFilter = !this.existsClientsToFilter; + this.moreClientsToFilter = (data.length > 50); + }); + } } diff --git a/src/app/clients/clients.datasource.ts b/src/app/clients/clients.datasource.ts deleted file mode 100644 index ef63e3672..000000000 --- a/src/app/clients/clients.datasource.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** Angular Imports */ -import { CollectionViewer, DataSource } from '@angular/cdk/collections'; - -/** rxjs Imports */ -import { Observable, BehaviorSubject } from 'rxjs'; - -/** Custom Services */ -import { ClientsService } from './clients.service'; - -/** - * Clients custom data source to implement server side filtering, pagination and sorting. - */ -export class ClientsDataSource implements DataSource { - - /** clients behavior subject to represent loaded journal clients page. */ - private clientsSubject = new BehaviorSubject([]); - /** Records subject to represent total number of filtered clients records. */ - private recordsSubject = new BehaviorSubject(0); - /** Records observable which can be subscribed to get the value of total number of filtered clients records. */ - public records$ = this.recordsSubject.asObservable(); - - /** - * @param {ClientsService} clientsService Clients Service - */ - constructor(private clientsService: ClientsService) { } - - /** - * Gets clients on the basis of provided parameters and emits the value. - * @param {any} filterBy Properties by which clients should be filtered. - * @param {string} orderBy Property by which clients should be sorted. - * @param {string} sortOrder Sort order: ascending or descending. - * @param {number} pageIndex Page number. - * @param {number} limit Number of clients within the page. - */ - getClients(orderBy: string = '', sortOrder: string = '', pageIndex: number = 0, limit: number = 10, showClosedAccounts: boolean = true) { - this.clientsSubject.next([]); - this.clientsService.getClients(orderBy, sortOrder, pageIndex * limit, limit) - .subscribe((clients: any) => { - if (showClosedAccounts) { - clients.pageItems = clients.pageItems; - } else { - clients.pageItems = clients.pageItems.filter((client: any) => client.status.value !== 'Closed'); - } - this.recordsSubject.next(clients.totalFilteredRecords); - this.clientsSubject.next(clients.pageItems); - }); - } - - /** - * @param {CollectionViewer} collectionViewer - */ - connect(collectionViewer: CollectionViewer): Observable { - return this.clientsSubject.asObservable(); - } - - /** - * @param {CollectionViewer} collectionViewer - */ - disconnect(collectionViewer: CollectionViewer): void { - this.clientsSubject.complete(); - this.recordsSubject.complete(); - } - - /** Filter Active Client Data. - * @param {string} filterValue Filter Value which clients should be filtered. - * @param {string} orderBy Property by which clients should be sorted. - * @param {string} sortOrder Sort order: ascending or descending. - * @param {number} pageIndex Page number. - * @param {number} limit Number of clients within the page. - */ - filterClients(filter: string, orderBy: string = '', sortOrder: string = '', pageIndex: number = 0, limit: number = 10, showClosedAccounts: boolean = true) { - this.clientsSubject.next([]); - this.clientsService.getClients(orderBy, sortOrder, pageIndex * limit, limit) - .subscribe((clients: any) => { - if (showClosedAccounts) { - clients.pageItems = clients.pageItems.filter((client: any) => client.displayName.toLowerCase().includes(filter)); - } else { - clients.pageItems = clients.pageItems.filter((client: any) => client.status.value !== 'Closed' && client.displayName.toLowerCase().includes(filter)); - } - this.recordsSubject.next(clients.totalFilteredRecords); - this.clientsSubject.next(clients.pageItems); - }); - } - -} diff --git a/src/app/loans/create-loans-account/create-loans-account.component.html b/src/app/loans/create-loans-account/create-loans-account.component.html index 24d4a7a08..43357c0e3 100644 --- a/src/app/loans/create-loans-account/create-loans-account.component.html +++ b/src/app/loans/create-loans-account/create-loans-account.component.html @@ -26,7 +26,7 @@ DETAILS + (loansAccountProductTemplate)="setTemplate($event)" #loansAccountDetailsForm> @@ -35,7 +35,7 @@ TERMS - @@ -46,7 +46,7 @@ CHARGES - @@ -57,7 +57,7 @@ REPAYMENT SCHEDULE - diff --git a/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts index 9b05992be..44b02678f 100644 --- a/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts +++ b/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts @@ -56,10 +56,10 @@ export class LoansAccountDetailsStepComponent implements OnInit { private route: ActivatedRoute, private settingsService: SettingsService) { this.loanId = this.route.snapshot.params['loanId']; - this.createLoansAccountDetailsForm(); } ngOnInit() { + this.createLoansAccountDetailsForm(); this.maxDate = this.settingsService.maxFutureDate; this.buildDependencies(); if (this.loansAccountTemplate) { @@ -87,7 +87,7 @@ export class LoansAccountDetailsStepComponent implements OnInit { 'loanOfficerId': [''], 'loanPurposeId': [''], 'fundId': [''], - 'submittedOnDate': [new Date(), Validators.required], + 'submittedOnDate': [this.settingsService.businessDate, Validators.required], 'expectedDisbursementDate': ['', Validators.required], 'externalId': [''], 'linkAccountId': [''], diff --git a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html index cabb08043..4a3e53a9d 100644 --- a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html +++ b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.html @@ -19,6 +19,40 @@ +
+
+ {{ 'Principal' | translate }} +
+ +
+ {{ dataObject.principalPortion | number }} +
+ +
+ {{ 'Interest' | translate }} +
+ +
+ {{ dataObject.interestPortion | number }} +
+ +
+ {{ 'Fees' | translate }} +
+ +
+ {{ dataObject.feeChargesPortion | number }} +
+ +
+ {{ 'Penalties' | translate }} +
+ +
+ {{ dataObject.penaltyChargesPortion | number }} +
+
+ Transaction Amount diff --git a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.html b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.html index 80ba623ec..91538bf64 100644 --- a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.html +++ b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.html @@ -19,6 +19,40 @@ +
+
+ {{ 'Principal' | translate }} +
+ +
+ {{ dataObject.principalPortion | number }} +
+ +
+ {{ 'Interest' | translate }} +
+ +
+ {{ dataObject.interestPortion | number }} +
+ +
+ {{ 'Fees' | translate }} +
+ +
+ {{ dataObject.feeChargesPortion | number }} +
+ +
+ {{ 'Penalties' | translate }} +
+ +
+ {{ dataObject.penaltyChargesPortion | number }} +
+
+ Transaction Amount @@ -27,19 +61,6 @@ - - Principal - - - - - Interest Amount - - - Interest Amount is required - - - External Id diff --git a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts index 86aad5bd7..89a69c9f2 100644 --- a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts @@ -70,8 +70,6 @@ export class PrepayLoanComponent implements OnInit { this.prepayLoanForm = this.formBuilder.group({ 'transactionDate': [new Date(), Validators.required], 'transactionAmount': ['', Validators.required], - 'principal': [{value: '', disabled: true}], - 'interestAmount': [{value: '', disabled: true}, Validators.required], 'externalId': [''], 'paymentTypeId': [''], 'note': [''] @@ -84,9 +82,7 @@ export class PrepayLoanComponent implements OnInit { setPrepayLoanDetails() { this.paymentTypes = this.dataObject.paymentTypeOptions; this.prepayLoanForm.patchValue({ - transactionAmount: this.dataObject.amount, - principal: this.dataObject.principalPortion, - interestAmount: this.dataObject.interestPortion, + transactionAmount: this.dataObject.amount }); } diff --git a/src/app/loans/loans-view/loans-view.component.html b/src/app/loans/loans-view/loans-view.component.html index d0e8693ac..b476b77b5 100644 --- a/src/app/loans/loans-view/loans-view.component.html +++ b/src/app/loans/loans-view/loans-view.component.html @@ -50,6 +50,8 @@
+ +
+ + + + + + + +
diff --git a/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.scss b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.scss new file mode 100644 index 000000000..aeead06e0 --- /dev/null +++ b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.scss @@ -0,0 +1,3 @@ +.container { + width: 37rem; +} diff --git a/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.spec.ts b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.spec.ts new file mode 100644 index 000000000..899cc1ca4 --- /dev/null +++ b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ManageSavingsAccountComponent } from './manage-savings-account.component'; + +describe('ManageSavingsAccountComponent', () => { + let component: ManageSavingsAccountComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ManageSavingsAccountComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ManageSavingsAccountComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.ts b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.ts new file mode 100644 index 000000000..e4e98615c --- /dev/null +++ b/src/app/savings/saving-account-actions/manage-savings-account/manage-savings-account.component.ts @@ -0,0 +1,140 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Dates } from 'app/core/utils/dates'; +import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; +import { SystemService } from 'app/system/system.service'; + +@Component({ + selector: 'mifosx-manage-savings-account', + templateUrl: './manage-savings-account.component.html', + styleUrls: ['./manage-savings-account.component.scss'] +}) +export class ManageSavingsAccountComponent implements OnInit { + + /** Minimum date allowed. */ + minDate = new Date(2000, 0, 1); + /** Maximum date allowed. */ + maxDate = new Date(); + /** Manage Savings Account form. */ + manageSavingsAccountForm: FormGroup; + /** Savings Account Id */ + savingAccountId: string; + transactionCommand: string; + + reasonOptions: any = []; + + transactionType: { + holdamount: boolean, + blockaccount: boolean, + unblockaccount: boolean + } = { + holdamount: false, blockaccount: false, unblockaccount: false }; + + /** + * @param {FormBuilder} formBuilder Form Builder + * @param {SavingsService} savingsService Savings Service + * @param {Dates} dateUtils Date Utils + * @param {ActivatedRoute} route Activated Route + * @param {Router} router Router + * @param {SettingsService} settingsService Setting service + */ + constructor(private formBuilder: FormBuilder, + private savingsService: SavingsService, + private dateUtils: Dates, + private route: ActivatedRoute, + private router: Router, + private systemService: SystemService, + private settingsService: SettingsService) { + this.transactionCommand = this.route.snapshot.params['name'].toLowerCase().replaceAll(' ', ''); + this.transactionType[this.transactionCommand] = true; + this.savingAccountId = this.route.parent.snapshot.params['savingAccountId']; + } + + /** + * Creates the post interest savings form. + */ + ngOnInit() { + this.maxDate = this.settingsService.businessDate; + this.createManageSavingsAccountForm(); + if (this.transactionType.holdamount || this.transactionType.blockaccount) { + this.getCodeValues(); + } + } + + getCodeValues() { + let codeName = 'SavingsTransactionFreezeReasons'; // Default Hold Amount + if (this.transactionType.blockaccount) { + codeName = 'SavingsAccountBlockReasons'; + } + + this.systemService.getCodes().subscribe((codes: any) => { + codes.some((code: any) => { + if (code.name === codeName) { + this.systemService.getCodeValues(code.id).subscribe((codeValues: any) => { + this.reasonOptions = codeValues; + return true; + }); + } + return false; + }); + }); + } + + /** + * Creates the post interest savings account form. + */ + createManageSavingsAccountForm() { + if (this.transactionType.holdamount) { + this.manageSavingsAccountForm = this.formBuilder.group({ + 'reasonForBlock': ['', Validators.required], + 'transactionDate': ['', Validators.required], + 'transactionAmount': [0.0, Validators.required] + }); + } else { + this.manageSavingsAccountForm = this.formBuilder.group({ + 'reasonForBlock': ['', Validators.required] + }); + } + } + + submit() { + let command = ''; + let payload = { }; + + if (this.transactionType.holdamount) { + const manageSavingsAccountFormData = this.manageSavingsAccountForm.value; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; + const prevTransactionDate: Date = this.manageSavingsAccountForm.value.transactionDate; + if (manageSavingsAccountFormData.transactionDate instanceof Date) { + manageSavingsAccountFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat); + } + payload = { + ...manageSavingsAccountFormData, + dateFormat, + locale + }; + command = 'holdAmount'; + + this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, command, payload).subscribe((response: any) => { + console.log(response); + this.router.navigate(['../../transactions'], { relativeTo: this.route }); + }); + } else { + payload = { + ... this.manageSavingsAccountForm.value + } + if (this.transactionType.blockaccount) { + command = 'block'; + } + + this.savingsService.executeSavingsAccountCommand(this.savingAccountId, command, payload).subscribe((response: any) => { + console.log(response); + this.router.navigate(['../../transactions'], { relativeTo: this.route }); + }); + } + } + +} diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.html b/src/app/savings/saving-account-actions/saving-account-actions.component.html index 7ccd85174..bc2a94ce2 100644 --- a/src/app/savings/saving-account-actions/saving-account-actions.component.html +++ b/src/app/savings/saving-account-actions/saving-account-actions.component.html @@ -10,3 +10,4 @@ + diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.ts b/src/app/savings/saving-account-actions/saving-account-actions.component.ts index 5ddfc4bc5..e7b19984c 100644 --- a/src/app/savings/saving-account-actions/saving-account-actions.component.ts +++ b/src/app/savings/saving-account-actions/saving-account-actions.component.ts @@ -27,6 +27,9 @@ export class SavingAccountActionsComponent { 'Unassign Staff': boolean 'Withdraw By Client': boolean 'Apply Annual Fees': boolean + 'Hold Amount': boolean + 'Block Account': boolean + 'Unblock Account': boolean } = { 'Approve': false, 'Reject': false, @@ -40,7 +43,10 @@ export class SavingAccountActionsComponent { 'Add Charge': false, 'Unassign Staff': false, 'Withdraw By Client': false, - 'Apply Annual Fees': false + 'Apply Annual Fees': false, + 'Hold Amount': false, + 'Block Account': false, + 'Unblock Account': false }; /** diff --git a/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.html b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.html new file mode 100644 index 000000000..f80249ca6 --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.html @@ -0,0 +1,8 @@ +

Release Amount

+
+

Are you sure you want to release this amount ?

+
+ + + + diff --git a/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.scss b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.spec.ts b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.spec.ts new file mode 100644 index 000000000..debb7b76d --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ReleaseAmountDialogComponent } from './release-amount-dialog.component'; + +describe('ReleaseAmountDialogComponent', () => { + let component: ReleaseAmountDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ReleaseAmountDialogComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ReleaseAmountDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.ts b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.ts new file mode 100644 index 000000000..61cdc6554 --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component.ts @@ -0,0 +1,16 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'mifosx-release-amount-dialog', + templateUrl: './release-amount-dialog.component.html', + styleUrls: ['./release-amount-dialog.component.scss'] +}) +export class ReleaseAmountDialogComponent { + + /** + * @param {MatDialogRef} dialogRef Component reference to dialog. + */ + constructor(public dialogRef: MatDialogRef) { } + +} diff --git a/src/app/savings/savings-account-view/savings-account-view.component.ts b/src/app/savings/savings-account-view/savings-account-view.component.ts index 130a4ce80..eba3a8e4c 100644 --- a/src/app/savings/savings-account-view/savings-account-view.component.ts +++ b/src/app/savings/savings-account-view/savings-account-view.component.ts @@ -135,6 +135,9 @@ export class SavingsAccountViewComponent implements OnInit { case 'Post Interest As On': case 'Assign Staff': case 'Add Charge': + case 'Hold Amount': + case 'Block Account': + case 'Unblock Account': case 'Unassign Staff': case 'Withdraw By Client': case 'Apply Annual Fees': diff --git a/src/app/savings/savings-account-view/savings-buttons.config.ts b/src/app/savings/savings-account-view/savings-buttons.config.ts index 3e0b76297..9c70e75a1 100644 --- a/src/app/savings/savings-account-view/savings-buttons.config.ts +++ b/src/app/savings/savings-account-view/savings-buttons.config.ts @@ -39,6 +39,11 @@ export class SavingsButtonsConfiguration { icon: 'arrow-down', taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT' }, + { + name: 'Hold Amount', + icon: 'lock', + taskPermissionName: 'HOLDAMOUNT_SAVINGSACCOUNT' + }, { name: 'Calculate Interest', icon: 'table', diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html index 471047ca4..b5e83bca2 100644 --- a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html +++ b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.html @@ -1,17 +1,20 @@
- - + +
@@ -30,7 +33,7 @@
{{ transactionData.id }}
- +
Type
@@ -44,7 +47,7 @@
- {{ transactionData.date | dateFormat }} + {{ transactionData.date | dateFormat }}
@@ -76,47 +79,47 @@
Payment Type
- +
{{ transactionData.paymentDetailData.paymentType.name }}
- +
Account No.
- +
{{ transactionData.paymentDetailData.accountNumber }}
- +
Cheque Number
- +
{{ transactionData.paymentDetailData.checkNumber }}
- +
Routing Code
- +
{{ transactionData.paymentDetailData.routingCode }}
- +
Receipt No.
- +
{{ transactionData.paymentDetailData.receiptNumber }}
- +
Bank No.
- +
{{ transactionData.paymentDetailData.bankNumber }}
@@ -125,6 +128,9 @@
+
+ +
diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts index 21560621a..11ea7087e 100644 --- a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts +++ b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts @@ -10,6 +10,7 @@ import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ import { UndoTransactionDialogComponent } from '../../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component'; import { Dates } from 'app/core/utils/dates'; +import { ReleaseAmountDialogComponent } from '../../custom-dialogs/release-amount-dialog/release-amount-dialog.component'; /** * View Transaction Component. @@ -25,6 +26,8 @@ export class ViewTransactionComponent { /** Transaction data. */ transactionData: any; + accountId: string; + /** * Retrieves the Transaction data from `resolve`. * @param {SavingsService} savingsService Savings Service @@ -41,7 +44,9 @@ export class ViewTransactionComponent { public dialog: MatDialog, private settingsService: SettingsService) { this.route.data.subscribe((data: { savingsAccountTransaction: any }) => { + this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.transactionData = data.savingsAccountTransaction; + console.log(this.transactionData); }); } @@ -49,7 +54,6 @@ export class ViewTransactionComponent { * Undo the savings transaction */ undoTransaction() { - const accountId = this.route.parent.snapshot.params['savingAccountId']; const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent); undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => { if (response.confirm) { @@ -61,7 +65,19 @@ export class ViewTransactionComponent { dateFormat, locale }; - this.savingsService.executeSavingsAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id).subscribe(() => { + this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'undo', data, this.transactionData.id).subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + releaseAmount() { + const releaseAmountDialogRef = this.dialog.open(ReleaseAmountDialogComponent); + releaseAmountDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + const data = { }; + this.savingsService.executeSavingsAccountTransactionsCommand(this.accountId, 'releaseAmount', data, this.transactionData.id).subscribe(() => { this.router.navigate(['../'], { relativeTo: this.route }); }); } diff --git a/src/app/savings/savings.module.ts b/src/app/savings/savings.module.ts index 5cfcea34c..643e96228 100644 --- a/src/app/savings/savings.module.ts +++ b/src/app/savings/savings.module.ts @@ -47,6 +47,8 @@ import { EditTransactionComponent } from './savings-account-view/transactions/ed import { ApplyAnnualFeesSavingsAccountComponent } from './saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component'; import { GsimAccountComponent } from './gsim-account/gsim-account.component'; import { CreateGsimAccountComponent } from './gsim-account/create-gsim-account/create-gsim-account.component'; +import { ManageSavingsAccountComponent } from './saving-account-actions/manage-savings-account/manage-savings-account.component'; +import { ReleaseAmountDialogComponent } from './savings-account-view/custom-dialogs/release-amount-dialog/release-amount-dialog.component'; /** @@ -100,7 +102,9 @@ import { CreateGsimAccountComponent } from './gsim-account/create-gsim-account/c EditTransactionComponent, ApplyAnnualFeesSavingsAccountComponent, GsimAccountComponent, - CreateGsimAccountComponent + CreateGsimAccountComponent, + ManageSavingsAccountComponent, + ReleaseAmountDialogComponent ], providers: [ ] })