import{r as o,B as e,h as s}from"./p-03169580.js";import{C as t}from"./p-f9010236.js";import{s as i}from"./p-ac5f2e11.js";import"./p-bd8b186e.js";import"./p-59c95c5f.js";import"./p-c9699503.js";import"./p-795b799a.js";import"./p-3a8e6af1.js";const l="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)}";let n=class{constructor(e){o(this,e);this.referring=false;this.errors=[];this.successful=false;this.formData={}}onError(o){if(o.detail.endpoint==="addJob"){setTimeout((()=>{this.errors=o.detail.error.response.errors.map((o=>o.message))}),100)}}async onSuccess(o){var e,s,t;this.errors=[];if(o.detail.endpoint==="addJob"){await this.formEl.reset();this.successful=true;this.confirmationId=(t=(s=(e=o===null||o===void 0?void 0:o.detail)===null||e===void 0?void 0:e.data)===null||s===void 0?void 0:s.addJob)===null||t===void 0?void 0:t.id;setTimeout((()=>{this.checkmarkEl.animating=true}),500)}}componentDidLoad(){if(!(e===null||e===void 0?void 0:e.isBrowser))return;this.formData.token=this.token;this.formData.locationId=this.locationId;if(!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":true}},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||((e=(o=i===null||i===void 0?void 0:i.config)===null||o===void 0?void 0:o.firebase)===null||e===void 0?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!"),!this.referring?s("p",null,'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("p",null,"Your job was submitted successfully."))),s("ion-col",{class:"dashboard-button"},!this.referring?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"}))):s("ion-button",{size:"default",onClick:()=>window?window.location.reload():null,expand:"block"},"Add Another"))))))}};n.style=l;export{n as floodteam_book_now};
//# sourceMappingURL=p-878a3f6e.entry.js.map