<kt-portlet>
	<kt-portlet-header [title]="(isNewRol)? 'Crear nuevo rol' : 'Editar rol'"
					   [class]="'kt-portlet__head--lg'">
		<div ktPortletTools class="d-flex">
			<button [routerLink]="(isNewRol)? ['../']: ['../../']"
					class="btn btn-primary kt-margin-r-10"
					[disabled]="loading"
					mat-raised-button matTooltip="Regresar">
				<i class="la la-arrow-left"></i>
				<span class="kt-hidden-mobile">Regresar</span>
			</button>
			<!--<button *ngxPermissionsOnly="(isNewRol)? 'web.roles.store' : 'web.roles.update'"-->
			<button class="btn btn-primary kt-margin-r-10" (click)="onSubmit()"
					[ngClass]="{'kt-spinner kt-spinner--right kt-spinner--md kt-spinner--light': loading}"
					[disabled]="loading"
					mat-raised-button matTooltip="{{(isNewRol) ? 'Guardar' : 'Actualizar'}} y salir">
				<i class="la la-save"></i>
				<span class="kt-hidden-mobile">{{(isNewRol) ? 'Guardar' : 'Actualizar'}}</span>
			</button>
		</div>
	</kt-portlet-header>

	<kt-portlet-body>
		<mat-tab-group [(selectedIndex)]="selectedTab">
			<mat-tab>
				<ng-template mat-tab-label>
					<!--i class="mat-tab-label-icon fa fa-building"></i--> Información básica
				</ng-template>
				<ng-template matTabContent>
					<!--begin::Form-->
					<!--<div *ngxPermissionsOnly="'web.roles.show'">-->
					<div>
						<div class="mat-table__bottom justify-content-center" *ngIf="isLoading">
							<mat-spinner [diameter]="25"></mat-spinner>
							<div class="mat-table__message ml-3">
								Espera un momento....
							</div>
						</div>
						<form [formGroup]="rolForm" class="kt-form kt-form--group-seperator-dashed"
							  [hidden]="isLoading">
							<div class="kt-form__section kt-form__section--first">
								<div class="form-group kt-form__group row">
									<div class="col-lg-4 kt-margin-bottom-20-mobile">
										<mat-form-field class="mat-form-field-fluid">
											<input matInput type="text" placeholder="Rol" formControlName="slug">
											<mat-hint *ngIf="isControlValid('slug')">Por favor introduce el
												<strong>rol</strong>
											</mat-hint>
											<mat-hint *ngIf="!isControlValid('slug')">
												<strong>Datos correctos</strong>
											</mat-hint>
											<mat-error *ngIf="isControlHasError('slug','required')">El campo es
												<strong>requerido</strong>
											</mat-error>
											<mat-error *ngIf="isControlHasError('slug','maxlength')">
												Debe contener máximo <strong>128</strong> caracteres
											</mat-error>
										</mat-form-field>
									</div>

									<div class="col-lg-4 kt-margin-bottom-20-mobile">
										<mat-form-field class="mat-form-field-fluid">
											<input matInput type="text" placeholder="Nombre" formControlName="name">
											<mat-hint *ngIf="isControlValid('name')">Por favor introduce el
												<strong>nombre</strong>
											</mat-hint>
											<mat-hint *ngIf="!isControlValid('name')">
												<strong>Datos correctos</strong>
											</mat-hint>
											<mat-error *ngIf="isControlHasError('name','required')">
												Debe contener máximo <strong>128</strong> caracteres
											</mat-error>
										</mat-form-field>
									</div>
								</div>

								<div class="form-group kt-form__group row">
									<div class="col-lg-5 kt-margin-bottom-20-mobile">
										<mat-checkbox formControlName="web">WEB</mat-checkbox>
										<mat-checkbox formControlName="movil" style="margin-left: 10px;">MOVIL</mat-checkbox>
									</div>
								</div>
							</div>
						</form>
						<app-permisos [permissions]="permissions"></app-permisos>

					</div>
					<!--end::Form-->
				</ng-template>
			</mat-tab>
		</mat-tab-group>
	</kt-portlet-body>
</kt-portlet>
