<kt-portlet>
	<kt-portlet-header [title]="(isNewVehiculo)? 'Crear nuevo vehículo' : 'Editar vehículo'"
					   [class]="'kt-portlet__head--lg'">
		<div ktPortletTools class="d-flex">
			<button [routerLink]="(isNewVehiculo)? ['../']: ['../../']"
					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="(isNewVehiculo)? 'administrador.vehiculos.store' : 'administrador.vehiculos.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="{{(isNewVehiculo) ? 'Guardar' : 'Actualizar'}} y salir">
				<i class="la la-save"></i>
				<span class="kt-hidden-mobile">{{(isNewVehiculo) ? '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="'administrador.formas_pagos.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]="vehiculosForm" 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="Número económico" formControlName="num_economico" required>
											<mat-hint *ngIf="isControlValid('num_economico')">Por favor introduce el
												<strong>Número económico</strong>
											</mat-hint>
											<mat-hint *ngIf="!isControlValid('num_economico')">
												<strong>Datos correctos</strong>
											</mat-hint>
											<mat-error *ngIf="isControlHasError('num_economico','required')">
												El campo es <strong>requerido</strong>
											</mat-error>
											<mat-error *ngIf="isControlHasError('num_economico','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="Descripción" formControlName="descripcion" required>
											<mat-hint *ngIf="isControlValid('descripcion')">Por favor introduce el
												<strong>Descripción</strong>
											</mat-hint>
											<mat-hint *ngIf="!isControlValid('descripcion')">
												<strong>Datos correctos</strong>
											</mat-hint>
											<mat-error *ngIf="isControlHasError('descripcion','required')">
												El campo es <strong>requerido</strong>
											</mat-error>
											<mat-error *ngIf="isControlHasError('descripcion','maxlength')">
												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-3 kt-margin-bottom-20-mobile">
										<mat-form-field class="mat-form-field-fluid">
											<mat-select formControlName="sucursal_id" placeholder="Sucursal">
												<mat-option>
													<ngx-mat-select-search (keyup)="onKeyUpManual($event, 'sucursal_id')"  (keydown)="onKeyDown('sucursal_id')" [noEntriesFoundLabel]="changeNoFoundLabel()" placeholderLabel="Buscar..." i18n-placeholderLabel formControlName="searchSucursal" [noEntriesFoundLabel]="changeNoFoundLabel()"></ngx-mat-select-search>
												</mat-option>
												<mat-option *ngFor="let sucursal of filteredSucursales|async" [value]="sucursal.id">
													{{sucursal.nombre}}
												</mat-option>
											</mat-select>
											<mat-error *ngIf="isControlHasError('sucursal_id', 'required')">
												El campo es <strong>requerido</strong>
											</mat-error>
										</mat-form-field>
									</div>

									<div class="col-lg-3 kt-margin-bottom-20-mobile">
										<mat-form-field class="mat-form-field-fluid">
											<mat-select formControlName="tipo_vehiculo_id" placeholder="Tipo Vehiculo">
												<mat-option>
													<ngx-mat-select-search (keyup)="onKeyUpManual($event, 'tipo_vehiculo')"  (keydown)="onKeyDown('tipo_vehiculo')" [noEntriesFoundLabel]="changeNoFoundLabel()" placeholderLabel="Buscar..." i18n-placeholderLabel formControlName="searchTipoVehiculo" [noEntriesFoundLabel]="changeNoFoundLabel()"></ngx-mat-select-search>
												</mat-option>
												<mat-option *ngFor="let tipo_vehiculo of filteredTiposVehiculos|async" [value]="tipo_vehiculo.id">
													{{tipo_vehiculo.nombre}}
												</mat-option>
											</mat-select>
											<mat-error *ngIf="isControlHasError('tipo_vehiculo_id', 'required')">
												El campo es <strong>requerido</strong>
											</mat-error>
										</mat-form-field>
									</div>
								</div>
							</div>
						</form>
                        <div>
                        </div>
					</div>
					<!--end::Form-->
				</ng-template>
			</mat-tab>
		</mat-tab-group>
	</kt-portlet-body>
</kt-portlet>
