src/app/workspaces/land-transactions/transactions-main-page/parts/land-transaction-tabbed-view.component.ts
/**
* @license
* Copyright (c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved.
*
* See LICENSE.txt in the project root for complete license information.
*/
import { Component, Input, Output, EventEmitter, OnChanges } from '@angular/core';
import { DateStringLibrary, isEmpty } from '@app/core';
import { Transaction, EmptyTransaction } from '@app/models';
@Component({
selector: 'emp-land-transaction-tabbed-view',
templateUrl: './land-transaction-tabbed-view.component.html'
})
export class LandTransactionTabbedViewComponent implements OnChanges {
@Input() transaction: Transaction = EmptyTransaction;
@Output() closeEvent = new EventEmitter<void>();
cardHint = '';
selectedTabIndex = 0;
ngOnChanges() {
this.setCardHint();
}
onClose() {
this.closeEvent.emit();
}
private setCardHint() {
let cardText = `<strong>${this.transaction.transactionID}</strong>`;
if (!!this.transaction.internalControlNo) {
cardText += ` | <strong>${this.transaction.internalControlNo}</strong> `;
}
if (!isEmpty(this.transaction.subtype)) {
cardText += ` | ${this.transaction.subtype.name}`;
}
if (!!this.transaction.presentationTime) {
const presentationTime = DateStringLibrary.format(this.transaction.presentationTime);
cardText += ` | Presentado el: ${presentationTime}`;
}
if (!!this.transaction.registrationTime) {
const registrationTime = DateStringLibrary.format(this.transaction.registrationTime, 'DMY HH:mm');
cardText += ` | Registrado el: ${registrationTime}`;
}
this.cardHint = cardText;
}
}