feat: savings account actions (approve) (#906)

Fixes: #905
This commit is contained in:
Karan Takalkar
2020-06-24 22:30:18 +05:30
committed by GitHub
parent 9d64300137
commit a9cd990184
13 changed files with 279 additions and 125 deletions
@@ -42,8 +42,8 @@
<ng-container *ngIf="buttonConfig.options">
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
<mat-menu #More="matMenu">
<span *ngFor="let button of buttonConfig.options">
<button mat-menu-item *mifosxHasPermission="button.taskPermissionName">{{button.name}}</button>
<span *ngFor="let option of buttonConfig.options">
<button mat-menu-item *mifosxHasPermission="option.taskPermissionName" (click)="doAction(option.name)">{{option.name}}</button>
</span>
</mat-menu>
</ng-container>
@@ -89,9 +89,12 @@ export class SavingsAccountViewComponent implements OnInit {
doAction(name: string) {
switch (name) {
case 'Approve':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Modify Application':
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
break;
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
break;
}
}
@@ -28,61 +28,61 @@ export class SavingsButtonsConfiguration {
setButtons(status: string) {
switch (status) {
case 'Active':
this.buttonsArray = [
{
name: 'Post Interest As On',
icon: 'fa fa-arrow-right',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
},
{
name: 'Deposit',
icon: 'fa fa-arrow-up',
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
},
{
name: 'Withdraw',
icon: 'fa fa-arrow-down',
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
},
{
name: 'Calculate Interest',
icon: 'fa fa-table',
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
}
];
break;
this.buttonsArray = [
{
name: 'Post Interest As On',
icon: 'fa fa-arrow-right',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
},
{
name: 'Deposit',
icon: 'fa fa-arrow-up',
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
},
{
name: 'Withdraw',
icon: 'fa fa-arrow-down',
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
},
{
name: 'Calculate Interest',
icon: 'fa fa-table',
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
}
];
break;
case 'Submitted and pending approval':
this.buttonsArray = [
{
name: 'Modify Application',
icon: 'fa fa-pencil ',
taskPermissionName: 'UPDATE_SAVINGSACCOUNT'
},
{
name: 'Approve',
icon: 'fa fa-check',
taskPermissionName: 'APPROVE_SAVINGSACCOUNT'
}
];
break;
this.buttonsArray = [
{
name: 'Modify Application',
icon: 'fa fa-pencil ',
taskPermissionName: 'UPDATE_SAVINGSACCOUNT'
},
{
name: 'Approve',
icon: 'fa fa-check',
taskPermissionName: 'APPROVE_SAVINGSACCOUNT'
}
];
break;
case 'Approved':
this.buttonsArray = [
{
name: 'Undo Approval',
icon: 'fa fa-undo',
taskPermissionName: 'APPROVALUNDO_SAVINGSACCOUNT'
},
{
name: 'Activate',
icon: 'fa fa-check',
taskPermissionName: 'ACTIVATE_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
icon: 'fa fa-plus',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
}
];
this.buttonsArray = [
{
name: 'Undo Approval',
icon: 'fa fa-undo',
taskPermissionName: 'APPROVALUNDO_SAVINGSACCOUNT'
},
{
name: 'Activate',
icon: 'fa fa-check',
taskPermissionName: 'ACTIVATE_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
icon: 'fa fa-plus',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
}
];
break;
default:
this.buttonsArray = [];
@@ -92,41 +92,41 @@ export class SavingsButtonsConfiguration {
setOptions(status: string) {
switch (status) {
case 'Active':
this.optionArray = [
{
name: 'Post Interest',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
},
{
name: 'Close',
taskPermissionName: 'CLOSE_SAVINGSACCOUNT'
}
];
break;
this.optionArray = [
{
name: 'Post Interest',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
},
{
name: 'Close',
taskPermissionName: 'CLOSE_SAVINGSACCOUNT'
}
];
break;
case 'Submitted and pending approval':
this.optionArray = [
{
name: 'Reject',
taskPermissionName: 'REJECT_SAVINGSACCOUNT'
},
{
name: 'Withdraw',
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
},
{
name: 'Delete',
taskPermissionName: 'DELETE_SAVINGSACCOUNT'
}
];
break;
this.optionArray = [
{
name: 'Reject',
taskPermissionName: 'REJECT_SAVINGSACCOUNT'
},
{
name: 'Withdraw',
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
},
{
name: 'Add Charge',
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
},
{
name: 'Delete',
taskPermissionName: 'DELETE_SAVINGSACCOUNT'
}
];
break;
case 'Approved':
default:
this.optionArray = [];