refactor: savings module (#1226)

See: #1196
This commit is contained in:
Karan Takalkar
2020-08-25 17:46:54 +05:30
committed by GitHub
parent f215e1aa96
commit efdd779aa9
30 changed files with 129 additions and 103 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ const routes: Routes = [
}
},
{
path: 'savingsaccounts',
path: 'savings-accounts',
loadChildren: () => import('../savings/savings.module').then(m => m.SavingsModule)
}
]
@@ -65,7 +65,9 @@
<button mat-raised-button *mifosxHasPermission="'CREATE_GROUP'"><i class="fa fa-plus"></i> Add Group </button>
<button mat-raised-button *mifosxHasPermission="'ASSOCIATEGROUPS_CENTER'" (click)="doAction('Manage Groups')"> <i class="fa fa-edit"></i> Manage Groups </button>
<span *ngIf="centerViewData.active">
<button mat-raised-button *mifosxHasPermission="'CREATE_SAVINGSACCOUNT'"> <i class="fa fa-file"></i> Centers Saving Application</button>
<button mat-raised-button *mifosxHasPermission="'CREATE_SAVINGSACCOUNT'" [routerLink]="['savings-accounts', 'create']">
<i class="fa fa-file"></i> Centers Saving Application
</button>
</span>
<button mat-raised-button [matMenuTriggerFor]="More"> More </button>
<mat-menu #More="matMenu">
@@ -19,6 +19,7 @@
<!-- Groups -->
<ng-container *ngIf="groupResourceData.length > 0">
<h3>Groups</h3>
<table mat-table [dataSource]="groupResourceData" matSort>
@@ -49,6 +50,7 @@
<tr mat-row *matRowDef="let row; columns: groupsColumns;" [routerLink]="['/groups', row.id, 'general']"></tr>
</table>
</ng-container>
<!-- savings overview table -->
@@ -78,63 +80,51 @@
</ng-container>
<ng-container matColumnDef="Actions">
<th mat-header-cell *matHeaderCellDef> Actions </th>
<td mat-cell *matCellDef="let element">
<ng-container *ngIf="element.status.active">
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '100'">
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '100'"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Deposit']">
<i class="fa fa-arrow-right" matTooltip="Deposit"></i>
</button>
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '300'">
<i class="fa fa-arrow-right" matTooltip[="Deposit"]></i>
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '300'"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Deposit']">
<i class="fa fa-arrow-right" matTooltip="Deposit"></i>
</button>
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '100'">
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '100'"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Withdrawal']">
<i class="fa fa-arrow-left" matTooltip="Withdraw"></i>
</button>
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '300'">
<button class="account-action-button" mat-raised-button color="primary" *ngIf="element.depositType.id == '300'"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Withdrawal']">
<i class="fa fa-arrow-left" matTooltip="Withdraw"></i>
</button>
</ng-container>
<ng-container *ngIf="element.status.submittedAndPendingApproval">
<button class="account-action-button" mat-raised-button color="primary">
<button class="account-action-button" mat-raised-button color="primary"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Approve']">
<i class="fa fa-check" matTooltip="Approve"></i>
</button>
</ng-container>
<ng-container *ngIf="!element.status.submittedAndPendingApproval && !element.status.active">
<button class="account-action-button" mat-raised-button color="primary">
<button class="account-action-button" mat-raised-button color="primary"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Undo Approval']">
<i class="fa fa-undo" matTooltip="Undo Approve"></i>
</button>
<button class="account-action-button" mat-raised-button color="primary">
<button class="account-action-button" mat-raised-button color="primary"
(click)="routeEdit($event)" [routerLink]="['../','savings-accounts', element.id, 'actions', 'Activate']">
<i class="fa fa-power-off" matTooltip="Activate"></i>
</button>
</ng-container>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="savingsAccountColumns"></tr>
<tr mat-row *matRowDef="let row; columns: savingsAccountColumns;" [routerLink]="['../', 'savingsaccounts', row.id, 'transactions']"></tr>
<tr mat-row *matRowDef="let row; columns: savingsAccountColumns;" [routerLink]="['../', 'savings-accounts', row.id, 'transactions']"></tr>
</table>
</ng-container>
</ng-container>
</ng-container>
</div>
@@ -45,4 +45,13 @@ export class GeneralTabComponent implements OnInit {
ngOnInit() {
}
/**
* Stops the propagation to view pages.
* @param $event Mouse Event
*/
routeEdit($event: MouseEvent) {
$event.stopPropagation();
}
}