PageSourceSearch

https://nadort-elektro.nl/assets/Aanvragen-edMOzGoE.js

js nadort-elektro.nl collected 2026-10-09 22:02:45 UTC 3,221 bytes, 1 lines download raw bytes

1import{u as j,r,j as e,N as b,H as w,B as x,C as v,af as N,b as f,c as g}from"./index-DZ2JdFDg.js";import{I as y}from"./inbox-C0F6sFM0.js";function _(){const{isAdmin:t,loading:p}=j(),[d,h]=r.useState([]),[l,o]=r.useState(null),c=async()=>{const{data:s}=await f.from("account_requests").select("*").order("requested_at",{ascending:!1});h(s??[])};if(r.useEffect(()=>{t&&c()},[t]),p)return null;if(!t)return e.jsx(b,{to:"/portaal",replace:!0});const i=async(s,u)=>{o(s);try{const{error:a}=await f.functions.invoke("approve-account",{body:{request_id:s,action:u,redirect_to:`${window.location.origin}/reset-password`}});if(a)throw a;g.success(u==="approve"?"Goedgekeurd en uitnodiging verstuurd.":"Aanvraag afgewezen."),c()}catch(a){g.error(a.message??"Er ging iets mis")}finally{o(null)}},n=d.filter(s=>s.status==="pending"),m=d.filter(s=>s.status!=="pending");return e.jsxs(e.Fragment,{children:[e.jsx(w,{children:e.jsx("title",{children:"Accountaanvragen — Portaal"})}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-semibold mb-6",children:"Accountaanvragen"}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:["Openstaand (",n.length,")"]}),n.length===0?e.jsxs("div",{className:"bg-card border border-border rounded-xl p-8 text-center text-muted-foreground",children:[e.jsx(y,{className:"w-6 h-6 mx-auto mb-2 opacity-60"}),"Geen openstaande aanvragen."]}):e.jsx("div",{className:"space-y-3",children:n.map(s=>e.jsxs("div",{className:"bg-card border border-border rounded-xl p-4 flex flex-col sm:flex-row gap-4 items-start justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:s.full_name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[s.email,s.phone?` · ${s.phone}`:""]}),s.message&&e.jsx("div",{className:"text-sm mt-2 max-w-prose",children:s.message}),e.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:new Date(s.requested_at).toLocaleString("nl-NL")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[e.jsxs(x,{size:"sm",onClick:()=>i(s.id,"approve"),disabled:l===s.id,className:"bg-accent text-accent-foreground hover:bg-accent/90 gap-1 w-full sm:w-auto",children:[e.jsx(v,{className:"w-4 h-4"})," Goedkeuren"]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>i(s.id,"reject"),disabled:l===s.id,className:"gap-1 w-full sm:w-auto",children:[e.jsx(N,{className:"w-4 h-4"})," Afwijzen"]})]})]},s.id))})]}),m.length>0&&e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Historie"}),e.jsx("div",{className:"space-y-2",children:m.map(s=>e.jsxs("div",{className:"bg-card border border-border rounded-lg px-4 py-3 flex flex-col sm:flex-row sm:items-center justify-between text-sm gap-2",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:s.full_name})," · ",e.jsx("span",{className:"text-muted-foreground",children:s.email})]}),e.jsx("span",{className:s.status==="approved"?"text-accent":"text-destructive",children:s.status==="approved"?"Goedgekeurd":"Afgewezen"})]},s.id))})]})]})}export{_ 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.