Good day. In this way I select product from 2 list
List No. 1
$$('.lista_productos_elegir').on('click','.sumarProducto1', function(e){
var list = $(this).closest('.swipeout_productos1');
var el_product_quantity_producto1 = list.find('.product-quantity');
var tipo_material = list.find('.tipo_material').text();
var tipo_costo_material = list.find('.tipo_costo_material').text();
var codinv_material = list.find('.codInventario_material').text();
var preciosocio_material = list.find('.preciosocio_material').text();
var volumenNegocio_material = list.find('.volumenNegocio_material').text();
var tipo_seleccion = list.find('.tipo_seleccion').text();
product_sum = parseInt(el_product_quantity_producto1.text());
cantidad_suma = product_sum+1;
//el_product_quantity_producto1.text(cantidad_suma);
var cantidad_valor1 =0;
var lista;
$('.lista_productos_elegir li').each(function(e){
lista = $(this).find('.product-quantity');
cantidad_valor1 += parseInt(lista.text());
});
if (cantidad_valor1 >=1){
myApp.alert("Puede llevar un máximo de 1 productos");
el_product_quantity_producto1.text(el_product_quantity_producto1.text());
}
else{
$(".lista_productos_seleccionado > tr").remove();
productos_seleccionados = deleteItem(productos_seleccionados, codinv_material);
productos_seleccionados.push({
"codigo": codinv_material,
"precio": preciosocio_material,
"cantidad": cantidad_suma
})
el_product_quantity_producto1.text(cantidad_suma);
agregarCupon(idPedido, codinv_material, tipo_costo_material,preciosocio_material,volumenNegocio_material,cantidad_suma,cod_cliente,tipo_cliente,cod_cupon,parseInt(tipo_seleccion));
productosSeleccionados();
$('.cupones_bienvenida_todos .cupon_check').attr('disabled', true);
}
});
List No.2 It is basically the same way of increasing the amount of product.
$$('.lista_productos_elegir3').on('click','.sumarProducto3', function(e){
var list3 = $(this).closest('.swipeout_productos3');
var el_product_quantity_producto3 = list3.find('.product-quantity');
var tipo_material = list3.find('.tipo_material').text();
var tipo_costo_material = list3.find('.tipo_costo_material').text();
var codinv_material = list3.find('.codInventario_material').text();
var preciosocio_material = list3.find('.preciosocio_material').text();
var volumenNegocio_material = list3.find('.volumenNegocio_material').text();
var tipo_seleccion = list3.find('.tipo_seleccion').text();
product_sum = parseInt(el_product_quantity_producto3.text());
cantidad_suma = product_sum+1;
var cantidad_valor3 =0;
var lista3;
$('.lista_productos_elegir3 li').each(function(e){
lista3 = $(this).find('.product-quantity');
cantidad_valor3 += parseInt(lista3.text());
});
if (cantidad_valor3 >=3){
myApp.alert("Puede llevar un máximo de 3 productos");
el_product_quantity_producto3.text(el_product_quantity_producto3.text());
}
else{
$(".lista_productos_seleccionado > tr").remove();
productos_seleccionados = deleteItem(productos_seleccionados, codinv_material);
productos_seleccionados.push({
"codigo": codinv_material,
"precio": preciosocio_material,
"cantidad": cantidad_suma
})
el_product_quantity_producto3.text(cantidad_suma);
agregarCupon(idPedido, codinv_material, tipo_costo_material, preciosocio_material, volumenNegocio_material, cantidad_suma, cod_cliente, tipo_cliente,cod_cupon, parseInt(tipo_seleccion));
productosSeleccionados();
$('.cupones_bienvenida_todos .cupon_check').attr('disabled', true);
}
});
How can I do if I already have a selected product in the List No. 1 and no longer allow me to select any value from the List No. 2 and vice versa
>