File
Implements
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Methods
Private
getLogo
|
getLogo()
|
|
|
import { Component, Input, OnInit } from '@angular/core';
import { SafeUrl } from '@angular/platform-browser';
import 'rxjs/add/operator/filter';
import { filter } from '../../../../../node_modules/rxjs/operators';
import { TemplateType } from '../../../enums/template-type.enum';
import { Template } from '../../../models';
import { TemplateService } from '../../../providers';
import { FILogoService } from '../../../providers/services/fi-logo.service';
@Component({
selector: 'app-template-label',
templateUrl: './template-label.component.html',
styleUrls: ['./template-label.component.css']
})
export class TemplateLabelComponent implements OnInit {
template: Template;
@Input()
id: string;
@Input()
type: TemplateType = TemplateType.Debit;
logoUrl: SafeUrl;
constructor(
private templateService: TemplateService,
private logoService: FILogoService
) {}
ngOnInit() {
this.templateService.templates$
.pipe(
filter(
templates =>
templates !== null &&
templates !== undefined &&
templates.length > 0
)
)
.subscribe(templates => {
const template = templates.filter(t => t.id === this.id)[0];
if (template === null || template === undefined) {
return;
}
this.template = template;
this.getLogo();
});
}
private getLogo() {
if (
this.template.accountCategory === null ||
this.template.accountCategory === undefined ||
this.template.accountCategory !== 'CustomerEntered'
) {
return;
}
const routingNumber = this.template.routingNumber;
if (
routingNumber === null ||
routingNumber === undefined ||
routingNumber.length !== 9
) {
return;
}
this.logoService.getlogo(routingNumber).subscribe(url => {
this.logoUrl = url;
});
}
}
<span *ngIf="template">
<p class="items-list-name">
<img *ngIf="logoUrl" [src]="logoUrl" class="fi-logo" />
<span *ngIf="!template.displayName || template.displayName.length < 1">{{template.name}}</span>
<span *ngIf="template.displayName && template.displayName.length > 0">{{template.displayName}}</span>
- {{template.accountNumber | mask}}
</p>
<p *ngIf="template.needsVerified && !template.isFrozen" class="items-list-status not-verified">
<a id="depositVerificationRequiredLabel" [routerLink]="['/verify', template.id]">Deposit Verification Required</a>
</p>
<p *ngIf="!template.needsVerified" class="items-list-status verified">
<span id="canSend" *ngIf="template.canDebit">Send</span>
<span *ngIf="template.canDebit && template.canCredit">And</span>
<span id="canReceive" *ngIf="template.canCredit">Receive</span>
Money
</p>
<p id="accountForzenLabel" *ngIf="template.isFrozen" class="items-list-status not-verified">Account is Frozen</p>
</span>
img.fi-logo {
margin-right: 5px;
width: 60px;
}
Legend
Html element with directive