import { Component, Input } from '@angular/core';
import { TechlifyListingControllerInterface } from '../../../base-model';
import * as i0 from "@angular/core";
import * as i1 from "../user-session.service";
import * as i2 from "@angular/common";
import * as i3 from "@angular/material/table";
import * as i4 from "@angular/material/card";
import * as i5 from "@angular/material/progress-bar";
export class UserSessionsComponent extends TechlifyListingControllerInterface {
    constructor(service) {
        super();
        this.service = service;
        this.displayedColumns = [
            '#',
            'Started On',
            'Expires At',
        ];
    }
    ngOnInit() {
        this.loadData();
    }
    loadData() {
        if (!this.user) {
            return;
        }
        this.isWorking = true;
        const params = {
            user_ids: this.user?.id,
        };
        this.service.index(params).subscribe({
            next: (response) => {
                this.models = this.models.concat(response?.data);
                this.isWorking = false;
            },
            error: () => (this.isWorking = false)
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UserSessionsComponent, deps: [{ token: i1.UserSessionService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: UserSessionsComponent, selector: "app-user-sessions", inputs: { user: "user" }, usesInheritance: true, ngImport: i0, template: "<mat-card>\n  <mat-card-content>\n    <table mat-table [dataSource]=\"models\" class=\"w-100\">\n\n      <!-- # Column -->\n      <ng-container matColumnDef=\"#\">\n        <th mat-header-cell *matHeaderCellDef> # </th>\n        <td mat-cell *matCellDef=\"let element; let i = index\"> {{ i + 1 }} </td>\n      </ng-container>\n\n      <!-- Started On Column -->\n      <ng-container matColumnDef=\"Started On\">\n        <th mat-header-cell *matHeaderCellDef> Started On </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.created_at | date:'medium' }}\n        </td>\n      </ng-container>\n\n      <!-- Expires At Column -->\n      <ng-container matColumnDef=\"Expires At\">\n        <th mat-header-cell *matHeaderCellDef> Expires At </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.expires_at | date:'medium' }}\n        </td>\n      </ng-container>\n\n      <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n      <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n    </table>\n\n    <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n\n  </mat-card-content>\n</mat-card>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i3.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i4.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i5.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UserSessionsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-user-sessions', template: "<mat-card>\n  <mat-card-content>\n    <table mat-table [dataSource]=\"models\" class=\"w-100\">\n\n      <!-- # Column -->\n      <ng-container matColumnDef=\"#\">\n        <th mat-header-cell *matHeaderCellDef> # </th>\n        <td mat-cell *matCellDef=\"let element; let i = index\"> {{ i + 1 }} </td>\n      </ng-container>\n\n      <!-- Started On Column -->\n      <ng-container matColumnDef=\"Started On\">\n        <th mat-header-cell *matHeaderCellDef> Started On </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.created_at | date:'medium' }}\n        </td>\n      </ng-container>\n\n      <!-- Expires At Column -->\n      <ng-container matColumnDef=\"Expires At\">\n        <th mat-header-cell *matHeaderCellDef> Expires At </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.expires_at | date:'medium' }}\n        </td>\n      </ng-container>\n\n      <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n      <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n    </table>\n\n    <mat-progress-bar mode=\"indeterminate\" *ngIf=\"isWorking\"></mat-progress-bar>\n\n  </mat-card-content>\n</mat-card>\n" }]
        }], ctorParameters: () => [{ type: i1.UserSessionService }], propDecorators: { user: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 