refactor: shares module (#1200)

See: #1196
This commit is contained in:
Karan Takalkar
2020-08-13 09:56:25 +05:30
committed by GitHub
parent 6f3b6c40e7
commit a1cd561453
18 changed files with 99 additions and 33 deletions
@@ -18,7 +18,7 @@ import { SharesService } from 'app/shares/shares.service';
export class ApplySharesComponent implements OnInit {
/** Shares account data. */
@Input() sharesAccountData: any;
sharesAccountData: any;
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
@@ -42,6 +42,9 @@ export class ApplySharesComponent implements OnInit {
private route: ActivatedRoute,
private router: Router) {
this.accountId = this.route.parent.snapshot.params['shareAccountId'];
this.route.data.subscribe((data: { shareAccountActionData: any }) => {
this.sharesAccountData = data.shareAccountActionData;
});
}
/**
@@ -21,7 +21,7 @@ import { SharesService } from 'app/shares/shares.service';
export class ApproveSharesComponent implements OnInit {
/** Shares account data. */
@Input() sharesAccountData: any;
sharesAccountData: any;
/** Shares account Id */
accountId: any;
@@ -46,6 +46,9 @@ export class ApproveSharesComponent implements OnInit {
private route: ActivatedRoute,
public dialog: MatDialog) {
this.accountId = this.route.parent.snapshot.params['shareAccountId'];
this.route.data.subscribe((data: { shareAccountActionData: any }) => {
this.sharesAccountData = data.shareAccountActionData;
});
}
/**
@@ -18,7 +18,7 @@ import { SharesService } from 'app/shares/shares.service';
export class RedeemSharesComponent implements OnInit {
/** Shares account data. */
@Input() sharesAccountData: any;
sharesAccountData: any;
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
@@ -42,6 +42,9 @@ export class RedeemSharesComponent implements OnInit {
private route: ActivatedRoute,
private router: Router) {
this.accountId = this.route.parent.snapshot.params['shareAccountId'];
this.route.data.subscribe((data: { shareAccountActionData: any }) => {
this.sharesAccountData = data.shareAccountActionData;
});
}
/**
@@ -21,7 +21,7 @@ import { SharesService } from 'app/shares/shares.service';
export class RejectSharesComponent implements OnInit {
/** Shares account data. */
@Input() sharesAccountData: any;
sharesAccountData: any;
/** Shares account Id */
accountId: any;
@@ -48,6 +48,9 @@ export class RejectSharesComponent implements OnInit {
private route: ActivatedRoute,
public dialog: MatDialog) {
this.accountId = this.route.parent.snapshot.params['shareAccountId'];
this.route.data.subscribe((data: { shareAccountActionData: any }) => {
this.sharesAccountData = data.shareAccountActionData;
});
}
/**
@@ -3,7 +3,7 @@
<mifosx-close-shares-account *ngIf="actions['Close']"></mifosx-close-shares-account>
<mifosx-activate-shares-account *ngIf="actions['Activate']"></mifosx-activate-shares-account>
<mifosx-undo-approval-shares-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-shares-account>
<mifosx-apply-shares [sharesAccountData]="sharesAccountData" *ngIf="actions['Apply Additional Shares']"></mifosx-apply-shares>
<mifosx-redeem-shares [sharesAccountData]="sharesAccountData" *ngIf="actions['Redeem Shares']"></mifosx-redeem-shares>
<mifosx-approve-shares [sharesAccountData]="sharesAccountData" *ngIf="actions['Approve Additional Shares']"></mifosx-approve-shares>
<mifosx-reject-shares [sharesAccountData]="sharesAccountData" *ngIf="actions['Reject Additional Shares']"></mifosx-reject-shares>
<mifosx-apply-shares *ngIf="actions['Apply Additional Shares']"></mifosx-apply-shares>
<mifosx-redeem-shares *ngIf="actions['Redeem Shares']"></mifosx-redeem-shares>
<mifosx-approve-shares *ngIf="actions['Approve Additional Shares']"></mifosx-approve-shares>
<mifosx-reject-shares *ngIf="actions['Reject Additional Shares']"></mifosx-reject-shares>
@@ -43,14 +43,9 @@ export class SharesAccountActionsComponent {
/**
* @param {ActivatedRoute} route Activated Route
*/
constructor(private route: ActivatedRoute,
private sharesService: SharesService) {
constructor(private route: ActivatedRoute) {
const name = this.route.snapshot.params['name'];
const accountId = this.route.parent.snapshot.params['shareAccountId'];
this.sharesService.getSharesAccountData(accountId, false).subscribe((response: any) => {
this.sharesAccountData = response;
this.actions[name] = true;
});
this.actions[name] = true;
}
}