import{r as o,B as e,h as s}from"./p-f8363b1b.js";import{C as t}from"./p-687fce60.js";import{s as i}from"./p-02e053de.js";import"./p-86bd3473.js";import"./p-a93a14c5.js";import"./p-ccb7d102.js";import"./p-5717491f.js";import"./p-60cf0cc2.js";const l=class{constructor(e){o(this,e),this.referring=!1,this.errors=[],this.successful=!1,this.formData={}}onError(o){"addJob"===o.detail.endpoint&&setTimeout((()=>{this.errors=o.detail.error.response.errors.map((o=>o.message))}),100)}async onSuccess(o){var e,s,t;this.errors=[],"addJob"===o.detail.endpoint&&(await this.formEl.reset(),this.successful=!0,this.confirmationId=null===(t=null===(s=null===(e=null==o?void 0:o.detail)||void 0===e?void 0:e.data)||void 0===s?void 0:s.addJob)||void 0===t?void 0:t.id,setTimeout((()=>{this.checkmarkEl.animating=!0}),500))}componentDidLoad(){(null==e?void 0:e.isBrowser)&&(this.formData.token=this.token,this.formData.locationId=this.locationId,this.referring||new t(".btn"))}onBeforeSubmit(o){return{...o,referralId:this.referralId?this.referralId:null}}render(){var o,e;return s("ion-card",{class:{successful:this.successful,"ion-padding":!0}},this.errors.map((o=>s("floodteam-error",{message:o}))),s("fireenjin-form",{ref:o=>this.formEl=o,endpoint:"addJob",formData:this.formData,resetButtonColor:"medium",beforeSubmit:this.onBeforeSubmit.bind(this)},s("ion-list",null,s("fireenjin-input",{name:"customer",label:"Customer Name",labelPosition:"stacked",placeholder:"What is the customer's full name?"}),s("fireenjin-input",{type:"tel",inputMode:"tel",labelPosition:"stacked",label:"Customer Phone Number",placeholder:"What is the customer's phone number?",name:"phone"}),s("fireenjin-input",{name:"email",type:"email",labelPosition:"stacked",label:"Customer Email",placeholder:"What is the customer's email address?"}),s("fireenjin-input-address",{googleMapsKey:this.googleMapsKey||(null===(e=null===(o=null==i?void 0:i.config)||void 0===o?void 0:o.firebase)||void 0===e?void 0:e.apiKey),name:"address",label:"Job Address",labelPosition:"stacked",placeholder:"What is the address of the loss?"}))),s("div",{class:"success-message"},s("floodteam-checkmark",{size:"100px",ref:o=>this.checkmarkEl=o}),s("ion-grid",null,s("ion-row",null,s("ion-col",{class:"message-content"},s("ion-label",null,s("h1",null,"Job Added Successfully!"),s("p",null,this.referring?"Your job was submitted successfully.":'Job was submitted successfully, here is the confirmation number. Use the "Copy to Clipboard" button to copy and paste it into the field on AnswerConnect\'s system.'))),s("ion-col",{class:"dashboard-button"},this.referring?s("ion-button",{size:"default",href:`/jobs/${this.confirmationId}`,expand:"block"},"Open Job"):s("div",null,s("b",null,this.confirmationId),s("br",null),s("ion-button",{class:"btn",size:"default",expand:"block","data-clipboard-text":this.confirmationId},"Copy to clipboard",s("ion-icon",{name:"clipboard",slot:"end"}))))))))}};l.style="floodteam-book-now .success-message{display:block;opacity:0;height:0px;transition:opacity 0.6s ease;transition-delay:1s}floodteam-book-now .successful .success-message{opacity:1;height:auto}floodteam-book-now fireenjin-form{transition:opacity 0.6s ease;opacity:1}floodteam-book-now .successful fireenjin-form{opacity:0;height:0px}floodteam-book-now b{display:block;text-align:center;color:var(--ion-color-secondary)}";export{l as floodteam_book_now}