<div class="row">
	<div class="card w-100">
		<div class="card-footer">
			<h4>
				<i class="fas fa-portrait"></i>
				Clientes
			</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 Cliente
					</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">Tipo documento</th>
						<th class="text-left">N° Documento</th>
						<th class="text-left">Cliente</th>
						<th class="text-left">N° Celular</th>
						<th class="text-left">Email</th>
						<th class="text-center">Estado</th>
					</thead>
					<tbody>
						<tr ng:repeat="client in cliente | filter: search">
							<td class="text-center">
								<button class="btn btn-warning" ng:click="openModal(2,client)">
									<i class="fa fa-edit"></i>
								</button>
								<button class="btn btn-danger" ng:click="delete(client)">
									<i class="fa fa-trash"></i>
								</button>
							</td>
							<td class="text-left" ng:bind="client.tipodoc.tipo"></td>
							<td class="text-left" ng:bind="client.documento"></td>
							<td class="text-left" ng:bind="client.cliente"></td>
							<td class="text-left" ng:bind="client.celular"></td>
							<td class="text-left" ng:bind="client.email"></td>
							<td class="text-center">
								<span class="badge badge-success" ng:show="client.enabled">ACTIVO</span>
								<span class="badge badge-danger" ng:show="!client.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="">Tipo documento</label>	
	        				<select class="form-control" ng:options="tipo.id as tipo.tipo for tipo in tipodoc" ng:model="modal.model.tipo_doc" required>
	        					<option value="">Seleccionar</option>
	        				</select>
	        			</div>
	        		
	        			<div class="form-group">
	        				<label for="">N° documento</label>	
	        				<input type="text" class="form-control" name="documento" ng:model="modal.model.documento"  required>
	        				<small ng:show="modal.fails.documento" ng:repeat="fail in modal.fails.documento" ng:bind="fail" class="text-danger d-block"></small>
	        			</div>

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

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

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

						<div class="form-group">
	        				<label for="">E-mail</label>	
	        				<input type="text" class="form-control" name="email" ng:model="modal.model.email"  >
	        				<small ng:show="modal.fails.email" ng:repeat="fail in modal.fails.email" 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">Cliente 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>