1import{j as e}from"./vendor-query-nkyHp8gL.js";import{r as m}from"./vendor-react-BNT0nzvx.js";import{D as b}from"./DashboardLayout-BwqfxABs.js";import{C as v}from"./use-admin-DyDskQ2r.js";import{c as f,d as N,e as y,p as x,P as _}from"./use-poi-zones-DmeoiSIQ.js";import{i as C,B as i,Y as w,n as d}from"./index-UlqsakHc.js";import{D as A,b as P,c as D,d as k}from"./dialog-DV4xISIc.js";import{A as T,h as I,a as O,b as S,c as L,d as Z,e as E,f as F,g as B}from"./alert-dialog-Cot7QkN9.js";import{P as H}from"./pencil-DXkSP-oF.js";import{T as R}from"./trash-2-omFn8pi_.js";import{S as Y}from"./save-CCuP_3hI.js";import"./input-otp-zCOwu37W.js";import"./shield-check-D_dnqQxv.js";import"./shield-DMA6z9Kg.js";import"./chevron-right-Cm0QdkHJ.js";import"./eye-Ca0Gb1H3.js";import"./mail-check-B9b1HxOk.js";import"./users-C1fVyj3Z.js";import"./newspaper-DDM9CgLF.js";import"./crown-DVNd9quJ.js";import"./target-nBqdJqET.js";import"./list-CEIXZF2y.js";import"./flag-CwDWn1bT.js";import"./vendor-ui-DPPUfW-O.js";import"./vendor-charts-B_MCcq71.js";import"./vendor-supabase-BRDBMtg7.js";const q={name:"",slug:"",type:"landmark",priority:0,is_active:!0,description:"",center_lat:null,center_lng:null,radius_miles:2,meta_title:"",meta_description:""},ge=()=>{const{data:u,isLoading:p}=v(),[a,g]=m.useState(""),{data:o,isLoading:c}=f(a||void 0),l=N(),h=y(),{toast:n}=C(),[t,r]=m.useState(null),j=async()=>{if(!t?.name||!t?.slug||!a){n({title:"Name, slug and city required",variant:"destructive"});return}try{await l.mutateAsync({...t,city_id:a}),n({title:t.id?"POI zone updated":"POI zone created"}),r(null)}catch(s){n({title:"Error",description:s.message,variant:"destructive"})}};return e.jsxs(b,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h1",{className:"text-xl font-medium text-foreground",children:"POI Zones"}),e.jsxs(i,{size:"sm",onClick:()=>r({...q}),disabled:!a,children:[e.jsx(w,{className:"w-4 h-4 mr-1"})," Add"]})]}),e.jsxs("div",{className:"mb-4 max-w-xs",children:[e.jsx("label",{className:"text-xs font-medium text-foreground block mb-1",children:"Select City"}),p?e.jsx(d,{className:"w-4 h-4 animate-spin"}):e.jsxs("select",{value:a,onChange:s=>g(s.target.value),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm",children:[e.jsx("option",{value:"",children:"â Choose city â"}),(u??[]).map(s=>e.jsxs("option",{value:s.id,children:[s.name,", ",s.state??s.country]},s.id))]})]}),a&&c&&e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(d,{className:"w-5 h-5 animate-spin text-muted-foreground"})}),a&&!c&&e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_100px_80px_60px_60px_80px] gap-3 px-4 py-2.5 bg-secondary/30 border-b border-border text-xs font-medium text-muted-foreground",children:[e.jsx("span",{children:"Name"}),e.jsx("span",{children:"Type"}),e.jsx("span",{children:"Slug"}),e.jsx("span",{children:"Pri"}),e.jsx("span",{children:"Active"}),e.jsx("span",{children:"Actions"})]}),e.jsxs("div",{className:"divide-y divide-border max-h-[500px] overflow-y-auto",children:[(o??[]).length===0&&e.jsx("div",{className:"px-4 py-6 text-sm text-muted-foreground text-center",children:"No POI zones yet."}),(o??[]).map(s=>e.jsxs("div",{className:"grid grid-cols-[1fr_100px_80px_60px_60px_80px] gap-3 px-4 py-2.5 text-sm items-center",children:[e.jsx("span",{className:"text-foreground truncate",children:s.name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:x(s.type)}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:s.slug}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.priority}),e.jsx("span",{className:"text-xs",children:s.is_active?"â":"â"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>r({...s}),children:e.jsx(H,{className:"w-3.5 h-3.5"})}),e.jsxs(T,{children:[e.jsx(I,{asChild:!0,children:e.jsx(i,{variant:"ghost",size:"sm",children:e.jsx(R,{className:"w-3.5 h-3.5 text-destructive"})})}),e.jsxs(O,{children:[e.jsxs(S,{children:[e.jsxs(L,{children:["Delete ",s.name,"?"]}),e.jsx(Z,{children:"This will remove the POI zone."})]}),e.jsxs(E,{children:[e.jsx(F,{children:"Cancel"}),e.jsx(B,{onClick:()=>h.mutateAsync(s.id),children:"Delete"})]})]})]})]})]},s.id))]})]}),e.jsx(A,{open:!!t,onOpenChange:()=>r(null),children:e.jsxs(P,{className:"max-w-md",children:[e.jsx(D,{children:e.jsx(k,{children:t?.id?"
1Edit POI Zone":"Add POI Zone"})}),t&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Name *"}),e.jsx("input",{value:t.name,onChange:s=>r({...t,name:s.target.value}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Slug *"}),e.jsx("input",{value:t.slug,onChange:s=>r({...t,slug:s.target.value}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Type"}),e.jsx("select",{value:t.type,onChange:s=>r({...t,type:s.target.value}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1",children:_.map(s=>e.jsx("option",{value:s,children:x(s)},s))})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Lat"}),e.jsx("input",{type:"number",step:"any",value:t.center_lat??"",onChange:s=>r({...t,center_lat:s.target.value?parseFloat(s.target.value):null}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Lng"}),e.jsx("input",{type:"number",step:"any",value:t.center_lng??"",onChange:s=>r({...t,center_lng:s.target.value?parseFloat(s.target.value):null}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Radius (mi)"}),e.jsx("input",{type:"number",step:"0.1",value:t.radius_miles??2,onChange:s=>r({...t,radius_miles:parseFloat(s.target.value)||2}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Priority"}),e.jsx("input",{type:"number",value:t.priority??0,onChange:s=>r({...t,priority:parseInt(s.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsx("div",{className:"flex items-end pb-1",children:e.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-foreground",children:[e.jsx("input",{type:"checkbox",checked:t.is_active??!0,onChange:s=>r({...t,is_active:s.target.checked})}),"Active"]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Description"}),e.jsx("textarea",{value:t.description??"",onChange:s=>r({...t,description:s.target.value}),rows:2,className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1 resize-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-foreground",children:"Meta Title"}),e.jsx("input",{value:t.meta_title??"",onChange:s=>r({...t,meta_title:s.target.value}),className:"w-full px-3 py-2 rounded-lg border border-border bg-background text-sm mt-1"})]}),e.jsxs(i,{onClick:j,disabled:l.isPending,className:"w-full",children:[l.isPending?e.jsx(d,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(Y,{className:"w-4 h-4 mr-2"})," Save"]})]})]})})]})};export{ge 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.