-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Asset Externalization Owner management for Loans (#1771)
Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
- Loading branch information
1 parent
1b60a8f
commit bddf46c
Showing
36 changed files
with
702 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
src/app/accounting/view-transaction/view-transaction.component.scss
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
src/app/accounting/view-transaction/view-transaction.component.spec.ts
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
src/app/loans/common-resolvers/external-asset-owner-active-transfer.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { ExternalAssetOwnerService } from '../external-asset-owner.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ExternalAssetOwnerActiveTransferResolver implements Resolve<boolean> { | ||
|
||
/** | ||
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service. | ||
*/ | ||
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { } | ||
|
||
/** | ||
* Returns the Loans with Association data. | ||
* @returns {Observable<any>} | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot): Observable<any> { | ||
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId'); | ||
return this.externalAssetOwnerService.retrieveExternalAssetOwnerActiveTransfer(loanId); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/app/loans/common-resolvers/external-asset-owner-journal-entry.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; | ||
import { Observable, of } from 'rxjs'; | ||
import { ExternalAssetOwnerService } from '../external-asset-owner.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ExternalAssetOwnerJournalEntryResolver implements Resolve<boolean> { | ||
|
||
/** | ||
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service. | ||
*/ | ||
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { } | ||
|
||
/** | ||
* Returns the Loans with Association data. | ||
* @returns {Observable<any>} | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot): Observable<any> { | ||
const transferId = route.paramMap.get('transferId') || route.parent.paramMap.get('transferId'); | ||
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransferJournalEntries(transferId); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/app/loans/common-resolvers/external-asset-owner.resolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; | ||
import { Observable } from 'rxjs'; | ||
import { ExternalAssetOwnerService } from '../external-asset-owner.service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ExternalAssetOwnerResolver implements Resolve<boolean> { | ||
|
||
/** | ||
* @param {ExternalAssetOwnerService} externalAssetOwnerService External Asset Owner service. | ||
*/ | ||
constructor(private externalAssetOwnerService: ExternalAssetOwnerService) { } | ||
|
||
/** | ||
* Returns the Loans with Association data. | ||
* @returns {Observable<any>} | ||
*/ | ||
resolve(route: ActivatedRouteSnapshot): Observable<any> { | ||
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId'); | ||
return this.externalAssetOwnerService.retrieveExternalAssetOwnerTransfers(loanId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { HttpClient, HttpParams } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ExternalAssetOwnerService { | ||
|
||
constructor(private http: HttpClient) { } | ||
|
||
/** | ||
* @param {string} loanId Loan Id | ||
* @param {string} command Command | ||
* @param {any} data Data | ||
* @returns {Observable<any>} | ||
*/ | ||
executeExternalAssetOwnerLoanCommand(loanId: string, data: any, command: string): Observable<any> { | ||
const httpParams = new HttpParams().set('command', command); | ||
return this.http.post(`/external-asset-owners/transfers/loans/${loanId}`, data, { params: httpParams }); | ||
} | ||
|
||
/** | ||
* @param {string} loanId Loan Id | ||
* @returns {Observable<any>} | ||
*/ | ||
retrieveExternalAssetOwnerTransfers(loanId: string): Observable<any> { | ||
const httpParams = new HttpParams().set('loanId', loanId); | ||
return this.http.get(`/external-asset-owners/transfers`, { params: httpParams }); | ||
} | ||
|
||
/** | ||
* @param {string} loanId Loan Id | ||
* @returns {Observable<any>} | ||
*/ | ||
retrieveExternalAssetOwnerActiveTransfer(loanId: string): Observable<any> { | ||
const httpParams = new HttpParams().set('loanId', loanId); | ||
return this.http.get(`/external-asset-owners/transfers/active-transfer`, { params: httpParams }); | ||
} | ||
|
||
/** | ||
* @param {string} transferId Transfer Id | ||
* @returns {Observable<any>} | ||
*/ | ||
retrieveExternalAssetOwnerTransferJournalEntries(transferId: string): Observable<any> { | ||
return this.http.get(`/external-asset-owners/transfers/${transferId}/journal-entries`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/app/loans/loans-view/external-asset-owner-tab/external-asset-owner-tab.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<div class="tab-container mat-typography"> | ||
<div fxLayout="row" fxLayoutAlign="start center"> | ||
|
||
<h3 fxFlex="90%">External Asset Owner</h3> | ||
|
||
<div fxFlex="10%" *ngIf="canBeSaled()" > | ||
<button mat-raised-button class="f-right" color="primary" (click)="saleLoan()" *mifosxHasPermission="'SALE_LOAN'"> | ||
<fa-icon icon="dollar-sign" class="m-r-10"></fa-icon>Sale Loan | ||
</button> | ||
</div> | ||
|
||
<div fxFlex="10%" *ngIf="canBeCancelled()" > | ||
<button mat-raised-button class="f-right" color="warn" (click)="cancelSaleLoan()" *mifosxHasPermission="'SALE_LOAN'"> | ||
<fa-icon icon="trash" class="m-r-10"></fa-icon>Cancel Sale Loan | ||
</button> | ||
</div> | ||
|
||
<div fxFlex="10%" *ngIf="canBeBuyed()" > | ||
<button mat-raised-button class="f-right" color="primary" (click)="buyBackLoan()" *mifosxHasPermission="'SALE_LOAN'"> | ||
<fa-icon icon="dollar-sign" class="m-r-10"></fa-icon>Buy Back Loan | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<table mat-table mat-sort [dataSource]="loanTransfersData" *ngIf="loanTransfersData.length>0"> | ||
|
||
<ng-container matColumnDef="status"> | ||
<th mat-header-cell *matHeaderCellDef> Status </th> | ||
<td mat-cell *matCellDef="let item"> | ||
<div [ngClass]="itemStatus(item.status)"> | ||
<fa-icon icon="stop"></fa-icon> | ||
<span class="m-l-10 status"> | ||
{{ item.status | translate }} | ||
</span> | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="effectiveFrom"> | ||
<th mat-header-cell *matHeaderCellDef> Effective From </th> | ||
<td mat-cell *matCellDef="let item"> {{ item.effectiveFrom | dateFormat }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="ownerExternalId"> | ||
<th mat-header-cell *matHeaderCellDef> Owner External Id </th> | ||
<td mat-cell *matCellDef="let item"> | ||
<mifosx-external-identifier externalId="{{item.owner.externalId}}"></mifosx-external-identifier> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="transferExternalId"> | ||
<th mat-header-cell *matHeaderCellDef> Transfer External Id </th> | ||
<td mat-cell *matCellDef="let item"> | ||
<mifosx-external-identifier externalId="{{item.transferExternalId}}"></mifosx-external-identifier> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="settlementDate"> | ||
<th mat-header-cell *matHeaderCellDef> Settlement Date </th> | ||
<td mat-cell *matCellDef="let item"> {{ item.settlementDate | dateFormat }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="purchasePriceRatio"> | ||
<th mat-header-cell *matHeaderCellDef> Purchase Price Ratio </th> | ||
<td mat-cell *matCellDef="let item"> {{ item.purchasePriceRatio | number }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="actions"> | ||
<th mat-header-cell class="center" *matHeaderCellDef> Actions </th> | ||
<td mat-cell *matCellDef="let item" class="center td-min-space"> | ||
<button class="account-action-button" *ngIf="!isPending(item)" mat-raised-button color="primary" matTooltip="View Journal Entries" | ||
matTooltipPosition="left" (click)="routeJournalEntry($event)" [routerLink]="['/', 'journal-entry', 'view-transfer', item.transferId]"> | ||
<i class="fa fa-arrow-circle-right"></i> | ||
</button> | ||
</td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="loanTransferColumns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: loanTransferColumns;"></tr> | ||
</table> | ||
</div> |
Oops, something went wrong.