1 2 $(function () { 3 $(".tablaProdBolsa").DataTable({ 4 "ajax": "ajax/agregarBolsaAutomatica.ajax.php", 5 "deferRender": true, 6 "retrieve": true, 7 "processing": true, 8 9 "language":{ 10 "sProcessing": "Procesando...", 11 "sLengthMenu": "Mostrar _MENU_ registros", 12 "sZeroRecords": "No se encontraron resultados", 13 "sEmptyTable": "Ningún dato disponible en esta tabla", 14 "sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_", 15 "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0", 16 "sInfoFiltered": "(filtrado de un total de _MAX_ registros)", 17 "sInfoPostFix": "", 18 "sSearch": "Buscar:", 19 "sUrl": "", 20 "sInfoThousands": ",", 21 "sLoadingRecords": "Cargando...", 22 "oPaginate": { 23 "sFirst": "Primero", 24 "sLast": "Ãltimo", 25 "sNext": "Siguiente", 26 "sPrevious": "Anterior" 27 }, 28 "oAria": { 29 "sSortAscending": ": Activar para ordenar la columna de manera ascendente", 30 "sSortDescending": ": Activar para ordenar la columna de manera descendente" 31 } 32 }, 33 }); 34 }); 35 36 37 /*============================================= 38AGREGANDO PRODUCTOS A LA VENTA DESDE LA TABLA 39=============================================*/ 40 41$(".tablaProdBolsa").on("click", "button.agregarProducto", function(){ 42 43 var idProductoCa = $(this).attr("idProductoCa"); 44 //console.log("idProductoCa",idProductoCa); 45 $(this).removeClass("btn-warning agregarProducto"); 46 47 $(this).addClass("btn-default"); 48 var datos = new FormData(); 49 datos.append("idProductoCa", idProductoCa); 50 51 $.ajax({ 52 53 url:"ajax/catalogo.ajax.php", 54 method: "POST", 55 data: datos, 56 cache: false, 57 contentType: false, 58 processData: false, 59 dataType:"json", 60 success:function(respuesta){ 61 var descripcion = respuesta["nombre"]; 62 var lineaProducto = respuesta["nombreUnidad"]; 63 64 // console.log("respuesta", respuesta); 65 66 $(".nuevoProducto").append( 67 '<div class="row">'+ 68 '<div class="col-6">'+ 69 '<div class="input-group">'+ 70 71 '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs quitarProductoB" idProductoCa="'+idProductoCa+'"><i class="fa fa-times"> </i></button> </span>'+ 72 73 '<input type="text" class="form-control nuevaDesripcionProducto" idProductoCa="'+idProductoCa+'" id="nuevaDesripcionProducto" value="'+descripcion+'" name="nuevaDesripcionProducto[]" readonly>'+ 74 75 '</div>'+ 76 '</div>'+ 77 78 '<div class="col-2 ingresoPrecio">'+ 79 '<div class="input-group">'+ 80 '<input type="text" class="form-control nuevoPrecioProductoB" id="nuevoPrecioProductoB" value="'+lineaProducto+'" name="nuevoPrecioProductoB" min="1" placeholder="0.00" required readonly>'+ 81 82 '</div>'+ 83 '</div>'+ 84 85 '<div class="col-2">'+ 86 '<input type="text" class="form-control nuevaCantidadProductoB" id="nuevaCantidadProductoB" name="nuevaCantidadProductoB" min="1" placeholder="0" required>'+ 87 '</div>'+ 88 '</div>' 89 90 ) 91 92 93 94 listarProductosB() 95 96 97 } 98 99 }) 100 101 102 103}); 104 105 106 107var idQuitarProducto = []; 108localStorage.removeItem("quitarProductoB"); 109 110$(".formularioVenta").on("click", "button.quitarProductoB", function(){ 111 112 113 $(this).parent().parent().parent().parent().remove(); 114 var idProductoCa = $(this).attr("idProductoCa"); 115 116 /*============================================= 117 ALMACENAR EN EL LOCALSTORAGE EL ID DEL PRODUCTO A QUITAR 118 =============================================*/ 119 120 if(localStorage.getItem("quitarProductoB") == null){ 121 122 idQuitarProducto = []; 123 124 }else{ 125 126 idQuitarProducto.concat(localStorage.getItem("quitarProductoB")) 127 128 } 129 idQuitarProducto.push({"idProductoCa":idProductoCa}); 130 localStorage.setItem("quitarProductoB", JSON.stringify(idQuitarProducto)); 131 132 133 134 135 $("button.recuperarBoton[idProductoCa='"+idProductoCa+"']").removeClass('btn-default'); 136 $("button.recuperarBoton[idProductoCa='"+idProductoCa+"']").addClass('btn-warning agregarProducto'); 137 138 if($(".nuevoProducto").children().length == 0){ 139 140 141 $("#nuevoTotalProducto").val(0); 142 143 144 }else{ 145 146 // SUMAR TOTAL DE PRECIOS 147 148 149 150 listarProductosB() 151 152 153 154 155 156 } 157 158 159}) 160 161 162/*============================================= 163MODIFICAR LA CANTIDAD 164=============================================*/ 165 166
167$(".formularioVenta").on("change", "input.nuevaCantidadProductoB", function(){ 168 169 170 171 listarProductosB() 172 173 174 175}) 176 177 178 179function listarProductosB(){ 180 181 var listaProductos = []; 182 183 var descripcion = $(".nuevaDesripcionProducto"); 184 185 var cantidad = $(".nuevaCantidadProductoB"); 186 187 188 for(var i = 0; i < descripcion.length; i++){ 189 190 listaProductos.push({ "id" : $(descripcion[i]).attr("idProductoCa"), 191 "descripcion" : $(descripcion[i]).val(), 192 "cantidad" : $(cantidad[i]).val()}) 193 194 } 195 196 $("#listarProductos").val(JSON.stringify(listaProductos)); 197 198 199} 200 201 202 203 204 205$(".btnEditarBolsaAutomatica").click(function(){ 206 207 var idBolsaAu = $(this).attr("idBolsaAu"); 208 209 window.location = "index.php?ruta=editarBolsaAutomatica&idBolsaAu="+idBolsaAu; 210 211 212}) 213 214 215 216 217 218 219 220 221 222
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.