Fix search entities view for savings and deposits accounts

This commit is contained in:
Jose Alberto Hernandez
2024-02-07 14:10:07 +01:00
committed by Adam Saghy
parent 5d0e063be6
commit f643b15949
11 changed files with 45 additions and 14 deletions
+1 -1
View File
@@ -251,7 +251,7 @@ const routes: Routes = [
loadChildren: () => import('../savings/savings.module').then(m => m.SavingsModule) loadChildren: () => import('../savings/savings.module').then(m => m.SavingsModule)
}, },
{ {
path: 'recurringdeposits', path: 'recurring-deposits-accounts',
loadChildren: () => import('../deposits/recurring-deposits/recurring-deposits.module').then(m => m.RecurringDepositsModule) loadChildren: () => import('../deposits/recurring-deposits/recurring-deposits.module').then(m => m.RecurringDepositsModule)
}, },
{ {
@@ -115,7 +115,7 @@
<button mat-menu-item *mifosxHasPermission="'CREATE_SHAREACCOUNT'" <button mat-menu-item *mifosxHasPermission="'CREATE_SHAREACCOUNT'"
[routerLink]="['shares-accounts', 'create']">{{"labels.buttons.New Share Account" | translate}}</button> [routerLink]="['shares-accounts', 'create']">{{"labels.buttons.New Share Account" | translate}}</button>
<button mat-menu-item *mifosxHasPermission="'CREATE_RECURRINGDEPOSITACCOUNT'" <button mat-menu-item *mifosxHasPermission="'CREATE_RECURRINGDEPOSITACCOUNT'"
[routerLink]="['recurringdeposits', 'create-recurring-deposits-account']">{{"labels.buttons.New Recurring Deposit Account" | translate}}</button> [routerLink]="['recurring-deposits-accounts', 'create-recurring-deposits-account']">{{"labels.buttons.New Recurring Deposit Account" | translate}}</button>
<button mat-menu-item *mifosxHasPermission="'CREATE_FIXEDDEPOSITACCOUNT'" <button mat-menu-item *mifosxHasPermission="'CREATE_FIXEDDEPOSITACCOUNT'"
[routerLink]="['fixed-deposits-accounts', 'create']">{{"labels.buttons.New Fixed Deposits Account" | translate}}</button> [routerLink]="['fixed-deposits-accounts', 'create']">{{"labels.buttons.New Fixed Deposits Account" | translate}}</button>
</mat-menu> </mat-menu>
@@ -476,7 +476,7 @@
<td mat-cell class="center" *matCellDef="let element"> <td mat-cell class="center" *matCellDef="let element">
<ng-container *ngIf="element.status.submittedAndPendingApproval"> <ng-container *ngIf="element.status.submittedAndPendingApproval">
<button class="account-action-button" mat-raised-button *mifosxHasPermission="'APPROVE_SAVINGSACCOUNT'" <button class="account-action-button" mat-raised-button *mifosxHasPermission="'APPROVE_SAVINGSACCOUNT'"
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Approve']" color="primary"> [routerLink]="['../','recurring-deposits-accounts', element.id, 'actions', 'Approve']" color="primary">
<i class="fa fa-check"></i> <i class="fa fa-check"></i>
</button> </button>
</ng-container> </ng-container>
@@ -484,12 +484,12 @@
<button <button
class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)" class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
*mifosxHasPermission="'APPROVALUNDO_SAVINGSACCOUNT'" *mifosxHasPermission="'APPROVALUNDO_SAVINGSACCOUNT'"
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Undo Approval']"> [routerLink]="['../','recurring-deposits-accounts', element.id, 'actions', 'Undo Approval']">
<i class="fa fa-undo"></i> <i class="fa fa-undo"></i>
</button> </button>
<button class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)" <button class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
*mifosxHasPermission="'ACTIVATE_SAVINGSACCOUNT'" *mifosxHasPermission="'ACTIVATE_SAVINGSACCOUNT'"
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Activate']"> [routerLink]="['../','recurring-deposits-accounts', element.id, 'actions', 'Activate']">
<i class="fa fa-check-circle"></i> <i class="fa fa-check-circle"></i>
</button> </button>
</ng-container> </ng-container>
@@ -498,7 +498,7 @@
<tr mat-header-row *matHeaderRowDef="openSavingsColumns"></tr> <tr mat-header-row *matHeaderRowDef="openSavingsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: openSavingsColumns;" <tr mat-row *matRowDef="let row; columns: openSavingsColumns;"
[routerLink]="['../', 'recurringdeposits', row.id, 'general']" class="select-row"></tr> [routerLink]="['../', 'recurring-deposits-accounts', row.id, 'general']" class="select-row"></tr>
</table> </table>
@@ -525,7 +525,7 @@
<tr mat-header-row *matHeaderRowDef="closedSavingsColumns"></tr> <tr mat-header-row *matHeaderRowDef="closedSavingsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: closedSavingsColumns;" <tr mat-row *matRowDef="let row; columns: closedSavingsColumns;"
[routerLink]="['../', 'recurringdeposits', row.id, 'general']" class="select-row"></tr> [routerLink]="['../', 'recurring-deposits-accounts', row.id, 'general']" class="select-row"></tr>
</table> </table>
<!-- Shares overview Table --> <!-- Shares overview Table -->
@@ -211,7 +211,7 @@ export class ChargesTabComponent implements OnInit {
private reload() { private reload() {
const clientId = this.recurringDepositsAccountData.clientId; const clientId = this.recurringDepositsAccountData.clientId;
const url: string = this.router.url; const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/recurringdeposits`, { skipLocationChange: true }) this.router.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url])); .then(() => this.router.navigate([url]));
} }
@@ -37,6 +37,7 @@
<tr> <tr>
</tr> </tr>
<tr> <tr>
<td>{{"labels.inputs.Deposit Frequency" | translate }}</td>
<td><span>{{recurringDepositsAccountData.recurringFrequency}} <td><span>{{recurringDepositsAccountData.recurringFrequency}}
&nbsp;{{recurringDepositsAccountData.recurringFrequencyType.value}} &nbsp;{{recurringDepositsAccountData.recurringFrequencyType.value}}
</span></td> </span></td>
@@ -148,7 +148,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
reload() { reload() {
const clientId = this.recurringDepositsAccountData.clientId; const clientId = this.recurringDepositsAccountData.clientId;
const url: string = this.router.url; const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/recurringdeposits`, { skipLocationChange: true }) this.router.navigateByUrl(`/clients/${clientId}/recurring-deposits-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url])); .then(() => this.router.navigate([url]));
} }
@@ -33,7 +33,7 @@ export class NotificationsPageComponent implements OnInit {
'center' : '/centers/', 'center' : '/centers/',
'shareAccount' : '/shares-accounts/', 'shareAccount' : '/shares-accounts/',
'fixedDeposit' : '/fixed-deposits-accounts/', 'fixedDeposit' : '/fixed-deposits-accounts/',
'recurringDepositAccount': '/recurringdeposits/', 'recurringDepositAccount': '/recurring-deposits-accounts/',
'savingsAccount' : '/savings-accounts/', 'savingsAccount' : '/savings-accounts/',
'shareProduct': '/products/share-products/', 'shareProduct': '/products/share-products/',
'loanProduct' : '/products/loan-products/' 'loanProduct' : '/products/loan-products/'
@@ -112,6 +112,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
'enableDownPayment': this.loanProductsTemplate.enableDownPayment, 'enableDownPayment': this.loanProductsTemplate.enableDownPayment,
'enableInstallmentLevelDelinquency': this.loanProductsTemplate.enableInstallmentLevelDelinquency, 'enableInstallmentLevelDelinquency': this.loanProductsTemplate.enableInstallmentLevelDelinquency,
'loanScheduleType': this.loanProductsTemplate.loanScheduleType.code, 'loanScheduleType': this.loanProductsTemplate.loanScheduleType.code,
'useDueForRepaymentsConfigurations': this.loanProductsTemplate.useDueForRepaymentsConfigurations,
'allowAccrualPostingInArrears': this.loanProductsTemplate.allowAccrualPostingInArrears
}); });
this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(transactionProcessingStrategyCode); this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(transactionProcessingStrategyCode);
@@ -243,6 +245,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
'dueDaysForRepaymentEvent': [''], 'dueDaysForRepaymentEvent': [''],
'overDueDaysForRepaymentEvent': [''], 'overDueDaysForRepaymentEvent': [''],
'loanScheduleType': [LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE, Validators.required], 'loanScheduleType': [LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE, Validators.required],
'allowAccrualPostingInArrears': [false]
}); });
} }
@@ -3,6 +3,7 @@ import { Component, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { SearchData } from '../search.model';
/** /**
* Search Page Component * Search Page Component
@@ -16,7 +17,7 @@ export class SearchPageComponent {
/** Flags if number of search results exceed 200 */ /** Flags if number of search results exceed 200 */
overload: boolean; overload: boolean;
/** Datasource for loans disbursal table */ /** Datasource for loans disbursal table */
dataSource: MatTableDataSource<any>; dataSource: MatTableDataSource<SearchData>;
/** Displayed Columns for serach results */ /** Displayed Columns for serach results */
displayedColumns: string[] = ['entityType', 'entityName', 'entityAccount', 'externalId', 'parentType', 'parentName', 'details']; displayedColumns: string[] = ['entityType', 'entityName', 'entityAccount', 'externalId', 'parentType', 'parentName', 'details'];
/** Paginator for the table */ /** Paginator for the table */
@@ -31,6 +32,7 @@ export class SearchPageComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router) { private router: Router) {
this.route.data.subscribe(( data: { searchResults: any }) => { this.route.data.subscribe(( data: { searchResults: any }) => {
console.log(data.searchResults);
this.dataSource = new MatTableDataSource(data.searchResults); this.dataSource = new MatTableDataSource(data.searchResults);
this.dataSource.paginator = this.paginator; this.dataSource.paginator = this.paginator;
this.hasResults = (data.searchResults.length > 0); this.hasResults = (data.searchResults.length > 0);
@@ -45,7 +47,7 @@ export class SearchPageComponent {
* Returns link to entity view page. * Returns link to entity view page.
* @param {any} entity Entity * @param {any} entity Entity
*/ */
navigate(entity: any) { navigate(entity: SearchData) {
switch (entity.entityType) { switch (entity.entityType) {
case 'CLIENT': case 'CLIENT':
this.router.navigate(['clients', entity.entityId, 'general']); this.router.navigate(['clients', entity.entityId, 'general']);
@@ -60,7 +62,13 @@ export class SearchPageComponent {
this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]); this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]);
break; break;
case 'SAVING': case 'SAVING':
this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId, 'transactions']); if (entity.subEntityType === 'depositAccountType.recurringDeposit') {
this.router.navigate(['clients', entity.parentId, 'recurring-deposits-accounts', entity.entityId, 'transactions']);
} else if (entity.subEntityType === 'depositAccountType.fixedDeposit') {
this.router.navigate(['clients', entity.parentId, 'fixed-deposits-accounts', entity.entityId, 'transactions']);
} else if (entity.subEntityType === 'depositAccountType.savingsDeposit') {
this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId, 'transactions']);
}
break; break;
case 'LOAN': case 'LOAN':
this.router.navigate(['clients', entity.parentId, 'loans-accounts', entity.entityId, 'general']); this.router.navigate(['clients', entity.parentId, 'loans-accounts', entity.entityId, 'general']);
+19
View File
@@ -0,0 +1,19 @@
export interface SearchData {
entityId: number;
entityAccountNo: string;
entityExternalId: string;
entityName: string;
entityType: string;
parentId: number;
parentName: string;
entityStatus: EntityStatus;
parentType: string;
subEntityType: string;
}
export interface EntityStatus {
id: number;
code: string;
value: string;
}
@@ -40,7 +40,7 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
'center' : '/centers/', 'center' : '/centers/',
'shareAccount' : '/shares-accounts/', 'shareAccount' : '/shares-accounts/',
'fixedDeposit' : '/fixed-deposits-accounts/', 'fixedDeposit' : '/fixed-deposits-accounts/',
'recurringDepositAccount': '/recurringdeposits/', 'recurringDepositAccount': '/recurring-deposits-accounts/',
'savingsAccount' : '/savings-accounts/', 'savingsAccount' : '/savings-accounts/',
'shareProduct': '/products/share-products/', 'shareProduct': '/products/share-products/',
'loanProduct' : '/products/loan-products/' 'loanProduct' : '/products/loan-products/'