<div class="row">
	<div class="card w-100">
		<div class="card-footer">
			<h4>
				<i class="fa fa-store"></i>
				Consulta Venta
			</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(2)">
						<i class="fa fa-retweet"></i>
						Sincronizar con SUNAT
					</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">Pago Reg.</th>
						<th class="text-left">Detracción Reg.</th>

						<th class="text-left">Fecha Emision</th>
					
						
						<th class="text-left">Serie</th>
						<th class="text-center">Numero</th>
						<th class="text-center">RUC</th>
						<th class="text-center">Razon Social</th>
						<th class="text-center">Moneda</th>
						<th class="text-center">Base Imponible</th>
						<th class="text-center">IGV</th>
						<th class="text-center">Total</th>
					</thead>
					<tbody>
						<tr ng:repeat="venta in ventas | filter: search" ng-class="{'text-danger': venta.enabled == '0'}">
							
							<td class="text-center">
								<!--
								<button class="btn btn-primary" ng:click="openModal(1,venta)">
									<i class="fa fa-info-circle"></i>
								</button>	

								<button class="btn btn-danger" ng:click="openModal(2,venta)">
									<i class="fa fa-times"></i>
								</button>
								-->
								<div class="dropdown">
									<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
									</button>
									<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
									<a class="dropdown-item" ng:click="openModal(1,venta)" style="font-size: 20px;">
										<i class="fa fa-info-circle"></i>
										Detalle
									</a>
									<a class="dropdown-item" ng:click="deletebajafact(venta)" style="font-size: 20px;" ng:if="venta.enabled == '1'">
										<i class="fa fa-times"></i>
										Dar de baja
									</a>
									</div>
								</div>

							</td>
							
							<td class="text-left">
								<span class="badge badge-secondary" ng:show="!venta.id_formapago">NO</span>
								<span class="badge badge-success" ng:show="venta.id_formapago">SI</span>
							</td>

							<td class="text-left">
								<span class="badge badge-secondary" ng:show="!venta.iddetraccion">NO</span>
								<span class="badge badge-success" ng:show="venta.iddetraccion">SI</span>
							</td>

							<td class="text-left" ng:bind="venta.fecha | date: 'dd/MM/yyyy'"></td>
							<!--<td class="text-left" ng:bind="venta.tipodoc.tipo_abr"></td>-->
							<td class="text-left" ng:bind="venta.serie"></td>
							<td class="text-left" ng:bind="venta.numero"></td>
							<td class="text-left" ng:bind="venta.ruc"></td>
							<td class="text-left" ng:bind="venta.razonsocial"></td>
							<td class="text-left" ng:bind="venta.moneda"></td>
							<td class="text-left" ng:bind="venta.baseimponible"></td>
							<td class="text-left" ng:bind="venta.igv"></td>
							<td class="text-left" ng:bind="venta.total"></td>
							<!--
							<td class="text-center">

								<button ng:click="dowloadfile(guia)" ng:if="guia.file_attached">
									<i class="fa fa-download"></i>
								</button>
								
							</td>
							-->

						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>

<div class="modal fade bd-example-modal-lg" id="modal_edit" tabindex="-1" role="dialog">
	<div class="modal-dialog modal-lg" 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 id="form_edit" name="form_edit">
					<fieldset>
						<div class="form-group">
							<label><u><b>DATOS DE FACTURA</b></u></label>
							<table>
								<tr>
									<td> Fecha</td>
									<td class="text-center">:</td>
									<td class="text-left"ng:bind="modal.model.fecha | date: 'dd/MM/yy'"></td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Numero </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.serie + '-' + modal.model.numero"></td>
									</td>
								</tr>
								<tr>
									<td>Cliente</td>
									<td class="text-center">:</td>
									<td colspan="9" class="text-left" ng:bind="modal.model.razonsocial"></td>
								</tr>
								<tr>
									<td> Valor Venta</td>
									<td class="text-center">:</td>
									<td class="text-left"ng:bind="modal.model.baseimponible"></td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>IGV </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.igv"></td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Total </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.total"></td>
								</tr>
								

							</table>
						</div>
						<br>
						<div class="form-group">
							<label><u><b>DATOS DE PAGO</b></u></label>
							<table>
								<tr>
									<td> Pago registro</td>
									<td class="text-center">:</td>
									<td class="text-left">
										<span class="badge badge-secondary" ng:show="!modal.model.id_formapago">NO</span>
										<span class="badge badge-success" ng:show="modal.model.id_formapago">SI</span>
									</td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Forma pago </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.formapago.formapago"></td>
									</td>
								</tr>
								<tr>
									<td>Fecha pago</td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.fechapago | date: 'dd/MM/yy'"></td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Monto pagado</td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.montopago"></td>
									</td>
								</tr>
								<tr>
									<td>Detalle pago</td>
									<td class="text-center">:</td>
									<td colspan="9" class="text-left" ng:bind="modal.model.detallepago"></td>
								</tr>
							</table>
							

						</div>

						<br>
						<div class="form-group">
							<label><u><b>DATOS DE DETRACCION</b></u></label>
							<table>
								<tr>
									<td> Detracción registrada</td>
									<td class="text-center">:</td>
									<td class="text-left">
										<span class="badge badge-secondary" ng:show="!modal.model.iddetraccion">NO</span>
										<span class="badge badge-success" ng:show="modal.model.iddetraccion">SI</span>
									</td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>N° constancia detracción </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.iddetraccion"></td>
									</td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Fecha pago detracción </td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.fecdetraccion | date: 'dd/MM/yy'"></td>
									</td>
								</tr>
								<tr>
									<td>RUC Adquirente</td>
									<td class="text-center">:</td>
									<td class="text-left" ng:bind="modal.model.docdetraccion"></td>
									<td class="text-center">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
									<td>Adquirente</td>
									<td class="text-center">:</td>
									<td colspan="9" class="text-left" ng:bind="modal.model.razdetraccion"></td>
									</td>
								</tr>
								<tr>
									<td>Monto Deposito</td>
									<td class="text-center">:</td>
									<td colspan="9" class="text-left" ng:bind="modal.model.montodetraccion"></td>
								</tr>
							</table>
							

						</div>
					</fieldset>
				</form>
			</div>
			<div class="modal-footer">
				<button class="btn btn-info btn-block" ng:click="deletepago(modal.model)" ng:if="modal.model.id_formapago">
					<i class="fa fa-store"></i>
					<any ng:show="!modal.spinner">Eliminar pago</any>
					<any ng:show="modal.spinner">
						<i class="fa fa-spin fa-spinner"></i>
						eliminando pago
					</any>
				</button>
				<br>
				<button class="btn btn-info btn-block" ng:click="deletedetraccion(modal.model)" ng:if="modal.model.iddetraccion">
					<i class="fa fa-book"></i>
					<any ng:show="!modal.spinner">Eliminar detracción</any>
					<any ng:show="modal.spinner">
						<i class="fa fa-spin fa-spinner"></i>
						eliminando detracción
					</any>
				</button>
			</div>
		</div>
	</div>
</div>
