Commit 66617cc4 by gema

el boton enviar al super envia todos los ingredientes independientemente de si…

el boton enviar al super envia todos los ingredientes independientemente de si estan chequeados. luego ya para borra elemento se tiene en cuenta el checked.
parent 930c2759
......@@ -9,7 +9,8 @@ $(document).ready(function() {
});
$('.btn-lista-compra').on('click', function (e) {
get_checkeds();
/*get_checkeds();*/
get_all();
$.ajax({
url: "lista-compra/useingredient",
type: "POST",
......@@ -128,10 +129,37 @@ $(document).ready(function() {
function get_checkeds()
{
/*
$(':input:checked').each(function () {
*/
//antes solo enviábamos los ingredientes propios de las recetas que estuviesen checkeados, ahora los enviamos todos.
$(':input:checked').each(function () {
let id_val = $(this).attr('rel');
if(id_val=="" || id_val==null)
{
let id_real_val = $(this).attr('rel2');
if( jQuery.inArray(id_real_val, ids_custom_delete)<0)
{
ids_custom_delete.push(id_real_val);
}
}
else
{
if( jQuery.inArray(id_val, ids_delete)<0)
{
ids_delete.push(id_val);
}
if( jQuery.inArray(id_val, ids_to_buy)<0 && $(this).attr('used')=="N")
{
ids_to_buy.push(id_val);
}
}
});
}
function get_all()
{
$(':input').each(function () {
let id_val = $(this).attr('rel');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment