1import{j as e}from"./ui-CSrc_TbM.js";import{d as s,u as r,h as a,a as i}from"./vendor-FSlF3Q-G.js";import{S as t,B as l,b9 as c,j as n}from"./index-BbnHXA1g.js";import{b as o}from"./forms-CBDowen9.js";import{q as d}from"./questions-BuRML1IK.js";import"./utils-B3Uwl82U.js";import"./maps-Blw1RXHV.js";const m=()=>{const{state:n}=s.useContext(t),m=r(),u=a(),v={user:n.user},{register:h,handleSubmit:p,formState:{isValid:_}}=o({mode:"onChange"});m.state||u("/");const[b,x]=i.useState(d),[j,g]=i.useState(v.user.service_pricing),[f,N]=i.useState(1);let S=f>=b[0].questions?.length/6;const y=e=>{e.preventDefault(),1==f?u("/supplier-profile"):N(f-1)},k=e=>{if(v.user.service_pricing){Object.entries(j).map(e=>{e[0]===m.state&&g(e[1])});for(let s in j)if(s===e)return j[s]}},D=async e=>{if(1==f&&localStorage.setItem("Pricing_Data",JSON.stringify({...e})),localStorage.setItem("Pricing_Data",JSON.stringify({...JSON.parse(localStorage.getItem("Pricing_Data")),...e})),S){let e={},s=JSON.parse(localStorage.getItem("Pricing_Data"));e.service_pricing={[m.state]:s},await c(e,()=>u("/supplier-profile"))}else N(f+1)};return i.useEffect(()=>{n.user?.service_pricing||u("/supplier-profile");let e=[];for(let s=0;s<d.length;s++)d[s].id===m.state&&e.push(d[s]);x(e)},[]),e.jsx(s.Fragment,{children:e.jsx("section",{className:"is-fullheight",children:e.jsx("div",{className:"container",children:e.jsx("div",{className:"columns is-centered",children:e.jsxs("div",{className:"register",children:[e.jsxs("div",{className:"get-started",children:[e.jsx("p",{style:{width:"435px"},children:3==f&&b[0].name3?b[0].name3:b[0].name}),e.jsxs("span",{className:"details",children:[2==f&&b[0].subtext2_name2?b[0].subtext2_name2:b[0].subtext,b[0].hyperlink?e.jsxs("a",{style:{fontWeight:"bolder"},href:b[0].hyperlink.link,target:"_blank",rel:"noopener noreferrer",children:[" ",b[0].hyperlink.text]}):""]}),e.jsx("span",{className:"details",children:b[0].subtext2}),e.jsx("span",{className:"details",children:b[0].subtext3}),e.jsx("span",{className:"details",children:b[0].subtext4})]}),(q=6*(f-1),w=6*f,e.jsxs("form",{className:"form-signup",style:{borderTop:"2px solid #D0D5DD",borderRadius:"12px"},children:[b?b[0].questions?.slice(q,w).map(s=>e.jsxs("div",{className:"field",children:[s.header?e.jsx("div",{className:"form-header bold",children:s.header}):"",e.jsx("div",{className:"form-header",children:s.name}),e.jsx("input",{className:"form-input",name:s.id,type:"number",placeholder:"£",defaultValue:k(s.id),...h(s.id,{required:"This field is required"})})]},s.id)):"","archaeology-survey"===b[0].id?e.jsxs("div",{className:"field",children:[e.jsx("div",{className:"form-header bold mb-3",children:"Travel cost to site and local archive"}),e.jsx("div",{className:"label-3 mb-2",children:"This cost is taken from your travel costs in your supplier profile"}),v.user.service_pricing&&v.user.service_pricing.travel_cost?e.jsxs("div",{children:[e.jsxs("div",{className:"label-2 mb-2",children:["East Midlands - £"," ",v.user.service_pricing.travel_cost.travel_cost_east_midlands]}),e.jsxs("div",{className:"label-2 mb-2",children:["East of England - £ ",v.user.service_pricing.travel_cost.travel_cost_east]}),e.jsxs("div",{className:"label-2 mb-2",children:["Greater London - £"," ",v.user.service_pricing.travel_cost.travel_cost_greater_london]}),e.jsxs("div",{className:"label-2 mb-2",children:["North East - £ ",v.user.service_pricing.travel_cost.travel_cost_north_east]}),e.jsxs("div",{className:"label-2 mb-2",children:["North West - £ ",v.user.service_pricing.travel_cost.travel_cost_north_west]}),e.jsxs("div",{className:"label-2 mb-2",children:["Scotland - £ ",v.user.service_pricing.travel_cost.travel_cost_scotland]}),e.jsxs("div",{className:"label-2 mb-2",children:["South East - £ ",v.user.service_pricing.travel_cost.travel_cost_south_east]}),e.jsxs("div",{className:"label-2 mb-2",children:["South West - £ ",v.user.service_pricing.travel_cost.travel_cost_south_west]}),e.jsxs("div",{className:"label-2 mb-2",children:["Wales - £ ",v.user.service_pricing.travel_cost.travel_cost_wales]}),e.jsxs("div",{className:"label-2 mb-2",children:["West Midlands - £"," ",v.user.service_pricing.travel_cost.travel_cost_west_midlands]}),e.jsxs("div",{className:"label-2 mb-2",children:["Yorkshire and the Humber - £"," ",v.user.service_pricing.travel_cost.travel_cost_yorkshire_humber]})]}):""]}):"",e.jsxs("div",{className:"field",children:[e.jsx(l,{className:"form-input button",disabled:!_,onClick:p(D),type:"submit",label:S?"Submit":"Continue"}),e.jsx("div",{className:"form-input text",children:e.jsx("a",{onClick:y,children:1==f?"Cancel":"Go Back"})})]})]}))]})})})})});var q,w};m.propTypes={user:n.object};export{m as default};
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.