summaryrefslogtreecommitdiffstats
path: root/assets/js/gradings.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assets/js/gradings.js40
1 files changed, 28 insertions, 12 deletions
diff --git a/assets/js/gradings.js b/assets/js/gradings.js
index f884bf2..4730248 100644
--- a/assets/js/gradings.js
+++ b/assets/js/gradings.js
@@ -131,6 +131,18 @@ function displayData() {
calendar_obj.addEventSource(transformed_gradings);
}
+async function validateInputs() {
+ if ($("#input-grading-name").val() != null && $("#input-grading-name").val().length > 0) {
+ $("#btn-add-grading").removeAttr("disabled");
+ $("#input-grading-name").addClass("valid");
+ $("#input-grading-name").removeClass("invalid");
+ } else {
+ $("#btn-add-grading").attr("disabled", "disabled");
+ $("#input-grading-name").addClass("invalid");
+ $("#input-grading-name").removeClass("valid");
+ }
+}
+
function gradingClickHandler(eventClickInfo) {
let grading_id = parseInt(eventClickInfo.event.id);
let grading_subject = gradings[grading_id]["subject"];
@@ -144,19 +156,21 @@ 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();
- 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);
+
+function setupPickers() {
+ // Setup pickers, todo (adding an event), to be stored in messages
+ 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", () => {
@@ -176,6 +190,7 @@ document.addEventListener("DOMContentLoaded", () => {
calendar_obj.render();
// Modal for adding gradings
+
// setupPickers(); // todo (adding an event), to be stored in messages
// // Setup modals
// const modal_elems = document.querySelectorAll('.modal');
@@ -186,6 +201,7 @@ document.addEventListener("DOMContentLoaded", () => {
// };
// M.Modal.init(modal_elems, modal_options);
+
loadGradings(true);
// Setup refresh handler
$("#refresh-icon").click(() => {