text: function calculateLateDays(e){let t=document.getElementById("g_id");if(0!==t.selectedIndex){var a=t.options[t.selectedIndex].getAttribute("data-due-date"),n=new Date(e),o=new Date(a),l=(n.getTime()-o.getTime())/864e5;l<0&&(l=0);var d=Math.floor(l);document.getElementById("late_days").value=d}else alert("Please select a gradeable first!")}function updateLateDays(e){var t=new FormData($("#late-day-form").get(0)),a=$("input:radio[name=csv_option]:checked").val(),n=buildCourseUrl(["late_days","update"])+"?csv_option="+a;return $.ajax({url:n,type:"POST",data:t,processData:!1,contentType:!1,success:function(){window.location.reload()},error:function(){window.alert("Something went wrong. Please try again.")}}),!1}function deleteLateDays(e,t){datestamp_mmddyy=t.split(" ")[0];var a=buildCourseUrl(["late_days","delete"]);window.confirm("Are you sure you would like to delete this entry?")&&$.ajax({url:a,type:"POST",data:{csrf_token:csrfToken,user_id:e,datestamp:datestamp_mmddyy},success:function(){window.location.reload()},error:function(){window.alert("Something went wrong. Please try again.")}})}$(document).ready(function(){flatpickr("#late-calendar",{plugins:[ShortcutButtonsPlugin({button:[{label:"Now"},{label:"End of time"}],label:"or",onClick:(e,t)=>{let a;switch(e){case 0:a=new Date;break;case 1:a=new Date("9998-01-01")}t.setDate(a,!0)}})],allowInput:!0,enableTime:!1,enableSeconds:!1,time_24hr:!0,dateFormat:"Y-m-d",onChange:function(e,t,a){calculateLateDays(e[0])}})});