import { Component, Input } from '@angular/core';
import { TechlifyListingControllerInterface } from '../base-model';
import * as i0 from "@angular/core";
import * as i1 from "./user-client.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";
import * as i6 from "../user-client-enable-disable-button/user-client-enable-disable-button.component";
export class UserClientsListComponent extends TechlifyListingControllerInterface {
    constructor(service) {
        super();
        this.service = service;
        this.displayedColumns = [
            '#',
            'Name',
            'Added On',
            'Status',
            'Action'
        ];
    }
    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: UserClientsListComponent, deps: [{ token: i1.UserClientService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: UserClientsListComponent, selector: "app-user-clients-list", 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      <!-- Name Column -->\n      <ng-container matColumnDef=\"Name\">\n        <th mat-header-cell *matHeaderCellDef> Name </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.client?.name }}\n        </td>\n      </ng-container>\n\n      <!-- Added On Column -->\n      <ng-container matColumnDef=\"Added On\">\n        <th mat-header-cell *matHeaderCellDef> Added On </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.created_at | date }}\n        </td>\n      </ng-container>\n\n      <!-- Status Column -->\n      <ng-container matColumnDef=\"Status\">\n        <th mat-header-cell *matHeaderCellDef> Status </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.is_enabled ? 'Enabled' : 'Disabled' }}\n        </td>\n      </ng-container>\n\n      <!-- Action Column -->\n      <ng-container matColumnDef=\"Action\">\n        <th mat-header-cell *matHeaderCellDef> Action </th>\n        <td mat-cell *matCellDef=\"let element\">\n          <app-user-client-enable-disable-button\n            [userClient]=\"element\"\n            (saved)=\"reload()\"\n          ></app-user-client-enable-disable-button>\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: "component", type: i6.UserClientEnableDisableButtonComponent, selector: "app-user-client-enable-disable-button", inputs: ["userClient"], outputs: ["saved"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UserClientsListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-user-clients-list', 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      <!-- Name Column -->\n      <ng-container matColumnDef=\"Name\">\n        <th mat-header-cell *matHeaderCellDef> Name </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.client?.name }}\n        </td>\n      </ng-container>\n\n      <!-- Added On Column -->\n      <ng-container matColumnDef=\"Added On\">\n        <th mat-header-cell *matHeaderCellDef> Added On </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.created_at | date }}\n        </td>\n      </ng-container>\n\n      <!-- Status Column -->\n      <ng-container matColumnDef=\"Status\">\n        <th mat-header-cell *matHeaderCellDef> Status </th>\n        <td mat-cell *matCellDef=\"let element\">\n          {{ element?.is_enabled ? 'Enabled' : 'Disabled' }}\n        </td>\n      </ng-container>\n\n      <!-- Action Column -->\n      <ng-container matColumnDef=\"Action\">\n        <th mat-header-cell *matHeaderCellDef> Action </th>\n        <td mat-cell *matCellDef=\"let element\">\n          <app-user-client-enable-disable-button\n            [userClient]=\"element\"\n            (saved)=\"reload()\"\n          ></app-user-client-enable-disable-button>\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.UserClientService }], propDecorators: { user: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 