<div class="row">
	<div class="card w-100">
		<div class="card-footer">
			<h4>
				<i class="fa fa-street-view"></i>
				Rutas
			</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 Ruta
					</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">Descripcion</th>
						<th class="text-left">Pais</th>
						<th class="text-left">Departamento</th>
						<th class="text-left">Provincia</th>
						<th class="text-left">Distrito</th>
						<th class="text-center">Estado</th>
					</thead>
					<tbody>
						<tr ng:repeat="ruta in rutas | filter: search">
							<td class="text-center">
								<button class="btn btn-warning" ng:click="openModal(2,ruta)">
									<i class="fa fa-edit"></i>
								</button>
								<button class="btn btn-danger" ng:click="delete(ruta)">
									<i class="fa fa-trash"></i>
								</button>
							</td>
							<td class="text-left" ng:bind="ruta.descripcion"></td>
							<td class="text-left" ng:bind="ruta.pais"></td>
							<td class="text-left" ng:bind="ruta.departamento"></td>
							<td class="text-left" ng:bind="ruta.provincia"></td>
							<td class="text-left" ng:bind="ruta.distrito"></td>
							<td class="text-center">
								<span class="badge badge-success" ng:show="ruta.enabled">ACTIVO</span>
								<span class="badge badge-danger" ng:show="!ruta.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="">Descripción</label>	
	        				<input type="text" class="form-control" name="descripcion" ng:model="modal.model.descripcion"  required>
	        				<small ng:show="modal.fails.descripcion" ng:repeat="fail in modal.fails.descripcion" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>

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

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

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

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

						<div class="form-group">
	        				<label for="">Codigo SUNAT</label>	
	        				<input type="text" class="form-control" name="cod_sunat" ng:model="modal.model.cod_sunat"  >
	        				<small ng:show="modal.fails.cod_sunat" ng:repeat="fail in modal.fails.cod_sunat" ng:bind="fail" class="text-danger d-block"></small>
	        			</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">Ruta Activa</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>