window.BackendCalendarTableView=window.BackendCalendarTableView||{},function(){"use strict";var d,o,l;function r(t,n){$("#calendar .calendar-header .btn").addClass("disabled").prop("disabled",!0);var r={};$(".provider-column").each(function(e,a){var t=$(a),n=t.data("provider").id;r[n]=t.find(".calendar-wrapper").fullCalendar("getView").name}),$("#calendar .calendar-view").remove(),Backend.placeFooterToBottom();var e=$("
",{class:"calendar-view"}).appendTo("#calendar");e.data({startDate:t.toString("yyyy-MM-dd"),endDate:n.toString("yyyy-MM-dd")});var i=$("
").appendTo(e);E(t,n).done(function(e){for(var a=t;a<=n;)s(i,a,e),a.add({days:1});_(),Backend.placeFooterToBottom(),$("#calendar .calendar-header .btn").removeClass("disabled").prop("disabled",!1),$(".provider-column").each(function(e,a){var t=$(a),n=t.data("provider").id;t.find(".calendar-wrapper").fullCalendar("changeView",r[n]||"agendaDay")})})}function s(e,a,t){var n=$("
",{class:"date-column"}).appendTo(e);n.data("date",a.getTime()),$("
",{class:"date-column-title",text:GeneralFunctions.formatDate(a,GlobalVariables.dateFormat)}).appendTo(n);var r=d.val(),i=o.val(),s=GlobalVariables.availableProviders.filter(function(e){var a=e.services.filter(function(a){return i.filter(function(e){return Number(a)===Number(e)}).length});return!r.length&&!i.length||r.length&&!i.length&&-1!==r.indexOf(e.id)||!r.length&&i.length&&a.length||r.length&&i.length&&a.length&&-1!==r.indexOf(e.id)});"provider"===GlobalVariables.user.role_slug&&GlobalVariables.availableProviders.forEach(function(e){Number(e.id)===Number(GlobalVariables.user.id)&&(s=[e])}),"secretary"===GlobalVariables.user.role_slug&&(s=[],GlobalVariables.availableProviders.forEach(function(e){-1",{class:"provider-column"}).appendTo(e);r.data("provider",t),function(e,a,t){var n=$("
",{class:"calendar-wrapper"}).appendTo(e),r="";switch(GlobalVariables.dateFormat){case"DMY":r="ddd D/M";break;case"MDY":case"YMD":r="ddd M/D";break;default:throw new Error("Invalid date format setting provided!",GlobalVariables.dateFormat)}var i="",s="";switch(GlobalVariables.timeFormat){case"military":i="H:mm",s="H(:mm)";break;case"regular":i="h:mm a",s="h(:mm) a";break;default:throw new Error("Invalid time format setting provided!"+GlobalVariables.timeFormat)}var d=GlobalVariables.firstWeekday,o=GeneralFunctions.getWeekDayId(d);n.fullCalendar({defaultView:"agendaDay",height:c(),editable:!0,timeFormat:i,slotLabelFormat:s,allDaySlot:!0,columnFormat:r,firstDay:o,snapDuration:"00:15:00",header:{left:"listDay,agendaDay",center:"",right:""},selectable:!0,selectHelper:!0,select:function(e,a,t){if(e.hasTime()&&a.hasTime()){$("#insert-appointment").trigger("click");var n=$(t.target).parents(".provider-column").data("provider").id,r=GlobalVariables.availableProviders.find(function(e){return Number(e.id)===Number(n)}),i=GlobalVariables.availableServices.find(function(e){return-1!==r.services.indexOf(e.id)});return i&&$("#select-service").val(i.id),$("#select-service").val()||$("#select-service option:first").prop("selected",!0),$("#select-service").trigger("change"),r&&$("#select-provider").val(r.id),$("#select-provider").val()||$("#select-provider option:first").prop("selected",!0),$("#select-provider").trigger("change"),$("#start-datetime").datepicker("setDate",new Date(e.format("YYY/MM/DD HH:mm:ss"))),$("#end-datetime").datepicker("setDate",new Date(a.format("YYYY/MM/DD HH:mm:ss"))),!1}},monthNames:[EALang.january,EALang.february,EALang.march,EALang.april,EALang.may,EALang.june,EALang.july,EALang.august,EALang.september,EALang.october,EALang.november,EALang.december],monthNamesShort:[EALang.january.substr(0,3),EALang.february.substr(0,3),EALang.march.substr(0,3),EALang.april.substr(0,3),EALang.may.substr(0,3),EALang.june.substr(0,3),EALang.july.substr(0,3),EALang.august.substr(0,3),EALang.september.substr(0,3),EALang.october.substr(0,3),EALang.november.substr(0,3),EALang.december.substr(0,3)],dayNames:[EALang.sunday,EALang.monday,EALang.tuesday,EALang.wednesday,EALang.thursday,EALang.friday,EALang.saturday],dayNamesShort:[EALang.sunday.substr(0,3),EALang.monday.substr(0,3),EALang.tuesday.substr(0,3),EALang.wednesday.substr(0,3),EALang.thursday.substr(0,3),EALang.friday.substr(0,3),EALang.saturday.substr(0,3)],dayNamesMin:[EALang.sunday.substr(0,2),EALang.monday.substr(0,2),EALang.tuesday.substr(0,2),EALang.wednesday.substr(0,2),EALang.thursday.substr(0,2),EALang.friday.substr(0,2),EALang.saturday.substr(0,2)],buttonText:{today:EALang.today,day:EALang.day,week:EALang.week,month:EALang.month,agendaDay:EALang.calendar,listDay:EALang.list},eventClick:g,eventResize:y,eventDrop:h,viewRender:m}),n.fullCalendar("gotoDate",moment(a)),$("
",{text:t.first_name+" "+t.last_name}).prependTo(e)}(r,a,t),p(r.find(".calendar-wrapper"),t),u(r,n.appointments),b(r,n.unavailability_events),Backend.placeFooterToBottom()}(n,a,e,t)})}function c(){var e=window.innerHeight-$("#footer").outerHeight()-$("#header").outerHeight()-60;return 500",{class:"event unavailability break"});m.html(EALang.break+' '+d.toString("HH:mm")+" ("+c+"')"),m.data(i),t.find("tr").each(function(e,a){var t=$(a).find("td:first"),n=new Date(r.getTime()).set({hour:parseInt(t.text().split(":")[0]),minute:parseInt(t.text().split(":")[1])});if(d",{html:[$("",{text:EALang.start}),$("",{text:GeneralFunctions.formatDate(e.start.format("YYYY-MM-DD HH:mm:ss"),GlobalVariables.dateFormat,!0)}),$("
"),$("",{text:EALang.end}),$("",{text:GeneralFunctions.formatDate(e.end.format("YYYY-MM-DD HH:mm:ss"),GlobalVariables.dateFormat,!0)}),$("
"),$("",{text:EALang.notes}),$("",{text:v(e)}),$("
"),$("
"),$("
",{class:"d-flex justify-content-center",html:[$("