summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-09-27 19:46:41 +0200
committersijanec <sijanecantonluka@gmail.com>2020-09-27 19:46:41 +0200
commitd9c8e2d2493b5b20b81f9a27291d4b333dd3389a (patch)
tree8364247c1e1f536e99ebe141eedb68bbc95f1dfc
parentadded checkouts and removed lopolisAPI (diff)
downloadbeziapp-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
-rw-r--r--assets/js/meals.js10
-rwxr-xr-xdist/cache_name.txt2
-rwxr-xr-xdist/js/app.js2
-rwxr-xr-xdist/js/meals.js5
-rwxr-xr-xdist/pages/about.html2
-rwxr-xr-xdist/sw.js4
6 files changed, 16 insertions, 9 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);
diff --git a/dist/cache_name.txt b/dist/cache_name.txt
index b0329f3..7f68c2e 100755
--- a/dist/cache_name.txt
+++ b/dist/cache_name.txt
@@ -2,4 +2,4 @@
-///site-static-1.0.16.0-beta-140f8a9|||
+///site-static-1.0.16.0-beta-cc5cd1d|||
diff --git a/dist/js/app.js b/dist/js/app.js
index 4fdfad8..5a895a3 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -3,7 +3,7 @@
const app_version = "1.0.16.0-beta";
-const previous_commit = "140f8a9b1842bb999da12073ea2e52fd0c72b1b5";
+const previous_commit = "cc5cd1d44867e6c3ac628f8d141969111c28a46d";
const BEZIAPP_UPDATE_INTERVAL = 300; // update vsakih 300 sekund
if ("serviceWorker" in navigator) {
diff --git a/dist/js/meals.js b/dist/js/meals.js
index c545e69..fa25e40 100755
--- a/dist/js/meals.js
+++ b/dist/js/meals.js
@@ -18,8 +18,9 @@ function lopolisLogout(){localforage.setItem("logged_in_lopolis",false).then(()=
async function lopolisLogin(){setLoading(true);var usernameEl=$("#meals-username");var passwordEl=$("#meals-password");try{let l=new lopolisc();await l.login(usernameEl.val(),passwordEl.val());}catch(e){UIAlert(D("loginError"),"lopolisLogin(): ajax.error");setLoading(false);return false;}
let promises_to_run=[localforage.setItem("logged_in_lopolis",true),localforage.setItem("lopolis_username",usernameEl.val()),localforage.setItem("lopolis_password",passwordEl.val())];await Promise.all(promises_to_run);checkLogin();UIAlert("Credential match!");return true;}
function setupEventListeners(){$("#meals-login").click(()=>{lopolisLogin();});$("#meals-logout").click(()=>{lopolisLogout();});}
-var mealClickHandler=(eventClickInfo)=>{let meal_date=eventClickInfo.event.id;let meal_object=meals_data_global[meal_date];$("#checkout_label").show();let can_do_checkout=true;try{let checkout_object=checkouts_data_global[meal_date];}catch(e){$("#checkout_label").hide();let can_do_checkout=false;}
-if(can_do_checkout){let cc=$("#checkout_checkbox");cc.off();cc.on("change",()=>{let l=new lopolisc();checkouts_data_global[meal_date].checked=!(cc[0].checked);setLoading(true);l.setCheckouts(checkouts_data_global).then(()=>{UIAlert(D("successfulCheckingInOut"),"successfulcheckinginout");setLoading(false);}).catch(()=>{UIAlert(D("errorCheckingInOut"),"errorcheckinginout");setLoading(false);});});cc.prop("disabled",checkouts_data_global[meal_date].readonly);}
+var mealClickHandler=(eventClickInfo)=>{let meal_date=eventClickInfo.event.id;let meal_object=meals_data_global[meal_date];$("#checkout_label").show();let can_do_checkout=true;let checkout_object;try{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=!(checkout_object.checked);cc.off();cc.on("change",()=>{let l=new lopolisc();checkouts_data_global[meal_date].checked=!(cc[0].checked);setLoading(true);l.setCheckouts(checkouts_data_global).then(()=>{UIAlert(D("successfulCheckingInOut"),"successfulcheckinginout");setLoading(false);}).catch(()=>{UIAlert(D("errorCheckingInOut"),"errorcheckinginout");setLoading(false);});});cc.prop("disabled",checkout_object.readonly);}
$("#meal-type").text(meal_object.meal);let meal_date_obj=new Date(meal_date);$("#meal-date").text(dateString.longFormatted(meal_date_obj));if(!(meal_object.readonly)){document.getElementById("meal-readonly").style.display="none";}else{document.getElementById("meal-readonly").style.display="block";}
document.getElementById("meal-options").innerHTML="";for(const[option_index,option_object]of Object.entries(meal_object.menu_options)){let menu_option_li_el=document.createElement("li");let menu_option_a_el=document.createElement("button");menu_option_a_el.innerText=option_object.text;let classlist="";if(option_object.selected!=null){if(option_object.selected){classlist="color: green; font-weight: bold";}}
menu_option_a_el.classList="waves-effect waves-light btn-large";menu_option_a_el.style="color: var(--color-text); background-color: rgba(0,0,0,0); line-height: 1.2; height:auto; "+classlist+" !important";menu_option_a_el.id="menu_index_"+option_index;if(!(meal_object.readonly)){menu_option_a_el.disabled=false;menu_option_a_el.onclick=()=>{setLoading(true);let l=new lopolisc();l.chooseMenu(meals_data_global[meal_date],option_index);l.setMeals(meals_data_global).then(()=>{UIAlert(D("mealSet"),"meal set!");setLoading(false);}).catch(()=>{UIAlert(D("errorSettingMeals"),"error setting meals");setLoading(false);});menu_option_a_el.className="to-be-selected-meal";let sidenav_element=document.getElementById("meal-info");let sidenav_instance=M.Sidenav.getInstance(sidenav_element);sidenav_instance.close();};}else{menu_option_a_el.disabled=true;}
diff --git a/dist/pages/about.html b/dist/pages/about.html
index 8dd751e..79822eb 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -160,7 +160,7 @@
<div class="row">
<p>
<small>
- ^HEAD 140f8a9b1842bb999da12073ea2e52fd0c72b1b5
+ ^HEAD cc5cd1d44867e6c3ac628f8d141969111c28a46d
</small>
</p>
</div>
diff --git a/dist/sw.js b/dist/sw.js
index 9c45bf2..434ec85 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -3,8 +3,8 @@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.16.0-beta-140f8a9";
-// commit before the latest is 140f8a9b1842bb999da12073ea2e52fd0c72b1b5
+const static_cache_name = "site-static-1.0.16.0-beta-cc5cd1d";
+// commit before the latest is cc5cd1d44867e6c3ac628f8d141969111c28a46d
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!