diff options
-rw-r--r-- | assets/js/gradings.js | 24 | ||||
-rw-r--r-- | dist/js/gradings.js | 3 |
2 files changed, 15 insertions, 12 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js index bd664bb..4730248 100644 --- a/assets/js/gradings.js +++ b/assets/js/gradings.js @@ -156,6 +156,7 @@ function gradingClickHandler(eventClickInfo) { M.Sidenav.getInstance(modal).open(); } + function setupPickers() { // Setup pickers, todo (adding an event), to be stored in messages var date_object = new Date(); @@ -171,6 +172,7 @@ function setupPickers() { } + document.addEventListener("DOMContentLoaded", () => { checkLogin(); // Calendar setup @@ -188,17 +190,17 @@ document.addEventListener("DOMContentLoaded", () => { calendar_obj.render(); // Modal for adding gradings - setupPickers(); // TODO: Hook up submit logic - // Setup modals - const modal_elems = document.querySelectorAll('.modal'); - const modal_options = { - onOpenStart: () => { $("#fab-new").hide() }, - onCloseEnd: () => { $("#fab-new").show() }, - dismissible: false - }; - $("#input-grading-name").on("blur", validateInputs); - $("#input-grading-description").on("blur", validateInputs); - M.Modal.init(modal_elems, modal_options); + + // setupPickers(); // todo (adding an event), to be stored in messages + // // Setup modals + // const modal_elems = document.querySelectorAll('.modal'); + // const modal_options = { + // onOpenStart: () => { $("#fab-new").hide() }, + // onCloseEnd: () => { $("#fab-new").show() }, + // dismissible: false + // }; + // M.Modal.init(modal_elems, modal_options); + loadGradings(true); // Setup refresh handler diff --git a/dist/js/gradings.js b/dist/js/gradings.js index c644562..de5f21b 100644 --- a/dist/js/gradings.js +++ b/dist/js/gradings.js @@ -14,4 +14,5 @@ async function validateInputs(){if($("#input-grading-name").val()!=null&&$("#inp function gradingClickHandler(eventClickInfo){let grading_id=parseInt(eventClickInfo.event.id);let grading_subject=gradings[grading_id]["subject"];let grading_date_obj=gradings[grading_id]["date"];let grading_date=dateString.longFormatted(grading_date_obj);let grading_description=gradings[grading_id]["description"];$("#grading-subject").text(grading_subject);$("#grading-date").text(grading_date);$("#grading-description").text(grading_description);const modal=document.querySelectorAll(".side-modal")[0];M.Sidenav.getInstance(modal).open();} function setupPickers(){var date_object=new Date();let elems=document.querySelectorAll('#datepicker-add');let options={autoClose:true,format:"dd.mm.yyyy",defaultDate:date_object,setDefaultDate:true,firstDay:1} instances=M.Datepicker.init(elems,options);} -document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();setupPickers();const modal_elems=document.querySelectorAll('.modal');const modal_options={onOpenStart:()=>{$("#fab-new").hide()},onCloseEnd:()=>{$("#fab-new").show()},dismissible:false};$("#input-grading-name").on("blur",validateInputs);$("#input-grading-description").on("blur",validateInputs);M.Modal.init(modal_elems,modal_options);loadGradings(true);$("#refresh-icon").click(()=>{loadGradings(true);});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});});
\ No newline at end of file + +document.addEventListener("DOMContentLoaded",()=>{checkLogin();var calendarEl=document.getElementById("calendar");calendar_obj=new FullCalendar.Calendar(calendarEl,{firstDay:1,plugins:["dayGrid"],defaultDate:getDateString(),navLinks:false,editable:false,events:[],eventClick:gradingClickHandler,height:"parent"});calendar_obj.render();loadGradings(true);$("#refresh-icon").click(()=>{loadGradings(true);});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});}); |