Files
cbsnexora/src/app/shared/account-number/account-number.component.ts
T
Ralph HopmanandAdam Saghy cac1d11ad7 build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
2025-01-15 11:59:30 +00:00

54 lines
1.2 KiB
TypeScript

import { Component, Input, OnInit } from '@angular/core';
import { Clipboard } from '@angular/cdk/clipboard';
@Component({
selector: 'mifosx-account-number',
templateUrl: './account-number.component.html',
styleUrls: ['./account-number.component.scss']
})
export class AccountNumberComponent implements OnInit {
@Input() accountNo: string;
@Input() display = 'right';
@Input() clientId: number | null = null;
@Input() accountId: number | null = null;
@Input() accountType: string | null = null;
iconVisible = false;
displayL = false;
displayR = true;
constructor(private clipboard: Clipboard) {}
ngOnInit(): void {
this.displayL = this.display === 'left';
this.displayR = this.display === 'right';
}
copyValue(): void {
this.clipboard.copy(this.accountNo);
}
mouseEnter() {
this.iconVisible = true;
}
mouseLeave() {
this.iconVisible = false;
}
getAccountLink(): string {
if (this.accountType) {
return `/#/clients/${this.clientId}/${this.getAccountType()}/${this.accountId}`;
}
return '';
}
private getAccountType(): string {
if (this.accountType === '1') {
return 'loan-accounts';
} else if (this.accountType === '2') {
return 'savings-accounts';
}
}
}