/*! tempstars-app - v5.14.0 */
function goToDeleteAccountDentist(){const e=TempStars.User.getCurrentUser().locations[0].practiceName;TempStars.App.goReact("dentistDeleteAccount",{userEmail:e})}TempStars.Pages.Dentist.Chat=function(){"use strict";var e,t,o,a;function n(){TempStars.App.goReact("dentistJobConfirmed",{jobId:e.id})}function i(o){if(t){var a=e.location.practiceName,n=e.hygienist.firstName;TempStars.ChatPage.newMessages(o,a,n,t)}}function s(){return TempStars.ChatPage.memberUpdated(e.interlocutorLastConsumedMessageIndex)}return{init:function(){a=0,app.onPageBeforeInit("dentist-chat",(function(t){e=t.context,$$(".dentist-chat-back").on("click",n),$$(".dentist-chat-cancel-job").on("click",TempStars.Job.cancelJobBtnHandler),$$(".dentist-chat-report-abuse").on("click",(()=>TempStars.Conversations.reportAbuseBtnHandler(e))),$$(".messagebar .link").on("click",TempStars.Conversations.sendMessageBtnHandler),$$(".messagebar textarea").on("keydown",TempStars.Conversations.sendMessageBtnHandler)})),app.onPageInit("dentist-chat",(async function(e){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),$$(".messagebar")[0].f7Messagebar,t=$$(".messages")[0].f7Messages,o&&t.addMessages(o),TempStars.Conversations.getChatChannel().on("messageAdded",i),TempStars.Conversations.getChatChannel().on("memberUpdated",s)})),app.onPageAfterAnimation("dentist-chat",(function(e){$$(".messagebar textarea").focus()})),app.onPageBeforeRemove("dentist-chat",(function(){$$(".dentist-chat-back").off("click",n),$$(".dentist-chat-cancel-job").off("click",TempStars.Job.cancelJobBtnHandler),$$(".dentist-chat-report-abuse").off("click",(()=>TempStars.Conversations.reportAbuseBtnHandler(e))),$$(".messagebar .link").off("click",TempStars.Conversations.sendMessageBtnHandler),$$(".messagebar .link").off("keyup",TempStars.Conversations.sendMessageBtnHandler),TempStars.Conversations.getChatChannel().removeListener("messageAdded",i),TempStars.Conversations.getChatChannel().removeListener("memberUpdated",s),TempStars.Conversations.exitFromChat(),t=null}))},getData:async function e(t){console.log("*[dentist chat]getData");try{return o=await TempStars.Conversations.getConversationParams(t,o),t}catch(o){return console.log("*[dentist chat getData error]"),a>4?(app.hidePreloader(),app.modal({title:"Error",text:"Something happens during chat initialization. Reload app and try again",buttons:[{text:"OK",bold:!0,onClick:()=>TempStars.Dentist.Router.goBackPage("",{id:t.id})}]}),t):(a++,e(t))}}}}(),TempStars.Pages.Dentist.Chat.init(),TempStars.Pages.Dentist.ContactSupport=function(){"use strict";function e(){window.Cordova?cordova.InAppBrowser.open("https://support.tempstars.com/","_system","location=yes"):window.open("https://support.tempstars.com/","_blank","location=yes")}function t(){let e=$$("#search_support")[0].value;console.log("go",e),window.Cordova?cordova.InAppBrowser.open(`https://support.tempstars.com/hc/en-us/search?utf8=%E2%9C%93&query=${e}`,"_system","location=yes"):window.open(`https://support.tempstars.com/hc/en-us/search?utf8=%E2%9C%93&query=${e}`,"_blank","location=yes")}function o(){let e=_.uniqBy(TempStars.User.getCurrentUser().locations,"email").map(((e,t)=>`\n\t\t\t<label class="label-checkbox item-content checkbox-item-content"> \n\t\t\t\t<input id="email" type="radio" name="location" value="${e.email}" ${0===t?"checked":""}> \n\t\t\t\t<div class="item-media item-checkbox-container"> \n\t\t\t\t\t<i class="icon icon-form-checkbox"></i> \n\t\t\t\t</div> \n\t\t\t\t<div class="item-inner item-checkbox-text-content"> \n\t\t\t\t\t<div class="item-title">${e.email}</div> \n\t\t\t\t</div> \n\t\t\t</label>`));app.modal({title:"Which e-mail?",text:`\n\t\t\tWhich e-mail would you like us to reply to?<br>\n\t\t\t<div class="list-block"> \n\t\t\t<li class="item-content signup-modal-content"> \n\t\t\t\t<div class="item-inner"> \n\t\t\t\t\t<div id="locations" class="item-input"> \n\t\t\t\t\t${e.join(" ")} \n\t\t\t\t\t</div> \n\t\t\t\t</div> \n\t\t\t</li> \n\t\t</div>\t\n\t\t\t`,buttons:[{text:"OK",onClick:a}]})}function a(){var e=document.querySelector('input[name="location"]:checked').value,t=document.getElementsByName("questionType")[0],o=$$(".contact_support_textarea");if(o[0].value.length>=5){if(t.checked)TempStars.Api.contactSupport({questionType:t.value,text:o[0].value,email:e});else(t=document.getElementsByName("questionType")[1]).checked&&TempStars.Api.contactSupport({questionType:t.value,text:o[0].value,email:e});app.modal({title:"<b>Success!</b>",text:"Thank you! We received your request and the information you've provided. \n      For emergency requests, we'll get back to your right away.\n      For general questions, our repsonse time is within 1 business day.",buttons:[{text:"Ok",onClick:n}]})}else app.modal({title:"Wait a second",text:"Enter at least 5 characters to submit",buttons:[{text:"Ok",onClick:function(){}}]})}function n(){app.showPreloader("Loading"),TempStars.Dentist.Router.goBackPage("home")}return $$(".textareainput"),{init:function(){app.onPageBeforeInit("contact-support",(function(a){$$("#back").on("click",n),$$("#submit_dentist").on("click",o),$$("#go_search").on("click",t),$$("#support_link").on("click",e)})),app.onPageInit("contact-support",(function(e){console.log("inside page")})),app.onPageBeforeRemove("contact-support",(function(e){console.log("before page remove")}))},getData:function(e){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.ContactSupport.init(),TempStars.Pages.Dentist.HirejobActive=function(){"use strict";var e;function t(){TempStars.Pages.Dentist.HirejobHome.deleteJob(e.params.id,(function(){TempStars.Dentist.Router.goBackPage()}))}function o(t){var o=parseInt($$(this).attr("data-id")),a=_.find(e.jobApplications,{id:o});TempStars.Dentist.Router.goForwardPage("hirejob-candidate",{application:a,job:e.params})}function a(){app.modal({title:"<strong>Enter new title</strong>",text:'<textarea id="hirejob-new-title" placeholder="Type new title here (50 char max)" style="height: 50px; margin-top: 10px; padding: 8px; font-size: 12px">'+(e.params.title||"")+"</textarea>",buttons:[{text:"Submit",bold:!0,onClick:function(){var t=$$("#hirejob-new-title").val();n((function(){app.showPreloader("Updating title..."),TempStars.Api.updateHireJob(e.params.id,{title:t}).then((function(){app.hidePreloader(),e.params.title=t,$$("#hirejob-title").html(t)}))}))}},{text:"Cancel"}]})}function n(e){app.modal({title:"<b>Resubmitted for Review</b>",text:"Great, we'll take a quick look at your edits and approve the changes within 24hrs.",buttons:[{text:"OK",bold:!0,onClick:function(){e()}}]})}function i(){app.modal({title:"<strong>Enter new description</strong>",text:'<textarea id="hirejob-new-description" placeholder="Type new description here" style="height: 150px; margin-top: 10px; padding: 8px; font-size: 12px">'+(e.params.description||"")+"</textarea>",buttons:[{text:"Submit",bold:!0,onClick:function(){var t=$$("#hirejob-new-description").val();n((function(){app.showPreloader("Updating description..."),TempStars.Api.updateHireJob(e.params.id,{description:t}).then((function(){app.hidePreloader(),e.params.description=t,$$("#hirejob-description").html(t)}))}))}},{text:"Cancel"}]})}return{init:function(){app.onPageInit("dentist-hirejob-active",(function(n){e=n.context,$$(".job").on("click",o),$$("#dentist-hirejob-active-delete").on("click",t),$$("#hirejob-edit-title-btn").on("click",a),$$("#hirejob-edit-description-btn").on("click",i)})),app.onPageBeforeRemove("dentist-hirejob-active",(function(e){$$(".job").off("click",o),$$("#dentist-hirejob-active-delete").off("click",t),$$("#hirejob-edit-description-btn").off("click",i),$$("#hirejob-edit-title-btn").off("click",a)}))},getData:function(t){if(t.weekDaysText=TempStars.App.convertToString(t),e&&!t.id)return Promise.resolve(e);var o=t.id;TempStars.User.getCurrentUser().dentistId;return new Promise((function(a,n){TempStars.Api.getAvailableCandidates(o).then((function(o){o.sort((function(e,t){return("0"===t.status)-("0"===e.status)})),a(e={params:t,jobApplications:o})})).catch((function(e){console.log(e),n(e)}))}))}}}(),TempStars.Pages.Dentist.HirejobActive.init(),TempStars.Pages.Dentist.HirejobCandidate=function(){"use strict";var e;function t(){app.modal({title:"Recommendation Engine",text:"We use a number of real-world factors unique to your office and this candidate to calculate the chance that you will be happy with this candidate if hired for your team.",buttons:[{text:"OK",bold:!0,onClick:function(){}}]})}function o(t){app.modal({title:"Remove Candidate?",text:"Are you sure you want to remove this candidate from this job posting?",buttons:[{text:"I'm Sure",onClick:function(t){return new Promise((function(t,o){TempStars.Api.removeApplication(e.application.id).then((function(o){TempStars.Dentist.Router.goBackPage("hirejob-home"),t(e)})).catch((function(e){o(e)}))}))}},{text:"Cancel",onClick:function(){TempStars.Dentist.Router.goBackPage()}}]})}function a(t){var o={status:t.target.checked?3:2},a=e.application;TempStars.Api.updateJobApplication(a.id,o)}function n(t){if(Number(e.application.status)>1)TempStars.Api.viewResume(e.application.id).then((function(e){app.modal({text:"Resume will be opened in a new window",buttons:[{text:"OK",bold:!0,onClick:function(){window.open(e.hireResumeUrl,"_system")}}]})}));else{app.modal({title:"<strong>View Resume?</strong>",text:"Are you sure you want to view the resume for this applicant?",buttons:[{text:"Yes",onClick:function(t){TempStars.User.getCurrentUser().dentistId;TempStars.Api.viewResume(e.application.id).then((function(t){if(e.application.resumeViewed=!0,t.hireResumeUrl)e.application.viewedResume=!0,function(t){app.modal({title:"<strong>Give Candidate Your Contact Info?</strong>",text:"Would you like to give this candidate access to your office name, address and phone number?",buttons:[{text:"Yes",onClick:function(){window.open(t.hireResumeUrl,"_system");var o=$$("#dentist-candidate-allow-contact-info-check")[0];o&&(o.checked=!0),TempStars.Api.updateJobApplication(e.application.id,{status:3}).then((function(){e.application.status=3,TempStars.Dentist.Router.reloadPage("hirejob-candidate",{},e)}))}},{text:"No",onClick:function(){window.open(t.hireResumeUrl,"_system"),app.modal({title:"<strong>No problem...</strong>",text:' If you change your mind, just check the "Allow applicant to see your office\'s name and contact info" box and this candidate to give them access.',buttons:[{text:"I understand",onClick:function(){e.application.status=2,TempStars.Dentist.Router.reloadPage("hirejob-candidate",{},e)}}]})}}]})}(t);else{app.modal({title:"Warning",text:"This hygienist doesn't have a resume uploaded",buttons:[{text:"OK",onClick:function(e){}}]})}}))}},{text:"No",onClick:function(){}}]})}}function i(e){var t="Checking our records, it looks like this candidate has temp'ed at your office before";return e.completed_num&&e.workedScore>2?t+" and you indicated you were happy with them.":e.completed_num&&2==e.workedScore?t+" and you indicated you were unhappy with them.":"Checking our records, it looks like this candidate has not temp'ed at your office before."}return{init:function(){app.onPageInit("dentist-hirejob-candidate",(function(i){var s;TempStars.User.getCurrentUser();e=i.context,console.log(e.application.hygienist.stats),$$("#dentist-candidate-cancel-button").on("click",o),$$("#dentist-candidate-submit-button").on("click",n),$$("#dentist-hirejob-info").on("click",t),$$("#dentist-candidate-allow-contact-info-check").on("change",a),e.application.hygienist.starScore&&(s=e.application.hygienist.starScore,$("#dentist-hirejob-hygienist-rating").starRating({starSize:20,activeColor:"gold",initialRating:s,readOnly:!0,useGradient:!1}),$("#dentist-hirejob-hygienist-rating").append("<label>("+e.application.hygienist.stats.ratings_num+")</label>"))})),app.onPageBeforeRemove("dentist-hirejob-candidate",(function(e){$$("#dentist-candidate-cancel-button").off("click",o),$$("#dentist-candidate-submit-button").off("click",n),$$("#dentist-hirejob-info").off("click",t),$$("#dentist-candidate-allow-contact-info-check").off("change",a)}))},getData:function(e){return new Promise((function(t,o){TempStars.Api.getHygienistStatsForJobBoard(e.application.hygienist.id).then((function(t){return 0===e.application.status?TempStars.Api.updateJobApplication(e.application.id,{status:1}).then((function(){return t})):t})).then((function(o){e.application.hygienist.stats=o,e.application.hygienist.stats.workedScore=o.is_favourite?5:o.is_blocked?2:4,e.application.hygienist.stats.ratingPercent=o.ratings_num?Math.round(o.happy_num/o.ratings_num*100):0;var a,n={application:e.application,job:e.job,identification:e.application.hygienist.firstName[0].toUpperCase()+e.application.hygienist.lastName[0].toUpperCase()+e.application.hygienist.id,userSince:moment(e.application.user.registerTimestamp).format("MMMM YYYY"),workHistoryText:i(e.application.hygienist.stats),hygienistScore:(a=e.application.hygienist.stats.hygienistScore,'<label class="dentist-candidate-'+(a>=65?"green":a>=45?"yellow":"red")+'">'+a+"%</label>")};t(n)})).catch((function(e){console.log(e),o(e)}))}))}}}(),TempStars.Pages.Dentist.HirejobCandidate.init(),TempStars.Pages.Dentist.HirejobConfirmation=function(){"use strict";var e={},t=0,o=[],a="";function n(){t?TempStars.Dentist.Router.goBackPage("hirejob-home"):TempStars.Dentist.Router.goBackPage("hirejob-step-description")}function i(e){var n="hirejob-step-"+e.target.getAttribute("value");console.log("*[goto page]",n),a?TempStars.Dentist.Router.goBackPage(n,{id:parseInt(t),type:a,jobs:o}):TempStars.Dentist.Router.goBackPage(n,{id:t,jobs:o})}function s(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function r(){!function(){var a=TempStars.User.getCurrentUser().email,n="";n=a==app.formToJSON("#dentist-hirejob-step-details-form").email?a:app.formToJSON("#dentist-hirejob-step-details-form").email;var i=_.find(o,{id:parseInt(t)});if(console.log("job",i),console.log("formdata",e),e.title!=i.title&&e.description!=i.description){console.log("CHANGED");var s=moment().add(1,"months"),r={daysOfWeek:e.daysOfWeek,jobType:parseInt(e.position),startDate:moment(e.dateStart).format("YYYY-MM-DD"),endDate:moment(s).format("YYYY-MM-DD"),approxStart:e.approxStart,approxEnd:e.approxEnd,sendEmailTo:n,isOrtho:0,isRestorative:0,minYearsExp:"1",title:e.title,description:e.description,locationId:e.locationId}}else(r=i).endDate=moment().add(30,"days").format("YYYY-MM-DD"),r.status=1;console.log(r),TempStars.Api.updateHireJob(t,r).then((function(){TempStars.Dentist.Router.goForwardPage("hirejob-step-success")})).catch((function(e){app.hidePreloader(),app.alert("Error posting job. "+e.error.message)}))}()}function c(){$(".email").removeAttr("readonly"),$(".email").addClass("email-active"),$(".update-email-button").get(0).style.display="none",$("#change-email-button").get(0).style.display="flex"}function l(){$(".email").attr("readonly","readonly"),$(".email").removeClass("email-active"),$(".update-email-button").get(0).style.display="flex",$("#change-email-button").get(0).style.display="none"}function d(e){TempStars.Dentist.Router.goForwardPage("hirejob-step-position")}function p(e){f(!0)}function m(){var e=parseInt($$(this).attr("data-id"));e&&TempStars.Api.cancelHireJob(e).then((function(){f(!1),TempStars.Dentist.Router.goBackPage("hirejob-home")})).catch((function(e){console.log("*[cancelHireJob error]",e),f(!0)}))}function u(){f(!1)}function f(e){e?($("#overlay-content").empty(),$("#hirejob-modal-delete").show().appendTo($("#overlay-content"))):($("#hirejob-modal-delete").hide().appendTo($("#dentist-hirejob-step-details-page")),$("#overlay-content").empty()),$("#overlay-content").get(0).style.display=e?"flex":"none",$("#overlay-bg").get(0).style.display=e?"block":"none"}return{init:function(){app.onPageBeforeInit("dentist-hirejob-confirmation",(function(e){$$(".btn-back").on("click",n),$$(".btn-close-conf").on("click",s),$$(".btn-submit").on("click",r),$$(".update-email-button").on("click",c),$$("#change-email-button").on("click",l),$$(".navbar2-btn").on("click",n),$$(".edit-button").on("click",d),$$(".btn-delete-job").on("click",p),$$("#btn-hirejob-confirm-delete").on("click",m),$$("#btn-hirejob-cancel-delete").on("click",u),$$(".title-container-stroke").on("click",i)})),app.onPageInit("dentist-hirejob-confirmation",(function(t){$(".availability-day-conf").each((function(t){e.availability?"1"==e.availability[t]&&$(this).addClass("active-day-"+t):1==(e.daysOfWeek.split(",")||[])[t]&&$(this).addClass("active-day-"+t)})),"Ongoing"!=e.endDate&&e.endDate||($("#endDate_text").get(0).style.marginLeft="38px"),$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-confirmation",(function(e){$$(".btn-back").off("click",n),$$(".btn-close").off("click",s),$$(".btn-forward").off("click",r),$$(".title-container-stroke").off("click",i),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(n){var i=TempStars.User.getCurrentUser().locations;if(null!=n.id){t=n.id,o=n.jobs;var s=_.find(n.jobs,{id:parseInt(n.id)});s.startDate&&!moment().isBefore(s.startDate)&&(s.startDate=moment().format("YYYY-MM-DD")),s.endDate=s.endDate?s.endDate:moment().add(30,"days").format("YYYY-MM-DD"),$.extend(e,s);var r=_.find(i,{id:parseInt(e.locationId)});"edit"==n.type?(a=n.type,$.extend(e,app.formGetData("hirejob-position-form")),$.extend(e,app.formGetData("hirejob-location-form")),$.extend(e,app.formGetData("hirejob-availability-form")),$.extend(e,app.formGetData("hirejob-dates-form")),$.extend(e,app.formGetData("hirejob-requirements-form")),$.extend(e,app.formGetData("hirejob-description-form"))):"repost"==n.type&&(a=n.type,$.extend(e,app.formGetData("hirejob-position-form")),$.extend(e,app.formGetData("hirejob-location-form")),$.extend(e,app.formGetData("hirejob-availability-form")),$.extend(e,app.formGetData("hirejob-requirements-form")),$.extend(e,app.formGetData("hirejob-description-form")));var c=r&&r.address?r.address+", "+r.city+", "+r.province:"";e.location=c,app.formStoreData("hirejob-position-form",{position:e.jobType,basis:e.basis}),app.formStoreData("hirejob-location-form",{location:e.locationId}),app.formStoreData("hirejob-availability-form",{availability:e.daysOfWeek.split("")}),app.formStoreData("hirejob-dates-form",{endMode:e.endMode,startDate:e.startDate,endDate:e.endDate}),app.formStoreData("hirejob-requirements-form",{experience:e.experience,mode:e.mode}),app.formStoreData("hirejob-description-form",{description:e.description,title:e.title})}else console.log("**[formData]",e),$.extend(e,app.formGetData("hirejob-position-form")),$.extend(e,app.formGetData("hirejob-location-form")),$.extend(e,app.formGetData("hirejob-availability-form")),$.extend(e,app.formGetData("hirejob-dates-form")),$.extend(e,app.formGetData("hirejob-requirements-form")),$.extend(e,app.formGetData("hirejob-description-form"));var l=TempStars.User.getCurrentUser();if(e.email=l.email,e.startDate||(e.startDate=moment().format("YYYY-MM-DD")),e.endDate||("repost"===n.type?e.endDate=moment().add(30,"days").format("YYYY-MM-DD"):e.endDate="Ongoing"),!e.location){c=(r=_.find(i,{id:parseInt(e.location)}))&&r.address?r.address+", "+r.city+", "+r.province:"";e.location=c}var d="";switch(parseInt(e.experience)){case 0:d="New Graduate";break;case 1:d="1 Year";break;case 2:d="2 Years";break;case 3:d="3 Years";break;case 4:d="4 Years";break;case 5:d="5+ Years"}return e.mode&&e.mode.find((function(e){return"orthodontic"===e}))&&(d+=" <span>&#183;</span> Orthodontic"),e.mode&&e.mode.find((function(e){return"restorative"===e}))&&(d+=" <span>&#183;</span> Restorative"),Promise.resolve({id:n.id,formData:e,gradeText:d})}}}(),TempStars.Pages.Dentist.HirejobConfirmation.init(),TempStars.Pages.Dentist.HirejobFeedback=function(){"use strict";var e={};function t(e){4===+e.target.getAttribute("value")?($$(".btn-submit").addClass("disabled"),$$(".textareainput").removeAttr("readonly")):($$(".btn-submit").removeClass("disabled"),$$(".textareainput").val(""),$$(".textareainput").prop("readonly",!0))}function o(t){var o=app.formToJSON("#dentist-hirejob-feedback-form");TempStars.Api.leaveFeedback(e.id,o.answer,o.feedback),TempStars.Api.cancelHireJob(e.id).then((function(){TempStars.Dentist.Router.goBackPage("hirejob-home")})).catch((function(e){console.log("*[cancelHireJob error]",e),TempStars.Dentist.Router.goBackPage("hirejob-home")}))}function a(){TempStars.Dentist.Router.goBackPage("hirejob-step-details",e)}return{init:function(){app.onPageBeforeInit("dentist-hirejob-feedback",(function(e){$$(".btn-close").on("click",a),$$(".select-position input").on("click",t),$$("#submit_feedback").on("click",o),$$(".textareainput").on("change keyup paste",(function(e){$$(".textareainput").val().length>=5?$$(".btn-submit").removeClass("disabled"):$$(".btn-submit").addClass("disabled")}));app.formGetData("hirejob-feedback-form")})),app.onPageInit("dentist-hirejob-feedback",(function(t){console.log("inside page"),console.log(e)})),app.onPageBeforeRemove("dentist-hirejob-feedback",(function(e){console.log("before page remove")}))},getData:function(t){return e=t,Promise.resolve({readonlyText:true,questions:[{id:1,question:"Didn't get any applicants."},{id:2,question:"Wasn't able to find qualified applicants."},{id:3,question:"Already hired an applicant."},{id:4,question:"Other"}]})}}}(),TempStars.Pages.Dentist.HirejobFeedback.init(),TempStars.Pages.Dentist.HirejobHome=function(){"use strict";var e,t=[],o=!1;function a(){TempStars.Dentist.Router.goBackPage("home")}function n(){TempStars.App.goReact("jobBoard")}function i(){m(!1),localStorage.setItem("overlayTokensInfo",1)}function s(e){var t=(e=e||window.event).currentTarget||e.target;if(t){var o=t.getAttribute("data-id");return console.log("*[todo applications]",o),e.preventDefault(),e.stopPropagation(),!1}}function r(e){return e=e||window.event,app.formDeleteData("hirejob-position-form"),app.formDeleteData("hirejob-location-form"),app.formDeleteData("hirejob-availability-form"),app.formDeleteData("hirejob-dates-form"),app.formDeleteData("hirejob-requirements-form"),app.formDeleteData("hirejob-description-form"),TempStars.Dentist.Router.goForwardPage("hirejob-step-position"),e.preventDefault(),e.stopPropagation(),!1}function c(t){var o=(t=t||window.event).currentTarget||t.target;if(o){var a=o.getAttribute("data-id");return $(".jobs-empty").hide(),console.log(e),TempStars.Dentist.Router.goForwardPage("hirejob-step-details",{id:a,jobs:e}),t.preventDefault(),t.stopPropagation(),!1}}function l(e){e.stopPropagation(),t.dataChanges=t.dataChanges+1,d(parseInt($$(this).attr("data-id")),(function(){TempStars.Dentist.Router.reloadPage()}))}function d(e,t){new Framework7({confirm:{buttonOk:"Confirm",buttonCancel:"Go Back"}}).modal({title:"Delete This Job Posting?",text:"You'll still be able to see details of candidates whose resumes you viewed.  Are you sure?",buttons:[{text:"I'm Sure",onClick:function(){return new Promise((function(o,a){TempStars.Api.cancelHireJob(e).then(t).catch((function(e){a(e)}))}))}},{text:"Cancel"}]})}function p(e){var o=parseInt($$(this).attr("data-id")),a=_.find(t.jobs,{id:o});TempStars.Dentist.Router.goForwardPage("hirejob-active",a)}function m(e){$("#tokens-info-wrapper").hide().appendTo($("#page-dentist-hirejob-home")),$("#overlay-content").empty(),$("#overlay-content").get(0).style.display="none",$("#overlay-bg").get(0).style.display="none"}return{init:function(){app.onPageInit("dentist-hirejob-home",(function(e){$$(".job").on("click",p),$$(".remove-job").on("click",l),$("#jobpostings-content"),o||($("#tokens-info-wrapper").show().appendTo($("#overlay-content")),o=!0),$(".navbar2-btn-back").on("click",a),$(".navbar2-btn-new").on("click",r),$(".btn-postjob").on("click",r),$(".navbar2-btn-token").on("click",n),$(".btn-tokens-info-close").on("click",i),$(".btn-close-token-info").on("click",i),$(".job-applications-btn").on("click",s),$(".hirejob-item").on("click",c),localStorage.getItem("overlayTokensInfo")||m(!0)})),app.onPageBeforeRemove("dentist-hirejob-home",(function(e){$$(".job").off("click",p),$$(".remove-job").off("click",l),$(".navbar2-btn-back").off("click",a),$(".navbar2-btn-new").off("click",r),$(".btn-postjob").off("click",r),$(".navbar2-btn-token").off("click",n),$(".btn-tokens-info-close").off("click",i),$(".btn-close-token-info").off("click",i),$(".job-applications-btn").off("click",s),$(".hirejob-item").off("click",c)}))},deleteJob:d,getData:function(){return t.dataChanges=1,t.hasExpired=!1,t.isEmpty=!0,t.tokens=5,new Promise((function(o,a){TempStars.Api.getAllHireJobs().then((function(a){console.log(a),t.jobs=a.sort((function(e,t){return 0===e.status&&1===t.status?1:1===e.status&&0===t.status?-1:e.status>1&&t.status<2?1:0})),e=t.jobs,console.log(e),a.forEach((function(e){2==e.status||3==e.status?t.hasExpired=!0:0!=e.status&&1!=e.status||(t.isEmpty=!1)})),console.log(t),o(t)})).catch((function(e){console.log(e),a(e)}))}))}}}(),TempStars.Pages.Dentist.HirejobHome.init(),TempStars.Pages.Dentist.HirejobPost1=function(){"use strict";var e,t={Monday:!1,Tuesday:!1,Wednesday:!1,Thursday:!1,Friday:!1,Saturday:!1,Sunday:!1},o={},a=new Date,n="",i=(new Date,(new Date).setDate(a.getDate()),""),s="";TempStars.Config.helpEmail;function r(){var e="Ongoing"===app.formToJSON("#hirejob-post1-form")["dentist-hirejob-post1-endtype"];$$("#dentist-hirejob-post1-end-date").css("display",e?"none":"flex")}function c(t){app.prompt("Enter the e-mail where you would like notifications about this posting sent:","Enter E-mail",(function(t){e=t,$$("#email").text("E-mail Notifications to: "+t)}))}function l(t){var o,r=TempStars.User.getCurrentUser().locations,c=app.formToJSON("#hirejob-post1-form"),l=_.find(r,{address:c.location});if(!l.stripeCustomerId)return o=l.id,void app.modal({title:"Payment Info Required",text:"Posting a job on our Job Board is free, but it requires that you have payment information on your file.<br><br>You only have to do it once and your information is kept under bank-level security encryption.<br><br>There are never any surprise fees. Would you like to enter payment information now?",buttons:[{text:"Yes",bold:!0,onClick:function(){TempStars.Dentist.Router.goForwardPage("payment-info",{locationId:o})}},{text:"Cancel",onClick:function(){}}]});if(l.isCardValid){$$("#hirejob-post1-form .field-error-msg").removeClass("error").html("");var d=validate(c,{startDate:{presence:{allowEmpty:!1}}});if(d)d.startDate&&$$('#hirejob-post1-form input[name="startDate"]').addClass("error").next().html("This field is required");else if(""==n&&"Ongoing"!=c["dentist-hirejob-post1-endtype"]){var p="Your default start date is "+moment(a).local().format("MMMM D, YYYY")+", Please select end date";app.modal({title:"Empty End Date",text:p,buttons:[{text:"Edit",onClick:function(){}}]})}else if(a>n&&"Ongoing"!=c["dentist-hirejob-post1-endtype"]){p="Start date: "+moment(a).local().format("MMMM D, YYYY")+", is greater than End date:"+moment(n).local().format("MMMM D, YYYY")+"<br/> Please select valid dates.";app.modal({title:"Invalid Date Selections",text:p,buttons:[{text:"Edit",onClick:function(){}}]})}else{var m="You're looking to hire a: ";"Assistant"==(c=app.formToJSON("#hirejob-post1-form"))["dentist-hirejob-post1-role-select"]?m+="Dental Assistant":m+=c["dentist-hirejob-post1-role-select"],m+="<br/>Starting "+c["start-mode"]+": "+moment(a).local().format("MMMM D, YYYY")+"<br/>Location: "+l.address+"<br/>Ending"+(c["end-mode"]?" "+c["end-mode"]:"")+": "+c["dentist-hirejob-post1-endtype"]+" "+("Ongoing"===c["dentist-hirejob-post1-endtype"]?"":moment(n).local().format("MMMM D, YYYY"))+"<br/>For these days: "+(s?"<br/>"+s:"Not specified")+"<br/>Send notifications and applicant alerts to this e-mail:<br/>"+e,c.email=e,c.availableDays=i,c.startDate=a,c.endDate=n,app.modal({title:"<b>Confirm Job Details</b>",text:m,buttons:[{text:"Confirm",onClick:function(){TempStars.Dentist.Router.goForwardPage("hirejob-post2",c)}},{text:"Edit",onClick:function(){}}]})}}else TempStars.Pages.Dentist.Home.showCardInvalidModal(l.id)}function d(e){}function p(e){for(var o in i="",s="",t.Monday=$$("#available-days-checkbox-monday").prop("checked"),i=i+(t.Monday?"1":"0")+",",t.Tuesday=$$("#available-days-checkbox-tuesday").prop("checked"),i=i+(t.Tuesday?"1":"0")+",",t.Wednesday=$$("#available-days-checkbox-wednesday").prop("checked"),i=i+(t.Wednesday?"1":"0")+",",t.Thursday=$$("#available-days-checkbox-thursday").prop("checked"),i=i+(t.Thursday?"1":"0")+",",t.Friday=$$("#available-days-checkbox-friday").prop("checked"),i=i+(t.Friday?"1":"0")+",",t.Saturday=$$("#available-days-checkbox-saturday").prop("checked"),i=i+(t.Saturday?"1":"0")+",",t.Sunday=$$("#available-days-checkbox-sunday").prop("checked"),i+=t.Sunday?"1":"0",t){t[o]&&(s+=o+", ")}s=s.substr(0,s.length-2),$$("#selected_days").text(s)}function m(e){TempStars.Dentist.Router.goBackPage("jobs")}return{init:function(){app.onPageInit("dentist-hirejob-post1",(function(e){app.formToJSON("#hirejob-post1-form");$$("#available-days-checkbox-monday").prop("checked",!1),$$("#available-days-checkbox-tuesday").prop("checked",!1),$$("#available-days-checkbox-wednesday").prop("checked",!1),$$("#available-days-checkbox-thursday").prop("checked",!1),$$("#available-days-checkbox-friday").prop("checked",!1),$$("#available-days-checkbox-saturday").prop("checked",!1),$$("#available-days-checkbox-sunday").prop("checked",!1),t={Monday:!1,Tuesday:!1,Wednesday:!1,Thursday:!1,Friday:!1,Saturday:!1,Sunday:!1},i="",s="",r(),$(document).on("opened",".popover-available-days",d),$(document).on("closed",".popover-available-days",p),$$("#dentist-hirejobpost1-next-button").on("click",l.bind(this)),$$("#dentist-hirejob-post1-endtype").on("change",r),app.calendar({input:"#dentist-hirejob-start-date",cssClass:"open-calendar",toolbar:!0,firstDay:0,yearPicker:!0,dateFormat:"D, M d, yyyy",minDate:moment().subtract(1,"days"),onDayClick:function(e,t,o,n,i){a=new Date(o,n,i),setTimeout((function(){e.close()}),400)}}),app.calendar({input:"#dentist-hirejob-end-date",cssClass:"open-calendar",toolbar:!0,firstDay:0,yearPicker:!0,dateFormat:"D, M d, yyyy",minDate:moment(a).local()._d,onDayClick:function(e,t,o,a,i){n=new Date(o,a,i),setTimeout((function(){e.close()}),400)}}),$$(".open-prompt").on("click",c),function(){for(var e=TempStars.Dentist.getActiveLocations(),t="",o=0;o<e.length;o++)t+='<option value="'+e[o].address+'">'+e[o].address+"</option>";$$("#dentist-hirejob-post1-location").html(t)}()})),app.onPageBeforeRemove("dentist-hirejob-post1",(function(e){$(document).off("opened",".popover-available-days",d),$(document).off("closed",".popover-available-days",p),$$(".open-prompt").off("click",c),$$(".detailback").off("click",m),$$("#dentist-hirejobpost1-next-button").off("click",l),$$("#dentist-hirejob-post1-endtype").off("change",r)}))},getData:function(){var t=TempStars.User.getCurrentUser();return e=t.email,o.dentist=t,Promise.resolve(o)}}}(),TempStars.Pages.Dentist.HirejobPost1.init(),TempStars.Pages.Dentist.HirejobPost2=function(){"use strict";var e,t=0,o="Registered Dental Hygienist";function a(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function n(e){$$("#chars-left-val").html(50-e.target.value.length)}function i(t){var a=new Framework7({confirm:{buttonOk:"Confirm",buttonCancel:"Go Back"}}),n=TempStars.User.getCurrentUser().dentist,i=a.formToJSON("#dentist-hirejob-post2-form");if(function(e){return""!=e["dentist-hirejob-post2-grade"]||($("#dentist-hirejob-post2-grade").next().addClass("error").html("Minimum Years Experience must be selected"),!1)}(i)){var r="";switch(parseInt(i["dentist-hirejob-post2-grade"])){case 0:r="New Grads Welcome";break;case 1:r="1 Year";break;case 2:r="2 Years";break;case 3:r="3 Years";break;case 4:r="4 Years";break;case 5:r="5+ Years"}var c=o+"<br/>Min. Years Exp: "+r+"<br/>";i.mode&&i.mode.indexOf("orthodontic")>-1&&(c+="Orthodontic Certified<br/>"),i.mode&&i.mode.indexOf("restorative")>-1&&(c+="Restorative Certified");var l="Job postings automatically expire after 30 days, although you can remove them sooner.<br/>You will receive notifications when qualified candidates apply for this position.<br/>There is no fee for hiring a TempStars candidate.<br/>We bill $18"+(n.country===TempStars.COUNTRY.CA?"+hst":"")+" per resume viewed, up to a maximum of $54"+(n.country===TempStars.COUNTRY.CA?"+hst":"")+". There is no additional fee for viewing more than 3 resumes.<br/>This means - the maximum you will be billed for this posting is $54"+(n.country===TempStars.COUNTRY.CA?"+hst":"")+" if you view 3 or more qualified resumes. If you don't view any resumes, you won't be billed anything.<br/><h3>Do you Agree & Post This Job?";a.modal({title:"<b>Confirmation: Candidate Requirements</b>",text:c,buttons:[{text:"Confirm",onClick:function(){a.modal({title:"Confirmation: Policies",text:l,buttons:[{text:"Agree & Post",onClick:function(){var t={};for(var o in e)t[o]=e[o];for(var o in i)t[o]=i[o];s(t)}},{text:"Go Back",onClick:function(){}}]})}},{text:"Go Back",onClick:function(){}}]})}}function s(e){var o=TempStars.User.getCurrentUser().locations;app.modal({title:"<b>Job Posting Successfully Submitted</b>",text:"We will do a quick manual review of your posting and publish it once it's approved<br/>(within 24hrs)<br/>You will be notified by e-mail when a qualified candidate applies for this posting.<br/>To view this job posting and to view applicants, tap on Hire Staff and select it from the list of your postings.<br/>We don't charge for hiring, but standard temping placement fees apply if you arrange any temping with an applicant.<br/>",buttons:[{text:"I Understand",bold:!0,onClick:function(){var a;t=0,"Assistant"==e["dentist-hirejob-post1-role-select"]?t=1:"Front Desk"==e["dentist-hirejob-post1-role-select"]?t=2:"Associate Dentist"==e["dentist-hirejob-post1-role-select"]&&(t=3),app.showPreloader("Posting Job"),TempStars.User.getCurrentUser().dentistId;var n=0;e["start-mode"].indexOf("approximate")>-1&&(n=1);var i=0;e["end-mode"].indexOf("approximate")>-1&&(i=1);var s=0;e.mode&&e.mode.indexOf("orthodontic")>-1&&(s=1);var r=0;e.mode&&e.mode.indexOf("restorative")>-1&&(r=1),a={daysOfWeek:e.availableDays,jobType:t,startDate:moment(e.startDate).format("YYYY-MM-DD"),endDate:e.endDate?moment(e.endDate).format("YYYY-MM-DD"):null,approxStart:n,approxEnd:i,sendEmailTo:e.email,isOrtho:s,isRestorative:r,minYearsExp:e["dentist-hirejob-post2-grade"],title:e.title,description:e.description,locationId:_.find(o,{address:e.location}).id},TempStars.Api.postHireJob(a).then((function(){app.hidePreloader(),TempStars.Dentist.Router.goBackPage("home")})).catch((function(e){app.hidePreloader(),app.alert("Error posting job. "+e.error.message),TempStars.Dentist.Router.goBackPage()}))}}]})}return{init:function(){app.onPageInit("dentist-hirejob-post2",(function(t){$$("#dentist-hirejobpost2-submit-button").on("click",i),$$("#dentist-hirejobpost2-cancel-button").on("click",a),"Hygienist"==e["dentist-hirejob-post1-role-select"]?(o="Registered Dental Hygienist",TempStars.HYGIENIST_TYPES.HYGIENIST):"Assistant"==e["dentist-hirejob-post1-role-select"]?(o="CDA Level II Assistant",TempStars.HYGIENIST_TYPES.ASSISTANT):"Front Desk"==e["dentist-hirejob-post1-role-select"]?(o="Admin / Front Desk",TempStars.HYGIENIST_TYPES.FRONT_DESK):"Associate Dentist"==e["dentist-hirejob-post1-role-select"]&&(o="Associate Dentist",TempStars.HYGIENIST_TYPES.ASSOCIATE_DENTIST),function(){for(var e=document.getElementsByTagName("div"),t=e.length;t--;){var a=e[t];"response"===a.className&&"CDA Level II Assistant"==o&&(a.style.display="none")}}(),$$("#hygienist-type").text(o),$$("#hirejob-title").on("keyup",n)})),app.onPageBeforeRemove("dentist-hirejob-post2",(function(e){$$("#dentist-hirejobpost2-submit-button").off("click",i),$$("#hirejob-title").on("keyup",n),$$("#dentist-hirejobpost2-cancel-button").off("click",a)}))},getData:function(t){return e=t,Promise.resolve({post1Data:e})}}}(),TempStars.Pages.Dentist.HirejobPost2.init(),TempStars.Pages.Dentist.HirejobStepAvailability=function(){"use strict";var e=[],t={availability:[]},o=!1;function a(){$.extend(t,app.formToJSON("#dentist-hirejob-step-availability-form")),console.log("*formData",t),o&&app.formStoreData("hirejob-availability-form",t),e&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goBackPage("hirejob-step-location",t)}function n(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function i(){$.extend(t,app.formToJSON("#dentist-hirejob-step-availability-form")),console.log("*[formData]",t),o&&(app.formStoreData("hirejob-availability-form",t),e&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goForwardPage("hirejob-step-dates",t))}function s(e){var o=e.target.getAttribute("value"),a=e.target.getAttribute("checked");$$(".select-day input").each((function(e,t){a?$(".select-day input").eq(e).addClass("active"):$(".select-day input").eq(e).removeClass("active")}));var n=t.availability.indexOf(o);-1==n?t.availability.push(o):t.availability.splice(n),r()}function r(){console.log(t.availability),(o=!!t.availability.length)?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-availability",(function(e){$$(".btn-back").on("click",a),$$(".btn-close").on("click",n),$$(".btn-forward").on("click",i),$$(".select-day input").on("click",s),$(".select-day input").removeClass("active");var c=app.formGetData("hirejob-availability-form");console.log("*[data]",c),c&&(mergeFormData(c,t),$("input[name=availability]").each((function(e,t){var o=-1!=c.availability.indexOf($(t).attr("value"));$(t).prop("checked",o),o?$(".select-day input").eq(e).addClass("active"):$(".select-day input").eq(e).removeClass("active")}))),r(),console.log(o)})),app.onPageInit("dentist-hirejob-step-availability",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-availability",(function(e){$$(".btn-back").off("click",a),$$(".btn-close").off("click",a),$$(".btn-forward").off("click",i),$$(".select-day input").off("click",s),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(t){return"repost"===t.type&&(e=t),Promise.resolve({})}}}(),TempStars.Pages.Dentist.HirejobStepAvailability.init(),TempStars.Pages.Dentist.HirejobStepDates=function(){"use strict";var e,t,o,a=["January","February","March","April","May","June","July","August","September","October","November","December"],n={endMode:"",startDate:"",endDate:""},i=!1,s={},r=new Date,c=new Date;function l(){$.extend(n,app.formToJSON("#hirejob-step-dates-form")),i&&app.formStoreData("hirejob-dates-form",n),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goBackPage("hirejob-step-availability")}function d(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function p(){if($.extend(n,app.formToJSON("#hirejob-step-dates-form")),"1"==s.basis&&(n.endMode=""),m(),console.log("*[formData]",n),i)if(app.formStoreData("hirejob-dates-form",n),e.type&&"repost"===e.type){_.findIndex(e.jobs,{id:parseInt(e.id)});TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs})}else TempStars.Dentist.Router.goForwardPage("hirejob-step-requirements")}function m(){(i=!!n.startDate)?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-dates",(function(e){$$(".btn-back").on("click",l),$$(".btn-close").on("click",d),$$(".btn-forward").on("click",p),$("#end-date-calendar-container").get(0).style.display="none";var i=app.formGetData("hirejob-dates-form");console.log("*[data]",i),i&&(i.startDate&&(r=moment(i.startDate,"YYYY-MM-DD").toDate()),i.endDate&&(c=moment(i.endDate,"YYYY-MM-DD").toDate()),mergeFormData(i,n)),(i=app.formGetData("hirejob-position-form"))&&(mergeFormData(i,s),"2"!=i.basis&&"3"!=i.basis||($("#end-date-calendar-container").get(0).style.display="block")),t=app.calendar({input:"#hirejob-calendar-start-input",container:"#hirejob-calendar-start",value:[r],weekHeader:!0,firstDay:0,toolbarTemplate:'<div class="toolbar calendar-custom-toolbar"><div class="new-posting_toolbar-inner"><div class="left"><a href="#" class="link icon-only"><svg width="12" height="19" viewBox="0 0 12 19" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M9.61914 2.25L1.96987 9.5L9.61914 16.75" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div><div class="new-posting_center"></div><div class="right"><a href="#" class="link icon-only"> <svg width="12" height="19" viewBox="0 0 12 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.38086 16.75L10.0301 9.5L2.38086 2.25" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/</svg></a></div></div></div>',onDayClick:function(e,t,o,a,i){var s=new Date(o,a,i);r=s,n.startDate=moment(s).format("YYYY-MM-DD"),console.log("*[startDate]",n.startDate),m()},onOpen:function(e){$$(".calendar-custom-toolbar .new-posting_center").text(a[e.currentMonth]+" "+e.currentYear),$$(".calendar-custom-toolbar .left .link").on("click",(function(){t.prevMonth(),r=n.startDate?n.startDate:new Date(r.setMonth(r.getMonth()-1))})),$$(".calendar-custom-toolbar .right .link").on("click",(function(){t.nextMonth(),r=new Date(r.setMonth(r.getMonth()+1))}))},onMonthYearChangeStart:function(e){$$(".calendar-custom-toolbar .new-posting_center").text(a[e.currentMonth]+" "+e.currentYear)}}),o=app.calendar({input:"#hirejob-calendar-end-input",container:"#hirejob-calendar-end",value:[c],weekHeader:!0,firstDay:0,dateFormat:"D, M d, yyyy",toolbarTemplate:'<div class="toolbar calendar-custom-toolbar no-shadow"><div class="new-posting_toolbar-inner"><div class="left"><a href="#" class="link icon-only"><svg width="12" height="19" viewBox="0 0 12 19" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M9.61914 2.25L1.96987 9.5L9.61914 16.75" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div><div class="new-posting_center"></div><div class="right"><a href="#" class="link icon-only"> <svg width="12" height="19" viewBox="0 0 12 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.38086 16.75L10.0301 9.5L2.38086 2.25" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/</svg></a></div></div></div>',onDayClick:function(e,t,o,a,i){var s=new Date(o,a,i);c=s,n.endDate=moment(s).format("YYYY-MM-DD"),console.log("*[endDate]",n.endDate),m()},onOpen:function(e){$$(".calendar-custom-toolbar .new-posting_center").text(a[e.currentMonth]+" "+e.currentYear),$$(".calendar-custom-toolbar .left .link").on("click",(function(){o.prevMonth(),c=n.endDate?n.endDate:new Date(r.setMonth(r.getMonth()-1))})),$$(".calendar-custom-toolbar .right .link").on("click",(function(){o.nextMonth(),c=new Date(c.setMonth(c.getMonth()+1))}))},onMonthYearChangeStart:function(e){$$(".calendar-custom-toolbar .new-posting_center").text(a[e.currentMonth]+" "+e.currentYear)}}),m()})),app.onPageInit("dentist-hirejob-step-dates",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-dates",(function(e){$$(".btn-back").off("click",l),$$(".btn-close").off("click",l),$$(".btn-forward").off("click",p),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(t){return e=t,Promise.resolve({})}}}(),TempStars.Pages.Dentist.HirejobStepDates.init(),TempStars.Pages.Dentist.HirejobStepDescription=function(){"use strict";var e,t={description:"",title:""},o=!1,a="",n=[];function i(e){e.data,d()}function s(e){e.data,d()}function r(){$.extend(t,app.formToJSON("#hirejob-step-description-form")),d(),o&&app.formStoreData("hirejob-description-form",t),TempStars.Dentist.Router.goBackPage("hirejob-step-requirements")}function c(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function l(){null!=e?o&&($.extend(t,app.formToJSON("#hirejob-step-description-form")),app.formStoreData("hirejob-description-form",t),TempStars.Dentist.Router.goForwardPage("hirejob-confirmation",{id:parseInt(e),type:a,jobs:n})):o&&($.extend(t,app.formToJSON("#hirejob-step-description-form")),app.formStoreData("hirejob-description-form",t),TempStars.Dentist.Router.goForwardPage("hirejob-step-details")),d(),console.log("*[formData]",t)}function d(){$.extend(t,app.formToJSON("#hirejob-step-description-form")),(o=!(!t.title.length||!t.description.length))?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-description",(function(e){$$(".btn-back").on("click",r),$$(".btn-close").on("click",c),$$(".listing_title").on("input",i),$$(".listing_description").on("input",s),$$(".btn-forward").on("click",l);var o=app.formGetData("hirejob-description-form");console.log("*[data]",o),o&&(t=o,mergeFormData(o,t)),d()})),app.onPageInit("dentist-hirejob-step-description",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-description",(function(e){$$(".btn-back").off("click",r),$$(".btn-close").off("click",r),$$(".btn-forward").off("click",l),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(o){e=o.id,n=o.jobs;var i=_.find(o.jobs,{id:parseInt(o.id)});return i?(o.type&&(a=o.type),Promise.resolve({formData:t,title:i.title?i.title:"",description:i.description?i.description:""})):(o.type&&(a=o.type),Promise.resolve({formData:t}))}}}(),TempStars.Pages.Dentist.HirejobStepDescription.init(),TempStars.Pages.Dentist.HirejobStepDetails=function(){"use strict";var e={},t=0,o=[],a=[];function n(t){var o=$(this).attr("id"),a=e.candidates.find((function(e){return e.id==o}));a.hygienist=e.candidates.find((function(e){return e.id==o})),TempStars.Dentist.Router.goForwardPage("hirejob-candidate",{application:a,job:e})}function i(){t?TempStars.Dentist.Router.goBackPage("hirejob-home"):TempStars.Dentist.Router.goBackPage("hirejob-step-description")}function s(e){var t="hirejob-step-"+e.target.getAttribute("value");console.log("*[goto page]",t),TempStars.Dentist.Router.goBackPage(t)}function r(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function c(){!function(){var o=TempStars.User.getCurrentUser().email,a=[0,0,0,0,0,0,0];a.forEach((function(t,o){e.availability.filter((function(e){return parseInt(e)===o+1})).length&&(a[o]=1)}));var n=0;e.startMode.length&&(n=1);var i=0;e.endMode.length&&(i=1);var s=0;e.mode&&e.mode.find((function(e){return"orthodontic"===e}))&&(s=1);var r=0;e.mode&&e.mode.find((function(e){return"restorative"===e}))&&(r=1);var c="";c=o==app.formToJSON("#dentist-hirejob-step-details-form").email?o:app.formToJSON("#dentist-hirejob-step-details-form").email;var l={daysOfWeek:a.join(),jobType:parseInt(e.position),startDate:moment(e.dateStart).format("YYYY-MM-DD"),endDate:"Ongoing"!=e.endDate?moment(e.endDate).format("YYYY-MM-DD"):null,approxStart:n,approxEnd:i,sendEmailTo:c,isOrtho:s,isRestorative:r,minYearsExp:e.experience,title:e.title,description:e.description,locationId:parseInt(e.location)};t?TempStars.Api.updateHireJob(t,l).then((function(){TempStars.Dentist.Router.goForwardPage("hirejob-step-success")})).catch((function(e){app.hidePreloader(),app.alert("Error posting job. "+e.error.message)})):TempStars.Api.postHireJob(l).then((function(){TempStars.Dentist.Router.goForwardPage("hirejob-step-success")})).catch((function(e){app.hidePreloader(),app.alert("Error posting job. "+e.error.message)}))}()}function l(){TempStars.Dentist.Router.goForwardPage("hirejob-confirmation",{id:t,jobs:o,type:"repost"})}function d(){$(".email").removeAttr("readonly"),$(".email").addClass("email-active"),$(".update-email-button").get(0).style.display="none",$("#change-email-button").get(0).style.display="flex"}function p(){$(".email").attr("readonly","readonly"),$(".email").removeClass("email-active"),$(".update-email-button").get(0).style.display="flex",$("#change-email-button").get(0).style.display="none"}function m(e){TempStars.Dentist.Router.goForwardPage("hirejob-confirmation",{id:t,jobs:o,type:"edit"})}function u(e){h(!0)}function f(){t&&(console.log("onclick to feedback"),h(!1),TempStars.Dentist.Router.goForwardPage("hirejob-feedback",{id:t,jobs:a}))}function b(){h(!1)}function h(e){e?($("#overlay-content").empty(),$("#hirejob-modal-delete").show().appendTo($("#overlay-content"))):($("#hirejob-modal-delete").hide().appendTo($("#dentist-hirejob-step-details-page")),$("#overlay-content").empty()),$("#overlay-content").get(0).style.display=e?"flex":"none",$("#overlay-bg").get(0).style.display=e?"block":"none"}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-details",(function(e){console.log(e.context),$$(".btn-back").on("click",i),$$(".btn-close").on("click",r),$$(".btn-submit").on("click",c),$$(".update-email-button").on("click",d),$$("#change-email-button").on("click",p),$$(".navbar2-btn").on("click",i),$$(".edit-button").on("click",m),$$(".btn-delete-job").on("click",u),$$("#btn-hirejob-confirm-delete").on("click",f),$$("#btn-hirejob-cancel-delete").on("click",b),$$(".title-container-stroke").on("click",s),$$(".alert-banner-expired-repost-button").on("click",l),$$(".candidate-container").on("click",n)})),app.onPageInit("dentist-hirejob-step-details",(function(t){$(".availability-day").each((function(t){if(e.availability){if(e.availability.filter((function(e){return parseInt(e)===t+1})).length)return $(this).addClass("active-day-"+t)}else 1==(e.daysOfWeek.split(",")||[])[t]&&$(this).addClass("active-day-"+t);e.candidates&&e.candidates.forEach((function(e){e.resumeViewed?$("#viewed").get(0).style.display="block":$("#unopened").get(0).style.display="block"}))})),2==e.status&&($(".detail-mode-info-container").get(0).style.opacity="0.75",$(".details_mode-fields-container").get(0).style.opacity="0.75"),$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-details",(function(e){$$(".btn-back").off("click",i),$$(".btn-close").off("click",r),$$(".btn-forward").off("click",c),$$(".title-container-stroke").off("click",s),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(n){var i=TempStars.User.getCurrentUser().locations;if(o=n.jobs,n.id){t=n.id;var s=_.find(n.jobs,{id:parseInt(n.id)});a=n.jobs,$.extend(e,s);var r=(d=_.find(i,{id:parseInt(e.locationId)}))&&d.address?d.address:"";e.location=r,app.formStoreData("hirejob-position-form",{position:e.jobType,basis:e.basis}),app.formStoreData("hirejob-location-form",{location:e.locationId}),app.formStoreData("hirejob-availability-form",{availability:e.daysOfWeek.split(",")}),app.formStoreData("hirejob-dates-form",{endMode:e.endMode,startDate:e.startDate,endDate:e.endDate}),app.formStoreData("hirejob-requirements-form",{experience:e.experience,mode:e.mode}),app.formStoreData("hirejob-description-form",{description:e.description,title:e.title});var c="";switch(parseInt(e.jobType)){case 0:c="Hygienist";break;case 1:c="Assistant";break;case 2:c="Front Desk";break;case 3:c="Associate Dentist"}}else console.log("**[formData]",e),$.extend(e,app.formGetData("hirejob-position-form")),$.extend(e,app.formGetData("hirejob-location-form")),$.extend(e,app.formGetData("hirejob-availability-form")),$.extend(e,app.formGetData("hirejob-dates-form")),$.extend(e,app.formGetData("hirejob-requirements-form")),$.extend(e,app.formGetData("hirejob-description-form"));var l=TempStars.User.getCurrentUser();if(e.email=l.email,e.startDate||(e.startDate=moment().format("YYYY-MM-DD")),e.endDate||(e.endDate="Ongoing"),!e.location){var d;r=(d=_.find(i,{id:parseInt(e.location)}))&&d.address?d.address+", "+d.city+", "+d.province:"";e.location=r}var p="";switch(parseInt(e.experience)){case 0:p="New Graduate";break;case 1:p="1 Year";break;case 2:p="2 Years";break;case 3:p="3 Years";break;case 4:p="4 Years";break;case 5:p="5+ Years"}return e.mode&&e.mode.find((function(e){return"orthodontic"===e}))&&(p+=" <span>&#183;</span> Orthodontic"),e.mode&&e.mode.find((function(e){return"restorative"===e}))&&(p+=" <span>&#183;</span> Restorative"),n.id?TempStars.Api.getAvailableCandidates(n.id).then((function(t){var o=[];return console.log(t),t.forEach((function(e){var t=e.hygienist;t.resumeViewed=e.resumeViewed,t.photoUrl=t.photoUrl?t.photoUrl:"../../img/user.jpg",t.firstName=0===t.resumeViewed?t.id:t.firstName,o.push(t)})),e.candidates=o,{id:n.id,formData:e,position:c,status:e.status,gradeText:p,isDetailsMode:!!n.id}})):Promise.resolve({id:n.id,formData:e,position:c,status:e.status,gradeText:p,isDetailsMode:!!n.id})}}}(),TempStars.Pages.Dentist.HirejobStepDetails.init(),TempStars.Pages.Dentist.HirejobStepLocation=function(){"use strict";var e,t,o,a={location:0},n=!1;function i(){$.extend(a,app.formToJSON("#dentist-hirejob-step-location-form")),console.log("*formData",a),n&&app.formStoreData("hirejob-location-form",a),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goBackPage("hirejob-step-position")}function s(){$.extend(a,app.formToJSON("#dentist-hirejob-step-location-form")),console.log("*formData",a),n&&(app.formStoreData("hirejob-location-form",a),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goForwardPage("hirejob-step-availability"))}function r(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function c(){m(!0)}function l(e){var t=e.target.getAttribute("data-val");a.location=+t,$$(".select-location input").each((function(e,o){t==e+1?$(".select-location input").eq(e).prop("checked"):$(".select-location input").eq(e).removeClass("active")})),u()}function d(e){e=e||window.event;var o=app.formToJSON("#hirejob-location-form");console.log("*[added location]",o);var a=TempStars.User.getCurrentUser().dentistId,n=TempStars.User.getCurrentUser().email,i={dentistId:a,address:o.address,city:o.city,province:o.province,postalCode:o.zipcode,email:n,phone:o.phone,country:0,practiceName:"test"};return TempStars.Api.addLocation(i).then((function(e){console.log("*[addLocation]",e),t++;var a=$("<div>").addClass("select-location");a.on("click",l),$("<input>").attr({type:"radio",name:"location",id:"location-"+t,value:e.locationId,readonly:"readonly"}).appendTo(a),$("<label>").attr({for:"location-"+t}).html(o.address+", "+o.city+" "+o.province).appendTo(a),$("#dentist-hirejob-step-location-list").append(a)})).catch((function(e){console.log("*[addLocation]error",e)})),$("#hirejob-location-address").val(""),$("#hirejob-location-state").val(""),$("#hirejob-location-zipcode").val(""),$("#hirejob-location-city").val(""),$("#hirejob-location-country").val(""),$("#hirejob-location-phone").val(""),m(!1),e.preventDefault(),e.stopPropagation(),!1}function p(e){return e=e||window.event,m(!1),e.preventDefault(),e.stopPropagation(),!1}function m(e){e?($("#overlay-content").empty(),$("#hirejob-modal-location").show().appendTo($("#overlay-content"))):($("#hirejob-modal-location").hide().appendTo($("#page-dentist-hirejob-step-position")),$("#overlay-content").empty()),$("#overlay-content").get(0).style.display=e?"flex":"none",$("#overlay-bg").get(0).style.display=e?"block":"none"}function u(){console.log("*",a),(n=!!a.location)?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-location",(function(e){$$(".btn-back").on("click",i),$$(".btn-close").on("click",r),$$(".btn-forward").on("click",s),$$("#btn-add-office-location").on("click",c),$$(".select-location input").on("click",l),$$("#btn-hirejob-location-add").on("click",d),$$("#btn-hirejob-location-cancel").on("click",p),$(".select-location input").removeClass("active");var t=app.formGetData("hirejob-location-form");t&&(mergeFormData(t,a),console.log(a),$("input[name=location]").each((function(e,t){var o=a.location==$(t).attr("value");$(t).prop("checked",o),o?$(".select-location input").eq(e).addClass("active"):$(".select-location input").eq(e).removeClass("active")}))),u()})),app.onPageInit("dentist-hirejob-step-location",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-location",(function(e){$$(".btn-back").off("click",i),$$(".btn-close").off("click",i),$$(".btn-forward").off("click",s),$$(".select-location a").off("click",l),$$("#btn-hirejob-location-add").off("click",d),$$("#btn-hirejob-location-cancel").off("click",p),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(a){return e=a,o=TempStars.User.getCurrentUser().dentistId,TempStars.User.getCurrentUser().dentist,t=TempStars.User.getCurrentUser().locations.filter((function(e){return 0===e.removed})).length,TempStars.Api.getLocations(o).then((function(e){TempStars.Dentist.setLocations(e);let t=1;return e.forEach((function(e){e.index=t,t++})),console.log(e),{locations:e.filter((function(e){return 0===e.removed}))}}))}}}(),TempStars.Pages.Dentist.HirejobStepLocation.init(),TempStars.Pages.Dentist.HirejobStepPosition=function(){"use strict";var e,t={position:0,basis:1},o=!1;function a(){$.extend(t,app.formToJSON("#dentist-hirejob-step-position-form")),console.log("*formData",t),o&&app.formStoreData("hirejob-position-form",t),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goBackPage("hirejob-home")}function n(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function i(){$.extend(t,app.formToJSON("#dentist-hirejob-step-position-form")),console.log("*formData",t),o&&(app.formStoreData("hirejob-position-form",t),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goForwardPage("hirejob-step-location"))}function s(e){var o=+e.target.getAttribute("value");t.position=o,$$(".select-position input").each((function(e,t){o==$(t).attr("value")?$(".select-position input").eq(e).addClass("active"):$(".select-position input").eq(e).removeClass("active")})),c()}function r(e){var o=+e.target.getAttribute("value");t.basis=o,$$(".select-basis input").each((function(e,t){o==$(t).attr("value")?$(".select-basis input").eq(e).addClass("active"):$(".select-basis input").eq(e).removeClass("active")})),c()}function c(){(o=!!t.position)?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-position",(function(e){$$(".btn-back").on("click",a),$$(".btn-close").on("click",n),$$(".btn-forward").on("click",i),$$(".select-position input").on("click",s),$$(".select-basis input").on("click",r),$(".select-position input").removeClass("active"),$(".select-basis input").removeClass("active"),$(".select-basis input").eq(0).addClass("active");var o=app.formGetData("hirejob-position-form");console.log("*[data]",o),o&&(mergeFormData(o,t),$("input[name=basis]").each((function(e,o){var a=t.basis==$(o).attr("value");$(o).prop("checked",a),a?$(".select-basis input").eq(e).addClass("active"):$(".select-basis input").eq(e).removeClass("active")})),$("input[name=position]").each((function(e,o){var a=t.position==$(o).attr("value");$(o).prop("checked",a),a?$(".select-position input").eq(e).addClass("active"):$(".select-position input").eq(e).removeClass("active")}))),c()})),app.onPageInit("dentist-hirejob-step-position",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-position",(function(e){$$(".btn-back").off("click",a),$$(".btn-close").off("click",a),$$(".btn-forward").off("click",i),$$(".select-position input").off("click",s),$$(".select-basis input").off("click",r),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(t){return e=t,Promise.resolve({})}}}(),TempStars.Pages.Dentist.HirejobStepPosition.init(),TempStars.Pages.Dentist.HirejobStepRequirements=function(){"use strict";var e,t={experience:0,mode:""},o=!1;function a(){$.extend(t,app.formToJSON("#hirejob-step-requirements-form")),o&&app.formStoreData("hirejob-requirements-form",t),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goBackPage("hirejob-step-dates")}function n(){$.extend(t,app.formToJSON("#hirejob-step-requirements-form")),r(),console.log("*[formData]",t),o&&(app.formStoreData("hirejob-requirements-form",t),e.type&&"repost"===e.type?TempStars.Dentist.Router.goBackPage("hirejob-confirmation",{id:parseInt(e.id),type:e.type,jobs:e.jobs}):TempStars.Dentist.Router.goForwardPage("hirejob-step-description"))}function i(){TempStars.Dentist.Router.goBackPage("hirejob-home")}function s(e){var o=e.target.getAttribute("data-val");t.experience=+o,$$(".select-experience input").each((function(e,t){o==e+1?$(".select-experience input").eq(e).prop("checked"):$(".select-experience input").eq(e).removeClass("active")})),r()}function r(){(o=!!t.experience)?$(".btn-forward").removeClass("disabled"):$(".btn-forward").addClass("disabled")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-requirements",(function(e){$$(".btn-back").on("click",a),$$(".btn-close").on("click",i),$$(".btn-forward").on("click",n),$$(".select-experience input").on("click",s),$(".select-experience input").removeClass("active"),t.experience=0;var o=app.formGetData("hirejob-requirements-form");console.log("*[data]",o),o&&(mergeFormData(o,t),$("input[name=experience]").each((function(e,o){var a=t.experience==$(o).attr("value");$(o).prop("checked",a),a?$(".select-experience input").eq(e).addClass("active"):$(".select-experience input").eq(e).removeClass("active")}))),r()})),app.onPageInit("dentist-hirejob-step-requirements",(function(e){$(".navbar").get(0).style.display="none"})),app.onPageBeforeRemove("dentist-hirejob-step-requirements",(function(e){$$(".btn-back").off("click",a),$$(".btn-close").off("click",a),$$(".btn-forward").off("click",n),$$(".select-experience input").off("click",s),"dentist/hirejob-home.html"==e.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(t){e=t;var o=app.formGetData("hirejob-position-form");return Promise.resolve({position:o.position})}}}(),TempStars.Pages.Dentist.HirejobStepRequirements.init(),TempStars.Pages.Dentist.HirejobStepSuccess=function(){"use strict";function e(){console.log("*[back]"),TempStars.Dentist.Router.goBackPage("hirejob-home")}return{init:function(){app.onPageBeforeInit("dentist-hirejob-step-success",(function(t){$$(".btn-close").on("click",e),$$(".btn-backToJobPosting").on("click",e)})),app.onPageInit("dentist-hirejob-step-success",(function(e){$(".navbar").get(0).style.display="none",setTimeout((function(){document.getElementById("btn-close").click()}),1e4)})),app.onPageBeforeRemove("dentist-hirejob-step-success",(function(t){$$(".btn-back").off("click",e),$$(".btn-close").off("click",e),"dentist/hirejob-home.html"==t.view.url?$(".navbar").get(0).style.display="flex":$(".navbar").get(0).style.display="none"}))},getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.HirejobStepSuccess.init(),TempStars.Pages.Dentist.Home=function(){"use strict";var e,t,o,a,n,i,s=new Date,r=["","Unfilled","Custom","Booked","Completed","Expired"];function c(e){closeAnnouncement(e,t)}function l(e){return TempStars.ChatPage.newMessageListener(t,e)}function d(){TempStars.Dentist.Router.goForwardPage("contact-support")}function p(e){app.modal({title:"<b>Claim Your Free Placement</b>",text:"Welcome back!<br><br> If you don’t mind, we have a couple of fast & easy questions we’d like to ask, then that Free Placement will be yours!",buttons:[{text:"Ask away!",bold:!0,onClick:function(){TempStars.Dentist.Router.goForwardPage("survey",{surveyId:e})}}]})}function m(e){if(e>=n.length)return;var o=localStorage.getItem("postponeSurvey");o=(o=o?JSON.parse(o):[]).filter((function(e){return moment(e.postponeUntil)>moment()})),localStorage.setItem("postponeSurvey",JSON.stringify(o));const a=t.jobs[n[e]];TempStars.Api.getHygienistById(a.hygienistId).then((function(i){var s=(i?i.firstName+" "+i.lastName+"<br>":"")+(i.photoUrl?'<img src="'+i.photoUrl+'" width="60px" style="margin-top: 5px;" /><br>':"")+moment(a.shifts[0].shiftDate).local().format("ddd, MMM D, YYYY")+"<br>"+a.shifts[0].postedStart+" - "+a.shifts[0].postedEnd+"<br>How happy would you be to have "+i.firstName+" work at your office again?";app.modal({title:"Review Your "+(a.type?"Assistant":"Hygienist"),text:s,verticalButtons:!0,buttons:[{text:"😍 Favourite!",onClick:function(){TempStars.Analytics.track("submit rating",{rating:"Favourite",userTypeRated:a.type?"Assistant":"Hygienist"}),function(e,o){app.modal({title:"We’re so glad!",text:` Spread the love and send ${o.firstName} a note of appreciation:\n            <div class="list-block inset" style="margin:15px 0 0px 5px;font-size:13px;">\n                    <li class="item-content signup-modal-content">\n                        <div class="item-inner happy-feedback-item">\n                            <div class="item-input">\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Thanks so much, ${o.firstName}!”" checked>\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Thanks so much, ${o.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Great job, ${o.firstName}!”">\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Great job, ${o.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Really appreciate it, ${o.firstName}!”" >\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Really appreciate it, ${o.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“You were great, ${o.firstName}!”">\n                                    <div class="item-media item-checkbox-container">\n                                        <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                    <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                        <div class="item-title">“You were great, ${o.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="not">\n                                    <div class="item-media item-checkbox-container">\n                                        <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                    <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                        <div class="item-title">Don’t send a note</div>\n                                    </div>\n                                </label>\n                            </div>\n                        </div>\n                    </li>\n                </div>`,buttons:[{text:"Submit",onClick:function(){"not"!=$("input[name='feedbackType']:checked")[0].value&&TempStars.Api.positiveFeedback({job:t.jobs[n[e]],feedback:$("input[name='feedbackType']:checked").val()}),TempStars.User.updateUserReview({},o),u(e,TempStars.Rating.VERY_HAPPY)}},{text:"Go Back",onClick:function(){m(e)}}]})}(e,i)}},{text:"🙂 Pleased",onClick:function(){TempStars.Analytics.track("submit rating",{rating:"Pleased",userTypeRated:a.type?"Assistant":"Hygienist"}),u(e,TempStars.Rating.PLEASED),app.modal({title:"<strong>TempStars</strong>",text:"Glad to hear!<br><br><b>A friendly reminder:</b> Standard placement fees apply to future shifts booked with "+i.firstName+" - whether arranged on the app or through direct contact.",buttons:[{text:"OK"}]})}},{text:`<div style="line-height: 26px;">\n                        <div>🙁 Unhappy</div>\n                        <div style="font-size: 10px; color:black;">(${i.firstName} <b>won’t</b> be notified if you select this.)</div>\n                        </div>\n                        `,onClick:function(){TempStars.Analytics.track("submit rating",{rating:"Unhappy",userTypeRated:a.type?"Assistant":"Hygienist"}),function(e,o){app.modal({title:"<b>Uh Oh.</b>",text:`\n                <div style="text-align:center;">\n                Can you tell us briefly where ${o.firstName} went wrong?\n                </div>\n                <div class="list-block">\n\n                <div class="item-input">\n                    <textarea id="UnhappyFeedback" placeholder="You can provide details here..."></textarea>\n                </div>\n                <label class="label-checkbox item-content">\n                <input type="checkbox" id="contactUs" name="contactUs">\n                <div class="item-media">\n                  <i class="icon icon-form-checkbox"></i>\n                </div>\n                <div class="item-inner">\n                  <div class="item-title">Please contact me about this</div>\n                </div>\n              </label>\n                <input id="dentist-name" placeholder="your name" type="text">\n                </div>\n            `,buttons:[{text:"Go Back",onClick:function(){m(e)}},{text:"Submit",bold:!0,onClick:function(){TempStars.Api.negativeFeedback({job:t.jobs[n[e]],negativeFeedback:$$("#UnhappyFeedback").val(),contact:$("input[name='contactUs']")[0].checked,name:$$("#dentist-name").val()}),app.alert(`\n                            We really appreciate your feedback.  We track negative feedback internally to manage our membership and ensure we're only connecting offices with the best members.<br><br> \n                            Over the course of 1,000's of placements, 97% of offices report "Happy" or "Very Happy", so we're sorry the ball got dropped here.<br> \n                            They have been blocked from viewing any of your future postings.<br><br>\n                            A friendly reminder: Standard placement fees apply to future shifts booked with ${o.firstName}, whether arranged on the app or through direct contact.`,"Thank you!",(function(){u(e,TempStars.Rating.NO_THANK_YOU)}))}}]}),$$("input[name='contactUs']").on("change",(function(){$("input[name='contactUs']")[0].checked?$$("#dentist-name").addClass("visible"):$$("#dentist-name").removeClass("visible")}))}(e,i)}},{text:"Do this later...",onClick:function(){o.push({jobId:a.id,postponeUntil:moment().add(1,"day")}),localStorage.setItem("postponeSurvey",JSON.stringify(o)),m(e+1)}}]})}))}function u(e,o){TempStars.Api.saveHygienistRating(t.jobs[n[e]].id,{hygienistRating:o}).then((function(){m(e+1)}))}function f(e,o,a,n,i){var s=moment({year:a,month:parseInt(n),day:i}).toDate(),r=moment({year:a,month:parseInt(n),day:i}).format("MMM D, YYYY"),c=moment(moment().format("YYYY-MM-DD")).format("X"),l=moment(r,"MMM D, YYYY").format("X");if(t.jobs.filter((e=>moment(s).format("YYYY-MM-DD")===e.startDate)).length>2)return g();c>l?app.modal({title:"<b>TempStars</b>",text:"You can't create shift in the past",buttons:[{text:"OK",bold:!0,onClick:function(){}}]}):app.modal({title:"<b>Post a Shift?</b>",text:"Would you like to find a temp for "+r+"?",buttons:[{text:"YES",bold:!0,onClick:function(){TempStars.App.goReact("postJob",{date:r})}},{text:"Cancel",onClick:function(){}}]})}function b(e){return moment(e.startDate).toDate()}function h(e){return e.status===TempStars.JOB_STATUSES.COMPLETED&&e.invoice.id&&!e.invoice.dentistMarkedPaid&&(e.actionRequired=!0),e}function g(){app.modal({title:"<b>Maximum Reached</b>",text:"Our system allows a maximum of 3 shifts per location. This location has reached it's maximum of 3.",buttons:[{text:"OK"}]})}const y=e=>{TempStars.App.goReact("postJob",{date:e?.date||void 0})};function v(e,t={}){if(1!==TempStars.User.getCurrentUser().locations.length||TempStars.User.getCurrentUser().locations[0].isUpdated)y(t);else{const e=TempStars.User.getCurrentUser().locations[0];app.modal({title:"Confirm your office information",text:`\n                            <ul style="text-align:left; font-size: 16px;">\n                            <li><b>Primary Contact</b> : ${e.primaryContact}</li>\n                            <li><b>Parking</b>: ${e.parking}</li>\n                            <li><b>Avg Recall</b>: ${e.avgApptTime}</li>\n                            <li><b>Radiography</b>: ${e.radiography}</li>\n                            <li><b>Ultrasonic</b>: ${e.ultrasonic}</li>\n                            <li><b>Charting</b>: ${e.charting}</li>\n                            <li><b>Software</b>: ${e.software}</li>\n                            </ul>\n                        `,buttons:[{text:"Confirm",onClick:async()=>{await TempStars.Api.updateLocation(parseInt(e.id),{isUpdated:1}),y(t)}},{text:"Change",onClick:function(){TempStars.Dentist.Router.goForwardPage("update-information",{location:e})}}]})}}function k(e,t){e&&e.preventDefault();var o=TempStars.User.getCurrentUser().dentist;o.isAcceptedJobBoardPolicy?TempStars.App.goReact("jobBoard"):app.modal({title:"<b>Job Board Policy</b>",text:["Our Job Board is a game-changer for finding great permanent and contract dental professionals to grow your team.",'But remember - this is only for permanent and long-term positions. Our policy strictly prohibits use of the Job Board to arrange temping shifts. For our fast/easy temping, click "Get a Temp" from the home calendar screen.'].join("<br><br>"),afterText:'\n                    <div style="display: flex; align-items: center; justify-content: center; margin-top: 15px;">\n                    <input type="checkbox" id="agreeCheckbox" style="margin-right: 10px;">\n                    <label id="agreeCheckboxLabel" for="agreeCheckbox">I Agree</label>\n                    </div>\n                ',buttons:[{text:"Continue",bold:!0,close:!1,onClick:function(e,t){const a=document.getElementById("agreeCheckbox"),n=document.getElementById("agreeCheckboxLabel");a&&a.checked?(TempStars.Api.updateDentist({isAcceptedJobBoardPolicy:!0}),o.isAcceptedJobBoardPolicy=1,app.closeModal(),TempStars.App.goReact("jobBoard")):(n.style.color="var(--error-main, #D32F2F)",t.preventDefault())}},{text:"Go Back",onClick:function(){app.closeModal()}}]})}function S(e){app.modal({text:"Your current credit card information has been previously declined. To proceed, please update your payment information by going to your office profile.",buttons:[{text:"OK",onClick:function(){TempStars.Dentist.Router.goForwardPage("payment-info",{locationId:e})}}]})}const T=e=>{var t=TempStars.User.getCurrentUser().locations;e.sortedJobs={};var a=0,n=0;o={};let i=!1;for(a=0;a<e.jobs.length;a++){if(e.jobs[a].partialOffers){let t=0;for(n=0;e.jobs[a].partialOffers&&n<e.jobs[a].partialOffers.length;n++)e.jobs[a].partialOffers[n].isResubmitRequested&&t++;i=t===e.jobs[a].partialOffers.length}e.jobs[a].status!==TempStars.JOB_STATUSES.PARTIAL&&e.jobs[a].status!==TempStars.JOB_STATUSES.OFFER_EXPIRED||e.jobs[a].partialOffers&&i&&(e.jobs[a].status=TempStars.JOB_STATUSES.POSTED),e.jobs[a].partialOffers||e.jobs[a].status!==TempStars.JOB_STATUSES.PARTIAL||(e.jobs[a].status=TempStars.JOB_STATUSES.POSTED),e.jobs[a].partialOffers&&!i&&e.jobs[a].status===TempStars.JOB_STATUSES.POSTED&&(e.jobs[a].partialOffers.find((e=>e.status===TempStars.PARTIAL_OFFER_STATUS.REJECTED))||(e.jobs[a].status=TempStars.JOB_STATUSES.OFFER_EXPIRED)),void 0===o[e.jobs[a].startDate]&&(o[e.jobs[a].startDate]=[]),o[e.jobs[a].startDate].push({id:e.jobs[a].id,status:e.jobs[a].status,shifts:e.jobs[a].shifts,type:e.jobs[a].type,address:_.find(t,{id:e.jobs[a].locationId}).address,hasRemovedOffers:e.jobs[a].partialOffers&&e.jobs[a].partialOffers.length>0});let s=o[e.jobs[a].startDate],c=b(e.jobs[a]),l=s.map((function(e){return e.status})),d="Unfilled",p="";s.length>=1&&(d=r[D(l)]),s.length>=2&&(p=r[w(l)]),void 0===e.sortedJobs[d+p]&&(e.sortedJobs[d+p]=[]),e.sortedJobs[d+p].push(c)}return e.actionRequired=_(e.jobs).map(h).filter("actionRequired").map(b).value(),e};function D(e){return _.includes(e,TempStars.Job.status.COMPLETED)?TempStars.Job.status.COMPLETED:_.includes(e,TempStars.Job.status.POSTED)?TempStars.Job.status.POSTED:_.includes(e,TempStars.Job.status.EXPIRED)?TempStars.Job.status.EXPIRED:_.includes(e,TempStars.Job.status.PARTIAL)?TempStars.Job.status.PARTIAL:_.includes(e,TempStars.Job.status.CONFIRMED)?TempStars.Job.status.CONFIRMED:0}function w(e){return _.includes(e,TempStars.Job.status.CONFIRMED)?TempStars.Job.status.CONFIRMED:_.includes(e,TempStars.Job.status.PARTIAL)?TempStars.Job.status.PARTIAL:_.includes(e,TempStars.Job.status.EXPIRED)?TempStars.Job.status.EXPIRED:_.includes(e,TempStars.Job.status.POSTED)?TempStars.Job.status.POSTED:_.includes(e,TempStars.Job.status.COMPLETED)?TempStars.Job.status.COMPLETED:0}async function x(o=s){const a=await TempStars.Dentist.getAllJobs(JSON.stringify({date:o}));for(const e of a){const o=t.jobs.findIndex((t=>t.id===e.id));-1===o?t.jobs.push(e):t.jobs[o]=e}t.sortedJobs={},T(t),e.updateEvents(t.actionRequired),e.updateMarkers([t.sortedJobs.Booked,t.sortedJobs.BookedBooked,t.sortedJobs.BookedCompleted,t.sortedJobs.BookedCustom,t.sortedJobs.BookedUnfilled,t.sortedJobs.Completed,t.sortedJobs.CompletedBooked,t.sortedJobs.CompletedCompleted,t.sortedJobs.CompletedCustom,t.sortedJobs.CompletedUnfilled,t.sortedJobs.Custom,t.sortedJobs.CustomBooked,t.sortedJobs.CustomCompleted,t.sortedJobs.CustomCustom,t.sortedJobs.CustomUnfilled,t.sortedJobs.Unfilled,t.sortedJobs.UnfilledBooked,t.sortedJobs.UnfilledCompleted,t.sortedJobs.UnfilledCustom,t.sortedJobs.UnfilledUnfilled,t.sortedJobs.ExpiredUnfilled,t.sortedJobs.UnfilledExpired,t.sortedJobs.ExpiredExpired,t.sortedJobs.ExpiredCustom,t.sortedJobs.CustomExpired,t.sortedJobs.ExpiredBooked,t.sortedJobs.BookedExpired,t.sortedJobs.CompletedExpired,t.sortedJobs.Expired])}return{init:function(){a=app.onPageBeforeInit("dentist-home",(async function(a){t=a.context;let{dentist:l}=TempStars.User.getCurrentUser();(!l.newTermsSeenOn||moment.utc(l.newTermsSeenOn)<moment.utc(TempStars.TERMS_UPDATE_DATE))&&app.modal({title:"<b>Terms of Service Update</b>",text:'We have made important updates to our Terms of Service. <a class="external" target="_system" href="https://'+TempStars.Config.web.siteUrl+'/terms" >Click here to review our Terms of Service</a>. Please read carefully and agree below to proceed. By tapping “I Agree”, you confirm you have reviewed and agree to using TempStars under our updated Terms of Service.',buttons:[{text:"I Agree",onClick:function(){TempStars.Api.updateDentist({newTermsSeenOn:moment.utc().format("YYYY-MM-DD HH:mm:ss")}).then((function(){TempStars.User.refresh()}))}}]}),app.closeModal(),function(){function e(e){t.jobs.forEach((t=>{if(t.id===e.jobId){x();const e=new Date(t.startDate),o=moment(e).subtract(1,"M").format("YYYY-M-D");$$('[data-date="'+o+'"] .unread-message-count').hide()}}))}TempStars.socket.on("newPartialOfferSubmitted",e),TempStars.socket.on("cancelledPartialOffer",e),TempStars.socket.on("updatedPartialOffer",e),TempStars.socket.on("jobUpdated",e),TempStars.socket.on("jobCancelled",e),TempStars.socket.on("instabookOffer",e)}(),mainView.showNavbar(),function(t){var a=["January","February","March","April","May","June","July","August","September","October","November","December"];e=app.calendar({container:"#dentist-calendar-inline-container",value:[s],weekHeader:!0,firstDay:0,toolbarTemplate:'<div class="toolbar calendar-custom-toolbar"><div class="toolbar-inner"><div class="left"><a href="#" class="link icon-only"><i class="icon icon-back"></i></a></div><div class="center"></div><div class="right"><a href="#" class="link icon-only"><i class="icon icon-forward"></i></a></div></div></div>',onOpen:function(t){$$(".calendar-custom-toolbar .center").text(a[t.currentMonth]+" "+t.currentYear),$$(".calendar-custom-toolbar .left .link").on("click",(async function(){e.prevMonth(),s=new Date(s.setMonth(s.getMonth()-1)),await x(s)})),$$(".calendar-custom-toolbar .right .link").on("click",(async function(){e.nextMonth(),s=new Date(s.setMonth(s.getMonth()+1)),await x(s)}))},onMonthYearChangeStart:function(e){$$(".calendar-custom-toolbar .center").text(a[e.currentMonth]+" "+e.currentYear)},events:t.actionRequired,rangesClasses:[{cssClass:"calendar-booked",range:t.sortedJobs.Booked},{cssClass:"calendar-booked-booked",range:t.sortedJobs.BookedBooked},{cssClass:"calendar-booked-completed",range:t.sortedJobs.BookedCompleted},{cssClass:"calendar-booked-custom",range:t.sortedJobs.BookedCustom},{cssClass:"calendar-booked-unfilled",range:t.sortedJobs.BookedUnfilled},{cssClass:"calendar-completed",range:t.sortedJobs.Completed},{cssClass:"calendar-completed-booked",range:t.sortedJobs.CompletedBooked},{cssClass:"calendar-completed-completed",range:t.sortedJobs.CompletedCompleted},{cssClass:"calendar-completed-custom",range:t.sortedJobs.CompletedCustom},{cssClass:"calendar-completed-unfilled",range:t.sortedJobs.CompletedUnfilled},{cssClass:"calendar-custom",range:t.sortedJobs.Custom},{cssClass:"calendar-custom-booked",range:t.sortedJobs.CustomBooked},{cssClass:"calendar-custom-completed",range:t.sortedJobs.CustomCompleted},{cssClass:"calendar-custom-custom",range:t.sortedJobs.CustomCustom},{cssClass:"calendar-custom-unfilled",range:t.sortedJobs.CustomUnfilled},{cssClass:"calendar-unfilled",range:t.sortedJobs.Unfilled},{cssClass:"calendar-unfilled-booked",range:t.sortedJobs.UnfilledBooked},{cssClass:"calendar-unfilled-completed",range:t.sortedJobs.UnfilledCompleted},{cssClass:"calendar-unfilled-custom",range:t.sortedJobs.UnfilledCustom},{cssClass:"calendar-unfilled-unfilled",range:t.sortedJobs.UnfilledUnfilled},{cssClass:"calendar-expired-unfilled",range:t.sortedJobs.ExpiredUnfilled},{cssClass:"calendar-unfilled-expired",range:t.sortedJobs.UnfilledExpired},{cssClass:"calendar-expired-expired",range:t.sortedJobs.ExpiredExpired},{cssClass:"calendar-expired-custom",range:t.sortedJobs.ExpiredCustom},{cssClass:"calendar-custom-expired",range:t.sortedJobs.CustomExpired},{cssClass:"calendar-expired-booked",range:t.sortedJobs.ExpiredBooked},{cssClass:"calendar-booked-expired",range:t.sortedJobs.BookedExpired},{cssClass:"calendar-completed-expired",range:t.sortedJobs.CompletedExpired},{cssClass:"calendar-expired",range:t.sortedJobs.Expired}],onDayClick:function(e,a,n,i,s){var c=moment({year:n,month:parseInt(i),day:s}).format("YYYY-MM-DD"),l=["","job-posted","job-partial","job-confirmed","job-completed","job-partial"],d=["","calendar-unfilled.svg","calendar-custom.svg","calendar-booked.svg","calendar-completed.svg","calendar-expired.svg"];if(void 0===o[c]||0===o[c].length)f(e,a,n,i,s);else if(1===o[c].length){if(o[c][0].status>=TempStars.Job.status.POSTED&&o[c][0].status<=TempStars.Job.status.EXPIRED){var p={id:o[c][0].id,jobCount:1},m=o[c][0].status;return 1===m&&o[c][0].hasRemovedOffers&&(m=2),o[c][0].status===TempStars.JOB_STATUSES.CONFIRMED?TempStars.App.goReact("dentistJobConfirmed",p):TempStars.Dentist.Router.goForwardPage(l[m],p)}}else{var u=moment(o[c][0].shifts[0].shiftDate).local().format("MMMM D"),b=o[c][0].shifts[0].postedStart+" - "+o[c][0].shifts[0].postedEnd,h=moment(o[c][1].shifts[0].shiftDate).local().format("MMMM D"),g=o[c][1].shifts[0].postedStart+" - "+o[c][1].shifts[0].postedEnd,y=r[o[c][0].status],v=r[o[c][1].status],$=o[c][0].type?"Assistant":"Hygienist",k=o[c][1].type?"Assistant":"Hygienist",S=o[c][0].address,T=o[c][1].address;2===o[c][0].status&&(y="Custom Offer waiting"),3===o[c][0].status&&(y="Booked / Confirmed"),2===o[c][1].status&&(v="Custom Offer waiting"),3===o[c][1].status&&(v="Booked / Confirmed");var D=_.find(t.unreadMessages.groupedByJob,{id:o[c][0].id})?'<div class="unread-message-count dentist-unread-message-count-job-selector">*</div>':"",w=_.find(t.unreadMessages.groupedByJob,{id:o[c][1].id})?'<div class="unread-message-count dentist-unread-message-count-job-selector">*</div>':"",x=[{text:'<div class="job-select-wrapper"><div class="job-select-icon" style="background-image: url(\'./img/'+d[o[c][0].status]+"');\">"+D+'</div><div class="job-select-button">Shift 1: '+u+" - "+$+"<br>"+b+" - "+y+"<br>"+S+"</div></div>",onClick:function(){const e={id:o[c][0].id,jobCount:2};return"Booked / Confirmed"===y?TempStars.App.goReact("dentistJobConfirmed",e):TempStars.Dentist.Router.goForwardPage(l[o[c][0].status],e)}},{text:'<div class="job-select-wrapper"><div class="job-select-icon" style="background-image: url(\'./img/'+d[o[c][1].status]+"');\">"+w+'</div><div class="job-select-button">Shift 2: '+h+" - "+k+"<br>"+g+" - "+v+"<br>"+T+"</div></div>",onClick:function(){const e={id:o[c][1].id,jobCount:2};return"Booked / Confirmed"===v?TempStars.App.goReact("dentistJobConfirmed",e):TempStars.Dentist.Router.goForwardPage(l[o[c][1].status],e)}}];o[c].length>2&&x.push({text:"My other shifts...",onClick:function(){TempStars.Dentist.Router.goForwardPage("jobs-posted",{},{jobInfo:o[c].map((function(e){var o=_.find(t.unreadMessages.groupedByJob,{id:e.id});return e.unreadMessagesCount=o?o.unreadMessagesCount:0,e.statusMark=d[e.status],e.jobStatusName=r[e.status],e.dateStr=moment(e.shifts[0].shiftDate).format("MMMM D"),e})),nextPages:l})}}),x.push({text:"Find Another Temp",onClick:function(){f(e,a,n,i,s)}}),x.push({text:"Go Back",onClick:function(){}}),app.modal({title:"View which shift posting?",text:"Select the posting you would like to view:",verticalButtons:!0,buttons:x})}}}),e.updateEvents(t.actionRequired)}(a.context),$$("#dentist-home-post-job-button").on("click",v),$$("#dentist-homejob-hire-staff-button").on("click",k),$$("#home-popup-wrapper").on("click",c),$$("#home-support-widget").on("click",d);const u=Object.keys(TempStars.Job.status);let b=Object.assign({},TempStars.Job.status);if(u.forEach(((e,o)=>{b[u[o]]=t.jobs.filter((e=>e.status===o+1)).map((e=>e.id))})),_.isNil(t.user.dentist.photoAnnounceUrl)||showAnnouncement(t.user.dentist.photoAnnounceUrl,t.user.dentist.announceUrl),n=[],t.jobs){t.jobs=_.orderBy(t.jobs,["shifts[0].shiftDate"],["desc"]);var h=localStorage.getItem("postponeSurvey");h=(h=h?JSON.parse(h):[]).filter((function(e){return moment(e.postponeUntil)>moment()})),localStorage.setItem("postponeSurvey",JSON.stringify(h)),t.jobs.map(((e,t)=>{_.some(h,{jobId:e.id})||!e.hygienistId||e.hygienistRating||e.ignoredHygienistRating||e.status===TempStars.Job.status.COMPLETED&&n.push(t)})),m(0)}i?Number(i)!==TempStars.SURVEYS.DISENGAGED_DENTIST&&Number(i)!==TempStars.SURVEYS.ENGAGED_DENTIST||(app.modal({title:"<b>Thank you!</b>",text:"We really appreciate your insights, it truly helps us improve. <br><br>And nicely done - your Free Placement has been added to your account! And while it doesn’t expire, we hope to see you active on TempStars once again. <br><br>As always, let us know if you need anything!",buttons:[{text:"Got it!",bold:!0}]}),TempStars.User.refresh()):l.disengagedPromotionStatus===TempStars.PROMOTION_STATUSES.ACTIVE?p(TempStars.SURVEYS.DISENGAGED_DENTIST):l.engagedPromotionStatus===TempStars.PROMOTION_STATUSES.ACTIVE&&p(TempStars.SURVEYS.ENGAGED_DENTIST),app.hidePreloader(),await x(s)})),app.onPageAfterAnimation("dentist-home",(async function(){var e=0;_.forEach(t.unreadMessages.groupedByDate,(function(t,o){t&&(TempStars.ChatPage.addingUnreadMessageCountBadge(o,t),e++)})),e||TempStars.Conversations.getUnreadMessages().then((function(e){var o=moment();_.forEach(t.jobs,(function(t){if(moment(t.startDate).diff(o,"hours")>-25){var a=e.find((function(e){return e.jobId==t.id&&e.unreadMessagesCount>0}));a&&TempStars.ChatPage.addingUnreadMessageCountBadge(t.startDate,a.unreadMessagesCount)}}))}))})),app.onPageBeforeRemove("dentist-home",(function(e){$$("#dentist-home-post-job-button").off("click",v),$$("#dentist-homejob-hire-staff-button").off("click",k),TempStars.Conversations.unsubscribeFromNewMessages(l),TempStars.Conversations.unsubscribeFromNewChannels(l),delete window.dentistInterval}))},recruitStaffHandler:k,getTempHandler:v,showCardInvalidModal:S,maxJobsReachedModal:g,processJobs:T,triggerPageInit:function(){a.trigger()},getData:function(e){return i=e.completedSurveyId,TempStars.Logging.log("getting data for dentist home page"),new Promise((async function(e,t){try{const[t,o,a,n]=await Promise.all([TempStars.User.getCurrentUser(),TempStars.Dentist.getAllJobs(JSON.stringify({date:new Date})),TempStars.Dentist.getHireJobsCount()]);let i={jobs:o,hireJobsNum:a,user:t};TempStars.Dentist.setHasCancelledJobs(t.dentist?.cancelledShiftsNum>0);i.numHygienists=Math.floor(15*Math.random())+175,i=T(i),await async function(e){const t=await TempStars.Conversations.getUnreadMessages();e.unreadMessages=TempStars.ChatPage.countUnreadMessagesPerDate(e.jobs,t);try{TempStars.Conversations.subscribeToNewMessages(l),TempStars.Conversations.subscribeToNewChannels(l)}catch(e){console.log("Error subscribing to new messages",e)}}(i),e(i)}catch(e){console.log(e),t(e)}}))}}}(),TempStars.Pages.Dentist.Home.init(),TempStars.Pages.Dentist.Hygienists=function(){"use strict";function e(e){var t=$(this).attr("data-name"),o=$(this).attr("data-id"),a=TempStars.User.getCurrentUser().dentistId;app.confirm("Are you sure you want to remove "+t+"?","Remove Blocked Hygienist",(function(){app.showPreloader("Removing Blocked Hygienist"),TempStars.Api.removeBlockedHygienist(a,o).then((function(){app.hidePreloader(),TempStars.Dentist.Router.reloadPage("hygienists")})).catch((function(e){app.hidePreloader(),app.alert("Error removing hygienist. Please try again.")}))}))}function t(e){var t=$(this).attr("data-name"),o=$(this).attr("data-id"),a=TempStars.User.getCurrentUser().dentistId;app.confirm("Are you sure you want to remove "+t+"?",`Remove ${"US"===TempStars.User.getCurrentUser().dentist.countryStr?"Favorite":"Favourite"} Hygienist`,(function(){app.showPreloader(`Removing ${"US"===TempStars.User.getCurrentUser().dentist.countryStr?"Favorite":"Favourite"} Hygienist`),TempStars.Api.removeFavouriteHygienist(a,o).then((function(){app.hidePreloader(),TempStars.Dentist.Router.reloadPage("hygienists")})).catch((function(e){app.hidePreloader(),app.alert("Error removing hygienist. Please try again.")}))}))}return{init:function(){app.onPageBeforeInit("dentist-hygienists",(function(o){$$(".dentist-hygienists-remove-blocked-button").on("click",e),$$(".dentist-hygienists-remove-fav-button").on("click",t)})),app.onPageBeforeRemove("dentist-hygienists",(function(o){$$(".dentist-hygienists-remove-blocked-button").off("click",e),$$(".dentist-hygienists-remove-fav-button").off("click",t)}))},getData:function(){var e={};return new Promise((function(t,o){TempStars.Api.getBlockedHygienists(TempStars.User.getCurrentUser().dentistId).then((function(t){return e.blocked=t,TempStars.Api.getFavouriteHygienists(TempStars.User.getCurrentUser().dentistId)})).then((function(o){e.favourites=o,t(e)})).catch((function(e){app.alert("Error retrieving hygienists. Please try again"),o(e)}))}))}}}(),TempStars.Pages.Dentist.Hygienists.init(),TempStars.Pages.Dentist.Invoice=function(){"use strict";let e,t=!1;let o=!1;function a(e){return(Math.round(104.75*e)/100).toFixed(2)}const n=async()=>((await TempStars.Api.getInvoiceForJob(e.invoice.jobId)).dentistMarkedPaid?app.alert("This invoice was already paid using Pay Now"):await r(),$("#dentist-invoice-pay-button").attr("disabled",!1)),i=t=>{t.preventDefault(),$("#dentist-invoice-already-paid-button").attr("disabled","disabled"),app.modal({title:"Has this invoice <b>already</b> been paid?",text:"Remember, the payment terms for this shift are "+TempStars.App.getJobPaymentTerms(e.paymentTerms)+". "+`<br /><br />Has your office already paid and settled this invoice with ${e.hygienist.firstName}?`,buttons:[{text:"Yes",onClick:async function(t){$(t).attr("disabled","disabled");return(await TempStars.Api.getInvoiceForJob(e.invoice.jobId)).dentistMarkedPaid?app.alert("This invoice was already paid using Pay Now"):(await TempStars.Api.updateAlreadyPaidInvoice(e.invoice.id),$$("#dentist-invoice-pay").hide(),$$("#dentist-invoice-already-paid-button").hide()),$("#dentist-invoice-already-paid-button").attr("disabled",!1)}},{text:"No",onClick:()=>{o||app.modal({title:"Pay invoice?",text:"A small processing fee of 4.75% applies to the payment, just to cover our transaction costs of sending this payment to "+e.hygienist.firstName+". <br /><br />Invoice #"+e.invoice.jobId+"<br />Date: "+moment.utc(e.startDate).format("MMM D, YYYY")+"<br />Invoice Amount: $"+e.invoice.totalInvoiceAmt.toFixed(2)+"<br />Processing Fee: 4.75%<br /><br /><b>Total Payable: $"+a(e.invoice.totalInvoiceAmt)+"</b><br /><br />Do you want to pay this invoice now?",buttons:[{text:"Yes",onClick:()=>n()},{text:"No"}]}),$("#dentist-invoice-already-paid-button").attr("disabled",!1)}}]})},s=async t=>{t&&t.preventDefault(),$("#dentist-invoice-pay-button").attr("disabled","disabled"),app.modal({title:"<b>Pay This Invoice?</b>",text:"We will process payment for this invoice and forward it directly to "+e.hygienist.firstName+". A small processing fee of 4.75% applies to the payment, just to cover our transaction costs of sending this payment to "+e.hygienist.firstName+". <br /><br />Invoice #"+e.invoice.jobId+"<br />Date: "+moment.utc(e.startDate).format("MMM D, YYYY")+"<br />Invoice Amount: $"+e.invoice.totalInvoiceAmt.toFixed(2)+"<br />Processing Fee: 4.75%<br /><br /><b>Total Payable: $"+a(e.invoice.totalInvoiceAmt)+"</b><br /><br />Once payment is successfully processed, we'll e-mail you a copy of the paid invoice receipt. Payment is secure using bank-level encryption. Pay now?",buttons:[{text:"Confirm",onClick:e=>{$(e).attr("disabled","disabled"),n()}},{text:"Cancel",onClick:()=>{$("#dentist-invoice-pay-button").attr("disabled",!1)}}]})},r=async()=>{app.showPreloader("Processing payment...");try{await TempStars.Api.payInvoice(e.invoice.id),TempStars.Analytics.track("pay invoice",{shiftStartDate:new Date(e.startDate.replace(/-/g,"/")+" "+e.shifts[0].actualStart).toISOString(),shiftEndDate:new Date(e.startDate.replace(/-/g,"/")+" "+e.shifts[0].actualEnd).toISOString(),shiftId:e.shifts[0].id,totalInvoiceAmount:e.invoice.totalInvoiceAmt,currencyCode:e.location.country?"USD":"CAD",dentalWorkerStatus:convertDentalOfficeStatus(),dentalWorkerType:e.hygienist.type?"Assistant":"Hygienist",hasUploadedResume:!!(e.hygienist&&e.hygienist.resumeUrl&&e.hygienist.resumeUrl.length),graduationYear:e.hygienist.graduationYear+"-01-01",dentalOfficeLocationId:e.locationId,shiftPostDate:new Date(e.postedOn).toISOString()}),app.hidePreloader(),app.modal({title:"<b>Paid</b>",text:"Easy peasy!<br /><br /> Payment was processed, we're e-mailing you a paid receipt to "+e.location.email+"<br /><br />Thank you!",buttons:[{text:"OK",onClick:function(){$$("#dentist-invoice-payment-processed-button").show(),$$("#dentist-invoice-pay-button").hide(),TempStars.Dentist.Router.goBackPage("",{id:e.invoice.jobId})}}]})}catch(e){if(app.hidePreloader(),"No have StripeAccountId"===e.message)return app.alert("Error submitting payment. Please try another method.<br/>This user not connected to Stripe Express program.");app.alert("Error submitting payment. Please try again later. <br/>"+e.message)}};function c(){const e=$$(this).prop("checked"),o=$$(this).attr("data-id");e?TempStars.Api.updateInvoice(o,{dentistMarkedPaid:1}).then((function(){$$("#dentist-invoice-paid-label").html("paid!"),t=!0,$$("#dentist-invoice-pay").hide()})):TempStars.Api.updateInvoice(o,{dentistMarkedPaid:0}).then((function(){$$("#dentist-invoice-paid-label").html("NOT paid"),t=!0,"US"!==TempStars.User.getCurrentUser().dentist.countryStr&&$$("#dentist-invoice-pay").show()}))}return{init:function(){app.onPageBeforeInit("dentist-invoice",(function(t){e=t.context,$$("#dentist-invoice-paid-checkbox").on("change",c),$$("#dentist-invoice-pay-button").on("click",s),$$("#dentist-invoice-already-paid-button").on("click",i),o=!e.hygienist.stripeAccountId&&e.location.country,(e.invoice.dentistMarkedPaid||o)&&$$("#dentist-invoice-pay").hide()})),app.onPageBeforeRemove("dentist-invoice",(function(){$$("#dentist-invoice-paid-checkbox").off("change",c),$$("dentist-invoice-pay-button").off("click",s)}))},getData:function(e){return e.jobId?Promise.props({job:TempStars.Api.getJobDetails(e.jobId),invoice:TempStars.Api.getInvoiceForJob(e.jobId)}).then((function(e){return{invoice:e.invoice,...e.job}})):Promise.resolve({})}}}(),TempStars.Pages.Dentist.Invoice.init(),TempStars.Pages.Dentist.Invoices=function(){"use strict";var e,t="date";function o(o){t="date",$(this).addClass("active").siblings().removeClass("active"),e&&e.length&&(e=_.orderBy(e,["invoice.sentOn"],["desc"]),TempStars.Dentist.Router.reloadPage("invoices",{},e))}function a(o){t="name",$(this).addClass("active").siblings().removeClass("active"),e&&e.length&&(e=_.sortBy(e,"hygienist.lastName"),TempStars.Dentist.Router.reloadPage("invoices",{},e))}function n(e){var t=parseInt($$(this).attr("data-id"));TempStars.App.goReact("invoice",{jobId:t})}return{init:function(){app.onPageBeforeInit("dentist-invoices",(function(i){"date"==t?($("#dentist-invoices-date-sorting-button").addClass("active").siblings().removeClass("active"),e=_.orderBy(e,["invoice.sentOn"],["desc"])):($("#dentist-invoices-hygienist-sorting-button").addClass("active").siblings().removeClass("active"),e=_.sortBy(e,"hygienist.lastName")),$("#dentist-invoices-date-sorting-button").on("click",o),$("#dentist-invoices-hygienist-sorting-button").on("click",a),$(document).on("click",".invoice",n)})),app.onPageBeforeRemove("dentist-invoices",(function(e){$("#dentist-invoices-date-sorting-button").off("click",o),$("#dentist-invoices-hygienist-sorting-button").off("click",a),$(document).off("click",".invoice",n)}))},getData:function(){return new Promise((function(o,a){TempStars.Api.getInvoices().then((function(a){e=a,"date"==t?e=_.orderBy(e,["invoice.sentOn"],["desc"]):"name"==t&&(e=_.sortBy(e,"hygienist.lastName")),o(e)})).catch((function(e){app.alert("Error retrieving invoices. Please try again"),a(e)}))}))}}}(),TempStars.Pages.Dentist.Invoices.init(),TempStars.Pages.Dentist.JobAvailableConfirmation=function(){"use strict";var e;const t=async()=>{const t=await TempStars.Api.getAvailableHygienists({jobId:e.id});TempStars.Dentist.Router.goBackPage(t.hygienists.length?"job-available":"home",t.hygienists.length&&{hygienists:t.hygienists,jobId:e.id})};const o=t=>{t.preventDefault(),e.hygienist.resumeUrl?app.modal({title:"<strong>Resume Checked?</strong>",text:`Have you reviewed ${e.hygienist.firstName}'s resume, and determined they’re a good fit for your office for this shift?`,buttons:[{text:"Yes",bold:!0,onClick:()=>a()},{text:"No"}]}):app.modal({title:"<strong>Accept Without Resume?</strong>",text:e.hygienist.firstName+" doesn’t have a resume uploaded, although they’ve been asked to do so, and told that their offers will most likely be declined if they don’t have a resume. This means you’re about to accept this offer without reviewing their resume.<br/><br/>We don’t recommend this and it’s better to wait for another offer, but if you’re in a pinch - many shifts are successfully completed with members who haven’t uploaded resumes resumes.<br/><br/>Are you sure?",buttons:[{text:"YES",bold:!0,onClick:()=>a()},{text:"Go Back"}]})};async function a(){app.modal({title:`Insta-book ${e.hygienist.firstName} Now?`,text:`\n                You're about to book ${e.hygienist.firstName} ${e.hygienist.lastName} for this \n                <strong style="color: var(--primary-main)">${e.type?"Assistant":"Hygienist"}</strong> temping shift:<br><br>\n                ${moment(e.startDate).format("dddd MMMM D, YYYY")}, <br>\n                ${e.shifts[0].postedStart} - ${e.shifts[0].postedEnd}<br>\n                $${e.hygienist.hourlyRate}/hr<br>\n                ${stringTravelAllowance(e.hygienist.distance)} flat travel/gas allowance<br><br>\n                Are you sure?\n                `,buttons:[{text:"go back",onClick:()=>{}},{text:"Confirm",bold:!0,onClick:async()=>{app.showPreloader(`Sit tight…we’re notifying ${e.hygienist.firstName} now.`);try{await(o=1e3,new Promise((function(e){setTimeout((function(){e()}),o)}))),await TempStars.Api.InstabookHygienist(e),app.hidePreloader(),TempStars.Analytics.track("DO_Autobook_Clicked",{date:moment(e.startDate).format("dddd MMMM D, YYYY"),start_time:e.shifts[0].postedStart,end_time:e.shifts[0].postedEnd,hourlyRate:e.hygienist.hourlyRate}),TempStars.Api.modifyJob(e.id,{autobook:1}),app.modal({title:`${e.hygienist.firstName} has been notified!`,text:`\n                                    We have notified ${e.hygienist.firstName} about the Insta-Booking, this will be confirmed within 15 minutes. <br>\n                                    During these 15 minutes, ${e.hygienist.firstName} does have the opportunity to reject this Insta-Booking, but over 85% of Insta-Books are Confirmed after 15 minutes, \n                                    so chances are very good this will be confirmed!<br>\n                                    We’ll let you know either way by e-mailing you at <a>${e.location.email}</a>, so keep a close eye on your e-mail for the next 20min or so.\n                                `,buttons:[{text:"OK",onClick:()=>TempStars.Dentist.Router.goForwardPage("home")}]})}catch(o){app.hidePreloader(),o&&o.error&&400===o.error.status?app.alert(o.error.message):app.modal({title:"No Longer Available",text:`Apologies, ${e.hygienist.firstName} was just booked by another office a few seconds ago!`,buttons:[{text:"OK",onClick:()=>t()}]})}var o}}]})}function n(e){e.preventDefault();app.modal({title:"",text:"Most resumes are viewable on mobiles, tablets and computers. If you don't see the resume, the file likely downloaded to your computer's \"Downloads\" folder.  Check there for the resume file and open from that folder.",buttons:[{text:"I Understand",bold:!0,onClick:i}]})}function i(t){window.Cordova?cordova.InAppBrowser.open(e.hygienist.resumeUrl,"_system","location=yes"):window.open(e.hygienist.resumeUrl)}return{init:function(){app.onPageBeforeInit("dentist-job-available-confirmation",(async function(a){(e=a.context).hygienist.photoUrl&&$$("#hygienist-profile-photo").attr("src",e.hygienist.photoUrl),$$("#dentist-job-available-details-accept-button").on("click",o),$$("#dentist-job-available-details-view-resume").on("click",n),$$(".dentist-internal-back").on("click",t),$("#hygienist-rating").starRating({starSize:20,activeColor:"gold",initialRating:e.hygienist.starScore,readOnly:!0,useGradient:!1}),await TempStars.Api.getPPELink(e.location.province,e.location.postalCode)})),app.onPageBeforeRemove("dentist-job-available-confirmation",(function(e){$$("#dentist-job-available-details-accept-button").off("click",o),$$("#dentist-job-available-details-view-resume").off("click",n),$$(".dentist-internal-back").on("click",t),clearInterval(undefined)}))},getData:function(){return e=page.context,Promise.resolve(e)}}}(),TempStars.Pages.Dentist.JobAvailableConfirmation.init(),TempStars.Pages.Dentist.JobAvailable=function(){"use strict";var e,t=!1;function o(t){app.modal({title:"Post A Second Shift?",text:"<br>Do you need a second temp for this day?<br>"+moment(e.shifts[0].shiftDate).local().format("MMMM D, YYYY")+"<br>",buttons:[{text:"YES",bold:!0,onClick:function(){TempStars.Pages.Dentist.Home.getTempHandler(null,{date:moment(e.startDate).toDate()})}},{text:"No",onClick:function(){}}]})}function a(t){t.preventDefault();var o="Are you sure?<br><br>";e.hygienistId&&(o+="Every hygienist who has submitted an offer will be notified."),app.modal({title:"Remove this shift",text:o,buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:n}]})}function n(){app.showPreloader("Removing shift..."),TempStars.Api.cancelJob(e.id).then((function(){app.hidePreloader(),TempStars.Dentist.Router.goBackPage("home")})).catch((function(t){app.hidePreloader(),app.alert("Error removing shift. Please try again."),TempStars.Dentist.Router.reloadPage("job-available",{id:e.id})}))}function i(t){t.preventDefault(),app.modal({title:"<strong>Change Shift Hours?</strong>",text:"When you change the shift hours, <strong>this will remove all current Custom Offers.</strong><br><br> Any "+(e.type?"dental assistant":"hygienist")+" who has submitted a Custom Offer will be notified of the new hours and advised to re-submit their offer if they're available for the new hours.<br/><br/>Are you sure?",buttons:[{text:"Yes",onClick:function(){e.pageTitle="Posted Job",TempStars.Dentist.Router.goForwardPage("modify-job",{},e)}},{text:"No"}]})}function s(t){t.preventDefault();let o=$$(this).attr("data-id");const a=e.availableHygienists.filter((e=>Number(e.id)===Number(o)))[0],n=formatProfileHygienistName(a,a?.skills);e.hygienist={...a,htmlName:n},TempStars.Dentist.Router.goForwardPage("job-available-confirmation",{},e)}return{init:function(){t||(app.onPageBeforeInit("dentist-job-available",(function(e){$$("#dentist-job-available-cancel-button").on("click",a),$$("#dentist-job-available-modify-button").on("click",i),$$("#dentist-job-available-new-job-button").on("click",o),_.map(e.context.hygenists,(function(e){var t="#hygienist-rating-"+e.id;$(t).starRating({starSize:16,activeColor:"gold",initialRating:hygienist.starScore,readOnly:!0,useGradient:!1})}))})),$$(document).on("click",".dentist-available-job-row",s),app.onPageBeforeRemove("job-available",(function(e){$$("#dentist-job-available-cancel-button").off("click",a),$$("#dentist-job-available-modify-button").off("click",i),$$("#dentist-job-available-new-job-button").off("click",o)})),t=!0)},getData:async t=>{try{return(e=await TempStars.Api.getJobDetails(t.jobId)).paymentTermsString=TempStars.App.getJobPaymentTerms(e.paymentTerms,!1),e.availableHygienists=t.hygienists,e}catch(e){console.log(e)}}}}(),TempStars.Pages.Dentist.JobAvailable.init(),TempStars.Pages.Dentist.JobCompleted=function(){"use strict";var e;function t(){TempStars.Dentist.Router.goBackPage("",{})}function o(e){var t=$$(this).attr("data-id"),o=$$("#dentist-job-completed-notes").val();TempStars.Api.updateJob(t,{dentistPrivateNotes:o}).then((function(){TempStars.Dentist.Router.goBackPage("home")})).catch((function(e){app.alert("Error saving notes. Please try again.")}))}function a(t){TempStars.App.goReact("invoice",{jobId:e.id,job:e})}function n(t){const o=e.shifts[0].actualStart?e.shifts[0].actualStart:e.shifts[0].postedStart,a=e.shifts[0].actualEnd?e.shifts[0].actualEnd:e.shifts[0].postedEnd;var s=(e.hygienist?e.hygienist.firstName+" "+e.hygienist.lastName+"<br>":"")+(e.hygienist.photoUrl?'<img src="'+e.hygienist.photoUrl+'" width="60px" style="margin-top: 5px;" /><br>':"")+moment(e.shifts[0].shiftDate).local().format("ddd, MMM D, YYYY")+"<br>"+o+" - "+a+"<br>How happy would you be to have "+e.hygienist.firstName+" work at your office again?";app.modal({title:"Rate your Hygienist",text:s,verticalButtons:!0,buttons:[{text:"😍 Favourite!",onClick:function(){!function(t){app.modal({title:"We’re so glad!",text:` Spread the love and send ${t.firstName} a note of appreciation:\n            <div class="list-block inset" style="margin:15px 0 0px 5px;font-size:13px;">\n                    <li class="item-content signup-modal-content">\n                        <div class="item-inner happy-feedback-item">\n                            <div class="item-input">\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Thanks so much, ${t.firstName}!”" checked>\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Thanks so much, ${t.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Great job, ${t.firstName}!”">\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Great job, ${t.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“Really appreciate it, ${t.firstName}!”" >\n                                    <div class="item-media item-checkbox-container">\n                                      <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                   <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                      <div class="item-title">“Really appreciate it, ${t.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value="“You were great, ${t.firstName}!”">\n                                    <div class="item-media item-checkbox-container">\n                                        <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                    <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                        <div class="item-title">“You were great, ${t.firstName}!”</div>\n                                    </div>\n                                </label>\n                                <label class="label-checkbox item-content checkbox-item-content">\n                                    <input id="dentist-get-temp" type="radio" name="feedbackType" value=" ">\n                                    <div class="item-media item-checkbox-container">\n                                        <i class="icon icon-form-checkbox"></i>\n                                    </div>\n                                    <div class="item-inner happy-feedback-item item-checkbox-text-content">\n                                        <div class="item-title">Don’t send a note</div>\n                                    </div>\n                                </label>\n                            </div>\n                        </div>\n                    </li>\n                </div>`,buttons:[{text:"Submit",onClick:function(){console.log($("input[name='feedbackType']:checked").val()),TempStars.Api.positiveFeedback({job:e,feedback:$("input[name='feedbackType']:checked").val()}),app.alert(`Great! They are now one of your ${"US"===TempStars.User.getCurrentUser().dentist.countryStr?"Favorites":"Favourites"} and will have exclusive first access to your future job postings.<br><br><b>A friendly reminder:</b> Standard placement fees apply to future shifts booked with ${e.hygienist.firstName} - whether arranged on the app or through direct contact.`,(function(){i(TempStars.Rating.VERY_HAPPY)}))}},{text:"Go Back",onClick:function(){n()}}]})}(e.hygienist)}},{text:"🙂 Pleased",onClick:function(){app.alert("Glad to hear, thank you!<br><br><b>A friendly reminder:</b> Standard placement fees apply to future shifts booked with "+e.hygienist.firstName+" - whether arranged on the app or through direct contact.",(function(){i(TempStars.Rating.PLEASED)}))}},{text:`<div style="line-height: 26px;">\n                <div>🙁 Unhappy</div>\n                <div style="font-size: 10px; color:black;">(${e.hygienist.firstName} <b>won’t</b> be notified if you select this.)</div>\n                </div>`,onClick:function(){!function(t){app.modal({title:"<b>Uh Oh.</b>",text:`\n            <div style="text-align:center;">\n            Can you tell us briefly where ${t.firstName} went wrong?\n            </div>\n            <div class="list-block">\n\n            <div class="item-input">\n                <textarea id="UnhappyFeedback" placeholder="You can provide details here..."></textarea>\n            </div>\n            <label class="label-checkbox item-content">\n            <input type="checkbox" id="contactUs" name="contactUs">\n            <div class="item-media">\n              <i class="icon icon-form-checkbox"></i>\n            </div>\n            <div class="item-inner">\n              <div class="item-title">Please contact me about this</div>\n            </div>\n          </label>\n            </div>\n        `,buttons:[{text:"Go Back",onClick:function(){n()}},{text:"Submit",bold:!0,onClick:function(){TempStars.Api.negativeFeedback({job:e,negativeFeedback:$$("#UnhappyFeedback").val(),contact:$("input[name='contactUs']")[0].checked}),app.alert(`\n                                        We really appreciate your feedback.  We track negative feedback internally to manage our membership and ensure we're only connecting offices with the best members.<br><br> \n                                        Over the course of 1,000's of placements, 97% of offices report "Happy" or "Very Happy", so we're sorry the ball got dropped here.<br> \n                                        They have been blocked from viewing any of your future postings.<br><br>\n                                        A friendly reminder: Standard placement fees apply to future shifts booked with ${t.firstName}, whether arranged on the app or through direct contact.\n                                    `,"Thank you!",(function(){i(TempStars.Rating.NO_THANK_YOU)}))}}]})}(e.hygienist)}}]})}function i(t){TempStars.Api.saveHygienistRating(e.id,{hygienistRating:t}).then((function(){TempStars.Dentist.Router.reloadPage("job-completed",{id:e.id})}))}return{init:function(){app.onPageBeforeInit("dentist-job-completed",(function(e){$$("#dentist-job-completed-notes-save-button").on("click",o),$$("#dentist-job-completed-view-invoice-button").on("click",a),$$("#dentist-job-completed-view-survey-button").on("click",n),$$("#dentist-job-completed-back").on("click",t)})),app.onPageBeforeRemove("dentist-job-completed",(function(e){$$("#dentist-job-completed-notes-save-button").off("click",o),$$("#dentist-job-completed-view-invoice-button").off("click",a),$$("#dentist-job-completed-view-survey-button").off("click",n),$$("#dentist-job-completed-back").off("click",t)}))},getData:function(t){return new Promise((async function(o,a){try{(e=await TempStars.Api.getJobDetails(t.id)).invoice=await TempStars.Api.getInvoiceForJob(t.id),e.hasOneJob=1===t.jobCount,e.hasInvoice=!!e.invoice.id,e.assistant=1===e.type,o(e)}catch(e){console.log("*[getData]error",e),a(e)}}))}}}(),TempStars.Pages.Dentist.JobCompleted.init(),TempStars.Pages.Dentist.JobConfirmed=function(){"use strict";var e,t=!1;const o=async e=>{if(await TempStars.Conversations.getUnreadMessagesForChannel(e)){const e='<div class="job-confirmed-unread-message-count">*</div>';$$("#dentist-job-confirmed-chat-div").append(e)}};function a(){app.showPreloader("Loading"),TempStars.Dentist.Router.goForwardPage("chat",e)}function n(t){app.modal({title:"Post A Second Shift?",text:"<br>Do you need a second Temp for this day?<br>"+moment(e.shifts[0].shiftDate).local().format("MMMM D, YYYY")+"<br>",buttons:[{text:"YES",bold:!0,onClick:function(){TempStars.Pages.Dentist.Home.getTempHandler(null,{date:moment(e.startDate).toDate()})}},{text:"No",onClick:function(){}}]})}function i(t){t.preventDefault(),e.pageTitle="Booked Shift";let{firstName:o}=e.hygienist;var a=`\n        Modifying the shift time of a booked shift is changing your agreement and commitment with ${o}. <br><br>\n\n        ${o} will be notified immediately about your shift change. <b> Changes to the original hours you booked may result in ${o} having to cancel this shift. </b> <br><br>\n        \n        In the event ${o} needs to cancel because of this change, we will notify you via email - so be sure to monitor your inbox. <br><br>\n        \n        Are you sure?\n        `;app.modal({title:"READ CAREFULLY",text:a,buttons:[{text:"Yes",bold:!0,onClick:function(){TempStars.Dentist.Router.goForwardPage("modify-job",{},e)}},{text:"No"}]})}function s(e){e.preventDefault(),$$("#dentist-job-confirmed-cancel-button").hide(),$$("#dentist-job-confirmed-break-button").show()}function r(o){var a,n;o.preventDefault(),moment().diff(moment.utc(e.shifts[0].shiftDate+" "+e.shifts[0].postedStart,"YYYY-MM-DD h:mm a"),"hours")>-24?(t=!0,n="Wait - Short Notice Cancelling?",a="Short-notice cancelling is serious -<br>"+(e.hygienist&&e.hygienist.firstName)+" has commited to this<br>shift and given up other<br>opportunites.<br><br>"+("US"===TempStars.Dentist.getCountry()?"":`Please be sure to read our <a href="https://${TempStars.Config.web[TempStars.Dentist.getCountry()].siteUrl}/short-notice" target="_system" class="external" style="font-size: 14px;">\n                New<br>Short Notice Cancellation Policy</a>.<br><br>`)+"Repeated short-notice cancellations<br>may result in your office being<br>removed the TempStars<br><br>Are you sure you must cancel?"):(n="Read Carefully",a="This "+(1==e.type?"assistant":"hygienist")+" has committed to and is counting on this shift.<br><br>Cancelling confirmed shifts may negatively impact your status on TempStars.<br><br>Are you sure you must cancel this shift?<br><br>",e.hygienist&&e.hygienist.firstName&&(a+=e.hygienist.firstName+" "+e.hygienist.lastName+" will be notified.")),app.modal({title:n,text:a,buttons:[{text:"Go Back"},{text:"Cancel Shift",bold:!0,onClick:c}]})}function c(){app.showPreloader("Cancelling Shift"),TempStars.Api.cancelJob(e.id).then((function(){app.hidePreloader();var o="";if(t){t=!1;let a=`${e.hygienist.firstName} has been notified of\n                your cancellation.<br><br>\n                We don't charge a placement fee<br>\n                for cancelled shifts, but as per our<br>\n                policy, we're going to try hard to find<br>\n                ${e.hygienist.firstName} a replacement shift.<br><br>\n                But if ${e.hygienist.firstName} is unable to pick<br>\n                up a replacement shift, we'll invoice<br>\n                your office for 50% of the shift time<br>\n                (minus 30 min) and send the funds<br>\n                directly to ${e.hygienist.firstName}.`,n=`\n                    ${e.hygienist.firstName} has been notified of your cancellation.<br><br>\n                    Please note, while we don’t charge a placement fee for cancelled shifts, we do take all cancellations very seriously. <br><br>\n\n                    We do remove any member who creates a habit of breaking their commitments and cancelling shifts. <br><br>\n\n                    Coming soon will be a cancellation fee that will be directly sent to the TempStars member who got cancelled on.<br><br>\n                `;o="CA"===TempStars.User.getCurrentUser().dentist.countryStr?a:n}app.modal({title:"Shift Cancelled",text:o,buttons:[{text:"OK",bold:!0,onClick:function(){TempStars.Dentist.Router.goBackPage("home")}}]})})).catch((function(e){app.hidePreloader(),app.alert("Error cancelling job. Please try again.")}))}return{init:function(){app.onPageBeforeInit("dentist-job-confirmed",(function(t){e.hygienist.photoUrl&&$$("#hygienist-profile-photo").attr("src",e.hygienist.photoUrl),$$("#dentist-job-confirmed-cancel-button").show(),$$("#dentist-job-confirmed-modify-button").on("click",i),$$("#dentist-job-confirmed-cancel-button").on("click",s),$$("#dentist-job-confirmed-break-button").on("click",r),$$("#dentist-job-confirmed-new-job-button").on("click",n),$$("#dentist-job-confirmed-chat").on("click",a),$("#hygienist-rating").starRating({starSize:20,activeColor:"gold",initialRating:t.context.hygienist.starScore,readOnly:!0,useGradient:!1}),o(e.id)})),app.onPageBeforeRemove("dentist-job-confirmed",(function(e){$$("#dentist-job-confirmed-modify-button").off("click",i),$$("#dentist-job-confirmed-cancel-button").off("click",s),$$("#dentist-job-confirmed-break-button").off("click",r),$$("#dentist-job-confirmed-new-job-button").off("click",n),$$("#dentist-job-confirmed-chat").off("click",a)}))},getData:function(t){return new Promise((function(o,a){TempStars.Api.getJobDetails(t.id).then((function(a){(e=a).hasOneJob=1===t.jobCount,e.paymentTermsString=TempStars.App.getJobPaymentTerms(e.paymentTerms,!1);for(var n=0;n<e.partialOffers.length;n++)if(e.partialOffers[n].status===TempStars.PARTIAL_OFFER_STATUS.ACCEPTED){e.hygienistRate=e.partialOffers[n].hourlyRate;break}e.hygienist.formattedName=formatProfileHygienistName(e.hygienist,e.hygienist?.skills),1===e.type?e.assistant=!0:e.assistant=!1,o(e)})).catch((function(e){console.log(e),a(e)}))}))}}}(),TempStars.Pages.Dentist.JobConfirmed.init(),TempStars.Pages.Dentist.JobPartialDetails=function(){"use strict";let e,t,o;const a=()=>{app.modal({text:`<b>${e.selOffer.hygienist.firstName} has declared they have been fully vaccinated against COVID and will provide proof of vaccination upon arrival at your office.</b>`,verticalButtons:!0,title:"<b>Proof of Vaccination</b>",buttons:[{text:"OK",bold:!0}]})};const n=t=>{t.preventDefault(),e.selOffer.hygienist.resumeUrl?app.modal({title:"<strong>Resume Checked?</strong>",text:`Have you reviewed ${e.selOffer.hygienist.firstName}'s resume, and determined they’re a good fit for your office for this shift?`,buttons:[{text:"Yes",bold:!0,onClick:()=>{i()}},{text:"No",onClick:()=>{}}]}):app.modal({title:"<strong>Accept Without Resume?</strong>",text:e.selOffer.hygienist.firstName+" doesn’t have a resume uploaded, although they’ve been asked to do so, and told that their offers will most likely be declined if they don’t have a resume. This means you’re about to accept this offer without reviewing their resume.<br/><br/>We don’t recommend this and it’s better to wait for another offer, but if you’re in a pinch - many shifts are successfully completed with members who haven’t uploaded resumes resumes.<br/><br/>Are you sure?",buttons:[{text:"YES",bold:!0,onClick:()=>i()},{text:"Go Back"}]})};function i(){e.Autobook&&e.hygienistId?app.alert(`Error accepting offer. Please wait until your instabooked ${e.assistant?"hygienist":"assistant"} confirms or rejects this shift. You will know in 20 minutes or less.`):TempStars.User.getCurrentUser().dentist.cancelledShiftsNum?function(){moment().diff(moment.utc(e.shifts[0].shiftDate+" "+e.shifts[0].postedStart,"YYYY-MM-DD h:mm a"),"hours");var t=moment(e.startDate).format("ddd MMM D, YYYY")+"<br/>"+e.selOffer.offeredStartTime+" - "+e.selOffer.offeredEndTime+"<br/><br/>When you Accept an offer, the "+(e.type?"assistant":"hygienist")+" is making an important commitment to your office and patients, and giving up other opportunities.<br/><br/>Cancelling booked shifts hurts everyone - not just the temp, but other offices who might need help but miss out because a temp was unnecessarily booked/confirmed.<br/><br/>If you Accept this offer, are you confident you'll keep this booking?<br><br>"+("US"===TempStars.Dentist.getCountry()?"":`Please be sure to read our\n\t\t\t\t<a href="https://${TempStars.Config.web[TempStars.Dentist.getCountry()].siteUrl}/short-notice" target="_system" class="external" style="font-size: 14px;">a\n\t\t\t\tNew<br>Short Notice Cancellation Policy</a>`);app.modal({title:"<strong>Think for a minute.</strong>",text:t,buttons:[{text:"YES",bold:!0,onClick:function(){s()}},{text:"Cancel"}]})}():s()}function s(){moment().diff(moment.utc(e.shifts[0].shiftDate+" "+e.shifts[0].postedStart,"YYYY-MM-DD h:mm a"),"hours");var t=e.selOffer.id,a=e.selOffer.hygienist.firstName+" "+e.selOffer.hygienist.lastName+"<br><br>"+moment.utc(e.startDate).format("ddd, MMM D")+"<br>"+e.selOffer.offeredStartTime+" - "+e.selOffer.offeredEndTime+"<br>Location: "+e.location.address+"<br><br>Rate: $"+e.selOffer.hourlyRate+'/hr<br><br>By accepting, you are Booking and Confirming this <span class="red-text">'+(1==e.type?"Dental Assistant":"Hygienist")+"</span> for this shift at the specified hours and rate.<br><br>Only Accept this offer if you're sure you'll keep the booking<br><br>"+("US"===TempStars.Dentist.getCountry()?"":`Be sure to read our\n            <a href="https://${TempStars.Config.web[TempStars.Dentist.getCountry()].siteUrl}/short-notice" target="_system" class="external" style="font-size: 14px;">\n            New<br>Short Notice Cancellation Policy</a>`)+"<br>Only Accept this offer and book "+e.selOffer.hygienist.firstName+" if you are sure you will keep your booking commitment once you accept it.";app.modal({title:"Accept and Book This Offer?",text:a,buttons:[{text:"I Agree & Accept",bold:!0,onClick:function(){!function(t){app.showPreloader("Accepting Custom Offer"),TempStars.Api.acceptPartialOffer(t).then((function(){app.hidePreloader(),TempStars.Analytics.track("accept offer",o);const t=formatProfileHygienistName(e.selOffer.hygienist,e.selOffer.hygienist?.skills);app.modal({title:"Booked and Confirmed",text:"Well done! <span class='blue-text'>"+t+"</span> is now booked and confirmed for your <span class='red-text'>"+(1==e.type?"Dental Assistant":"Hygienist")+"</span> shift on "+moment(e.startDate).format("dddd MMMM D")+".<br>You don’t have to do anything else.<br><br>Check your Inbox, we're sending you a confirmation e-mail shortly.",buttons:[{text:"I understand",bold:!0,onClick:function(){TempStars.Dentist.Router.goBackPage("home")}}]})})).catch((function(e){app.hidePreloader(),e&&e.message?app.alert("Error accepting offer. "+e.message):app.alert("Error accepting offer. Please try again.")}))}(t)}},{text:"I don't agree"}]})}function r(t){t.preventDefault();var o=e.selOffer.id;app.modal({title:"Decline this Offer?",text:"",buttons:[{text:"Decline",bold:!0,onClick:function(){!function(e){app.modal({title:"Help us improve by giving a reason for declining:",text:"",verticalButtons:!0,buttons:[{text:"No Resume",onClick:function(){d(e,{reason:"No Resume"})}},{text:"Hourly rate above our budget",onClick:function(){p(e,{reason:"Hourly rate above our budget"})}},{text:"Looking for more experience",onClick:function(){d(e,{reason:"Looking for more experience"})}},{text:"None",onClick:function(){d(e,{reason:"None"})}}]})}(o)}},{text:"Cancel"}]})}function c(e){for(var t,o='<div class="hourly-rate-wrapper"><p>Acceptable Rate</p><select class="job-partial-details-counter-offer no-fastclick" name="counter-offer"><option value="" disabled selected>Select Hourly Rate</option>',a=1;a<11;a++)o+='<option value="'+(t=e-a)+'">'+t+"$</option>";return o+='</select></div><div id="hourly-rate-error-msg">Please select your acceptable rate to submit a counter offer.</div>'}function l(t){app.modal({title:"Thank you!",text:t||"",buttons:[{text:"OK",bold:!0,onClick:function(){1==e.partialOffers.length&&Template7.global.jobsPostedData&&(Template7.global.jobsPostedData.jobInfo=Template7.global.jobsPostedData.jobInfo.map((function(t){return t.id==e.id&&(t.status=TempStars.JOB_STATUSES.POSTED,t.jobStatusName="Unfilled",t.statusMark="calendar-unfilled.svg"),t}))),TempStars.Dentist.Router.goBackPage("job-partial",{id:e.id})}}]})}function d(e,t,a){app.showPreloader("Declining Custom Offer"),TempStars.Api.rejectPartialOffer(e,t).then((function(){app.hidePreloader(),TempStars.Analytics.track("decline offer",o),l(a)})).catch((function(e){app.hidePreloader(),e&&e.message?app.alert("Error declining offer. "+e.message):app.alert("Error declining offer. Please try again.")}))}function p(t,o){app.modal({title:"Send a Counter Offer?",text:"What hourly rate would you accept for this shift? Let us know and we'll pass along that information to "+e.selOffer.hygienist.firstName+" for review."+c(e.selOffer.hourlyRate),buttons:[{text:"Submit",bold:!0,close:!1,onClick:function(){const a=+$$(".job-partial-details-counter-offer").val(),n="We have passed your hourly rate feedback to "+e.selOffer.hygienist.firstName+" and asked them to resubmit an offer at $"+a+"/hr if it is acceptable.<br/><br/>If it's acceptable, you'll receive another offer from "+e.selOffer.hygienist.firstName+". If not, you won't hear back from them.";a?(app.closeModal(),o=o&&o.reason?o.reason:"",d(t,{reason:o,counterOfferRate:a},n)):$("#hourly-rate-error-msg").show()}},{text:"Don't Send",onClick:function(){if(o){const a="We've indicated to "+e.selOffer.hygienist.firstName+" that you have declined their offer, but no counter offer information was sent.";$("#hourly-rate-error-msg").hide(),d(t,o,a)}}}]})}function m(){app.modal({title:"Send a Counter-Offer?",text:`If this offered hourly rate is higher than your budget, you can send a one-time proposed counter-offer to ${e.selOffer.hygienist.firstName} at a lower rate.`,buttons:[{text:"OK",bold:!0}]})}function u(e){e.preventDefault();app.modal({title:"",text:"Most resumes are viewable on mobiles, tablets and computers. If you don't see the resume, the file likely downloaded to your computer's \"Downloads\" folder.  Check there for the resume file and open from that folder.",buttons:[{text:"I Understand",bold:!0,onClick:f}]})}function f(t){window.Cordova?cordova.InAppBrowser.open(e.selOffer.hygienist.resumeUrl,"_system"):window.open(e.selOffer.hygienist.resumeUrl,"_system","location=yes")}return{init:function(){app.onPageBeforeInit("dentist-job-partial-details",(async function(i){e=i.context,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),TempStars.Api.updatePartialOfferViews(e.selOffer.id),e.selOffer.hygienist.photoUrl&&$$("#hygienist-profile-photo").attr("src",e.selOffer.hygienist.photoUrl),$$("#dentist-job-partial-details-accept-button").on("click",n),$$("#dentist-job-partial-details-decline-button").on("click",r),$$("#dentist-job-partial-details-send-custom-offer-button").on("click",(()=>p(e.selOffer.id))),$$("#dentist-job-partial-details-view-resume").on("click",u),$$("#dentist-job-partial-details-req-resubmit-button").on("click",b),$$("#hygienist-vax-proof-icon").on("click",a),$$("#dentist-job-partial-custom-offer-info").on("click",m);const s=e.selOffer.hygienist?.skills?.length?`<div class="list-block" style="margin:14px 0;">\n                  <ul>\n                    <li class="accordion-item accordion-item-expanded"><a href="#" class="item-content item-link">\n                        <div class="item-inner">\n                          <div class="item-title" style="font-size:14px; color: var(--secondary-main); text-decoration: underline;" >${e.selOffer.hygienist.firstName}'s Skill & Qualifications</div>\n                        </div></a>\n                      <div class="accordion-item-content">\n                          <div class="content-block" style="padding-bottom: 12px">\n                              <table>\n                                  ${e.selOffer.hygienist?.skills?.map((e=>`<tr><td>${e.label}<br></td></tr>`)).join("")}\n                              </table>\n                          </div> \n                      </div>\n                    </li>\n                  </ul>\n                </div>`:"";$$("#offer-hygienist-details").html(s),$("#hygienist-rating").starRating({starSize:20,activeColor:"gold",initialRating:e.selOffer.hygienist.starScore,readOnly:!0,useGradient:!1}),t=await TempStars.Api.getPPELink(e.location.province,e.location.postalCode);let c=convertHygienistStatus(e.selOffer.hygienist.status);o={shiftStartDate:new Date(e.startDate.replace(/-/g,"/")+" "+e.shifts[0].postedStart).toISOString(),shiftEndDate:new Date(e.startDate.replace(/-/g,"/")+" "+e.shifts[0].postedEnd).toISOString(),shiftId:e.shifts[0].id,shiftPostDate:new Date(e.postedOn).toISOString(),requestedHourlyRate:e.selOffer.hourlyRate,recommendedHourlyRate:e.proposedRate,currencyCode:e.location.country?"USD":"CAD",dentalWorkerStatus:c,dentalWorkerType:e.assistant?"Assistant":"Hygienist",hasUploadedResume:!!(e.selOffer.hygienist&&e.selOffer.hygienist.resumeUrl&&e.selOffer.hygienist.resumeUrl.length),graduationYear:e.selOffer.hygienist.graduationYear+"-01-01",dentalOfficeLocationId:e.locationId},TempStars.Analytics.track("view offer detail",o)})),app.onPageBeforeRemove("dentist-job-partial-details",(function(e){$$("#dentist-job-partial-details-accept-button").off("click",n),$$("#dentist-job-partial-details-decline-button").off("click",r),$$("#dentist-job-partial-details-send-custom-offer-button").off("click",p),$$("#dentist-job-partial-details-view-resume").off("click",u),$$("#dentist-job-partial-details-req-resubmit-button").off("click",b),$$("#dentist-job-partial-custom-offer-info").off("click",m),window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),clearInterval(undefined)}))},getData:function(){return Promise.resolve({})}};function b(){e.selOffer.isResubmitRequested?app.modal({title:"<b>Resubmit Already Requested</b>",text:"This offer expired and you have already requested that "+e.selOffer.hygienist.firstName+" resubmit their offer.<br><br>Watch your e-mail inbox for another offer if "+e.selOffer.hygienist.firstName+" is still available.",buttons:[{text:"OK",bold:!0}]}):app.modal({title:"<b>Request Resubmit?</b>",text:e.selOffer.hygienist.firstName+" "+e.selOffer.hygienist.lastName+" will receive a notification that you have requested a resubmission of their offer.",buttons:[{text:"OK",bold:!0,onClick:h},{text:"Cancel",onClick:function(){}}]})}function h(){return TempStars.Api.requestResubmitPartialOffer(e.selOffer.id).then((function(){app.modal({title:"<b>Request sent</b>",text:"Your request for re-submit has been sent. Keep an eye on your e-mail Inbox.  If "+e.selOffer.hygienist.firstName+" is still available, you will receive another offer.",buttons:[{text:"I Understand",bold:!0,onClick:function(){TempStars.Dentist.Router.goBackPage("home")}}]})}))}}(),TempStars.Pages.Dentist.JobPartialDetails.init(),TempStars.Pages.Dentist.JobPartial=function(){"use strict";var e,t=!1;function o(t){app.modal({title:"Post A Second Shift?",text:"<br>Do you need a second temp for this day?<br>"+moment(e.shifts[0].shiftDate).local().format("MMMM D, YYYY")+"<br>",buttons:[{text:"YES",bold:!0,onClick:function(){TempStars.Pages.Dentist.Home.getTempHandler(null,{date:moment(e.startDate).toDate()})}},{text:"No",onClick:function(){}}]})}function a(t){t.preventDefault();var o="Are you sure?<br><br>";e.hygienistId&&(o+="Every hygienist who has submitted an offer will be notified."),app.modal({title:"Remove this shift",text:o,buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:n}]})}function n(){app.showPreloader("Removing shift..."),TempStars.Api.cancelJob(e.id).then((function(){app.hidePreloader(),TempStars.Dentist.Router.goBackPage("home")})).catch((function(t){app.hidePreloader(),app.alert("Error removing shift. Please try again."),TempStars.Dentist.Router.reloadPage("job-partial",{id:e.id})}))}function i(t){t.preventDefault(),app.modal({title:"<strong>Change Shift Hours?</strong>",text:"When you change the shift hours, <strong>this will remove all current Custom Offers.</strong><br><br> Any "+(e.type?"dental assistant":"hygienist")+" who has submitted a Custom Offer will be notified of the new hours and advised to re-submit their offer if they're available for the new hours.<br/><br/>Are you sure?",buttons:[{text:"Yes",onClick:function(){e.pageTitle="Posted Job",TempStars.Dentist.Router.goForwardPage("modify-job",{},e)}},{text:"No"}]})}function s(t){t.preventDefault();const o=$$(this).attr("data-id");for(let t=0;t<e.partialOffers.length;t++)if(parseInt(e.partialOffers[t].id)===parseInt(o)){const o=e.partialOffers[t],a=formatProfileHygienistName(o.hygienist,o.hygienist?.skills);e.selOffer={...o,htmlName:a};break}const{locations:a}=TempStars.User.getCurrentUser(),n=a.find((t=>t.id===e.locationId));e.selOffer.status===TempStars.PARTIAL_OFFER_STATUS.REMOVED?app.modal({title:"<strong>This Offer Is No Longer Available</strong>",text:"This offer is no longer available. "+e.selOffer.hygienist.firstName+" was booked by another office for this date. <br><br>Hygienists and assistants can have multiple offers submitted to various offices for the same date. <br><br>The first office who Accepts their offer books them for that shift, which removes all other offers (to prevent double-booking).",buttons:[{text:"OK",onClick:function(){app.showPreloader("Removing partial offer..."),TempStars.Api.removePartialOffer(e.selOffer.id).then((function(){app.hidePreloader(),e.partialOffers=e.partialOffers.filter((function(e){return e.id!==o})),TempStars.Dentist.Router.reloadPage("job-partial",{id:e.id})}))}}]}):n.stripeCustomerId&&n.isCardValid?TempStars.App.goReact("customOfferDetails",{offerId:e.selOffer.id}):app.modal({title:"Add/Update Payment Details",text:"Almost there!  Just one more thing - to view the details of this offer, we require up-to-date payment details.<br><br>Don’t worry - we only ever process our placement fee of "+TempStars.Config[n.country?"US":"CA"].tempAmount+" after a temping shift is completed - no surprises.<br><br>Since 2015, TempStars has completed over 100,000 temping shifts - so we know what we’re doing, and we’ve got you.<br><br>Add/Update Payment Details Now?",buttons:[{text:"YES",bold:!0,onClick:function(){TempStars.Dentist.Router.goForwardPage("payment-info",{locationId:e.locationId}),TempStars.Analytics.track("add_payment_details",{add_payment_details:"payment-info"})}},{text:"Cancel",onClick:function(){TempStars.Analytics.track("add_payment_details",{add_payment_details:"cancel"})}}]})}function r(t){e.hasOneJob=1===t.jobCount,e.partialOffers=_.filter(e.partialOffers,(function(e){return(e.status===TempStars.PARTIAL_OFFER_STATUS.POSTED||e.status===TempStars.PARTIAL_OFFER_STATUS.EXPIRED||e.status===TempStars.PARTIAL_OFFER_STATUS.REMOVED)&&0===e.isResubmitRequested})),e.bonus&&(e.hasBonus=!0),1==e.type?e.assistant=!0:e.assistant=!1,e.dentistHasCancelledJobs=TempStars.Dentist.getHasCancelledJobs(),e.dentist=TempStars.User.getCurrentUser().dentist}return{init:function(){t||(app.onPageBeforeInit("dentist-job-partial",(function(t){$$("#dentist-job-partial-cancel-button").on("click",a),$$("#dentist-job-partial-modify-button").on("click",i),$$("#dentist-job-partial-new-job-button").on("click",o),TempStars.Analytics.track("view offers",{shiftStartDate:new Date(e.postedOn).toISOString(),totalAvailableOffers:t.context.partialOffers.length}),_.map(t.context.partialOffers,(function(e){var t="#hygienist-rating-"+e.id;$(t).starRating({starSize:16,activeColor:"gold",initialRating:e.hygienist.starScore,readOnly:!0,useGradient:!1})}))})),$$(document).on("click",".dentist-partial-job-row",s),app.onPageBeforeRemove("job-partial",(function(e){$$("#dentist-job-partial-cancel-button").off("click",a),$$("#dentist-job-partial-modify-button").off("click",i),$$("#dentist-job-partial-new-job-button").off("click",o)})),t=!0)},getData:async t=>{try{const o=await TempStars.Api.getCounterOfferMultiplier();if(t.id){(e=await TempStars.Api.getJobDetails(t.id)).paymentTermsString=TempStars.App.getJobPaymentTerms(e.paymentTerms,!1),r(e);const a=e.partialOffers.length?e.partialOffers[0].status:e.partialOffers.status,n=0===a&&1===e.Autobook&&e.hasOwnProperty("instabookTimeLeft")||4===a;return e={...e,cancelledOffer:n,partialOffersStatus:a,counterOfferMultiplier:o}}if(t.date){const a=await TempStars.Dentist.getJobsByDate(t.date);return(e=a[0]).paymentTermsString=TempStars.App.getJobPaymentTerms(e.paymentTerms,!1),r(e),e={...e,counterOfferMultiplier:o}}return e={...e,counterOfferMultiplier:o}}catch(e){console.log(e)}}}}(),TempStars.Pages.Dentist.JobPartial.init(),TempStars.Pages.Dentist.JobPosted=function(){"use strict";var e;function t(t){TempStars.App.goReact("postJob",{date:e.shifts[0].shiftDate})}function o(e){e&&e.preventDefault(),app.modal({title:"Remove Incentive",text:"Removing your incentive bonus lowers the chance of a successful placement. Are you sure?",buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:u}]})}function a(t){t.preventDefault(),e.postedStart=moment.utc(e.shifts[0].postedStart).local().format("h:mm a"),e.postedEnd=moment.utc(e.shifts[0].postedEnd).local().format("h:mm a"),TempStars.Job.offerIncentives(n)}function n(t){"0"===t?o(null):(app.showPreloader("Adding Incentive"),TempStars.Api.updateJob(e.id,{bonus:t}).then((function(){app.hidePreloader(),TempStars.Dentist.Router.reloadPage("job-posted",{id:e.id})})).catch((function(e){app.hidePreloader(),app.alert("Error adding incentive. Please try again.")})))}function i(t){TempStars.Dentist.Router.goForwardPage("modify-job",{},e)}function s(e){e.preventDefault(),app.modal({title:"Remove this shift",text:"Are you sure?",buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:c}]})}function r(e){e.preventDefault(),app.modal({title:"Cancel Shift",text:"Are you sure?",buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:c}]})}function c(){app.showPreloader("Removing shift..."),TempStars.Api.cancelJob(e.id).then((function(){app.hidePreloader(),TempStars.Dentist.Router.goBackPage("home")})).catch((function(e){app.hidePreloader(),app.alert("Error removing shift. Please try again.")}))}function l(t){var o=parseInt($$(this).attr("data-id"));e.shifts[0].type=o,d()}function d(){1===e.shifts[0].type?($$("#dentist-job-posted-checkmark-1").css("background-image","url('./img/radio-on.svg')"),$$("#dentist-job-posted-checkmark-2").css("background-image","url('./img/radio-off.svg')"),$$("#dentist-job-posted-offer-incentive-wrapper").css("display","flex")):2===e.shifts[0].type?($$("#dentist-job-posted-checkmark-1").css("background-image","url('./img/radio-off.svg')"),$$("#dentist-job-posted-checkmark-2").css("background-image","url('./img/radio-on.svg')"),$$("#dentist-job-posted-offer-incentive-wrapper").css("display","none")):($$("#dentist-job-posted-checkmark-1").css("background-image","url('./img/radio-off.svg')"),$$("#dentist-job-posted-checkmark-2").css("background-image","url('./img/radio-off.svg')"),$$("#dentist-job-posted-offer-incentive-wrapper").css("display","flex"))}function p(t){1===e.shifts[0].gapUnpaid?e.shifts[0].gapUnpaid=0:e.shifts[0].gapUnpaid=1,m()}function m(){1===e.shifts[0].gapUnpaid?$$("#dentist-job-posted-checkbox").css("background-image","url('./img/checkbox-on.svg')"):$$("#dentist-job-posted-checkbox").css("background-image","url('./img/checkbox-off.svg')")}function u(){app.showPreloader("Removing Incentive"),TempStars.Api.updateJob(e.id,{bonus:0,short:0,urgent:0,weekend:0}).then((function(){app.hidePreloader(),TempStars.Dentist.Router.reloadPage("job-posted",{id:e.id})})).catch((function(e){app.hidePreloader(),app.alert("Error removing incentive. Please try again.")}))}return{init:function(){app.onPageBeforeInit("dentist-job-posted",(function(n){e=n.context,$$("#dentist-job-posted-cancel-button").show(),$$("#dentist-job-posted-break-button").hide(),$$("#dentist-job-posted-modify-button").on("click",i),$$("#dentist-job-posted-cancel-button").on("click",s),$$("#dentist-job-posted-break-button").on("click",r),$$("#dentist-job-posted-remove-incentive-button").on("click",o),$$("#dentist-job-posted-offer-incentive-button").on("click",a),$$("#dentist-job-posted-new-job-button").on("click",t),d(),m()})),app.onPageBeforeRemove("dentist-job-posted",(function(e){$$("#dentist-job-posted-modify-button").off("click",i),$$("#dentist-job-posted-cancel-button").off("click",s),$$("#dentist-job-posted-break-button").off("click",r),$$("#dentist-job-posted-remove-incentive-button").off("click",o),$$("#dentist-job-posted-offer-incentive-button").off("click",a),$$("#dentist-job-posted-new-job-button").off("click",t)})),$$(document).on("click",".dentist-job-posted-check-type .checkmark-wrapper",l),$$(document).on("click",".dentist-job-posted-check-type .checkbox-wrapper",p)},getData:function(t){return new Promise((function(o,a){TempStars.Dentist.getJob(t.id).then((function(a){(e=a).hasOneJob=1===t.jobCount,e.jobsToday=t.jobCount,e.bonus&&(e.hasBonus=!0),1==e.type?e.assistant=!0:e.assistant=!1,o(Object.assign(a,{paymentTermsString:TempStars.App.getJobPaymentTerms(a.paymentTerms,!1)}))})).catch((function(e){a(e)}))})).catch((function(e){console.log(e)}))}}}(),TempStars.Pages.Dentist.JobPosted.init(),TempStars.Pages.Dentist.Job=function(){"use strict";function e(e){var o=$$(this).attr("data-id"),a=$$("#dentist-job-notes").val();TempStars.Api.updateJob(o,{dentistPrivateNotes:a}).then((function(){t()})).catch((function(e){app.alert("Error saving notes. Please try again.")}))}function t(e){TempStars.Dentist.Router.goBackPage("jobs")}return{init:function(){app.onPageBeforeInit("dentist-job",(function(o){$$("#dentist-job-notes-save-button").on("click",e),$$(".detailback").on("click",t)})),app.onPageBeforeRemove("dentist-job",(function(o){$$("#dentist-job-notes-save-button").off("click",e),$$(".detailback").off("click",t)}))},getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.Job.init(),TempStars.Pages.Dentist.JobsPosted=function(){"use strict";var e;function t(t){return 1===TempStars.User.getCurrentUser().locations.length&&e.jobInfo.length>=3?TempStars.Pages.Dentist.Home.maxJobsReachedModal():TempStars.App.goReact("postJob",{date:e.jobInfo[0].shifts[0].shiftDate})}function o(){var t=Number($$(this).attr("data-id")),o=_.find(e.jobInfo,{id:t}),a={id:t,selectJobData:e},n=o.status;return 1===n&&o.hasRemovedOffers&&(n=2),o.status===TempStars.JOB_STATUSES.CONFIRMED?TempStars.App.goReact("dentistJobConfirmed",a):TempStars.Dentist.Router.goForwardPage(e.nextPages[n],a)}return{init:function(){app.onPageBeforeInit("jobs-posted",(function(a){e=a.context,Template7.global.jobsPostedData=a.context,$$(".job-item").on("click",o),$$("#dentist-jobs-posted-new-job-button").on("click",t)})),app.onPageBeforeRemove("jobs-posted",(function(){$$(".job-item").off("click",o),$$("#dentist-jobs-posted-new-job-button").off("click",t)})),app.onPageBeforeAnimation("jobs-posted",(function(e){}))},getData:function(e){return e.jobsPostedData?Promise.resolve(e):Promise.resolve(Template7.global.jobsPostedData)}}}(),TempStars.Pages.Dentist.JobsPosted.init(),TempStars.Pages.Dentist.Jobs=function(){"use strict";var e,t="date";function o(o){t="date",$(this).addClass("active").siblings().removeClass("active"),e&&e.jobs&&(e.jobs=_.orderBy(e.jobs,["invoice.sentOn"],["desc"]),TempStars.Dentist.Router.reloadPage("jobs",{},e))}function a(o){t="name",$(this).addClass("active").siblings().removeClass("active"),e&&e.jobs&&(e.jobs=_.sortBy(e.jobs,"hygienist.lastName"),TempStars.Dentist.Router.reloadPage("jobs",{},e))}function n(t){var o=parseInt($$(this).attr("data-id")),a=_.find(e.jobs,{id:o});TempStars.Dentist.Router.goForwardPage("job",{},a)}return{init:function(){app.onPageBeforeInit("dentist-jobs",(function(i){"date"==t?($("#dentist-jobs-date-sorting-button").addClass("active").siblings().removeClass("active"),e.jobs=_.orderBy(e.jobs,["shifts[0].shiftDate"],["desc"])):($("#dentist-jobs-hygienist-sorting-button").addClass("active").siblings().removeClass("active"),e.jobs=_.sortBy(e.jobs,"hygienist.lastName")),$("#dentist-jobs-date-sorting-button").on("click",o),$("#dentist-jobs-hygienist-sorting-button").on("click",a),$(document).on("click",".job",n)})),app.onPageBeforeRemove("dentist-jobs",(function(e){$("#dentist-jobs-date-sorting-button").off("click",o),$("#dentist-jobs-hygienist-sorting-button").off("click",a),$(document).off("click",".job",n)}))},getData:function(){return new Promise((function(o,a){TempStars.Api.getDentistJobHistory(TempStars.User.getCurrentUser().dentistId).then((function(a){e={jobs:a},"date"==t?e.jobs=_.orderBy(e.jobs,["invoice.sentOn"],["desc"]):"name"==t&&(e.jobs=_.sortBy(e.jobs,"hygienist.lastName")),o(e)})).catch((function(e){app.alert("Error retrieving jobs. Please try again"),a(e)}))}))}}}(),TempStars.Pages.Dentist.Jobs.init(),TempStars.Pages.Dentist.Location=function(){"use strict";let e,t,o=!1;function a(e){app.alert("Remember to Save changes")}function n(t){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.Dentist.Router.goForwardPage("payment-info",{locationId:e.id})}function i(t){var o=app.formToJSON("#dentist-location-form"),a=TempStars.User.getCurrentUser().dentist;$$("#dentist-location-form .form-error-msg").html(""),$$("#dentist-location-form .field-error-msg").removeClass("error").html(""),validate.validators.optionalEmail=e=>""===e?null:validate.single(e,{email:!0});const n=validate(o,{secondaryEmail:{optionalEmail:!0},accountingEmail:{optionalEmail:!0},practiceName:{presence:{allowEmpty:!1}},businessOwner:{presence:{allowEmpty:!1}},address:{presence:{allowEmpty:!1}},city:{presence:{allowEmpty:!1}},province:{presence:{message:"is required"}},postalCode:{presence:{allowEmpty:!1}},phone:{presence:{allowEmpty:!1},phoneNumber:!0},primaryContact:{presence:{allowEmpty:!1}},parking:{presence:{message:"is required"}},radiography:{presence:{message:"is required"}},ultrasonic:{presence:{message:"is required"}},avgApptTime:{presence:{message:"is required"}},charting:{presence:{message:"is required"}},software:{presence:{message:"is required"}}});if(n){if(n.secondaryEmail&&$$('#dentist-location-form input[name="secondaryEmail"]').addClass("error").next().html(n.secondaryEmail[0]),n.accountingEmail&&$$('#dentist-location-form input[name="accountingEmail"]').addClass("error").next().html(n.accountingEmail[0]),n.practiceName&&$$('#dentist-location-form input[name="practiceName"]').addClass("error").next().html(n.practiceName[0]),n.businessOwner&&$$('#dentist-location-form input[name="businessOwner"]').addClass("error").next().html(n.businessOwner[0]),n.address&&$$('#dentist-location-form input[name="address"]').addClass("error").next().html(n.address[0]),n.city&&$$('#dentist-location-form input[name="city"]').addClass("error").next().html(n.city[0]),n.province){var i="State must be selected";a.country===TempStars.COUNTRY.CA&&(i="Province must be selected"),$$('#dentist-location-form select[name="province"]').addClass("error").next().html(i)}if(n.postalCode){i=n.postalCode[0];a.country===TempStars.COUNTRY.CA&&(i=i.replace("Postal","Zip")),$$('#dentist-location-form input[name="postalCode"]').addClass("error").next().html(n.postalCode[0])}return n.phone&&$$('#dentist-location-form input[name="phone"]').addClass("error").next().html(n.phone[0]),n.primaryContact&&$$('#dentist-location-form input[name="primaryContact"]').addClass("error").next().html(n.primaryContact[0]),n.parking&&$$('#dentist-location-form select[name="parking"]').addClass("error").next().html(n.parking[0]),n.radiography&&$$('#dentist-location-form select[name="radiography"]').addClass("error").next().html(n.radiography[0]),n.sterilization&&$$('#dentist-location-form select[name="sterilization"]').addClass("error").next().html(n.sterilization[0]),n.ultrasonic&&$$('#dentist-location-form select[name="ultrasonic"]').addClass("error").next().html(n.ultrasonic[0]),n.avgApptTime&&$$('#dentist-location-form select[name="avgApptTime"]').addClass("error").next().html(n.avgApptTime[0]),n.charting&&$$('#dentist-location-form select[name="charting"]').addClass("error").next().html(n.charting[0]),void(n.software&&$$('#dentist-location-form select[name="software"]').addClass("error").next().html(n.software[0]))}o.phone=o.phone.replace(/\D/g,""),o.phone.length>10&&"1"===o.phone[0]&&(o.phone=o.phone.substr(1)),app.modal({title:"Save Location",text:"Are you sure?",buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:function(){!function(t){var o=TempStars.User.getCurrentUser().dentist;if(o.country===TempStars.COUNTRY.CA&&!validate.validators.validatePostalCodeFromProvince(t.province,t.postalCode))return void $$('#dentist-location-form input[name="postalCode"]').addClass("error").next().html("Postal code is not in selected province.");app.showPreloader("Saving Location"),Promise.resolve().then((function(o){return t.photoUrl=o,t.isUpdated=1,TempStars.Api.updateLocation(e.id,t)})).then((function(){return TempStars.User.refresh()})).then((function(){app.hidePreloader(),window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.App.gotoStartingPage()})).catch((function(e){app.hidePreloader(),console.error(e),app.alert("Error updating location.  Please try again.")}))}(o)}}]})}function s(e){e.preventDefault(),window.cordova?app.modal({title:"Computer/Laptop Required",text:"Documents can't be uploaded from your mobile/tablet devices. You need to use a PC/Laptop/Mac computer to upload your document. Sign into your account from your computer and you'll be able to get your document uploaded.",buttons:[{text:"OK",bold:!0}]}):app.modal({text:"Microsoft Word (.doc or docx) or PDF (.pdf) files only. Temps can't view any other file types.",title:"",buttons:[{text:"Got it!",bold:!0,onClick:function(){$$("#dentist-location-web-document").click()}}]})}function r(e){e.preventDefault(),app.modal({title:"Upload Office Document",text:"If you have a document such as: Office Policy, Temping Manual, Infection Control Protocol, Instructions for parking/location/directions/map, or any other important document you want your temp to read, you can upload it here. They will see it after booking a shift.<br><br>NOTE: Only 1(one) file can be uploaded to your location, so if you have multiple documents, combine them into a single file before uploading.",buttons:[{text:"I Understand",bold:!0}]})}function c(e){$$("#dentist-location-document").attr("src",""),$$("#dentist-location-document-remove").hide(),$$("#dentist-location-document-add").show()}function l(e){var t=e.target.files[0],o=new FileReader;o.onload=function(e){$$("#dentist-location-document-remove").show(),$$("#dentist-location-document-add").hide(),$$("#dentist-location-document").attr("src",e.target.result)},o.readAsDataURL(t)}function d(e){var t=$$(this).val().toLocaleUpperCase();$$(this).val(t)}function p(e){var t=e.keyCode?e.keyCode:e.which;if(13==t||10==t)return window.Keyboard.hide(),$$("#dentist-location-save-button").trigger("click"),!1}return{init:function(){app.onPageAfterAnimation("location",(function(t){e.photoUrl&&($$("#dentist-location-document").attr("src",e.photoUrl),$$("#dentist-location-document-remove").show(),$$("#dentist-location-document-add").hide()),$$("#dentist-location-upload-document-button").on("click",s),$$("#dentist-location-remove-document-button").on("click",c),$$("#dentist-location-web-document").on("change",l),$$("#dentist-location-form input").on("change",a),$$("#dentist-location-form select").on("change",a),$$("#dentist-profile-delete-button").on("click",goToDeleteAccountDentist)})),app.onPageBeforeInit("location",(function(a){e=a.context,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),o||($$(document).on("click","#dentist-location-save-button",i),$$(document).on("click","#dentist-location-payment-button",n),$$("#dentist-location-upload-document-button").on("click",s),$$("#dentist-info").on("click",r),$$("#dentist-location-remove-document-button").on("click",c),$$("#dentist-location-web-document").on("change",l),$$('#dentist-location-form input[name="postalCode"]').on("focusout",d),$$("#dentist-location-form input").on("keypress",p),o=!0),e.photoUrl&&($$("#dentist-location-document").attr("src",e.photoUrl),$$("#dentist-location-document-remove").show(),$$("#dentist-location-document-add").hide()),$("#phone").inputmask({mask:"(999) 999-9999"}),$$('#dentist-location-form select[name="province"]').val(e.province).prop("selected",!0),$$('#dentist-location-form select[name="parking"]').val(e.parking).prop("selected",!0),$$('#dentist-location-form select[name="radiography"]').val(e.radiography).prop("selected",!0),$$('#dentist-location-form select[name="ultrasonic"]').val(e.ultrasonic).prop("selected",!0),$$('#dentist-location-form select[name="avgApptTime"]').val(e.avgApptTime).prop("selected",!0),$$('#dentist-location-form select[name="charting"]').val(e.charting).prop("selected",!0),$$('#dentist-location-form select[name="software"]').val(e.software).prop("selected",!0);const{address:m,city:u,province:f,country:b}=e;$$('#dentist-location-form input[name="mailingAddress"]').attr("value",m+", "+u+", "+f+", "+(b?"United States":"Canada")),TempStars.Autocomplete.init({country:e.country},(({state:e,city:o,postalCode:a,address:n})=>{$$('#dentist-location-form input[name="address"]').attr("value",n),t=e,$$('#dentist-location-form input[name="city"]').attr("value",o),$$("#dentist-location-form").val(e),$$('#dentist-location-form input[name="postalCode"]').attr("value",a)}))})),app.onPageBeforeRemove("location",(function(e){}))},getData:function(e){if(e.location)return Promise.resolve(e.location);var t=TempStars.User.getCurrentUser().locations,o=_.find(t,{id:e.locationId});return Promise.resolve(o)}}}(),TempStars.Pages.Dentist.Location.init(),TempStars.Pages.Dentist.LocationsAddStep1=function(){"use strict";var e;function t(e){var t=e.target.files[0],o=new FileReader;o.onload=function(e){$$("#locations-document-remove").show(),$$("#locations-document-add").hide(),$$("#locations-document").attr("src",e.target.result)},o.readAsDataURL(t)}function o(){$$("#locations-step1-form .form-error-msg").html(""),$$("#locations-step1-form .field-error-msg").removeClass("error").html("");const t=app.formToJSON("#locations-step1-form");validate.validators.optionalEmail=e=>""===e?null:validate.single(e,{email:!0});let o=validate(t,{practiceName:{presence:{allowEmpty:!1}},businessOwner:{presence:{allowEmpty:!1}},address:{presence:{allowEmpty:!1}},city:{presence:{allowEmpty:!1}},postalCode:{presence:{allowEmpty:!1}},phone:{presence:{allowEmpty:!1},phoneNumber:!0},email:{presence:{allowEmpty:!1},email:!0},secondaryEmail:{optionalEmail:!0},accountingEmail:{optionalEmail:!0}});return TempStars.Api.isPhoneNumberUnique({phone:t.phone}).then((function(a){if(a){if(""===$$("#locations-step1-form select[name=province]").val()){var n="Province must be selected";e.country===TempStars.COUNTRY.US&&(n="State must be selected"),$$('#locations-step1-form select[name="province"]').addClass("error").next().html(n),o||(o={}),o.province=!0}if(o)return o.practiceName&&$('#locations-step1-form input[name="practiceName"]').addClass("error").next().html(o.practiceName[0]),o.businessOwner&&$$('#locations-step1-form input[name="businessOwner"]').addClass("error").next().html(o.businessOwner[0]),o.address&&$$('#locations-step1-form input[name="address"]').addClass("error").next().html(o.address[0]),o.city&&$$('#locations-step1-form input[name="city"]').addClass("error").next().html(o.city[0]),o.postalCode&&$$('#locations-step1-form input[name="postalCode"]').addClass("error").next().html(e.country===TempStars.COUNTRY.CA?"Postal code can't be blank":"Zip code can't be blank"),o.phone&&$$('#locations-step1-form input[name="phone"]').addClass("error").next().html(o.phone[0]),o.email&&$$('#locations-step1-form input[name="email"]').addClass("error").next().html(o.email[0]),o.secondaryEmail&&$$('#locations-step1-form input[name="secondaryEmail"]').addClass("error").next().html(o.secondaryEmail[0]),void(o.accountingEmail&&$$('#locations-step1-form input[name="accountingEmail"]').addClass("error").next().html(o.accountingEmail[0]));if(e.country===TempStars.COUNTRY.CA&&!validate.validators.validatePostalCodeFromProvince(t.province,t.postalCode))return void $$('#locations-step1-form input[name="postalCode"]').addClass("error").next().html("Postal code is not in selected province.");t.phone=t.phone.replace(/\D/g,""),t.phone.length>10&&"1"===t.phone[0]&&(t.phone=t.phone.substr(1)),app.showPreloader("Saving Data..."),new Promise((function(e,t){if("img/dental-office.png"!==$$("#locations-document").attr("src"))if(window.cordova)app.alert("Documents can't be uploaded from your mobile/tablet devices. You need to use a PC/Laptop/Mac computer to upload your document. Sign into your account from your computer and you'll be able to get your document uploaded.");else{var o;(o=$("#locations-web-document")[0].files[0]).type;var a=$("#locations-document").attr("src"),n=TempStars.File.convertDataURItoBlobSync(a);TempStars.Api.getAwsUploadCredentials(o.type).then((function(t){return TempStars.Ajax.upload(t.signedRequest,n,{contentType:o.type}).then((function(){e(t.url)}))})).catch((function(e){t(e)}))}else e()})).then((function(e){e&&(t.photoUrl=e),t.isUpdated=1,app.formStoreData("locations-step1-form",t),app.hidePreloader(),app.modal({title:"<strong>Confirm E-mail For This Location</strong>",text:"You have entered <b>"+t.email+"</b> for this location. Important notifications, confirmations and invoices will be sent to this e-mail, so make sure it’s one you check regularly. <br><br>E-mails sent to this address will be considered received and read. <br><br>Is this correct?",buttons:[{text:"No"},{text:"<b>Yes</b>",onClick:function(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.Dentist.Router.goForwardPage("locations-add-step2")}}]})})).catch((function(e){console.log(e),app.hidePreloader()}))}else app.modal({title:"<strong>Confirm E-mail For This Location</strong>",text:"The phone number "+t.phone+" is already being used in our database. Please contact "+Template7.global.helpEmail+" and we'll help you get this location added to your account.",buttons:[{text:'<a href="mailto:'+Template7.global.helpEmail+'" class="external" target="_system">Contact support</a>'},{text:"<b>Ok</b>"}]}),$$('#locations-step1-form input[name="phone"]').addClass("error").next().html("not unique phone number")}))}function a(){app.modal({title:"<strong>Location E-mail</strong>",text:'<div class="locations-email-modal">For this location, indicate where to send updates: <br><br> <input id="location-email-input"></div>',buttons:[{text:"Submit",onClick:function(){var t=$$("#location-email-input")[0].value;$$("#location-email-text").html(t),e.email=t}},{text:"Cancel"}]})}function n(){app.modal({title:"Upload Office Document",text:"If you have a document such as: Office Policy, Temping Manual, Infection Control Protocol, Instructions for parking/directions/location/map, or any other important document you want your temp to read, you can upload it here. They will see it after booking a shift.<br><br>NOTE: Only 1(one) file can be uploaded to your account, so if you have multiple documents, combine them into a single file before uploading.",buttons:[{text:"I Understand",bold:!0}]})}function i(){window.cordova?app.modal({title:"Computer/Laptop Required",text:"Documents can't be uploaded from your mobile/tablet devices. You need to use a PC/Laptop/Mac computer to upload your document. Sign into your account from your computer and you'll be able to get your document uploaded.",buttons:[{text:"OK",bold:!0}]}):app.modal({text:"Microsoft Word (.doc or docx) or PDF (.pdf) files only. Temps can't view any other file types.",title:"",buttons:[{text:"Got it!",bold:!0,onClick:function(){$$("#locations-web-document").click()}}]})}return{init:function(){app.onPageBeforeInit("locations-add-step1",(function(s){e=s.context,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),$("#phone").inputmask({mask:"(999) 999-9999"}),$$("#locations-add-next-btn").on("click",o),$$("#change-location-email-btn").on("click",a),$$("#locations-document-info").on("click",n),$$("#locations-web-document").on("change",t),$$("#locations-upload-document-button").on("click",i),TempStars.Autocomplete.init({country:e.country},(({state:e,city:t,postalCode:o,address:a})=>{$$('#locations-step1-form input[name="address"]').attr("value",a),$$('#locations-step1-form input[name="city"]').attr("value",t),$$('#locations-step1-form select[name="province"]').val(e).prop("selected",!0),$$('#locations-step1-form input[name="postalCode"]').attr("value",o)}))})),app.onPageBeforeRemove("locations-add-step1",(function(){$$("#locations-add-next-btn").off("click",o),$$("#change-location-email-btn").off("click",a),$$("#locations-document-info").off("click",n),$$("#locations-web-document").off("change",t),$$("#locations-upload-document-button").off("click",i)}))},getData:function(){const e=TempStars.User.getCurrentUser();return Promise.resolve(e)}}}(),TempStars.Pages.Dentist.LocationsAddStep1.init(),TempStars.Pages.Dentist.LocationsAddStep2=function(){"use strict";function e(){var e={};$$("#locations-step2-form .form-error-msg").html(""),$$("#locations-step2-form .field-error-msg").removeClass("error").html("");var t=app.formToJSON("#locations-step2-form"),o=validate(t,{primaryContact:{presence:{allowEmpty:!1}},parking:{presence:{message:"is required"}},radiography:{presence:{message:"is required"}},ultrasonic:{presence:{message:"is required"}},avgApptTime:{presence:{message:"is required"}},charting:{presence:{message:"is required"}},software:{presence:{message:"is required"}}});if(o)return o.primaryContact&&$('#locations-step2-form input[name="primaryContact"]').addClass("error").next().html(o.primaryContact[0]),o.parking&&$$('#locations-step2-form select[name="parking"]').addClass("error").next().html(o.parking[0]),o.radiography&&$$('#locations-step2-form select[name="radiography"]').addClass("error").next().html(o.radiography[0]),o.sterilization&&$$('#locations-step2-form select[name="sterilization"]').addClass("error").next().html(o.sterilization[0]),o.ultrasonic&&$$('#locations-step2-form select[name="ultrasonic"]').addClass("error").next().html(o.ultrasonic[0]),o.avgApptTime&&$$('#locations-step2-form select[name="avgApptTime"]').addClass("error").next().html(o.avgApptTime[0]),o.charting&&$$('#locations-step2-form select[name="charting"]').addClass("error").next().html(o.charting[0]),void(o.software&&$$('#locations-step2-form select[name="software"]').addClass("error").next().html(o.software[0]));var a=TempStars.User.getCurrentUser().dentist;t.country=a.country,app.formStoreData("locations-step2-form",t),app.showPreloader("Saving Location Details..."),e.dentistId=TempStars.User.getCurrentUser().dentistId,_.assign(e,app.formGetData("locations-step1-form"),t),TempStars.Api.addLocation(e).then((function(e){return app.hidePreloader(),TempStars.Dentist.updateLocationCounter(),app.modal({title:"<b>Location Created</b>",text:"Do you want to enter payment info for this location now?",buttons:[{text:"Yes",onClick:function(){mainView.history.push("locations-home"),window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.Dentist.Router.goForwardPage("payment-info",{locationId:e.locationId})}},{text:"I'll do it later",onClick:function(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.Dentist.Router.goBackPage("locations-home")}}]})})).catch((function(e){app.hidePreloader(),app.alert(e.error.message)}))}return{init:function(){app.onPageBeforeInit("locations-add-step2",(function(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),$$("#locations-add-submit-btn").on("click",e)})),app.onPageBeforeRemove("locations-add-step2",(function(){$$("#locations-add-submit-btn").off("click",e)}))},getData:function(){return Promise.resolve()}}}(),TempStars.Pages.Dentist.LocationsAddStep2.init(),TempStars.Pages.Dentist.LocationsHome=function(){"use strict";var e,t,o,a;function n(){app.modal({title:"<b>Enable Multi-Location</b>",text:'The multi-location feature will become available once you have completed a temping placement with this location.<br/><br/>Once activated you’ll be able to manage all practice locations from one account. <br/><br/>If you have any questions about this, please <a href="#" id="contactus" class="external" >contact us here.</a>',buttons:[{text:"<b>OK</b>"}]}),$$("#contactus").on("click",(function(){app.closeModal(),TempStars.Dentist.Router.goForwardPage("contact-support")}))}function i(){app.modal({title:"<b>Activate Multi-Location?</b>",text:'In order to activate multi-location, you must read about and understand how it works.<br/><br/>VERY IMPORTANT: Tap this link to read about how the multi-location works: <a class="external" target="_system" href=https://'+Template7.global.siteUrl+"/multi-location>"+Template7.global.siteUrl+'/multi-location</a><br/><br/>Once activated you’ll be able to manage all practice locations from one account.<br/><br/>If you have any questions about this, please <a href="#" id="contactus" class="external" >contact us here.</a>',buttons:[{text:"No"},{text:"<b>Confirm</b>",onClick:function(){app.formStoreData("locations-activate-feature-"+a,!0),$$("#locations-activate-feature-btn").hide(),$$("#locations-add-btn").show()}}]}),$$("#contactus").on("click",(function(){app.closeModal(),TempStars.Dentist.Router.goForwardPage("contact-support")}))}function s(t){var o=Number($$(this).attr("data-id")),a=_.find(e.locations,{id:o});TempStars.Dentist.Router.goForwardPage("location",{},a)}function r(t){t.stopPropagation();var o=Number($$(t.target).attr("data-id")),a=_.find(e.locations,{id:o});1===e.locations.length?app.modal({title:"<b>Minimum 1 Location Required</b>",text:"Your account requires at least one location on file. <br><br>To delete this location you need to create another location first.",buttons:[{text:"I Understand"}]}):app.modal({title:"<strong>Delete this location?</strong>",text:a.address+", "+a.city+" "+a.province+"<br/><br/>Are you sure?",buttons:[{text:"No"},{text:"<b>Yes</b>",onClick:function(){app.showPreloader("Deleting location..."),TempStars.Api.deleteLocation(o).then((function(){return TempStars.Dentist.updateLocationCounter().then((function(){app.hidePreloader(),TempStars.Dentist.Router.reloadPage()}))})).catch((function(e){app.hidePreloader();let t="";e&&e.message&&(t="ERROR_LOCATION_HAD_FUTURE_JOBS"===e.message?"To remove this location, you must first remove/cancel any future shifts associated with it. Tap on the shift dates and tap “Remove Shift” or “Cancel Shift” at the bottom of the shift screen.<br/><br/>Do this for shifts on: "+function(e){var t="MMM&#160;DD";if(e.length>5)return moment.utc(e[0].startDate).format(t)+", "+moment.utc(e[1].startDate).format(t)+" ... "+moment.utc(e[e.length-1].startDate).format(t);return e.map((function(e){return moment.utc(e.startDate).format(t)})).join(", ")}(e.data):"Error during deleting this location. <br/>"+e.message),app.modal({title:"This Location Has Active Shifts",text:t,buttons:[{text:"<b>Ok</b>",onClick:function(){TempStars.Dentist.Router.goBackPage("home")}}]})}))}}]})}function c(){app.modal({title:"<b>Add Location?</b>",text:'Please confirm you’ve read and understand how the multi-location feature works. If you haven’t read it yet, the information link is here:<br/><a class="external" target="_system" href=https://'+Template7.global.siteUrl+"/multi-location>"+Template7.global.siteUrl+'/multi-location</a><br/><br/>If you have any questions about this, please contact us at <a href="#" id="contactus" class="external" >contact us here.</a>',buttons:[{text:"No"},{text:"<b>Confirm</b>",onClick:function(){TempStars.Dentist.Router.goForwardPage("locations-add-step1")}}]}),$$("#contactus").on("click",(function(){app.closeModal(),TempStars.Dentist.Router.goForwardPage("contact-support")}))}return{init:function(){app.onPageBeforeInit("locations-home",(function(l){e=l.context,0===t.completedJobs?($$(".locations-padlock").show(),$$("#locations-add-btn").addClass("locations-add-btn-disabled"),$$("#locations-add-btn").on("click",n)):(o>1||app.formGetData("locations-activate-feature-"+a)||($$("#locations-add-btn").hide(),$$("#locations-activate-feature-btn").show(),$$("#locations-activate-feature-btn").on("click",i)),$$("#locations-add-btn").on("click",c)),$$(".location-delete-btn").on("click",r),$$(".locations-item").on("click",s)})),app.onPageBeforeRemove("locations-home",(function(){0===t.completedJobs?$$("#locations-add-btn").off("click",n):(o>1||app.formGetData("locations-activate-feature-"+a)||$$("#locations-activate-feature-btn").off("click",i),$$("#locations-add-btn").off("click",c)),$$("#locations-add-btn").off("click",c),$$(".location-delete-btn").off("click",r),$$(".locations-item").off("click",s)}))},getData:function(){return a=TempStars.User.getCurrentUser().dentistId,t=TempStars.User.getCurrentUser().dentist,o=TempStars.User.getCurrentUser().locations.filter((function(e){return 0===e.removed})).length,TempStars.Api.getLocations(a).then((function(e){return TempStars.Dentist.setLocations(e),{locations:e.filter((function(e){return 0===e.removed}))}}))}}}(),TempStars.Pages.Dentist.LocationsHome.init(),TempStars.Dentist.Menu=function(){"use strict";return{init:function(){console.log("DENT MENU"),$$(document).on("click",".dentist-internal-forward",(function(e){e.preventDefault();var t=$$(this).attr("data-page");$$(this).attr("data-access");"hirejob-home"===t?TempStars.Pages.Dentist.Home.recruitStaffHandler():TempStars.Dentist.Router.goForwardPage(t)})),$$(document).on("click",".dentist-internal-home",(function(e){e.preventDefault(),TempStars.Dentist.Router.goBackPage("home")})),$$(document).on("click",".dentist-internal-back",(function(e){var t,o,a;e.preventDefault(),t=$$(this).attr("data-page"),(o=$$(this).attr("data-id"))&&(a={id:o}),TempStars.Dentist.Router.goBackPage(t,a)}))}}}(),TempStars.Dentist.Menu.init(),TempStars.Pages.Dentist.ModifyJob=function(){"use strict";var e;function t(){TempStars.Dentist.Router.goBackPage("",e)}function o(t){$$("#dentist-modify-job-form .form-error-msg").html(""),$$("#dentist-modify-job-form .field-error-msg").removeClass("error").html("");var o=app.formToJSON("#dentist-modify-job-form"),a=validate(o,{postedStart:{presence:{allowEmpty:!1},time:!0},postedEnd:{presence:{allowEmpty:!1},time:!0}});if(a)return a.postedStart&&$$("#dentist-modify-job-starttime").addClass("error").next().html(a.postedStart[0]),void(a.postedEnd&&$$("#dentist-modify-job-endtime").addClass("error").next().html(a.postedEnd[0]));moment(o.postedStart,"hh:mm a").toDate().getTime()>=moment(o.postedEnd,"hh:mm a").toDate().getTime()?$$("#dentist-modify-job-form .form-error-msg").html('<span class="ti-alert"></span> Arrival time must be before ending time.').show():function(t){var o=moment(e.startDate).local().format("ddd, MMM D, YYYY")+"<br>"+t.postedStart+" - "+t.postedEnd+"<br>";e.status==TempStars.Job.status.CONFIRMED?o+="<br>"+e.hygienist.firstName+" "+e.hygienist.lastName+" will be immediately notified.<br>We'll let you if there's a problem with the change.":e.status==TempStars.Job.status.PARTIAL&&(o+='<br>When you click "OK", all submitted Custom Offers will be removed. <br><br>We will immediately advise all '+(e.type?"dental assistants":"hygienists")+" to re-submit their offers if these new hours are still compatible.");app.confirm(o,"<strong>Modify Shift?</strong>",(function(){!function(t){var o,a,n;app.showPreloader("Modifying Shift"),a=moment(e.startDate+" "+t.postedStart,"YYYY-MM-DD h:mm a"),n=moment(e.startDate+" "+t.postedEnd,"YYYY-MM-DD h:mm a"),o={postedStart:a.format("YYYY-MM-DD HH:mm:ss"),postedEnd:n.format("YYYY-MM-DD HH:mm:ss")},e.shifts[0].postedStart=a.format("h:mm a"),e.shifts[0].postedEnd=n.format("h:mm a"),Template7.global.jobsPostedData&&(Template7.global.jobsPostedData.jobInfo=Template7.global.jobsPostedData.jobInfo.map((function(t){return t.id==e.id?(t.shifts[0].postedStart=a.format("h:mm a"),t.shifts[0].postedEnd=n.format("h:mm a"),t.status==TempStars.JOB_STATUSES.PARTIAL&&(t.status=TempStars.JOB_STATUSES.POSTED,t.jobStatusName="Unfilled",t.statusMark="calendar-unfilled.svg"),t):t})));TempStars.Api.modifyJob(e.id,o).then((function(){app.hidePreloader(),window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),e.status===TempStars.JOB_STATUSES.CONFIRMED?TempStars.App.goReact("dentistJobConfirmed",{id:e.id}):TempStars.Dentist.Router.goBackPage("job-posted",{id:e.id})})).catch((function(e){app.hidePreloader(),app.alert("Error modifying shift. Please try again.")}))}(t)}))}(o)}return{init:function(){app.onPageBeforeInit("dentist-modify-job",(function(a){(e=a.context).postedStart=e.shifts[0].postedStart,e.postedEnd=e.shifts[0].postedEnd,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),$$("#dentist-modify-job-starttime").val(e.postedStart),$$("#dentist-modify-job-endtime").val(e.postedEnd),$$("#dentist-modify-job-button").on("click",o),$$(".dentist-modify-job-back").on("click",t)})),app.onPageBeforeRemove("dentist-modify-job",(function(e){$$("#dentist-modify-job-button").off("click",o),$$(".dentist-modify-job-back").off("click",t)}))},getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.ModifyJob.init(),TempStars.Pages.Dentist.PaymentInfo=function(){var e,t;let o,a,n,i,s,r,c=!1;function l(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),"dentist-job-partial"===n.name?TempStars.Dentist.Router.goBackPage("",{locationId:t}):(e||(e="home"),TempStars.Dentist.Router.goForwardPage(e,{nohistory:!0}))}const d=e=>{const o=getCardDeclineStatus(e?.code);TempStars.Api.updateCardStatus({locationId:parseInt(t),isCardValid:o});const{cardStatus:a,statusColor:n}=getCardStatus(o);$$("#cardStatus").html(a).attr("style",`color: ${n};`),app.hidePreloader();const i=e.message||"Re-validating error";app.modal({title:"<b>Error</b>",text:i,buttons:[{text:"OK",bold:!0}]})},p=async()=>{app.showPreloader("Re-validating card");try{if(!i)return app.hidePreloader(),app.modal({title:"<b>Error</b>",text:"Have no old card",buttons:[{text:"OK",bold:!0}]});const a=await TempStars.Api.revalidateCard(r.location.stripeCustomerId,r.location.country),{error:c}=await o.confirmCardSetup(a.client_secret,{payment_method:s.id});if(c)return d(c);await TempStars.Api.updatePaymentInfo(t),r.location=await TempStars.Api.getLocationById(t);const{cardStatus:l}=getCardStatus(r.location.isCardValid);app.hidePreloader(),app.modal({title:"<b>Completed</b>",text:`Re-validating complete with card status: ${l}.`,buttons:[{text:"OK",bold:!0,onClick:function(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),"dentist-job-partial"===n.name?TempStars.Dentist.Router.goBackPage("",{locationId:t}):(e||(e="home"),TempStars.Dentist.Router.goForwardPage(e,{nohistory:!0}))}}]})}catch(e){d(e)}};async function m(i){if(c)try{app.showPreloader("Saving Payment Info");const i=await TempStars.Api.createSetupIntent(t),{setupIntent:s,error:r}=await o.confirmCardSetup(i.client_secret,{payment_method:{card:a}});if(r)throw r;await TempStars.Api.updatePaymentInfo(t),TempStars.Analytics.track("add payment info"),await TempStars.User.refresh(),app.hidePreloader(),app.modal({title:"<b>SUCCESS</b>",text:"Payment method was successfully updated.",buttons:[{text:"OK",bold:!0,onClick:function(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),"dentist-job-partial"===n.name?TempStars.Dentist.Router.goBackPage("",{locationId:t}):(e||(e="home"),TempStars.Dentist.Router.goForwardPage(e,{nohistory:!0}))}}]})}catch(e){app.hidePreloader(),e&&e.message?app.alert(e.message):app.alert("There was an error adding your payment information.  Please try again or contact "+TempStars.Config.US.helpEmail+" for assistance.")}}function u(e){var t=e.keyCode?e.keyCode:e.which;if(13==t||10==t)return window.Keyboard.hide(),$$("#dentist-payment-info-done-button").trigger("click"),!1}return{init:function(){app.onPageInit("dentist-payment-info",(function(e){if(o=Stripe(TempStars.StripePubKey),a=o.elements().create("card"),n=e.fromPage,r=e.context,s=e.context?.paymentMethod,i=e.context?.paymentMethod?.card,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),$$("#dentist-payment-info-done-button").on("click",m),$$("#dentist-re-validate-card-button").on("click",p),$$("#dentist-payment-info-form input").on("keypress",u),$$("#location-payment-info-back").on("click",l),s&&i){const{cardStatus:e,statusColor:t}=getCardStatus(r.location.isCardValid);$$("#cardStatus").html(e).attr("style",`color: ${t};`),$$("#cardInfo").html("**** **** **** "+i.last4+", "+i.exp_month+"/"+i.exp_year+"  ").attr("style","font-weight: bold")}else $$("#dentist-re-validate-card-button").attr("style","display: none"),$$("#dentist-re-validate-card-button").addClass("disabled disabled_button");mainView.showNavbar(),a.mount("#payment-element"),a.on("change",(({error:e,complete:t})=>{$$("#error").html(e?e.message:""),c=!e||t}))})),app.onPageBeforeRemove("dentist-payment-info",(function(e){$$("#dentist-payment-info-done-button").off("click",m),$$("#dentist-payment-info-form input").off("keypress",u),$$("#location-payment-info-back").off("click",l),a.unmount()})),app.onPageBeforeAnimation("dentist-payment-info",(function(e){mainView.showNavbar()}))},getData:async function(o){e=o.nextPage;let a={},n={};try{return n=await TempStars.Api.getLocationById(o.locationId),t=o.locationId,n.stripeCustomerId&&(a=await TempStars.Api.getDefaultSource(n.stripeCustomerId,n.country)),Promise.resolve({paymentMethod:a,location:n})}catch(e){return Promise.resolve({location:n})}}}}(),TempStars.Pages.Dentist.PaymentInfo.init(),TempStars.Pages.Dentist.PrivacyPolicy=function(){"use strict";return{getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.React=function(){"use strict";return{init:function(){app.onPageInit("react",(function(){$$("#react").find("script").each((function(e){var t=document.createElement("script");$$(this).attr("src")?t.src=$$(this).attr("src"):t.innerHTML=$$(this).text(),$$("head").append(t)}))}))},getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.React.init(),TempStars.Dentist.Router=function(){"use strict";var e;return{init:function(){e=new TempStars.Router("dentist")},goForwardPage:function(t,o,a){e.goForwardPage(t,o,a)},goBackPage:function(t,o,a){e.goBackPage(t,o,a)},reloadPage:function(t,o,a){e.reloadPage(t,o,a)}}}(),TempStars.Dentist.Router.init(),TempStars.Pages.Dentist.Support=function(){"use strict";function e(){TempStars.Dentist.Router.goForwardPage("contact-support")}const t=e=>{e.preventDefault(),window.Cordova?cordova.InAppBrowser.open(`https://${e.target.innerText}/`,"_system","location=yes"):window.open(`https://${e.target.innerText}/`,"_blank","location=yes")};return{init:function(){app.onPageBeforeInit("dentist-support",(function(o){$$(".support-center-button").on("click",e),$$("#support-privacy-link").on("click",t),$$("#support-terms-link").on("click",t),$$("#support-affiliate-link").on("click",t)})),app.onPageBeforeRemove("dentist-support",(function(o){$$(".support-center-button").off("click",e),$$("#support-privacy-link").off("click",t),$$("#support-terms-link").off("click",t),$$("#support-affiliate-link").off("click",t)}))},getData:function(){return Promise.resolve({isBrowser:!window.cordova,version:TempStars.version,platform:device.platform,platformVersion:device.version,manufacturer:device.manufacturer,model:device.model})}}}(),TempStars.Pages.Dentist.Support.init(),TempStars.Pages.Dentist.Survey=function(){"use strict";var e,t;function o(){for(var o=app.formToJSON(t),a=e.surveyId?e.surveyId:Number($$(t).attr("data-id")),n=[],i=Object.keys(o),s=0;s<i.length;s++)if(o.hasOwnProperty(i[s])){var r=o[i[s]];_.isArray(r)&&(r=r.join(", ")),n.push([i[s],r])}$$("#survey-social-media-other").val()&&$$("#survey-social-media-other").val().length&&n.push(["Where are you most active on Social Media?",$$("#survey-social-media-other").val()]);var c={answers:n,promotionId:a?Number(a):void 0};TempStars.Api.saveSurveyAnswer(a,c).then((function(){TempStars.User.getCurrentUser().dentistId?TempStars.Dentist.Router.goBackPage("home",{completedSurveyId:a}):TempStars.Hygienist.Router.goBackPage("home",{completedSurveyId:a})}))}return{init:function(){app.onPageBeforeInit("survey",(function(a){app.hidePreloader(),e=a.context,Number(e.surveyId)===TempStars.SURVEYS.DISENGAGED_DENTIST?($$("#engaged-users").hide(),t="#disengaged-dentist"):($$("#disengaged-dentist").hide(),t="#engaged-users"),$$("#survey-submit-btn").on("click",o)})),app.onPageBeforeRemove("survey",(function(){$$("#survey-submit-btn").on("click",o)}))},getData:function(e){return e.surveyId?Promise.resolve({surveyId:e.surveyId}):Promise.resolve()}}}(),TempStars.Pages.Dentist.Survey.init(),TempStars.Pages.Dentist.TermsOfService=function(){"use strict";return{getData:function(){return Promise.resolve({})}}}(),TempStars.Pages.Dentist.UpdateInformation=function(){"use strict";var e;function t(t){var o=app.formToJSON("#dentist-update-form");TempStars.User.getCurrentUser().dentist;$$("#dentist-update-form .form-error-msg").html(""),$$("#dentist-update-form .field-error-msg").removeClass("error").html("");var a=validate(o,{primaryContact:{presence:{allowEmpty:!1}},parking:{presence:{message:"is required"}},radiography:{presence:{message:"is required"}},ultrasonic:{presence:{message:"is required"}},avgApptTime:{presence:{message:"is required"}},charting:{presence:{message:"is required"}},software:{presence:{message:"is required"}}});if(console.log(a),a)return a.primaryContact&&$$('#dentist-update-form input[name="primaryContact"]').addClass("error").next().html(a.primaryContact[0]),a.parking&&$$('#dentist-update-form select[name="parking"]').addClass("error").next().html(a.parking[0]),a.radiography&&$$('#dentist-update-form select[name="radiography"]').addClass("error").next().html(a.radiography[0]),a.sterilization&&$$('#dentist-update-form select[name="sterilization"]').addClass("error").next().html(a.sterilization[0]),a.ultrasonic&&$$('#dentist-update-form select[name="ultrasonic"]').addClass("error").next().html(a.ultrasonic[0]),a.avgApptTime&&$$('#dentist-update-form select[name="avgApptTime"]').addClass("error").next().html(a.avgApptTime[0]),a.charting&&$$('#dentist-update-form select[name="charting"]').addClass("error").next().html(a.charting[0]),void(a.software&&$$('#dentist-update-form select[name="software"]').addClass("error").next().html(a.software[0]));app.modal({title:"Save Location",text:"Are you sure?",buttons:[{text:"No"},{text:"Yes",bold:!0,onClick:function(){!function(t){TempStars.User.getCurrentUser().dentist;app.showPreloader("Saving Location"),Promise.resolve().then((function(){return t.isUpdated=1,TempStars.Api.updateLocation(e.id,t)})).then((function(){return TempStars.User.refresh()})).then((function(){app.hidePreloader(),window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.App.gotoStartingPage()})).catch((function(e){app.hidePreloader(),console.error(e),app.alert("Error updating location.  Please try again.")}))}(o)}}]})}function o(){window.cordova&&window.Keyboard.hideFormAccessoryBar(!0),TempStars.Dentist.Router.goBackPage("home")}return{init:function(){app.onPageBeforeInit("update-information",(function(a){e=a.context,window.cordova&&window.Keyboard.hideFormAccessoryBar(!1),$$('#dentist-update-form select[name="parking"]').val(e.parking).change().attr("selected",!0),$$('#dentist-update-form select[name="radiography"]').val(e.radiography).change().attr("selected",!0),$$('#dentist-update-form select[name="ultrasonic"]').val(e.ultrasonic).change().attr("selected",!0),$$('#dentist-update-form select[name="avgApptTime"]').val(e.avgApptTime).change().attr("selected",!0),$$('#dentist-update-form select[name="charting"]').val(e.charting).change().attr("selected",!0),$$('#dentist-update-form select[name="software"]').val(e.software).change().attr("selected",!0),$$("#info-submit-btn").on("click",t),$$("#back").on("click",o)})),app.onPageInit("update-information",(function(e){console.log("inside page")})),app.onPageBeforeRemove("update-information",(function(e){console.log("before page remove")}))},getData:function(e){if(e.location)return Promise.resolve(e.location);var t=TempStars.User.getCurrentUser().locations,o=_.find(t,{id:e.locationId});return Promise.resolve(o)}}}(),TempStars.Pages.Dentist.UpdateInformation.init();