New-OMIS/public/assets/js/pages/calendar.init.js

1 line
17 KiB
JavaScript
Raw Permalink Normal View History

2024-04-04 07:23:00 +00:00
var start_date=document.getElementById("event-start-date"),timepicker1=document.getElementById("timepicker1"),timepicker2=document.getElementById("timepicker2"),date_range=null,T_check=null;function flatPickrInit(){var e={enableTime:!0,noCalendar:!0};flatpickr(start_date,{enableTime:!1,mode:"range",minDate:"today",onChange:function(e,t,n){1<t.split("to").length?document.getElementById("event-time").setAttribute("hidden",!0):(document.getElementById("timepicker1").parentNode.classList.remove("d-none"),document.getElementById("timepicker1").classList.replace("d-none","d-block"),document.getElementById("timepicker2").parentNode.classList.remove("d-none"),document.getElementById("timepicker2").classList.replace("d-none","d-block"),document.getElementById("event-time").removeAttribute("hidden"))}});flatpickr(timepicker1,e),flatpickr(timepicker2,e)}function flatpicekrValueClear(){start_date.flatpickr().clear(),timepicker1.flatpickr().clear(),timepicker2.flatpickr().clear()}function eventClicked(){document.getElementById("form-event").classList.add("view-event"),document.getElementById("event-title").classList.replace("d-block","d-none"),document.getElementById("event-category").classList.replace("d-block","d-none"),document.getElementById("event-start-date").parentNode.classList.add("d-none"),document.getElementById("event-start-date").classList.replace("d-block","d-none"),document.getElementById("event-time").setAttribute("hidden",!0),document.getElementById("timepicker1").parentNode.classList.add("d-none"),document.getElementById("timepicker1").classList.replace("d-block","d-none"),document.getElementById("timepicker2").parentNode.classList.add("d-none"),document.getElementById("timepicker2").classList.replace("d-block","d-none"),document.getElementById("event-location").classList.replace("d-block","d-none"),document.getElementById("event-description").classList.replace("d-block","d-none"),document.getElementById("event-start-date-tag").classList.replace("d-none","d-block"),document.getElementById("event-timepicker1-tag").classList.replace("d-none","d-block"),document.getElementById("event-timepicker2-tag").classList.replace("d-none","d-block"),document.getElementById("event-location-tag").classList.replace("d-none","d-block"),document.getElementById("event-description-tag").classList.replace("d-none","d-block"),document.getElementById("btn-save-event").setAttribute("hidden",!0)}function editEvent(e){var t=e.getAttribute("data-id");("new-event"==t?(document.getElementById("modal-title").innerHTML="",document.getElementById("modal-title").innerHTML="Add Event",document.getElementById("btn-save-event").innerHTML="Add Event",eventTyped):"edit-event"==t?(e.innerHTML="Cancel",e.setAttribute("data-id","cancel-event"),document.getElementById("btn-save-event").innerHTML="Update Event",e.removeAttribute("hidden"),eventTyped):(e.innerHTML="Edit",e.setAttribute("data-id","edit-event"),eventClicked))()}function eventTyped(){document.getElementById("form-event").classList.remove("view-event"),document.getElementById("event-title").classList.replace("d-none","d-block"),document.getElementById("event-category").classList.replace("d-none","d-block"),document.getElementById("event-start-date").parentNode.classList.remove("d-none"),document.getElementById("event-start-date").classList.replace("d-none","d-block"),document.getElementById("timepicker1").parentNode.classList.remove("d-none"),document.getElementById("timepicker1").classList.replace("d-none","d-block"),document.getElementById("timepicker2").parentNode.classList.remove("d-none"),document.getElementById("timepicker2").classList.replace("d-none","d-block"),document.getElementById("event-location").classList.replace("d-none","d-block"),document.getElementById("event-description").classList.replace("d-none","d-block"),document.getElementById("event-start-date-tag").classList.replace("d-block","d-none"),document.getElementById("event-timepicker1-tag").classList.replace("d-block","d-none"),document.getElementById("event-timepicker2-tag").classList.replace("d-block","d-none"),document.get