<div class="row">
	<div class="col-md-12">
		<div class="ibox">
			<div class="ibox-content">
				<div class="row">
					<div class="col-md-12">
						<button id="nueva-venta-btn" type="button" class="btn btn-primary"><i class="fa fa-plus" style=""></i> Nueva venta</button>
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="row m-t-md">
					<div id="ventas-table-wrapper">
						<div class="table-responsive">
							<table id="ventas-table" class="display table" style="width: 100%; cellspacing: 0;">
								<thead>
									<tr>
										<th>ID Venta</th>
										<th>Fecha</th>
										<th>Cliente</th>
										<th>Vendedor</th>
										<th>Acciones</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>1</td>
										<td>30-08-2015 11:42</td>
										<td>Ronald Sifredo Amaya</td>
										<td>Carlos Ulises Portillo</td>
										<td>
											<button class="btn btn-info btn-xs" onclick="ventasapp.facturar(1)">Facturar</button>
											<button class="btn btn-warning btn-xs"  onclick="ventasapp.modificar(1)">Modificar</button>
											<button class="btn btn-danger btn-xs"  onclick="ventasapp.eliminar(1)">Eliminar</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	 </div>
</div>
<script>
	$(document).ready(function(){
		ventasapp.setUrl('<?php echo base_url();?>');
		$('#nueva-venta-btn').on('click', function(e) {
			Custombox.open({
				target:"<?php echo base_url('transacciones/venta_nueva')?>",
				effect: 'fadein',
				overlayClose:false
			});
			e.preventDefault();
		});
		
		$("#ventas-table").DataTable({
			"processing": true,
			"order": [ 0, 'desc' ],
			"serverSide": true,
			"ajax": {
				"url": "<?php echo base_url();?>transacciones/cargar_ventas",
				"type": "POST"
			},
			"columnDefs": [
				{ "width": "20%", "targets": 0 ,"searchable": true},
				{ "width": "20%", "targets": 1 ,"searchable": false},
				{ "width": "20%", "targets": 2 ,"searchable": false},
				{ "width": "20%", "targets": 3 ,"searchable": false},
				{ "width": "20%", "className" : "myTableActionClass","orderable": false,"searchable": false, "targets": 4},
				{ "targets": 5,"orderable": false,"searchable": false,"visible": false},
				{ "targets": 6,"orderable": false,"searchable": false,"visible": false}
			],
			"language": {
				"searchPlaceholder": "Numero de Transaccion",
				"emptyTable":     "",
				"lengthMenu": "Mostrar _MENU_ registros por pagina",
				"zeroRecords": "",
				"info": "Pagina _PAGE_ de _PAGES_",
				"infoEmpty": "No hay registros",
				"infoFiltered": "(Ningun resultado encontrado de _MAX_ registros)",
				"search":         "Buscar:",
				"processing":     '<div class="sk-circle"><div class="sk-circle1 sk-child"></div><div class="sk-circle2 sk-child"></div><div class="sk-circle3 sk-child"></div><div class="sk-circle4 sk-child"></div><div class="sk-circle5 sk-child"></div><div class="sk-circle6 sk-child"></div><div class="sk-circle7 sk-child"></div><div class="sk-circle8 sk-child"></div><div class="sk-circle9 sk-child"></div><div class="sk-circle10 sk-child"></div><div class="sk-circle11 sk-child"></div><div class="sk-circle12 sk-child"></div></div>',
				"loadingRecords": '<div class="sk-circle"><div class="sk-circle1 sk-child"></div><div class="sk-circle2 sk-child"></div><div class="sk-circle3 sk-child"></div><div class="sk-circle4 sk-child"></div><div class="sk-circle5 sk-child"></div><div class="sk-circle6 sk-child"></div><div class="sk-circle7 sk-child"></div><div class="sk-circle8 sk-child"></div><div class="sk-circle9 sk-child"></div><div class="sk-circle10 sk-child"></div><div class="sk-circle11 sk-child"></div><div class="sk-circle12 sk-child"></div></div>',
				"paginate": {
					"first":      "Primero",
					"last":       "Ultimo",
					"next":       "Siguiente",
					"previous":   "Anterior"
				}
			},
			"bAutoWidth": false
		});
		
	});
</script>