PageSourceSearch

https://dorpdeblesse.nl/assets/admin.villages-8oH4AYIk.js

js dorpdeblesse.nl collected 2026-10-03 18:52:11 UTC 3,588 bytes, 1 lines download raw bytes

1import{l as S,Q as k,D as w,s as i,r,j as e,L as D,t}from"./index-CUjBj9Vf.js";function C(){const{user:f,isSuperAdmin:o,loading:j}=S(),d=k(),y=w({queryKey:["villages-all"],enabled:o,queryFn:async()=>{const{data:s,error:a}=await i.from("villages").select("id,name,slug,custom_domain,status").order("name");if(a)throw a;return s}}),[n,u]=r.useState(""),[l,c]=r.useState(""),[m,p]=r.useState(""),[g,x]=r.useState(!1);if(j)return e.jsx("main",{className:"container-app py-8 text-muted-foreground",children:"Laden…"});if(!f)return e.jsxs("main",{className:"container-app py-8",children:["Log eerst in via ",e.jsx(D,{to:"/profiel",className:"text-primary underline",children:"Profiel"}),"."]});if(!o)return e.jsx("main",{className:"container-app py-8",children:"Alleen super admins hebben toegang."});async function N(s){if(s.preventDefault(),!n||!l)return t.error("Naam en slug zijn verplicht");x(!0);const{error:a}=await i.from("villages").insert({name:n,slug:l.toLowerCase().replace(/[^a-z0-9-]/g,"-"),custom_domain:m||null,status:"active"});if(x(!1),a)return t.error(a.message);t.success("Dorp aangemaakt"),u(""),c(""),p(""),d.invalidateQueries({queryKey:["villages-all"]})}async function v(s,a){const{error:b}=await i.from("villages").update({status:a}).eq("id",s);if(b)return t.error(b.message);t.success("Status bijgewerkt"),d.invalidateQueries({queryKey:["villages-all"]})}const h=y.data??[];return e.jsxs("main",{className:"container-app py-4",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:"Dorpen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Beheer alle dorpen binnen DigiDorp."}),e.jsxs("form",{onSubmit:N,className:"mt-4 space-y-3 rounded-lg border bg-card p-4",children:[e.jsx("h2",{className:"font-semibold",children:"Nieuw dorp"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsx("input",{value:n,onChange:s=>u(s.target.value),placeholder:"Naam (bv. Steggerda)",className:"rounded-md border bg-background p-2 text-sm"}),e.jsx("input",{value:l,onChange:s=>c(s.target.value),placeholder:"Slug (bv. steggerda)",className:"rounded-md border bg-background p-2 text-sm"}),e.jsx("input",{value:m,onChange:s=>p(s.target.value),placeholder:"Custom domain (optioneel)",className:"rounded-md border bg-background p-2 text-sm"})]}),e.jsx("button",{disabled:g,type:"submit",className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:g?"Aanmaken…":"Dorp aanmaken"})]}),e.jsxs("ul",{className:"mt-6 space-y-3",children:[h.map(s=>e.jsxs("li",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["slug: ",e.jsx("code",{children:s.slug})]}),s.custom_domain&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["domein: ",s.custom_domain]})]}),e.jsxs("select",{value:s.status,onChange:a=>v(s.id,a.target.value),className:"rounded-md border bg-background p-1.5 text-xs",children:[e.jsx("option",{value:"active",children:"active"}),e.jsx("option",{value:"setup",children:"setup"}),e.jsx("option",{value:"suspended",children:"suspended"})]})]}),e.jsx("a",{href:`/?village=${s.slug}`,className:"mt-2 inline-block text-xs text-primary underline",children:"Open dit dorp →"})]},s.id)),h.length===0&&e.jsx("li",{className:"text-sm text-muted-foreground",children:"Geen dorpen gevonden."})]})]})}export{C as component};

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.