Fix for account id parameter in account tabs (#1711)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
7b9e036f01
commit
0f450262b9
@@ -148,4 +148,12 @@ export class Datatables {
|
|||||||
return columnName;
|
return columnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isValidUrl(urlString: string): boolean {
|
||||||
|
try {
|
||||||
|
return Boolean(new URL(urlString));
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class LoanDatatableResolver implements Resolve<Object> {
|
|||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
|
const loanId = route.paramMap.get('loanId') || route.parent.parent.paramMap.get('loanId');
|
||||||
const datatableName = route.paramMap.get('datatableName');
|
const datatableName = route.paramMap.get('datatableName');
|
||||||
return this.loansService.getLoanDatatable(loanId, datatableName);
|
return this.loansService.getLoanDatatable(loanId, datatableName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ export class LoanDocumentsTabComponent implements OnInit {
|
|||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private loansService: LoansService,
|
private loansService: LoansService,
|
||||||
private settingsService: SettingsService) {
|
private settingsService: SettingsService) {
|
||||||
this.entityId = this.route.snapshot.params['loanId'];
|
this.entityId = this.route.parent.snapshot.params['loanId'];
|
||||||
|
|
||||||
this.route.data.subscribe((data: { loanDocuments: any }) => {
|
this.route.data.subscribe((data: { loanDocuments: any }) => {
|
||||||
this.getLoanDocumentsData(data.loanDocuments);
|
this.getLoanDocumentsData(data.loanDocuments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() { }
|
ngOnInit() { }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class NotesTabComponent implements OnInit {
|
|||||||
private authenticationService: AuthenticationService) {
|
private authenticationService: AuthenticationService) {
|
||||||
const savedCredentials = this.authenticationService.getCredentials();
|
const savedCredentials = this.authenticationService.getCredentials();
|
||||||
this.username = savedCredentials.username;
|
this.username = savedCredentials.username;
|
||||||
this.entityId = this.route.snapshot.params['loanId'];
|
this.entityId = this.route.parent.snapshot.params['loanId'];
|
||||||
this.route.data.subscribe((data: { loanNotes: any }) => {
|
this.route.data.subscribe((data: { loanNotes: any }) => {
|
||||||
this.entityNotes = data.loanNotes;
|
this.entityNotes = data.loanNotes;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ export class SavingAccountActionsComponent {
|
|||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute) {
|
constructor(private route: ActivatedRoute) {
|
||||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||||
this.currencyCode = data.savingsAccountActionData.currency.code;
|
if (data.savingsAccountActionData) {
|
||||||
|
this.currencyCode = data.savingsAccountActionData.currency.code;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const name = this.route.snapshot.params['name'];
|
const name = this.route.snapshot.params['name'];
|
||||||
this.actions[name] = true;
|
this.actions[name] = true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class NotesTabComponent implements OnInit {
|
|||||||
private authenticationService: AuthenticationService) {
|
private authenticationService: AuthenticationService) {
|
||||||
const savedCredentials = this.authenticationService.getCredentials();
|
const savedCredentials = this.authenticationService.getCredentials();
|
||||||
this.username = savedCredentials.username;
|
this.username = savedCredentials.username;
|
||||||
this.entityId = this.route.snapshot.params['savingAccountId'];
|
this.entityId = this.route.parent.snapshot.params['savingAccountId'];
|
||||||
this.route.data.subscribe((data: { savingAccountNotes: any }) => {
|
this.route.data.subscribe((data: { savingAccountNotes: any }) => {
|
||||||
this.entityNotes = data.savingAccountNotes;
|
this.entityNotes = data.savingAccountNotes;
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-3
@@ -30,7 +30,7 @@ export class SavingsDocumentsTabComponent implements OnInit {
|
|||||||
this.route.data.subscribe((data: { savingsDocuments: any }) => {
|
this.route.data.subscribe((data: { savingsDocuments: any }) => {
|
||||||
this.setSavingsDocumentsData(data.savingsDocuments);
|
this.setSavingsDocumentsData(data.savingsDocuments);
|
||||||
});
|
});
|
||||||
this.entityId = this.route.snapshot.params['savingAccountId'];
|
this.entityId = this.route.parent.snapshot.paramMap.get('savingAccountId');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -53,8 +53,8 @@ export class SavingsDocumentsTabComponent implements OnInit {
|
|||||||
this.entityDocuments = data;
|
this.entityDocuments = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadDocument(parentEntityId: string, documentId: string) {
|
downloadDocument(documentId: string) {
|
||||||
this.savingsService.downloadSavingsDocument(parentEntityId, documentId).subscribe(res => {
|
this.savingsService.downloadSavingsDocument(this.entityId, documentId).subscribe(res => {
|
||||||
const url = window.URL.createObjectURL(res);
|
const url = window.URL.createObjectURL(res);
|
||||||
window.open(url);
|
window.open(url);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class TransactionsTabComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataSource = new MatTableDataSource(this.transactionsData);
|
this.dataSource = new MatTableDataSource(this.transactionsData);
|
||||||
this.accountWithTransactions = (this.transactionsData.length > 0);
|
this.accountWithTransactions = (this.transactionsData && this.transactionsData.length > 0);
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -36,6 +36,12 @@
|
|||||||
{{dataObject.data[0].row[i]}}
|
{{dataObject.data[0].row[i]}}
|
||||||
</span>
|
</span>
|
||||||
<span *ngSwitchDefault>
|
<span *ngSwitchDefault>
|
||||||
|
<span class="m-r-5" *ngIf="isValidUrl(dataObject.data[0].row[i])">
|
||||||
|
<button mat-icon-button matTooltip="View Link" (click)="openSite(dataObject.data[0].row[i])"
|
||||||
|
matTooltipPosition="right" class="small-icon">
|
||||||
|
<fa-icon icon="eye" size="lg"></fa-icon>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
{{dataObject.data[0].row[i]}}
|
{{dataObject.data[0].row[i]}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+5
@@ -26,3 +26,8 @@
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.small-icon {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|||||||
+9
@@ -133,4 +133,13 @@ export class DatatableSingleRowComponent implements OnInit {
|
|||||||
getInputName(attr: string): string {
|
getInputName(attr: string): string {
|
||||||
return this.datatables.getName(attr);
|
return this.datatables.getName(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isValidUrl(urlString: string): boolean {
|
||||||
|
return this.datatables.isValidUrl(urlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
openSite(siteUrl: string) {
|
||||||
|
window.open(siteUrl, '_blank');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user