1import{j as e}from"./vendor-query-D1Mshrk-.js";import{r as p}from"./vendor-react-BfQMi0FG.js";import{a0 as N,as as f,at as b,w as v,L as d,x as S,I as a,au as L,B as P,t as g}from"./index-D3kn74s7.js";import{P as A}from"./page-header-C7x1KRLA.js";import{C as E,a as F,b as O,d as w}from"./card-C6DfUXn8.js";import"./vendor-ui-nQy3bJlE.js";function D(){const{data:s,isLoading:j}=N(),r=f(),{register:i,handleSubmit:h,reset:u,setValue:l}=b(),[t,m]=p.useState({latitude:null,longitude:null});p.useEffect(()=>{s&&(u({address:s.address??"",city:s.city??"",postCode:s.postCode??""}),m({latitude:s.latitude?Number(s.latitude):null,longitude:s.longitude?Number(s.longitude):null}))},[s,u]);const y=n=>{const o={...Object.fromEntries(Object.entries(n).filter(([,c])=>c!=="")),...t.latitude!=null?{latitude:t.latitude}:{},...t.longitude!=null?{longitude:t.longitude}:{}};r.mutate(o,{onSuccess:()=>g.success("Address updated"),onError:()=>g.error("Failed to update address")})};return j?e.jsx("div",{className:"p-6",children:"Loading..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{title:"Business Address",description:"Manage your business address details"}),e.jsxs(E,{children:[e.jsx(F,{children:e.jsx(O,{children:"Address Details"})}),e.jsx(w,{children:e.jsxs("form",{onSubmit:h(y),className:"space-y-4",children:[e.jsx(v,{onAddressSelect:({address:n,city:x,postCode:o,latitude:c,longitude:C})=>{l("address",n),l("city",x),l("postCode",o),m({latitude:c,longitude:C})}}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"address",children:"Address"}),e.jsx(S,{id:"address",...i("address"),placeholder:"123 High Street",rows:3})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"city",children:"City"}),e.jsx(a,{id:"city",...i("city"),placeholder:"London"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"postCode",children:"Post Code"}),e.jsx(a,{id:"postCode",...i("postCode"),readOnly:!0,className:"bg-muted"})]})]}),(t.latitude!=null||t.longitude!=null)&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border bg-muted/50 px-3 py-2",children:[e.jsx(L,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 flex-1",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs text-muted-foreground",children:"Latitude"}),e.jsx(a,{value:t.latitude??"",readOnly:!0,className:"h-8 bg-transparent text-sm"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs text-muted-foreground",children:"Longitude"}),e.jsx(a,{value:t.longitude??"",readOnly:!0,className:"h-8 bg-transparent text-sm"})]})]})]}),e.jsx(P,{type:"submit",disabled:r.isPending,children:r.isPending?"Saving...":"Save Address"})]})})]})]})}export{D as AddressSettingsPage};
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.