<div class="row">
	<div class="card w-100">
		<div class="card-footer">
			<h4>
				<i class="fas fa-portrait"></i>
				Choferes
			</h4>
		</div>
		<div class="card-body" ng:show="spinner">
			<h4 class="text-center">
				<i class="fa fa-spin fa-spinner"></i>
				Cargando
			</h4>
		</div>
		<div class="card-body" ng:show="!spinner">
			<div class="row">
				<div class="col-xs-12 col-sm-6">
					<button class="btn btn-primary" ng:click="openModal(1)">
						<i class="fas fa-plus"></i>
						Agregar Chofer
					</button>
				</div>
				<div class="col-xs-12 col-sm-6">
					<input type="text" class="form-control" placeholder="Buscar" ng:model="search">
				</div>
			</div>
			<br>
			<div class="table-responsive table-responsive-vertical">
				<table class="table">
					<thead>
						<th class="text-center">Acciones</th>
						<th class="text-left">DNI</th>
						<th class="text-left">Nombre Completo</th>
						<th class="text-left">Licencia</th>
						<th class="text-left">Libreta</th>
						<th class="text-left">Nacionalidad</th>
						<th class="text-left"># Celular</th>
						<th class="text-center">Estado</th>
					</thead>
					<tbody>
						<tr ng:repeat="chofer in choferes | filter: search">
							<td class="text-center">
								<button class="btn btn-warning" ng:click="openModal(2,chofer)">
									<i class="fa fa-edit"></i>
								</button>
								<button class="btn btn-danger" ng:click="delete(chofer)">
									<i class="fa fa-trash"></i>
								</button>
							</td>
							<td class="text-left" ng:bind="chofer.documento_identidad"></td>
							<td class="text-left" ng:bind="chofer.nombres"></td>
							<td class="text-left" ng:bind="chofer.licencia"></td>
							<td class="text-left" ng:bind="chofer.libreta"></td>
							<td class="text-left" ng:bind="chofer.nacionalidad"></td>
							<td class="text-left" ng:bind="chofer.ncelular"></td>
							<td class="text-center">
								<span class="badge badge-success" ng:show="chofer.enabled">ACTIVO</span>
								<span class="badge badge-danger" ng:show="!chofer.enabled">INACTIVO</span>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<div class="modal fade" id="modal_edit" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
	    <div class="modal-content">
	      	<div class="modal-header">
	        	<h5 class="modal-title" ng:bind="modal.title"></h5>
	        	<button type="button" class="close" data-dismiss="modal" aria-label="Close">
	          		<span aria-hidden="true">&times;</span>
	        	</button>
	      	</div>
	      	<div class="modal-body">
	        	<form ng:submit="save()" id="form_edit" name="form_edit">
	        		<fieldset>
						
						<div class="form-group">
							<label for="">Documento de Identidad</label>	
							<input type="text" class="form-control" name="documento_identidad" ng:model="modal.model.documento_identidad" maxlength="8" minlength="8" numbers-only required>
							<small ng:show="modal.fails.documento_identidad" ng:repeat="fail in modal.fails.documento_identidad" ng:bind="fail" class="text-danger d-block"></small>
						</div>
						<div class="form-group">
							<label for="">Nombre Completo</label>	
							<input type="text" class="form-control" name="nombres" ng:model="modal.model.nombres" maxlength="150" required>
							<small ng:show="modal.fails.nombres" ng:repeat="fail in modal.fails.nombres" ng:bind="fail" class="text-danger d-block"></small>
						</div>
						
						
						<div class="form-group">
	        				<label for="">Nombres</label>	
	        				<input type="text" class="form-control" name="nombre" ng:model="modal.model.nombre" maxlength="150" required>
	        				<small ng:show="modal.fails.nombre" ng:repeat="fail in modal.fails.nombre" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>
						<div class="form-group">
	        				<label for="">Apellidos</label>	
	        				<input type="text" class="form-control" name="apellido" ng:model="modal.model.apellido" maxlength="150" required>
	        				<small ng:show="modal.fails.apellido" ng:repeat="fail in modal.fails.apellido" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>
						
	        			<div class="form-group">
	        				<label for="">Licencia</label>	
	        				<input type="text" class="form-control" name="licencia" ng:model="modal.model.licencia" required>
	        				<small ng:show="modal.fails.licencia" ng:repeat="fail in modal.fails.licencia" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>

						<div class="form-group">
	        				<label for=""># Celular</label>	
	        				<input type="text" class="form-control" name="ncelular" ng:model="modal.model.ncelular">
	        				<small ng:show="modal.fails.ncelular" ng:repeat="fail in modal.fails.ncelular" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>

	        			<div class="form-group">
	        				<label for="">Libreta</label>	
	        				<input type="text" class="form-control" name="libreta" ng:model="modal.model.libreta" required>
	        				<small ng:show="modal.fails.libreta" ng:repeat="fail in modal.fails.libreta" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>
	        			<div class="form-group">
	        				<label for="">País</label>	
	        				<select class="form-control" ng:options="pais.id as pais.nombre for pais in paises" ng:model="modal.model.pais_id" required>
	        					<option value="">Seleccionar</option>
	        				</select>
	        			</div>
	        			<div class="custom-control custom-checkbox mr-sm-2" ng:if="modal.edit">
					        <input type="checkbox" class="custom-control-input" id="customControlAutosizing" ng:model="modal.model.enabled">
					        <label class="custom-control-label" for="customControlAutosizing">Chofer Activo</label>
					   	</div>
	        		</fieldset>
	        	</form>
		    </div>
		    <div class="modal-footer">
	        	<button type="submit" class="btn btn-info btn-block" form="form_edit" ng:disabled="modal.spinner">
	        		<any ng:show="!modal.spinner">Guardar Datos</any>
	        		<any ng:show="modal.spinner">
	        			<i class="fa fa-spin fa-spinner"></i>
	        			Guardando
	        		</any>
	        	</button>
	      	</div>
	    </div>
	</div>
</div>