45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright since 2025 Mifos Initiative
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
/** Angular Imports */
|
|
import { Injectable, inject } from '@angular/core';
|
|
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
|
|
/** rxjs Imports */
|
|
import { Observable } from 'rxjs';
|
|
|
|
/** Custom Services */
|
|
import { SharesService } from '../shares.service';
|
|
|
|
/**
|
|
* Shares Account Actions data resolver.
|
|
*/
|
|
@Injectable()
|
|
export class ShareAccountActionsResolver {
|
|
private sharesService = inject(SharesService);
|
|
|
|
/**
|
|
* Returns the Shares account actions data.
|
|
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
|
* @returns {Observable<any>}
|
|
*/
|
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
const actionName = route.paramMap.get('name');
|
|
const shareAccountId = route.paramMap.get('shareAccountId') || route.parent.parent.paramMap.get('shareAccountId');
|
|
switch (actionName) {
|
|
case 'Apply Additional Shares':
|
|
case 'Redeem Shares':
|
|
case 'Approve Additional Shares':
|
|
case 'Reject Additional Shares':
|
|
return this.sharesService.getSharesAccountData(shareAccountId, true);
|
|
default:
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|