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 /dist/js | |
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 'dist/js')
-rwxr-xr-x | dist/js/app.js | 2 | ||||
-rwxr-xr-x | dist/js/meals.js | 5 |
2 files changed, 4 insertions, 3 deletions
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;} |