<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="nuevo-pedido-btn" type="button" class="btn btn-primary"><i class="fa fa-plus" style=""></i> Nuevo pedido</button>
					</div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="row m-t-md">
					<div id="pedidos-table-wrapper">
						<div class="table-responsive">
							<table id="pedidos-table" class="display table" style="width: 100%; cellspacing: 0;">
								<thead>
									<tr>
										<th>ID Pedido</th>
										<th>Fecha</th>
										<th>Cliente</th>
										<th>Vendedor</th>
										<th>Estado</th>
										<th>Acciones</th>
									</tr>
								</thead>
								<tbody>
									
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	 </div>
</div>
<script>
	$(document).ready(function(){
		pedidosapp.setUrl('<?php echo base_url();?>');
		$('#nuevo-pedido-btn').on('click', function(e) {
			Custombox.open({
				target:"<?php echo base_url('transacciones/pedido_nuevo')?>",
				effect: 'fadein',
				overlayClose:false
			});
			e.preventDefault();
		});
		
		$("#pedidos-table").DataTable({
			"processing": true,
			"order": [ 0, 'desc' ],
			"serverSide": true,
			"ajax": {
				"url": "<?php echo base_url();?>transacciones/cargar_pedidos",
				"type": "POST"
			},
			"columnDefs": [
				{ "width": "10%", "targets": 0 ,"searchable": true},
				{ "width": "20%", "targets": 1 ,"searchable": false},
				{ "width": "20%", "targets": 2 ,"searchable": false},
				{ "width": "15%", "targets": 3 ,"searchable": false},
				{ "width": "15%", "targets": 4 ,"searchable": false},
				{ "width": "20%", "className" : "myTableActionClass","orderable": false,"searchable": false, "targets": 5},
				{ "targets": 6,"orderable": false,"searchable": true,"visible": false},
				{ "targets": 7,"orderable": false,"searchable": true,"visible": false},
				{ "targets": 8,"orderable": false,"searchable": false,"visible": false},
			],
			"language": {
				"searchPlaceholder": "Nombre del Cliente",
				"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>