<kt-portlet>
	<kt-portlet-header [title]="titulo" [class]="'kt-portlet__head--lg'">
		<div ktPortletTools>
			<div class="div-group-show-hide-list">
				<div class="div-show-hide-list mr-1">
					<mat-spinner [diameter]="25" *ngIf="isLoading" class="mr-3"></mat-spinner>
					<mat-checkbox (change)="toggle($event)" style="margin-right: 20px">
						{{(deleted_at == '0') ? 'Mostrar eliminados' : 'Ocultar eliminados'}}
					</mat-checkbox>
				</div>
				<button [routerLink]="['../tipos-servicio/add']"  mat-raised-button class="btn btn-primary" matTooltip="Crear nuevo tipo de servicio" *ngxPermissionsOnly="'administrador.tipos_servicios.store'">
					<i class="la la-plus"></i>
					<span class="kt-hidden-mobile ml-2">Nuevo tipo de servicio</span>
				</button>
			</div>
		</div>
	</kt-portlet-header>

	<kt-portlet-body>

		<div class="kt-form kt-margin-b-30">
			<div class="kt-form__filtration">
				<div class="row align-items-center">
					<div class="col-md-1 kt-margin-bottom-10-mobile">
						<mat-form-field>
							<input matInput (keyup)="onKeyUp($event)" (keydown)="onKeyDown()" placeholder="Buscar..." class="mat-form-field mat-form-field-fluid">
							<mat-hint align="start">
								<strong>Buscar en todos los campos</strong>
							</mat-hint>
						</mat-form-field>
					</div>
				</div>
			</div>
		</div>

		<div class="mat-table__wrapper">
			<mat-table class="lmat-elevation-z8" [dataSource]="dataSourceTiposServicio" (matSortChange)="sort($event)" matSort matSortActive="id" matSortDirection="asc" matSortDisableClear>

				<ng-container matColumnDef="nombre">
					<mat-header-cell *matHeaderCellDef mat-sort-header>Nombre</mat-header-cell>
					<mat-cell *matCellDef="let tipos_servicio">{{tipos_servicio.nombre}}</mat-cell>
				</ng-container>

				<ng-container matColumnDef="created_at">
					<mat-header-cell *matHeaderCellDef mat-sort-header>Fecha</mat-header-cell>
					<mat-cell *matCellDef="let tipos_servicio">{{tipos_servicio.created_at}}</mat-cell>
				</ng-container>

				<ng-container matColumnDef="actions">
					<mat-header-cell *matHeaderCellDef></mat-header-cell>
					<mat-cell *matCellDef="let tipos_servicio" class="justify-content-center">
						<button mat-icon-button type="button" (click)="editTiposServicio(tipos_servicio.id)" class="btn-primary" matTooltip="Editar tipo de servicio" *ngxPermissionsOnly="'administrador.tipos_servicios.show'">
							<mat-icon>create</mat-icon>
						</button>&nbsp; &nbsp;
						<button mat-icon-button type="button" (click)="deleteTiposServicio(tipos_servicio)" class="btn-primary" matTooltip="{{!tipos_servicio.deleted_at ? 'Eliminar forma de pago' : 'Activar forma de pago'}}" *ngxPermissionsOnly="'administrador.tipos_servicios.destroy'">
							<mat-icon>{{!tipos_servicio.deleted_at ? 'delete' : 'done'}}</mat-icon>
						</button>
					</mat-cell>
				</ng-container>

				<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
				<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
			</mat-table>
			<div class="mat-table__message" *ngIf="dataSourceTiposServicio.data.length == 0">No se encontraron registros.</div>
			<div class="mat-table__message" *ngIf="showMessageWait">Espera un momento....</div>
		</div>

		<div class="mat-table__bottom">
			<mat-spinner [diameter]="25" *ngIf="isLoading"></mat-spinner>
			<mat-paginator [pageSize]="perPage" [pageSizeOptions]="pages" [length]="total" (page)="paginator($event)"></mat-paginator>
		</div>
	</kt-portlet-body>

</kt-portlet>
