- Account #: {{savingsAccountData.accountNo}} | Client Name: {{savingsAccountData.clientName}}
+ Account #: {{savingsAccountData.accountNo}} | {{entityType}} Name: {{savingsAccountData.clientName || savingsAccountData.groupName}}
Current Balance: {{savingsAccountData.currency.displaySymbol}} {{savingsAccountData.summary.accountBalance}}
Available Balance: {{savingsAccountData.currency.displaySymbol}} {{savingsAccountData.summary.availableBalance}}
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 d14801564..130a4ce80 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
@@ -29,6 +29,8 @@ export class SavingsAccountViewComponent implements OnInit {
savingsDatatables: any;
/** Button Configurations */
buttonConfig: SavingsButtonsConfiguration;
+ /** Entity Type */
+ entityType: string;
/**
* Fetches savings account data from `resolve`
@@ -44,6 +46,13 @@ export class SavingsAccountViewComponent implements OnInit {
this.savingsAccountData = data.savingsAccountData;
this.savingsDatatables = data.savingsDatatables;
});
+ if (this.router.url.includes('clients')) {
+ this.entityType = 'Client';
+ } else if (this.router.url.includes('groups')) {
+ this.entityType = 'Group';
+ } else if (this.router.url.includes('centers')) {
+ this.entityType = 'Center';
+ }
}
ngOnInit() {
@@ -101,13 +110,13 @@ export class SavingsAccountViewComponent implements OnInit {
/**
- * Refetches data fot the component
+ * Refetches data foe the component
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
*/
- reload() {
- const clientId = this.savingsAccountData.clientId;
+ private reload() {
const url: string = this.router.url;
- this.router.navigateByUrl(`/clients/${clientId}/savingsaccounts`, {skipLocationChange: true})
+ const refreshUrl: string = this.router.url.slice(0, this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length);
+ this.router.navigateByUrl(refreshUrl, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
}
@@ -135,7 +144,7 @@ export class SavingsAccountViewComponent implements OnInit {
this.router.navigate([`actions/Withdrawal`], { relativeTo: this.route });
break;
case 'Modify Application':
- this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
+ this.router.navigate(['edit'], { relativeTo: this.route });
break;
case 'Delete':
this.deleteSavingsAccount();
diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
index 6567c826f..336fa45e7 100644
--- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
+++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
@@ -5,7 +5,7 @@
All Transactions
-
+
diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
index 9f2aa7aeb..3c9439bab 100644
--- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
+++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
@@ -29,7 +29,7 @@ export class TransactionsTabComponent implements OnInit {
constructor(private route: ActivatedRoute,
private router: Router) {
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
- this.transactionsData = data.savingsAccountData.transactions.filter((transaction: any) => !transaction.reversed);
+ this.transactionsData = data.savingsAccountData.transactions?.filter((transaction: any) => !transaction.reversed);
this.status = data.savingsAccountData.status.value;
});
}
diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.ts b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts
index eef77026d..d0f7808d8 100644
--- a/src/app/savings/savings-account-view/view-charge/view-charge.component.ts
+++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts
@@ -49,7 +49,7 @@ export class ViewChargeComponent {
this.route.data.subscribe((data: { savingsAccountCharge: any }) => {
this.chargeData = data.savingsAccountCharge;
});
- this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
+ this.route.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsAccountData = data.savingsAccountData;
});
}
@@ -194,9 +194,9 @@ export class ViewChargeComponent {
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
*/
private reload() {
- const clientId = this.savingsAccountData.clientId;
const url: string = this.router.url.replace(`/${this.chargeData.id}`, '');
- this.router.navigateByUrl(`/clients/${clientId}/savingsaccounts`, {skipLocationChange: true})
+ const refreshUrl: string = this.router.url.slice(0, this.router.url.indexOf('savings-accounts') + 'savings-accounts'.length);
+ this.router.navigateByUrl(refreshUrl, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
}
diff --git a/src/app/savings/savings-routing.module.ts b/src/app/savings/savings-routing.module.ts
index a5dd0ff41..0743f5d48 100644
--- a/src/app/savings/savings-routing.module.ts
+++ b/src/app/savings/savings-routing.module.ts
@@ -32,14 +32,14 @@ import { SavingsAccountActionsResolver } from './common-resolvers/savings-accoun
import { SavingsTransactionRecieptResolver } from './common-resolvers/savings-transaction-reciept.resolver';
import { SavingsAccountTransactionTemplateResolver } from './common-resolvers/savings-account-transaction-template.resolver';
-
+/** Savings Routes */
const routes: Routes = [
{
path: '',
data: { title: extract('All Savings'), breadcrumb: 'Savings', routeParamBreadcrumb: false },
children: [
{
- path: 'create-savings-account',
+ path: 'create',
data: { title: extract('Create Savings Account'), breadcrumb: 'Create Savings Account' },
component: CreateSavingsAccountComponent,
resolve: {
@@ -49,14 +49,12 @@ const routes: Routes = [
{
path: ':savingAccountId',
data: { title: extract('Saving Account View'), routeParamBreadcrumb: 'savingAccountId' },
- resolve: {
- savingsAccountData: SavingsAccountViewResolver
- },
children: [
{
path: '',
component: SavingsAccountViewComponent,
resolve: {
+ savingsAccountData: SavingsAccountViewResolver,
savingsDatatables: SavingsDatatablesResolver
},
children: [
@@ -101,7 +99,7 @@ const routes: Routes = [
]
},
{
- path: 'edit-savings-account',
+ path: 'edit',
data: { title: extract('Edit Savings Account'), breadcrumb: 'Edit', routeParamBreadcrumb: false },
component: EditSavingsAccountComponent,
resolve: {
@@ -164,6 +162,7 @@ const routes: Routes = [
data: { routeParamBreadcrumb: 'id' },
component: ViewChargeComponent,
resolve: {
+ savingsAccountData: SavingsAccountViewResolver,
savingsAccountCharge: SavingsAccountChargeResolver
}
}
diff --git a/src/app/savings/savings.service.ts b/src/app/savings/savings.service.ts
index 94ebf49f8..f9836d399 100644
--- a/src/app/savings/savings.service.ts
+++ b/src/app/savings/savings.service.ts
@@ -140,11 +140,11 @@ export class SavingsService {
}
/**
- * @param clientId Client Id assosciated with savings account.
+ * @param entityId Entity Id assosciated with savings account.
* @returns {Observable} Savings account template.
*/
- getSavingsAccountTemplate(clientId: string, productId?: string): Observable {
- let httpParams = new HttpParams().set('clientId', clientId);
+ getSavingsAccountTemplate(entityId: string, productId?: string, isGroup?: boolean): Observable {
+ let httpParams = new HttpParams().set( isGroup ? 'groupId' : 'clientId', entityId);
httpParams = productId ? httpParams.set('productId', productId) : httpParams;
return this.http.get('/savingsaccounts/template', { params: httpParams });
}
diff --git a/src/app/search/search-page/search-page.component.ts b/src/app/search/search-page/search-page.component.ts
index 42f1afb41..be891e64e 100644
--- a/src/app/search/search-page/search-page.component.ts
+++ b/src/app/search/search-page/search-page.component.ts
@@ -51,7 +51,7 @@ export class SearchPageComponent {
this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]);
break;
case 'SAVING':
- this.router.navigate(['clients', entity.parentId, 'savingsaccounts', entity.entityId]);
+ this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId]);
break;
case 'LOAN':
this.router.navigate(['clients', entity.parentId, 'loans', entity.entityId]);
diff --git a/src/app/shared/notifications-tray/notifications-tray.component.ts b/src/app/shared/notifications-tray/notifications-tray.component.ts
index b41b2c7fd..26c824ed6 100644
--- a/src/app/shared/notifications-tray/notifications-tray.component.ts
+++ b/src/app/shared/notifications-tray/notifications-tray.component.ts
@@ -39,7 +39,7 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
'shareAccount' : '/shares-accounts/',
'fixedDeposit' : '/fixed-deposits-accounts/',
'recurringDepositAccount': '/recurringdeposits/',
- 'savingsAccount' : '/savingsaccounts/',
+ 'savingsAccount' : '/savings-accounts/',
'shareProduct': '/products/share-products/',
'loanProduct' : '/products/loan-products/'
};