diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-09-27 19:46:41 +0200 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-09-27 19:46:41 +0200 |
commit | d9c8e2d2493b5b20b81f9a27291d4b333dd3389a (patch) | |
tree | 8364247c1e1f536e99ebe141eedb68bbc95f1dfc /assets | |
parent | added checkouts and removed lopolisAPI (diff) | |
download | beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar.gz beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar.bz2 beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar.lz beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar.xz beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.tar.zst beziapp-d9c8e2d2493b5b20b81f9a27291d4b333dd3389a.zip |
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/meals.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/assets/js/meals.js b/assets/js/meals.js index bb04583..1cf1977 100644 --- a/assets/js/meals.js +++ b/assets/js/meals.js @@ -179,12 +179,18 @@ var mealClickHandler = (eventClickInfo) => { /// ˇˇˇ checkouts $("#checkout_label").show(); let can_do_checkout = true; + let checkout_object; try { - let checkout_object = checkouts_data_global[meal_date]; + checkout_object = checkouts_data_global[meal_date]; } catch (e) { $("#checkout_label").hide(); let can_do_checkout = false; } + if (checkout_object == undefined || checkout_object == null) { + can_do_checkout = false; + } + console.log(checkout_object); if (can_do_checkout) { let cc = $("#checkout_checkbox"); + cc[0].checked/*in*/ = !(checkout_object.checked/*out*/); cc.off(); cc.on("change", ()=>{ let l = new lopolisc(); @@ -198,7 +204,7 @@ var mealClickHandler = (eventClickInfo) => { setLoading(false); }); }); - cc.prop("disabled", checkouts_data_global[meal_date].readonly); + cc.prop("disabled", checkout_object.readonly); } /// ^^^ checkouts $("#meal-type").text(meal_object.meal); |