PageSourceSearch

https://aabaf1885.dk/assets/DameklubbenContentManager-Cz7J9GQ6.js

js aabaf1885.dk collected 2026-10-02 20:36:12 UTC 7,986 bytes, 1 lines download raw bytes

1import{_ as J,W as I,r as l,j as e,s as i}from"./index-OsPsciba.js";import{B as r}from"./button-CDesNA_Z.js";import{I as d}from"./input-C7U2fQl7.js";import{C,a as _}from"./card-W7vTnNqZ.js";import{D as M,a as T,b as E,c as B}from"./dialog-CLrmZ69y.js";import{T as Q,a as X,b as w,c as k}from"./tabs-CBn9BMSn.js";import{S as Y}from"./switch-1o_pQJwG.js";import{R as Z}from"./RichTextEditor-CBVg6pBq.js";import{S as $}from"./shield-CD4q4DnK.js";import{P as F}from"./plus-CrpTp1-F.js";import{P as R}from"./pencil-COlGHk_H.js";import{T as z}from"./trash-2-CiYxxQis.js";import{U as ee}from"./users-CnuNA7MS.js";import{S as se}from"./settings-DhwTLrLr.js";import"./index-CA0jfUh-.js";import"./index-D1CWbAMb.js";import"./list-ordered-DaBRqtz3.js";import"./quote-Bo1aAJSG.js";import"./image-BnSE21eh.js";function te({group:h}){const{toast:g}=I(),[c,o]=l.useState(!1),[f,p]=l.useState(!0);l.useEffect(()=>{(async()=>{const{data:t}=await i.from("subgroup_settings").select("membership_enabled").eq("group",h).maybeSingle();o((t==null?void 0:t.membership_enabled)??!1),p(!1)})()},[h]);const b=async t=>{o(t);const{error:x}=await i.from("subgroup_settings").upsert({group:h,membership_enabled:t},{onConflict:"group"});x?(g({title:"Fejl",description:x.message,variant:"destructive"}),o(!t)):g({title:t?"Bliv medlem aktiveret":"Bliv medlem skjult"})};return e.jsx(C,{children:e.jsx(_,{className:"py-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-heading text-sm flex items-center gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-primary"})," Bliv medlem"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Når aktiveret vises en "Bliv medlem"-knap på foreningens forside. Skjult som standard.'})]}),e.jsx(Y,{checked:c,onCheckedChange:b,disabled:f})]})})})}function ye(){const{isSuperAdmin:h,isDameklubAdmin:g}=J(),{toast:c}=I(),o=h||g,[f,p]=l.useState([]),[b,t]=l.useState(!1),[x,S]=l.useState(null),[n,u]=l.useState({title:"",slug:"",content:""}),[P,q]=l.useState([]),[A,j]=l.useState(!1),[v,D]=l.useState(null),[a,m]=l.useState({name:"",role:"",email:"",phone:"",ph
1oto_url:""}),N=async()=>{const{data:s}=await i.from("dameklub_pages").select("*").order("sort_order");p(s||[])},y=async()=>{const{data:s}=await i.from("dameklub_board_members").select("*").order("sort_order");q(s||[])};if(l.useEffect(()=>{o&&(N(),y())},[o]),!o)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[e.jsx($,{className:"w-12 h-12 text-destructive mb-4"}),e.jsx("h1",{className:"font-heading text-xl mb-2",children:"Ingen adgang"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Du har ikke tilladelse til denne side."})]});const L=s=>{S(s),u({title:s.title,slug:s.slug,content:s.content||""}),t(!0)},U=()=>{S(null),u({title:"",slug:"",content:""}),t(!0)},G=async()=>{const s=n.slug||n.title.toLowerCase().replace(/[^a-z0-9]+/g,"-");x?await i.from("dameklub_pages").update({...n,slug:s}).eq("id",x.id):await i.from("dameklub_pages").insert({...n,slug:s}),c({title:"Side gemt"}),t(!1),N()},O=async s=>{confirm("Slet denne side?")&&(await i.from("dameklub_pages").delete().eq("id",s),c({title:"Side slettet"}),N())},H=s=>{D(s),m({name:s.name,role:s.role,email:s.email||"",phone:s.phone||"",photo_url:s.photo_url||""}),j(!0)},K=()=>
1{D(null),m({name:"",role:"",email:"",phone:"",photo_url:""}),j(!0)},V=async()=>{v?await i.from("dameklub_board_members").update(a).eq("id",v.id):await i.from("dameklub_board_members").insert({...a,sort_order:P.length}),c({title:"Bestyrelsesmedlem gemt"}),j(!1),y()},W=async s=>{confirm("Slet dette medlem?")&&(await i.from("dameklub_board_members").delete().eq("id",s),c({title:"Medlem slettet"}),y())};return e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-2xl mb-6",children:"Dameklubben – Indhold"}),e.jsxs(Q,{defaultValue:"pages",children:[e.jsxs(X,{children:[e.jsx(w,{value:"pages",children:"Sider"}),e.jsx(w,{value:"board",children:"Bestyrelse"}),e.jsx(w,{value:"settings",children:"Indstillinger"})]}),e.jsxs(k,{value:"pages",className:"mt-4",children:[e.jsx("div",{className:"flex justify-end mb-4",children:e.jsxs(r,{onClick:U,children:[e.jsx(F,{className:"w-4 h-4 mr-2"})," Ny side"]})}),e.jsx("div",{className:"space-y-3",children:f.map(s=>e.jsx(C,{children:e.jsxs(_,{className:"flex items-center justify-between py-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-heading text-sm",children:s.title}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["/",s.slug]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>L(s),children:e.jsx(R,{className:"w-4 h-4"})}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>O(s.id),children:e.jsx(z,{className:"w-4 h-4 text-destructive"})})]})]})},s.id))})]}),e.jsxs(k,{value:"board",className:"mt-4",children:[e.jsx("div",{className:"flex justify-end mb-4",children:e.jsxs(r,{onClick:K,children:[e.jsx(F,{className:"w-4 h-4 mr-2"})," Nyt medlem"]})}),e.jsx("div",{className:"space-y-3",children:P.map(s=>e.jsx(C,{children:e.jsxs(_,{className:"flex items-center justify-between py-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[s.photo_url?e.jsx("img",{loading:"lazy",decoding:"async",src:s.photo_url,alt:s.name,className:"w-10 h-10 rounded-full object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:e.jsx(ee,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-heading text-sm",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.role})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>H(s),children:e.jsx(R,{className:"w-4 h-4"})}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>W(s.id),children:e.jsx(z,{className:"w-4 h-4 text-destructive"})})]})]})},s.id))})]}),e.jsx(k,{value:"settings",className:"mt-4",children:e.jsx(te,{group:"dameklub"})})]}),e.jsx(M,{open:b,onOpenChange:t,children:e.jsxs(T,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(E,{children:e.jsx(B,{children:x?"Rediger side":"Ny side"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Titel"}),e.jsx(d,{value:n.title,onChange:s=>u({...n,title:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Slug"}),e.jsx(d,{value:n.slug,onChange:s=>u({...n,slug:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Indhold"}),e.jsx(Z,{content:n.content,onChange:s=>u({...n,content:s})})]}),e.jsx(r,{onClick:G,className:"w-full",children:"Gem"})]})]})}),e.jsx(M,{open:A,onOpenChange:j,children:e.jsxs(T,{children:[e.jsx(E,{children:e.jsx(B,{children:v?"Rediger medlem":"Nyt medlem"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Navn"}),e.jsx(d,{value:a.name,onChange:s=>m({...a,name:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Rolle"}),e.jsx(d,{value:a.role,onChange:s=>m({...a,role:s.target.value}),placeholder:"Formand, Kasserer, Sekretær..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"E-mail"}),e.jsx(d,{value:a.email,onChange:s=>m({...a,email:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Telefon"}
1),e.jsx(d,{value:a.phone,onChange:s=>m({...a,phone:s.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Foto URL"}),e.jsx(d,{value:a.photo_url,onChange:s=>m({...a,photo_url:s.target.value}),placeholder:"https://..."})]}),e.jsx(r,{onClick:V,className:"w-full",children:"Gem"})]})]})})]})}export{ye 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.