<form id="formCompra" class="form-compra" action="/compras/save" method="post">
	<input type="hidden" name="id" id="idCompra" class="input-id" value="0" />
	<div class="form-group row">
		<label for="proveedor" class="col-2 col-form-label">Proveedor</label>
		<div class="col-4">
			<input type="hidden" name="id_proveedor" class="input-id-proveedor">
			<input type="text" name="proveedor" class="form-control input-proveedor" placeholder="Proveedor">
		</div>
		<label for="id_tipo_compra" class="col-2 col-form-label">Tipo de Compra</label>
		<div class="col-4">
			<select class="form-control select-tipo-compra" name="id_tipo_compra" id="id-tipo-compra">
				<option value="1">Factura</option>
				<option value="4">Factura No Afecta</option>
				<option value="2">Din</option>
				<option value="3">Factura Internacional</option>
				<option value="5">Nota de Débito</option>
				<option value="6">Nota de Crédito</option>
			</select>
		</div>
	</div>
	<div class="form-group row">
		<?php /*
		<label for="fecha" class="col-2 col-form-label" autocomplete="off">Fecha SII</label>
		<div class="col-4">
			<input type="date" name="fecha" id="fecha" class="form-control input-fecha" placeholder="Fecha">
		</div>
		*/ ?>
		<label for="fecha-recepcion" class="col-2 col-form-label" autocomplete="off">Fecha Recepción</label>
		<div class="col-4">
			<input type="date" name="fecha_recepcion" id="fecha-recepcion" class="form-control input-fecha-recepcion" placeholder="Fecha Recepción">
		</div>
		<label for="id_categoria" class="col-2 col-form-label">Categoría de Compra</label>
		<div class="col-4">
			<select class="form-control select-id-categoria-compra" name="id_categoria" id="select-id-categoria-compra">
				<option value="0">Seleccionar</option>
				<?php
					foreach($categorias_compras as $k => $v) {
						echo '<option value="' . $k . '">' . $v . '</option>';
					}
				?>
			</select>
		</div>
	</div>
	<div class="form-group row">
		<label for="folio" class="col-2 col-form-label">Folio</label>
		<div class="col-4">
			<input type="number" name="folio" class="form-control input-folio" placeholder="Folio">
		</div>
		<label for="id-almacen" class="col-2 col-form-label" autocomplete="off">Almacén Recepción</label>
		<div class="col-4">
			<select class="form-control select-id-almacen" name="id_almacen" id="id-almacen">
				<?php 
				foreach($almacenes as $k => $v) {
					echo '<option value="' . $k . '">' . $v . '</option>';
				} ?>
			</select>
		</div>
	</div>
	<div class="form-group row">
		<div class="col-6"></div>
		<div class="col-3">
			<input type="hidden" name="descuenta_iva" value="0">
			<input type="checkbox" name="descuenta_iva" class="check-descuenta-iva" value="1">
			<label for="descuenta_iva" class="col-form-label label-check">Iva</label>
		</div>

		<div class="col-3">
			<input type="hidden" name="contable" value="0">
			<input type="checkbox" name="contable" class="check-contable" value="1">
			<label for="contable" class="col-form-label label-check">Contable</label>
		</div>
	</div>
	<div class="lista-productos">
		<h5>Productos</h5>
	</div>
	<div class="row">
		<div class="col-lg-6 form-group row">
			<div class="col-12">
				<button type="button" class="btn btn-primary add-product"><i class="fas fa-plus"></i> Producto</button>
			</div>
		</div>
		<div class="col-lg-6 from-group row">
			<label for="descuento" class="col-5 col-form-label text-right">Descuento</label>
			<div class="col-5">
				<input type="number" name="descuento" class="form-control input-descuento" placeholder="0">
			</div>
			<div class="col-2">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6 form-group row">
		</div>
		<div class="col-lg-6 form-group row">
			<label for="total-neto" class="col-5 col-form-label text-right">Total Neto</label>
			<div class="col-5">
				<input type="number" name="total_neto" id="total-neto" class="form-control input-total-neto" placeholder="0">
			</div>
			<div class="col-2">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6 form-group row">
		</div>
		<div class="col-lg-6 form-group row">
			<label for="iva" class="col-5 col-form-label text-right">Iva</label>
			<div class="col-5">
				<input type="number" name="iva" id="iva" class="form-control input-iva" placeholder="0">
			</div>
			<div class="col-2">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6 form-group row">
		</div>
		<div class="col-lg-6 form-group row">
			<label for="exento" class="col-5 col-form-label text-right">Monto Exento</label>
			<div class="col-5">
				<input type="number" name="exento" id="exento" class="form-control input-exento" placeholder="0">
			</div>
			<div class="col-2">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6 form-group row">
		</div>
		<div class="col-lg-6 form-group row">
			<label for="descuento" class="col-5 col-form-label text-right">Total Compra</label>
			<div class="col-5">
				<input type="number" name="total" id="total" class="form-control input-total" readonly="readonly" placeholder="0">
			</div>
			<div class="col-2">
			</div>
		</div>
	</div>
	<div class="form-group row">
		<div class="col">
			<label for="observaciones" class="col-form-label">Observaciones</label>
			<div class="">
				<textarea class="form-control text-observaciones" name="observaciones" id="observaciones" rows="2"></textarea>
			</div>
		</div>
	</div>
	<div class="form-group row d-none">
		<div class="col-sm-12 text-right">
			<button type="submit" class="btn btn-primary btn-crear">Guardar</button>
		</div>
	</div>
</form>
<div class="copy d-none">
	<div class="row articulo-compra mb-2 border-bottom">
		<div class="col-lg-6 form-group row mb-2">
			<div class="col-9">
				<img class="imagen-producto" title="">
				<input type="hidden" name="id_producto[]" class="input-id-producto">
				<input type="text" name="nombre[]" class="form-control input-producto new" placeholder="Nombre">
			</div>
			<div class="col-3">
				<input type="number" name="cantidad[]" class="form-control input-cantidad" placeholder="Cantidad">
			</div>
		</div>
		<div class="col-lg-6 form-group row mb-2">
			<div class="col-5">
				<input type="number" name="costo_neto[]" class="form-control input-costo-neto" placeholder="Costo Neto">
			</div>
			<div class="col-5">
				<input type="number" name="costo_total[]" class="form-control input-costo-total" placeholder="Total">
			</div>
			<div class="col-2 text-right">
				<button type="button" class="btn btn-danger btn-delete btn-xs"><i class="fas fa-trash-alt"></i></button>
			</div>
		</div>
	</div>
</div>
<div class="alert-compra alert alert-warning mt-3 mb-0" style="display: none;"></div>
