bitwarden-estensione-browser/src/models/view/identityView.ts

87 lines
2.1 KiB
TypeScript
Raw Normal View History

2018-01-24 17:33:15 +01:00
import { View } from './view';
import { Identity } from '../domain/identity';
export class IdentityView implements View {
title: string;
middleName: string;
address1: string;
address2: string;
address3: string;
city: string;
state: string;
postalCode: string;
country: string;
company: string;
email: string;
phone: string;
ssn: string;
username: string;
passportNumber: string;
licenseNumber: string;
2018-01-24 22:58:34 +01:00
// tslint:disable
private _firstName: string;
private _lastName: string;
private _subTitle: string;
// tslint:enable
2018-01-24 17:33:15 +01:00
constructor(i?: Identity) {
// ctor
}
2018-01-24 22:58:34 +01:00
get firstName(): string {
return this._firstName;
}
set firstName(value: string) {
this._firstName = value;
this._subTitle = null;
}
get lastName(): string {
return this._lastName;
}
set lastName(value: string) {
this._lastName = value;
this._subTitle = null;
}
get subTitle(): string {
if (this._subTitle == null && (this.firstName != null || this.lastName != null)) {
this._subTitle = '';
if (this.firstName != null) {
this._subTitle = this.firstName;
}
if (this.lastName != null) {
if (this._subTitle !== '') {
this._subTitle += ' ';
}
this._subTitle += this.lastName;
}
}
return this._subTitle;
}
2018-01-25 20:26:09 +01:00
get fullName(): string {
if (this.title != null || this.firstName != null || this.middleName != null || this.lastName != null) {
let name = '';
if (this.title != null) {
name += (this.title + ' ');
}
if (this.firstName != null) {
name += (this.firstName + ' ');
}
if (this.middleName != null) {
name += (this.middleName + ' ');
}
if (this.lastName != null) {
name += this.lastName;
}
return name.trim();
}
return null;
}
2018-01-24 17:33:15 +01:00
}