1import{_ as z}from"./preload-helper-473bca6c.js";import{a as r,j as e,F as U}from"./index-de35e332.js";import{u as Q}from"./formik.esm-f321587a.js";import{a as A,r as h}from"./index-e1051c21.js";import{S as b}from"./react-select.esm-53ab0089.js";import{a as x}from"./index-fabe74d7.js";import{_ as O}from"./index-dd1efaef.js";import{l as K}from"./loadable.esm-9d70c066.js";import{e as Z}from"./index-7338b9ad.js";import{I as ee}from"./index-c7c79bce.js";import{b as L,c as g,s as ae,d as F,g as I,e as le,f as P}from"./Calculator-24b439a2.js";import{U as te}from"./UploadImages-3ae2724b.js";import{G as re}from"./GooglePlaces-c0e85ed2.js";import{d as w}from"./dayjs-2870b59b.js";const j="ADD_NEW_TAB",M="SET_CURENT_TAB",H="UPDATE_FORM_FIELD",V="COUNT_CURRENT_PRICE",$="SET_TOTAL",B="SET_URGENCY_INSTALLATION",Y="SET_SURVEY",W="SET_STATE";console.log("second feature");const J=L.survey.map(a=>({value:a.name,label:a.name}));function ne({handleChange:a,currentTab:t}){return r("div",{className:"row",style:{marginTop:25},children:[r("div",{className:"form-group col-md-4",children:[e("label",{children:"Service"}),e(b,{styles:g,isSearchable:!1,className:"reselect2-order",options:J,onChange:l=>{a("currentService",l)},value:t.currentService})]}),r("div",{className:"form-group col-md-4",children:[e("label",{children:"Width*:"}),e("input",{className:"form-control",value:t.width,type:"number",onChange:({target:l})=>a("width",l.value),min:1})]}),r("div",{className:"form-group col-md-4",children:[e("label",{children:"Height*:"}),e("input",{className:"form-control",value:t.height,type:"number",onChange:({target:l})=>a("height",l.value),min:1})]}),r("div",{className:"form-group col-md-12",children:[e("label",{children:"Comment:"}),e("textarea",{className:"form-control",rows:5})]})]})}console.log("some feature 0");function oe({handleChange:a,currentTab:t}){return r("div",{className:"row",style:{marginTop:25},children:[r("div",{className:"form-group col-md-6",children:[e("label",{children:"Service Type"}),e(b,{styles:g,isSearchable:!1,className:"reselect2-order",options:ae,onChange:l=>{a("currentServiceType",l)},value:t.currentServiceType})]}),e("div",{className:"form-group col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Material Type"}),e(b,{isSearchable:!1,options:F[t.currentServiceType?.value?t.currentServiceType.value:"Adhesive Vinyl"],className:"reselect2-order",styles:g,onChange:l=>a("currentService",l),value:t.currentService})]})}),r("div",{className:"form-group col-md-4",children:[e("label",{children:"Width*:"}),e("input",{className:"form-control",value:t.width,type:"number",onChange:({target:l})=>a("width",l.value),min:1})]}),r("div",{className:"form-group col-md-4",children:[e("label",{children:"Height*:"}),e("input",{className:"form-control",value:t.height,type:"number",onChange:({target:l})=>a("height",l.value),min:1})]}),r("div",{className:"form-group col-md-4",children:[e("label",{children:"Quantity*:"}),e("input",{className:"form-control",value:t.quantity,type:"number",onChange:({target:l})=>a("quantity",l.value),min:1})]}),r("div",{className:"form-group col-md-6",children:[e("label",{children:"Total Elevation*:"}),L.height.map(({title:l,price:i,img:n,width:d})=>r("div",{className:"form-check display-flex v-center",style:D.labelCheckContainer,onClick:s=>a("ftHeight",{title:l,price:i}),children:[e("input",{className:"form-check-input",type:"radio",value:t.ftHeight.price,checked:t.ftHeight.title===l,style:{marginTop:0}}),r("label",{className:"form-check-label",style:D.labelCheck,children:[l,e("img",{src:n,style:{width:d},alt:l})]})]},l))]}),r("div",{className:"form-group col-md-6",children:[e("label",{style:{color:"#ED0598"},children:"Additional services"}),r("div",{className:"form-group",children:[e("input",{onClick:()=>a("installation",!t.installation),type:"checkbox",checked:t.installation}),e("label",{style:{marginLeft:15},onClick:()=>a("installation",!t.installation),children:"Installation"})]}),r("div",{className:"form-group",children:[e("input",{type:"checkbox",onClick:()=>a("removal",!t.removal),checked:t.removal}),e("label",{style:{marginLeft:15},onClick:()=>a("removal",!t.removal),children:"Removal"})]}),r("div",{style:{marginTop:30},children:[e("h2",{children:"Price in current tab"}),r("p",{children:["Total Per Item -"," ",t.totalPerItem.toLocaleStr
1ing()," $"]}),r("p",{children:["Total Per SQ/FT -"," ",t.totalPerSqFt.toLocaleString()," $"]}),r("h3",{children:["Subtotal: ",t.total.toLocaleString()," $"]})]})]})]})}const D={labelCheck:{width:"90%",marginLeft:15,display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:0},labelCheckContainer:{display:"flex",alignItems:"center",marginBottom:20}};function se({dispatch:a,state:t}){const{currentTab:l,tabs:i}=t,n=i[l];A.useEffect(()=>{a({type:V})},[n.width,n.height,n.quantity,n.currentService,n.ftHeight,n.installation,n.removal]);const d=(s,p)=>{a({type:H,payload:{field:s,value:p}})};return e(U,{children:n.type==="CUSTOM"?e(ne,{handleChange:d,currentTab:n}):e(oe,{handleChange:d,currentTab:n,dispatch:a})})}let ie={...I(),currentService:J[0],type:"CUSTOM",name:"Survey",comment:"",total:250};const R={currentTab:0,tabs:[{...I(),type:"SERVICE"}],additional:{urgencyInstsllstion:0,survey:0},state:"NY",total:0,tax:0},ce=(a,t)=>{switch(t.type){case j:return{...a,tabs:[...a.tabs,t.serviceType==="CUSTOM"?ie:{...I(),type:t.serviceType}]};case M:return{...a,currentTab:t.currentTab};case H:return{...a,tabs:a.tabs.map((l,i)=>{if(i===a.currentTab){if(t.payload.field=="currentServiceType"){const n=t.payload.value;return{...l,currentServiceType:n,currentService:F[n.value][0]}}return{...l,[t.payload.field]:t.payload.value}}return l})};case V:return{...a,tabs:a.tabs.map((l,i)=>{if(a.currentTab===i){const n=le(l);return{...l,...n}}return l})};case $:return{...a,total:t.total,tax:t.total*(a.state==="NY"?1.0875:1.0825)};case B:return{...a,additional:{...a.additional,urgencyInstsllstion:t.urgencyInstsllstion}};case Y:return{...a,additional:{...a.additional,survey:a.additional.survey>0?0:250}};case W:return{...a,state:t.state};default:return a}};function de({setCurrentTab:a,addTab:t,currentTab:l,tabs:i}){return r("ul",{className:"nav nav-pills",children:[i.map((n,d)=>e("li",{className:"nav-item",onClick:()=>a(d),style:{marginLeft:10},children:e("a",{className:`nav-link ${d===l?"active":"tab-not-activated"}`,children:(n.type==="SERVICE"||n.type===void 0)&&n.currentService.label})})),e("li",{class:"nav-item",onClick:()=>t(),children:e("a",{class:"nav-link",children:"Add new service"})})]})}function me({state:a,dispatch:t}){const l=()=>{const d=a.tabs.reduce((s,p)=>s+p.total,0);t({type:B,urgencyInstsllstion:a.additional.urgencyInstsllstion>0?0:P(d)*.2})},i=()=>{t({type:Y})},n=d=>{t({type:W,state:d})};return r("div",{className:"footer-calculator",children:[e("hr",{}),r("div",{onClick:()=>l(),children:[e("input",{type:"checkbox",checked:a.additional.urgencyInstsllstion>0}),e("label",{style:{marginLeft:10,fontWeight:"bold",color:"rgb(237, 5, 152)"},children:"ð¥ Urgency Installation"})]}),r("div",{onClick:()=>i(),children:[e("input",{type:"checkbox",checked:a.additional.survey>0}),e("label",{style:{marginLeft:10,fontWeight:"bold",color:"rgb(237, 5, 152)"},children:"Survey"})]}),r("h3",{children:["Total: ",a.total.toFixed(2).toLocaleString()," $"]}),r("h3",{children:["Total with tax: ",a.tax.toFixed(2).toLocaleString()," $"]}),r("p",{style:{display:"flex"},children:[r("div",{class:"form-check",children:[e("input",{class:"form-check-input",type:"radio",name:"flexRadioDefault",id:"flexRadioDefault1",checked:a.state==="NY",onChange:()=>n("NY")}),e("label",{class:"form-check-label",for:"flexRadioDefault1",style:{fontSize:"12px",paddingLeft:"3px"},children:"New York"})]}),r("div",{class:"form-check",style:{marginLeft:15},children:[e("input",{class:"form-check-input",type:"radio",name:"flexRadioDefault",id:"flexRadioDefault2",onChange:()=>n("TX"),checked:a.state==="TX"}),e("label",{class:"form-check-label",for:"flexRadioDefault2",style:{fontSize:"12px",paddingLeft:"3px"},children:"Austin, TX"})]})]})]})}function ue({initialState:a,onChange:t}){const[l,i]=h.useReducer(ce,a?{...R,...a}:R);return h.useEffect(()=>{t(l)},[l]),h.useEffect(()=>{const{additional:s,tabs:p}=l,T=p.reduce((N,C)=>N+C.total,0);i({type:$,total:P(T)+s.urgencyInstsllstion+s.survey})},[l.tabs,l.additional,l.state]),r("div",{className:"backend-calculator-container",children:[e(de,{setCurrentTab:s=>{i({type:M,currentTab:s})},addTab:(s="SERVICE")=>{i({type:j,serviceType:s})},tabs:l.tabs,currentTab:l.currentTab}),l.tabs.map((s,p)=>l.currentTab===p&&h.createElement(se,{dispatch:i,state:l,key:p})),e(me,{state:l,dispatch:i})]})}const pe=h.memo(ue);K(()=>z(()=>import("./Calculator-24b439a2.js").then(a=>a.C),["assets/Calculator-24b439a2.js","assets/index-de35e332.js","assets/index-e1051c21.js","assets/_commonjsHelpers-23102255.js","assets/formik.esm-f321587a.js","assets/hoist-non-react-statics.cjs-3a2ffffa.js","assets/array-9964d6c8.js","assets/react-select.esm-53ab0089.js","assets/objectWithoutPropertiesLoose-bff13baa.js"]));const he=document.head.querySelector("[name~=csrf-token][content]").content,_=[{value:"pending",label:"Pending â³"},{value:"approved",label:"Approved ðð»"},{value:"cancled",label:"Cancled â"},{value:"on the way",label:"On the way â
"},{value:"in process",label:"In process â
"},{value:"last step to complete",label:"Last step to complete â
"},{value:"done",label:"Done â³"},{value:"completed",label:"Completed â
"},{value:"we are hit a traffic on the way",label:"We are hit a traffic on the way ð¥"},{value:"material is not there",label:"Material is not there ð«"},{value:"can not access to start the job",label:"Can not access to start the job ð"},{value:"we received wrong job information",label:"We received wrong job information ð«"},{value:"refunded",label:"Refunded ð"}];
1function fe({order:a,installers:t}){const[l,i]=h.useState(!1),[n,d]=h.useState(!1);h.useState(!1);const s=JSON.parse(a),[p,T]=h.useState([]),[N,C]=h.useState({label:s.address}),{values:m,setFieldValue:f,handleSubmit:q,handleChange:k}=Q({initialValues:{calculatedData:JSON.parse(s.details),status:_.find(o=>s.status===o.value),date:w(s.date).toDate(),notes:s.notes,address:s.address,installers:[],installer_notes:s.installer_notes,uuid:s.uuid,sendNotification:s.recive_notifaction,images:[]},onSubmit:async o=>{const c=new FormData,{tabs:S,additional:v,state:E}=o.calculatedData;if(c.append("details",JSON.stringify({services:S,additional:v,state:E})),c.delete("images[]"),c.delete("installers"),c.append("status",o.status.value),c.append("notes",o.notes),c.append("notify",o.sendNotification),c.append("installer_notes",o.installer_notes),c.append("uuid",o.uuid),c.append("address",N.label),c.append("notify",Number(o.sendNotification)),c.append("date",w(o.date).toJSON()),c.append("_method","put"),o.installers.length>0){const u=o.installers.map(y=>y.value);c.append("installers",JSON.stringify(u))}o.images&&Array.from(o.images).forEach(u=>{c.append("images[]",u)});try{const u=await fetch(`/admin/orders/${s.id}`,{method:"POST",body:c,headers:{"X-CSRF-Token":he,Accept:"application/json"}}),y=await u.json();u.ok?d(y.ok):i(!0)}catch{console.log("errorrrr")}}}),G=()=>{f("sendNotification",!m.sendNotification)};A.useEffect(()=>{x.get("/admin/installers").then(({data:o})=>{const c=o.map(v=>({value:v.id,label:v.name}));T(c);const S=JSON.parse(t);if(S.length>0){const v=S.map(E=>{const u=o.find(y=>y.id===E.id);if(u)return{value:u.id,label:u.name}});f("installers",v)}})},[]);const X=()=>{x.post(`/admin/dashboard/orders/refund/${s.id}`).then(({data:o})=>{o.ok&&location.reload()})};return r(U,{children:[e("form",{children:r("div",{className:"container-fluid",children:[r("div",{className:"row",children:[e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Order Status"}),e(b,{isSearchable:!1,options:_,styles:g,className:"reselect2-order",onChange:o=>{f("status",o)},value:m.status})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Date"}),e("div",{children:e(Z,{className:"form-control",selected:m.date,onChange:o=>f("date",o),showTimeSelect:!0,timeFormat:"HH:mm",dateFormat:"dd/MM/yyyy HH:mm",customInput:e(ee,{className:"form-control",mask:"99/99/9999 99:99"})})})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Notes"}),e("textarea",{name:"notes",value:m.notes,onChange:k,className:"form-control",rows:"4",children:" "})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Notes for installer"}),e("textarea",{name:"installer_notes",value:m?.installer_notes,onChange:k,className:"form-control",rows:"4",children:" "})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Address"}),e(re,{address:N,setAddress:C})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"Installers"}),e(b,{styles:g,isMulti:!0,options:p,onChange:o=>{f("installers",o)},value:m.installers})]})}),e("div",{className:"col-md-6",children:r("div",{className:"form-group",children:[e("label",{children:"UUID"}),e("input",{name:"uuid",value:m.uuid,onChange:k,className:"form-control",rows:"4"})]})}),["done","completed"].includes(m.status.value)&&e("div",{className:"col-md-12",children:e(te,{orderId:s.id,disableEditing:m.status.value==="completed"})})]}),e("hr",{}),e("div",{className:"col-md-12",children:e(pe,{onChange:o=>f("calculatedData",o),initialState:{tabs:m.calculatedData.services,additional:m.calculatedData.additional,total:m.calculatedData.total,state:m.calculatedData.state}})}),e("div",{className:"col-md-12",style:{marginTop:25},children:r("div",{class:"form-check",onClick:G,children:[e("input",{class:"form-check-input",type:"checkbox",checked:m.sendNotification,id:"flexCheckDefault"}),e("label",{class:"form-check-label",for:"flexCheckDefault",children:"Send notification ð"})]})}),r("div",{className:"col-md-12",children:[e("a",{className:"btn btn-primary",style:{marginBottom:15,marginTop:15},onClick:X,children:"Refund"}),m.status.value==="refunded"&&e("p",{style:{color:"red"},children:"Order all ready refunded"})]})]})}),e("div",{className:"card-footer",children:e("button",{type:"submit",className:"btn btn-primary",onClick:q,children:"Update an order"})}),n&&e(O,{success:!0,title:"Order updated",timeout:2e3,onConfirm:()=>{d(!1)},children:"Updated"}),l&&e(O,{error:!0,title:"Error while creating order",onConfirm:()=>{i(!1)},children:"Update order"})]})}const we=Object.freeze(Object.defineProperty({__proto__:null,default:fe,orderStatusList:_},Symbol.toStringTag,{value:"Module"}));
1export{pe as S,we as U,_ as o};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.