1var module_126721897331=function(){$("[data-cutom-tab]").click(function(){var id=$(this).attr("data-cutom-tab");$(".customPage-tabs ul li").removeClass("active"),$(".customPage-tabs--body").removeClass("open"),$(this).addClass("active"),$(id).addClass("open"),"#customPageEvents"==id&&updateCustomPageEvents()}),$("body").on("click","li",function(e){("#campsSchedule"==$(this).attr("data-camp-tab")||"#customPageEvents"==$(this).attr("data-cutom-tab")?$(".franchise_save_btn").hide():$(".franchise_save_btn").show(),"#customPage"==$(this).attr("data-fc-menu")&&$("li[data-cutom-tab='#customPageEvents']").hasClass("active")&&$(".franchise_save_btn").hide(),"#campCustomization"==$(this).attr("data-fc-menu"))&&("COMING SOON"==getFranchiseData().status?$(".camp_enroll_sec").show():$(".camp_enroll_sec").hide(),$("li[data-camp-tab='#campsSchedule']").hasClass("active")&&$(".franchise_save_btn").hide())});var customPageData=[];function updateCustomPageEvents(){if(customPageData=getFranchiseCustomPageData(),customPageData?.events?.length>0){let sortedEvent=sortEvents(customPageData?.events);$("#customPageEventsBody").html(renderCustomPageEventCard(sortedEvent))}else $("#customPageEventsBody").html("<p>No records found </p>")}async function updateCustomPageEventsData(newEvents){try{$(".loader").addClass("show");let franchiseData=getFranchiseData(),customPage=franchiseData?.additionalSettings?.customPage,customPageObj={...customPage,events:newEvents};const updatedAdditional={...franchiseData?.additionalSettings,customPage:customPageObj},updatedFranchiseData={...franchiseData,additionalSettings:JSON.stringify(updatedAdditional)},{loginToken:loginToken,currentUserCountryCode:currentUserCountryCode,envName:envName}=await getAuthHeaderProperties(),response=await axios({method:"post",url:`${backEndURL}/api/v1/facility/profile`,data:updatedFranchiseData,headers:{Authorization:`Bearer ${loginToken}`,country:`${currentUserCountryCode}`,environment:`${envName}`}});if(response.data){let data=response.data;setFranchiseData({...data,additionalSettings:JSON.parse(data?.additionalSettings)}),$("#openEditCustomEventForm").modal("hide"),$("#openAddCustomEventForm").modal("hide"),updateCustomPageEvents(),$(".loader").removeClass("show")}}catch(error){console.log(error),$(".loader").removeClass("show"),toggleTokenExpiryMo
1dal("show")}}function validateOneEventPerMonth(allEvents,editedEvent){let getEvents=allEvents?.filter(function(data){return moment(data.dateAndTime).format("DDDD")===moment(editedEvent).format("DDDD")});if(getEvents?.length>2)return!0}$(document).on("click",".openCustomPageEvent",function(){customPageData=getFranchiseCustomPageData();let id=$(this).attr("data-bs-custompageeventid"),editRecord=customPageData?.events.filter(function(data){return data.id===id})[0];localDateTime=convertUtcToLocal(editRecord.dateAndTime),$("#customPageEventTitle").val(editRecord?.content),$("#customPageEventDesc").val(editRecord?.desc),$("#customPageEventDate").val(moment(localDateTime).format("YYYY-MM-DD")),$("#customPageEventTime").val(moment(localDateTime).format("HH:mm")),$("#customPageId").val(editRecord?.id),renderCharLimit()}),$(document).on("click","#submitCustomPageEventEditForm",function(){let title=$("#customPageEventTitle").val(),desc=$("#customPageEventDesc").val(),date=$("#customPageEventDate").val(),time=$("#customPageEventTime").val();if(""==title?$("#edit_event_title_error").show():$("#edit_event_title_error").hide(),""==desc?$("#edit_event_description_error").show():$("#edit_event_description_error").hide(),""==date?$("#edit_event_date_error").show():$("#edit_event_date_error").hide(),""==time?$("#edit_event_time_error").show():$("#edit_event_time_error").hide(),title&&desc&&date&&time){let utcTime=convertLocalToUtc($("#customPageEventDate").val()+" "+$("#customPageEventTime").val()),editedCustomPageData=customPageData?.events?.filter(function(data){return data.id!=$("#customPageId").val()});if(validateOneEventPerMonth(editedCustomPageData,utcTime))$("#edit_event_duplicate_error").show();else{$("#edit_event_duplicate_error").hide();let editObject={id:$("#customPageId").val(),dateAndTime:utcTime,content:$("#customPageEventTitle").val(),desc:$("#customPageEventDesc").val()};updatedEvents=[],customPageData?.events.forEach(data=>{data.id==editObject.id?updatedEvents.push(editObject):updatedEvents.push(data)}),updateCustomPageEventsData(updatedEvents)}}}),$(document).on("click","#submitCustomPageEventAddForm",function(){let title=$("#addCustomPageEventTitle").val(),desc=$("#addCustomPageEventDesc").val(),date=$("#addCustomPageEventDate").val(),time=$("#addCustomPageEventTime").val();if(""==title?$("#add_event_title_error").show():$("#add_event_title_error").hide(),""==desc?$("#add_event_description_error").show():$("#add_event_description_error").hide(),""==date?$("#add_event_date_error").show():$("#add_event_date_error").hide(),""==time?$("#add_event_time_error").show():$("#add_event_time_error").hide(),title&&desc&&date&&time){let franchiseData=getFranchiseData(),utcTime=convertLocalToUtc($("#addCustomPageEventDate").val()+" "+$("#addCustomPageEventTime").val());if(validateOneEventPerMonth(customPageData?.events,utcTime))$("#add_event_duplicate_error").show();else{$("#add_event_duplicate_error").hide();let newObject={id:franchiseData?.facilityId+"-"+customPageData?.events?.length,dateAndTime:utcTime,content:title,desc:desc};updatedEvents=customPageData?.events?.length>0?customPageData?.events:[],updatedEvents.push(newObject),updateCustomPageEventsData(updatedEvents),$("#addCustomPageEventTitle").val(""),$("#addCustomPageEventDesc").val(""),$("#addCustomPageEventDate").val(""),$("#addCustomPageEventTime").val("")}}}),$(document).on("click",".upload_close",function(){$(".error_msg").hide()}),$(document).on("click","#deleteEvent",function(){if(confirm("Are you sure you want to delete the selected Event?")){customPageData=getFranchiseCustomPageData();let id=$(this).attr("data-bs-custompageeventid"),removedRecord=customPageData?.events.filter(function(data){return data.id!==id});updateCustomPageEventsData(removedRecord)}else console.log("User cancled deleting camps event")}),$(document).on("click","#addCustomPageEventDate",function(){const currentDate=new Date;$("#addCustomPageEventDate").attr("min",currentDate.toISOString().split("T")[0])}),$(document).on("click","#customPageEventDate",function(){const currentDate=new Date;$("#customPageEventDate").attr("min",currentDate.toISOString().split("T")[0])})}(); 2//# sourceURL=https://39646145.fs1.hubspotusercontent-na1.net/hubfs/39646145/hub_generated/module_assets/1/126721897331/1768381401833/module_Custom_Page.js
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.