Skip to content

Commit

Permalink
Investor Search data with actions (#1859)
Browse files Browse the repository at this point in the history
Co-authored-by: Jose Alberto Hernandez <[email protected]>
  • Loading branch information
josehernandezfintecheandomx and Jose Alberto Hernandez authored Sep 6, 2023
1 parent 2bdcb69 commit e0b1aea
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Use Node.js 19
- name: Use Node.js 20
uses: actions/setup-node@v1
with:
# no support for lts as of now with github actions.
# issue link : https://github.com/actions/setup-node/issues/26
# lts/gallium node v19.7.0 (npm v9.5.0)
node-version: '19.7.0'
# lts/gallium node v20.5.1 (npm v9.8.0)
node-version: '20.5.1'
- name: Angular CLI install
run : npm install -g --silent @angular/[email protected]

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###############
### STAGE 1: Build app
###############
ARG BUILDER_IMAGE=node:19-alpine
ARG BUILDER_IMAGE=node:20-alpine
ARG NGINX_IMAGE=nginx:1.19.3

FROM $BUILDER_IMAGE as builder
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
dockerfile: Dockerfile
args:
- BUILD_ENVIRONMENT_OPTIONS=--configuration production
- BUILDER_IMAGE=node:16-alpine
- BUILDER_IMAGE=node:20-alpine
- NGINX_IMAGE=nginx:1.19.3
- NPM_REGISTRY_URL=https://registry.npmjs.org/
- PUPPETEER_DOWNLOAD_HOST_ARG=https://storage.googleapis.com
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/shell/shell.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export class ShellComponent implements OnInit, OnDestroy {
* Unsubscribes from progress bar.
*/
ngOnDestroy() {
this.progressBar$.unsubscribe();
if (this.progressBar$) {
this.progressBar$.unsubscribe();
}
}

}
21 changes: 15 additions & 6 deletions src/app/organization/investors/investors.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,19 @@
<span class="m-l-10 status">{{record.status}}</span>
</div>
</td>
<td> Owner ExternalId </td>
<td class="field-name"> Owner ExternalId </td>
<td>
<mifosx-external-identifier externalId="{{record.owner.externalId}}"></mifosx-external-identifier>
</td>
<td> Effective From </td>
<td class="field-name"> Transfer ExternalId </td>
<td>
<mifosx-external-identifier externalId="{{record.transferExternalId}}"></mifosx-external-identifier>
</td>
<td class="field-name"> Effective From </td>
<td> {{ record.effectiveFrom | dateFormat }} </td>
</tr>
</table>
</mat-panel-title>
<mat-panel-description>
<mifosx-external-identifier externalId="{{record.transferExternalId}}"></mifosx-external-identifier>
</mat-panel-description>

</mat-expansion-panel-header>

Expand Down Expand Up @@ -110,7 +111,7 @@
{{record.effectiveFrom | dateFormat}}
</td>
</tr>
<tr>
<tr *ngIf="record.details">
<td fxFlex="25%" class="m-l-5">
<b>Details :</b>
</td>
Expand Down Expand Up @@ -149,6 +150,14 @@
</table>
</div>

<mat-divider [inset]="true"></mat-divider>

<div class="record-actions" fxLayout="row" fxLayoutAlign="flex-end" *ngIf="canBeCancelled(record)">
<button mat-button color="warn" (click)="cancelPendingSale(record)" matTooltip="Cancel Pending Sale">
<fa-icon icon="trash"></fa-icon>
</button>
</div>

</mat-expansion-panel>
</mat-accordion>

Expand Down
11 changes: 11 additions & 0 deletions src/app/organization/investors/investors.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
color: black;
}

.field-name {
font-weight: 800;
}

.record-actions {
margin-top: 1%;
button{
margin-right: 1%;
}
}

.external-asset-transfer {
margin-top: 10px;
min-height: 160px;
Expand Down
29 changes: 29 additions & 0 deletions src/app/organization/investors/investors.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, OnInit, ViewChild } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
import { ExternalAssetOwner } from 'app/loans/services/external-asset-owner';
import { ExternalAssetOwnerService } from 'app/loans/services/external-asset-owner.service';
import { SettingsService } from 'app/settings/settings.service';
import { CancelDialogComponent } from 'app/shared/cancel-dialog/cancel-dialog.component';

@Component({
selector: 'mifosx-investors',
Expand Down Expand Up @@ -73,6 +76,8 @@ export class InvestorsComponent implements OnInit {
/** Columns to be displayed in investors table. */
displayedColumns: string[] = ['status', 'effectiveFrom', 'ownerExternalId', 'loanAccount', 'transferExternalId', 'settlementDate', 'purchasePriceRatio', 'totalAmount', 'actions'];
constructor(private settingsService: SettingsService,
private router: Router,
private dialog: MatDialog,
private externalAssetOwner: ExternalAssetOwner,
private externalAssetOwnerService: ExternalAssetOwnerService,
private dateUtils: Dates) { }
Expand Down Expand Up @@ -155,6 +160,30 @@ export class InvestorsComponent implements OnInit {
this.searchEAO();
}

cancelPendingSale(transfer: any): void {
const deleteDataTableDialogRef = this.dialog.open(CancelDialogComponent, {
data: { cancelContext: `the Asset Transfer with the Owner External Id ${transfer.owner.externalId} ` }
});
deleteDataTableDialogRef.afterClosed().subscribe((response: any) => {
if (response.cancel) {
const payload: any = {
transferExternalId: transfer.transferExternalId
};
this.externalAssetOwnerService.executeExternalAssetOwnerTransferCommand(transfer.transferId, payload, 'cancel')
.subscribe((result: any) => {
this.reload();
});
}
});
}

reload() {
const url: string = this.router.url;
console.log(url);
this.router.navigateByUrl(`/`, {skipLocationChange: true})
.then(() => this.router.navigate([url]));
}

private resetPaginator() {
this.currentPage = 0;
this.paginator.firstPage();
Expand Down

0 comments on commit e0b1aea

Please sign in to comment.