summaryrefslogtreecommitdiffstats
path: root/dist/js/meals.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/meals.js')
-rwxr-xr-xdist/js/meals.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/dist/js/meals.js b/dist/js/meals.js
index 5c2aecb..adaf275 100755
--- a/dist/js/meals.js
+++ b/dist/js/meals.js
@@ -23,8 +23,8 @@ setLoading(false);},error:()=>{setLoading(false);UIAlert(D("lopolisAPIConnection
async function setMenu(date,menu){let choice={};choice[date]=menu;getToken(getMenus,[setMenus,choice]);}
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];$("#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;if(option_object.selected!=null){if(option_object.selected){menu_option_a_el.className="selected-meal";}}
-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 !important;";menu_option_a_el.id="menu_index_"+option_index;if(!(meal_object.readonly)){menu_option_a_el.onclick=()=>{setMenu(meal_date,option_object.value);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();};}
+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.onclick=()=>{setMenu(meal_date,option_object.value);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();};}
menu_option_li_el.appendChild(menu_option_a_el);document.getElementById("meal-options").appendChild(menu_option_li_el);}
let sidenav_element=document.getElementById("meal-info");let sidenav_instance=M.Sidenav.getInstance(sidenav_element);sidenav_instance.open();}
document.addEventListener("DOMContentLoaded",async()=>{checkLogin();var calendarEl=document.getElementById("meals-calendar");meals_calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:mealClickHandler,height:"parent"});meals_calendar_obj.render();setupEventListeners();$("#refresh-icon").click(function(){refreshMeals();});const menus=document.querySelectorAll('.side-menu');M.Sidenav.init(menus,{edge:'right',draggable:true});const modals=document.querySelectorAll('.side-modal');M.Sidenav.init(modals,{edge:'left',draggable:false});document.getElementsByClassName("fc-today-button")[0].style="display:none !important";var elemsx=document.querySelectorAll('select');M.FormSelect.init(elemsx);var datepickerelems=document.querySelectorAll('.datepicker');var today=new Date();M.Datepicker.init(datepickerelems,{firstDay:1,minDate:today,showDaysInNextAndPreviousMonths:true,showClearBtn:true,format:"dddd, dd. mmmm yyyy"});refreshMeals();}); \ No newline at end of file