32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
|
import { KeyValueComponent } from '@/shared/components';
|
|
import { licenseStatus } from '@/shared/localEnum/constants/licenseStatus';
|
|
import { Component, computed, inject } from '@angular/core';
|
|
import { Dialog } from 'primeng/dialog';
|
|
import { Message } from 'primeng/message';
|
|
import { ConsumerStore } from '../store/main.store';
|
|
|
|
@Component({
|
|
selector: 'consumer-license-info-dialog',
|
|
templateUrl: './license-info-dialog.component.html',
|
|
imports: [Dialog, KeyValueComponent, Message],
|
|
})
|
|
export class ConsumerLicenseInfoDialogComponent extends AbstractDialog {
|
|
private readonly store = inject(ConsumerStore);
|
|
|
|
license = computed(() => this.store.entity()?.license);
|
|
|
|
licenseStatus = computed(() => {
|
|
if (!this.store.entity()?.license?.expires_at) {
|
|
return null;
|
|
}
|
|
if (
|
|
new Date().toDateString() >
|
|
new Date(this.store.entity()?.license?.expires_at || '').toDateString()
|
|
) {
|
|
return licenseStatus.EXPIRED;
|
|
}
|
|
return licenseStatus.ACTIVE;
|
|
});
|
|
}
|