import{r as o,B as s,h as e}from"./p-a89095f5.js";import{C as t}from"./p-687fce60.js";import{s as i}from"./p-9e8ba117.js";import"./p-86bd3473.js";import"./p-d7f93824.js";import"./p-2a0c7fc9.js";import"./p-65879f9e.js";import"./p-60cf0cc2.js";const l=class{constructor(s){o(this,s),this.referring=!1,this.referralId=void 0,this.locationId=void 0,this.token=void 0,this.googleMapsKey=void 0,this.errors=[],this.successful=!1,this.formData={},this.confirmationId=void 0,this.checkmarkEl=void 0}onError(o){"addJob"===o.detail.endpoint&&setTimeout((()=>{this.errors=o.detail.error.response.errors.map((o=>o.message))}),100)}async onSuccess(o){var s,e,t;this.errors=[],"addJob"===o.detail.endpoint&&(await this.formEl.reset(),this.successful=!0,this.confirmationId=null===(t=null===(e=null===(s=null==o?void 0:o.detail)||void 0===s?void 0:s.data)||void 0===e?void 0:e.addJob)||void 0===t?void 0:t.id,setTimeout((()=>{this.checkmarkEl.animating=!0}),500))}componentDidLoad(){(null==s?void 0:s.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,s;return e("ion-card",{class:{successful:this.successful,"ion-padding":!0}},this.errors.map((o=>e("floodteam-error",{message:o}))),e("fireenjin-form",{ref:o=>this.formEl=o,endpoint:"addJob",formData:this.formData,resetButtonColor:"medium",beforeSubmit:this.onBeforeSubmit.bind(this)},e("ion-list",null,e("fireenjin-input",{name:"customer",label:"Customer Name",labelPosition:"stacked",placeholder:"What is the customer's full name?"}),e("fireenjin-input",{type:"tel",inputMode:"tel",labelPosition:"stacked",label:"Customer Phone Number",placeholder:"What is the customer's phone number?",name:"phone"}),e("fireenjin-input",{name:"email",type:"email",labelPosition:"stacked",label:"Customer Email",placeholder:"What is the customer's email address?"}),e("fireenjin-input-address",{googleMapsKey:this.googleMapsKey||(null===(s=null===(o=null==i?void 0:i.config)||void 0===o?void 0:o.firebase)||void 0===s?void 0:s.apiKey),name:"address",label:"Job Address",labelPosition:"stacked",placeholder:"What is the address of the loss?"}))),e("div",{class:"success-message"},e("floodteam-checkmark",{size:"100px",ref:o=>this.checkmarkEl=o}),e("ion-grid",null,e("ion-row",null,e("ion-col",{class:"message-content"},e("ion-label",null,e("h1",null,"Job Added Successfully!"),e("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.'))),e("ion-col",{class:"dashboard-button"},this.referring?e("ion-button",{size:"default",href:`/jobs/${this.confirmationId}`,expand:"block"},"Open Job"):e("div",null,e("b",null,this.confirmationId),e("br",null),e("ion-button",{class:"btn",size:"default",expand:"block","data-clipboard-text":this.confirmationId},"Copy to clipboard",e("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}