PageSourceSearch

https://nadort-elektro.nl/assets/Meldingen-DXCJc-qc.js

js nadort-elektro.nl collected 2026-10-09 22:03:56 UTC 43,388 bytes, 13 lines download raw bytes

vendor: 4,618 bytes, lines 1-11
1import{a4 as _e,b1 as at,aW as nt,r as i,b0 as rt,j as e,aY as Y,aX as X,bh as it,aV as te,a$ as ot,a_ as lt,bW as ke,e as Ce,B as M,bX as we,u as me,b as A,H as ue,D as q,ar as be,I as ae,S as fe,w as ee,J as I,y as O,z as De,a5 as ct,a6 as dt,a7 as mt,a8 as ut,a9 as ft,T as ht,aa as gt,a1 as Re,ax as Pe,ac as xt,at as pt,t as vt,F as wt,R as bt}from"./index-DZ2JdFDg.js";import{T as he,a as ge,b as H,c as J}from"./tabs-CsfuF8BP.js";import{a as jt}from"./useWebsiteMeldingenCounts-DsMYgPoT.js";import Nt from"./Storingen-CAaKzKBu.js";import yt from"./OfferteAanvragen-DgU1e3qX.js";import St from"./ContactBerichten-V7_qVCRB.js";import{C as ze,c as Ee}from"./card-BwIc6VxI.js";import{C as _t}from"./checkbox-Dp3Ts_Us.js";import{F as Ve,a as kt,H as Ae}from"./DoorsturenMeldingButton-WjopbS_9.js";import{P as Ct}from"./play-VWU43ZSe.js";import{V as je}from"./volume-x-BILDihib.js";import{D as re}from"./download-DuCPwZpS.js";import{E as Me}from"./ExpandableText-UoDEo4zN.js";import{u as Be}from"./useFocusItem-8JA1tF38.js";import{notifyUsers as Dt}from"./pushNotifications-BojXWary.js";import{m as Ne}from"./notificationSync-BBPsvEbC.js";import{R as Rt}from"./refresh-cw-DNf-HIuv.js";import{V as Te}from"./voicemail-D4iemoc_.js";import{R as ie}from"./rotate-ccw-GhTdmHsM.js";import{T as Le}from"./trash-2-DeU-Lotm.js";import"./dropdown-menu-dEEO5y5b.js";import"./EmailImportDropzone-Bh6Ahbjo.js";import"./ellipsis-vertical-CgBPPrS1.js";import"./file-video-x7Utbn94.js";import"./external-link-CQ_6TKwQ.js";import"./message-square-n-eUlBZ_.js";import"./save-CH8uQq9H.js";import"./paperclip-Dh9x9WIB.js";import"./image-Cv8h1pBT.js";import"./arrow-right-left-6GnwLx8D.js";import"./meldingPdf-d5NI-lpY.js";import"./jspdf.es.min-DTKfYfxW.js";import"./nadort-logo.jpg.asset-Cy0Q89v2.js";import"./file-down-PNs37hzC.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ie=_e("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Pt=_e("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);var $e=["PageUp","PageDown"],Oe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],He={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Z="Slider",[oe,zt,Et]=at(Z),[Ke,Vs]=nt(Z,[Et]),[Vt,ne]=Ke(Z),Fe=i.forwardRef((s,r)=>{const{name:n,min:c=0,max:g=100,step:u=1,orientation:m="horizontal",disabled:f=!1,minStepsBetweenThumbs:v=0,defaultValue:j=[c],value:C,onValueChange:x=()=>{},onValueCommit:y=()=>{},inverted:S=!1,form:z,...N}=s,D=i.useRef(new Set),_=i.useRef(0),h=m==="horizontal"?At:Mt,[w=[],E]=rt({prop:C,defaultProp:j,onChange:d=>{var L;(L=[...D.current][_.current])==null||L.focus(),x(d)}}),a=i.useRef(w);function o(d){const k=$t(w,d);p(d,k)}function b(d){p(d,_.current)}function l(){const d=a.current[_.current];w[_.current]!==d&&y(w)}function p(d,k,{commit:L}={commit:!1}){const U=Ft(u),K=Ut(Math.round((d-c)/u)*u+c,U),V=ke(K,[c,g]);E(($=[])=>{const W=Lt($,V,k);if(Kt(W,v*u)){_.current=W.indexOf(V);const se=String(W)!==String($);return se&&L&&y(W),se?W:$}else return $})}return e.jsx(Vt,{scope:s.__scopeSlider,name:n,disabled:f,min:c,max:g,valueIndexToChangeRef:_,thumbs:D.current,values:w,orientation:m,form:z,children:e.jsx(oe.Provider,{scope:s.__scopeSlider,children:e.jsx(oe.Slot,{scope:s.__scopeSlider,children:e.jsx(h,{"aria-disabled":f,"data-disabled":f?"":void 0,...N,ref:r,onPointerDown:Y(N.onPointerDown,()=>{f||(a.current=w)}),min:c,max:g,inverted:S,onSlideStart:f?void 0:o,onSlideMove:f?void 0:b,onSlideEnd:f?void 0:l,onHomeKeyDown:()=>!f&&p(c,0,{commit:!0}),onEndKeyDown:()=>!f&&p(g,w.length-1,{commit:!0}),onStepKeyDown:({event:d,direction:k})=>{if(!f){const K=$e.includes(d.key)||d.shiftKey&&Oe.includes(d.key)?10:1,V=_.current,$=w[V],W=u*K*k;p($+W,V,{commit:!0})}}})})})})});Fe.displayName=Z;var[Ue,We]=Ke(Z,{startEdge:"left",endEdge:"right",size:"width",direction:1}),At=i.forwardRef((s,r)=>{const{min:n,max:c,dir:g,inverted:u,onSlideStart:m,onSlideMove:f,onSlideEnd:v,onStepKeyDown:j,...C}=s,[x,y]=i.useState(null),S=X(r,h=>
11y(h)),z=i.useRef(void 0),N=it(g),D=N==="ltr",_=D&&!u||!D&&u;function T(h){const w=z.current||x.getBoundingClientRect(),E=[0,w.width],o=xe(E,_?[n,c]:[c,n]);return z.current=w,o(h-w.left)}return e.jsx(Ue,{scope:s.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width",children:e.jsx(Ge,{dir:N,"data-orientation":"horizontal",...C,ref:S,style:{...C.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:h=>{const w=T(h.clientX);m==null||m(w)},onSlideMove:h=>{const w=T(h.clientX);f==null||f(w)},onSlideEnd:()=>{z.current=void 0,v==null||v()},onStepKeyDown:h=>{const E=He[_?"from-left":"from-right"].includes(h.key);j==null||j({event:h,direction:E?-1:1})}})})}),Mt=i.forwardRef((s,r)=>{const{min:n,max:c,inverted:g,onSlideStart:u,onSlideMove:m,onSlideEnd:f,onStepKeyDown:v,...j}=s,C=i.useRef(null),x=X(r,C),y=i.useRef(void 0),S=!g;function z(N){const D=y.current||C.current.getBoundingClientRect(),_=[0,D.height],h=xe(_,S?[c,n]:[n,c]);return y.current=D,h(N-D.top)}return e.jsx(Ue,{scope:s.__scopeSlider,startEdge:S?"bottom":"top",endEdge:S?"top":"bottom",size:"height",direction:S?1:-1,children:e.jsx(Ge,{"data-orientation":"vertical",...j,ref:x,style:{...j.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const D=z(N.clientY);u==null||u(D)},onSlideMove:N=>{const D=z(N.clientY);m==null||m(D)},onSlideEnd:()=>{y.current=void 0,f==null||f()},onStepKeyDown:N=>{const _=He[S?"from-bottom":"from-top"].includes(N.key);v==null||v({event:N,direction:_?-1:1})}})})}),Ge=i.forwardRef((s,r)=>{const{__scopeSlider:n,onSlideStart:c,onSlideMove:g,onSlideEnd:u,onHomeKeyDown:m,onEndKeyDown:f,onStepKeyDown:v,...j}=s,C=ne(Z,n);return e.jsx(te.span,{...j,ref:r,onKeyDown:Y(s.onKeyDown,x=>{x.key==="Home"?(m(x),x.preventDefault()):x.key==="End"?(f(x),x.preventDefault()):$e.concat(Oe).includes(x.key)&&(v(x),x.preventDefault())}),onPointerDown:Y(s.onPointerDown,x=>{const y=x.target;y.setPointerCapture(x.pointerId),x.preventDefault(),C.thumbs.has(y)?y.focus():c(x)}),onPointerMove:Y(s.onPointerMove,x=>{x.target.hasPointerCapture(x.pointerId)&&g(x)}),onPointerUp:Y(s.onPointerUp,x=>{const y=x.target;y.hasPointerCapture(x.pointerId)&&(y.releasePointerCapture(x.pointerId),u(x))})})}),qe="SliderTrack",Ye=i.forwardRef((s,r)=>{const{__scopeSlider:n,...c}=s,g=ne(qe,n);return e.jsx(te.span,{"data-disabled":g.disabled?"":void 0,"data-orientation":g.orientation,...c,ref:r})});Ye.displayName=qe;var le="SliderRange",Xe=i.forwardRef((s,r)=>{const{__scopeSlider:n,...c}=s,g=ne(le,n),u=We(le,n),m=i.useRef(null),f=X(r,m),v=g.values.length,j=g.values.map(y=>Je(y,g.min,g.max)),C=v>1?Math.min(...j):0,x=100-Math.max(...j);return e.jsx(te.span,{"data-orientation":g.orientation,"data-disabled":g.disabled?"":void 0,...c,ref:f,style:{...s.style,[u.startEdge]:C+"%",[u.endEdge]:x+"%"}})});Xe.displayName=le;var ce="SliderThumb",Ze=i.forwardRef((s,r)=>{const n=zt(s.__scopeSlider),[c,g]=i.useState(null),u=X(r,f=>g(f)),m=i.useMemo(()=>c?n().findIndex(f=>f.ref.current===c):-1,[n,c]);return e.jsx(Bt,{...s,ref:u,index:m})}),Bt=i.forwardRef((s,r)=>{const{__scopeSlider:n,index:c,name:g,...u}=s,m=ne(ce,n),f=We(ce,n),[v,j]=i.useState(null),C=X(r,T=>j(T)),x=v?m.form||!!v.closest("form"):!0,y=ot(v),S=m.values[c],z=S===void 0?0:Je(S,m.min,m.max),N=It(c,m.values.length),D=y==null?void 0:y[f.size],_=D?Ot(D,z,f.direction):0;return i.useEffect(()=>{if(v)return m.thumbs.add(v),()=>{m.thumbs.delete(v)}},[v,m.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[f.startEdge]:`calc(${z}% + ${_}px)`},children:[e.jsx(oe.ItemSlot,{scope:s.__scopeSlider,children:e.jsx(te.span,{role:"slider","aria-label":s["aria-label"]||N,"aria-valuemin":m.min,"aria-valuenow":S,"aria-valuemax":m.max,"aria-orientation":m.orientation,"data-orientation":m.orientation,"data-disabled":m.disabled?"":void 0,tabIndex:m.disabled?void 0:0,...u,ref:C,style:S===void 0?{display:"none"}:s.style,onFocus:Y(s.onFocus,()=>{m.valueIndexToChangeRef.current=c})})}),x&&e.jsx(Qe,{name:g??(m.name?m.name+(m.values.length>1?"[]":""):void 0),form:m.form,value:S},c)]})});Ze.displayName=ce;var Tt="RadioBubbleInput",Qe=i.forwardRef(({__scopeSlider:s,value:r,...n},c)=>{const g=i.useRef(null),u=X(g,c),m=lt(r);return i.useEffect(()=>{const f=g.current;if(!f)return;const v=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(v,"value").set;if(m!==r&&C){const x=new Event("input",{bubbles:!0});C.call(f,r),f.dispatchEvent(x)}},[m,r]),e.jsx(te.input,{style:{display:"none"},...n,ref:u,defaultValue:r})});Qe.displayName=Tt;function Lt(s=[],r,n){const c=[...s];return c[n]=r,c.sort((g,u)=>g-u)}function Je(s,r,n){const u=100/(n-r)*(s-r);return ke(u,[0,100])}function It(s,r){return r>2?`Value ${s+1} of ${r}`:r===2?["Minimum","Maximum"][s]:void 0}function $t(s,r){if(s.length===1)return 0;const n=s.map(g=>Math.abs(g-r)),c=Math.min(...n);return n.indexOf(c)}function Ot(s,r,n){const c=s/2,u=xe([0,50],[0,c]);return(c-u(r)*n)*n}function Ht(s){return s.slice(0,-1).map((r,n)=>s[n+1]-r)}function Kt(s,r){if(r>0){const n=Ht(s);return Math.min(...n)>=r}return!0}function xe(s,r){return n=>{if(s[0]===s[1]||r[0]===r[1])return r[0];const c=(r[1]-r[0])/(s[1]-s[0]);return r[0]+c*(n-s[0])}}function Ft(s){return(String(s).split(".")[1]||"").length}function Ut(s,r){const n=Math.pow(10,r);return Math.round(s*n)/n}var et=Fe,Wt=Ye,Gt=Xe,qt=Ze;const de=i.forwardRef(({className:s,...r},n)=>e.jsxs(et,{ref:n,className:Ce("relative flex w-full touch-none select-none items-center",s
11),...r,children:[e.jsx(Wt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(Gt,{className:"absolute h-full bg-primary"})}),e.jsx(qt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));de.displayName=et.displayName;function ye(s){if(!Number.isFinite(s)||s<0)return"0:00";const r=Math.floor(s/60),n=Math.floor(s%60);return`${r}:${n.toString().padStart(2,"0")}`}function tt({src:s,className:r,onFirstPlay:n}){const c=i.useRef(null),g=i.useRef(!1),[u,m]=i.useState(!1),[f,v]=i.useState(0),[j,C]=i.useState(0),[x,y]=i.useState(1),[S,z]=i.useState(!1),[N,D]=i.useState(1);i.useEffect(()=>{const o=c.current;o&&(o.playbackRate=N)},[N]);const _=()=>{const o=c.current;o&&(o.paused?o.play().catch(()=>{}):o.pause())},T=o=>{const b=c.current;!b||!j||(b.currentTime=o[0],v(o[0]))},h=o=>{const b=c.current;if(!b)return;const l=o[0];b.volume=l,y(l),l>0&&S&&(b.muted=!1,z(!1))},w=()=>{const o=c.current;if(!o)return;const b=!S;o.muted=b,z(b)},E=()=>{const o=[1,1.25,1.5,2,.75],b=o.indexOf(N);D(o[(b+1)%o.length])},a=j>0?f/j*100:0;return e.jsxs("div",{className:Ce("rounded-xl border bg-gradient-to-br from-secondary/60 to-background p-3 sm:p-4 shadow-sm",r),children:[e.jsx("audio",{ref:c,src:s,preload:"metadata",onLoadedMetadata:o=>C(o.currentTarget.duration||0),onTimeUpdate:o=>v(o.currentTarget.currentTime),onPlay:()=>{m(!0),g.current||(g.current=!0,n==null||n())},onPause:()=>m(!1),onEnded:()=>{m(!1),v(0)}}),e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsx(M,{type:"button",size:"icon",onClick:_,className:"h-11 w-11 rounded-full shrink-0 bg-accent text-accent-foreground hover:bg-accent/90 shadow-md","aria-label":u?"Pauzeren":"Afspelen",children:u?e.jsx(Pt,{className:"h-5 w-5"}):e.jsx(Ct,{className:"h-5 w-5 ml-0.5"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[e.jsx("div",{className:"relative",children:e.jsx(de,{value:[Math.min(f,j||0)],max:j||0,step:.1,onValueChange:T,"aria-label":"Positie in voicemail"})}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] tabular-nums text-muted-foreground",children:[e.jsx("span",{children:ye(f)}),e.jsxs("span",{children:["-",ye(Math.max(0,(j||0)-f))]})]})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 shrink-0",children:[e.jsxs(M,{type:"button",variant:"ghost",size:"sm",onClick:E,className:"h-8 px-2 text-xs font-medium text-muted-foreground hover:text-foreground","aria-label":"Afspeelsnelheid",title:"Afspeelsnelheid",children:[N,"×"]}),e.jsxs("div",{className:"flex items-center gap-1.5 group",children:[e.jsx(M,{type:"button",variant:"ghost",size:"icon",onClick:w,className:"h-8 w-8 text-muted-foreground hover:text-foreground","aria-label":S?"Geluid aan":"Geluid uit",children:S||x===0?e.jsx(je,{className:"h-4 w-4"}):e.jsx(we,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-20 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:e.jsx(de,{value:[S?0:x],max:1,step:.05,onValueChange:h,"aria-label":"Volume"})})]}),e.jsx(M,{type:"button",variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8 text-muted-foreground hover:text-foreground",children:e.jsx("a",{href:s,download:!0,"aria-label":"Download voicemail",children:e.jsx(re,{className:"h-4 w-4"})})})]})]}),e.jsxs("div",{className:"sm:hidden mt-2 flex items-center justify-between gap-2 text-xs",children:[e.jsxs("button",{type:"button",onClick:E,className:"text-muted-foreground hover:text-foreground font-medium",children:[N,"×"]}),e.jsxs("button",{type:"button",onClick:w,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[S||x===0?e.jsx(je,{className:"h-4 w-4"}):e.jsx(we,{className:"h-4 w-4"}),S?"Uit":"Aan"]}),e.jsxs("a",{href:s,download:!0,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[e.jsx(re,{className:"h-4 w-4"})," Download"]})]}),e.jsxs("span",{className:"sr-only",children:[Math.round(a),"% afgespeeld"]})]})}function Yt(){const{isAdmin:s,isAdministratie:r,user:n}=me(),c=s||r,g=s||r,[u,m]=i.useState([]),[f,v]=i.useState(!0),[j,C]=i.useState("nieuw"),[x,y]=i.useState({}),[S,z]=i.useState(null),[N,D]=i.useState(""),_=Be(!f&&u.length>0),[T,h]=i.useState(!1),[w,E]=i.useState(!1),[a,o]=i.useState(!1),[b,l]=i.useState(""),p=i.useRef(null);i.useEffect(()=>{if(!_)return;const t=u.find(R=>R.id===_);(!t||t.status!==j)&&C("alle")},[_,u]);const d=async()=>{v(!0);const{data:t,error:R}=await A.from("voicemail_messages").select("*").order("created_at",{ascending:!1});R?I({title:"Laden mislukt",description:R.message,variant:"destructive"}):m(t??[]),v(!1)};i.useEffect(()=>{d()},[]);const k=async()=>{E(!0);const{data:t,error:R}=await A.functions.invoke("gmail-voicemail-sync",{body:{}});
11if(E(!1),R){I({title:"Ophalen mislukt",description:R.message,variant:"destructive"});return}const B=(t==null?void 0:t.imported)??0;I({title:B>0?`${B} nieuwe voicemail(s)`:"Geen nieuwe voicemails",description:B>0?"De berichten staan nu in de lijst.":"Alles was al opgehaald."}),B>0&&d()};i.useEffect(()=>{let t=!1;return(async()=>{const R=u.filter(P=>P.audio_path&&!x[P.id]);if(R.length===0)return;const B=await Promise.all(R.map(async P=>{const{data:F}=await A.storage.from("voicemails").createSignedUrl(P.audio_path,3600);return[P.id,(F==null?void 0:F.signedUrl)??""]}));t||y(P=>{const F={...P};for(const[G,Q]of B)Q&&(F[G]=Q);return F})})(),()=>{t=!0}},[u]);const L=N.trim().toLowerCase(),U=t=>L?[t.caller_number??"",t.from_email??"",t.subject??"",t.body_text??"",t.handling_note??""].some(R=>R.toString().toLowerCase().includes(L)):!0,K=u.filter(t=>j==="alle"?!0:t.status===j).filter(U),V={alle:u.length,nieuw:u.filter(t=>t.status==="nieuw").length,beluisterd:u.filter(t=>t.status==="beluisterd").length,behandeld:u.filter(t=>t.status==="behandeld").length},$=async(t,R)=>{const B={status:R,handled_at:R==="nieuw"?null:new Date().toISOString()},{error:P}=await A.from("voicemail_messages").update(B).eq("id",t);if(P)return I({title:"Bijwerken mislukt",description:P.message,variant:"destructive"});m(F=>F.map(G=>G.id===t?{...G,...B}:G)),R!=="nieuw"&&Ne(t,"voicemail_messages")},W=async t=>{Ne(t.id,"voicemail_messages"),t.status==="nieuw"&&await $(t.id,"beluisterd")},se=async t=>{if(!confirm("Deze voicemail definitief verwijderen?"))return;t.audio_path&&await A.storage.from("voicemails").remove([t.audio_path]);const{error:R}=await A.from("voicemail_messages").delete().eq("id",t.id);if(R)return I({title:"Verwijderen mislukt",description:R.message,variant:"destructive"});m(B=>B.filter(P=>P.id!==t.id))},pe=async t=>{if(!t)return;const R=Array.from(t).filter(P=>P.type.startsWith("audio/")||/\.(mp3|wav|m4a|ogg|oga|flac|mp4)$/i.test(P.name));if(R.length===0){I({title:"Geen audio-bestand",description:"Sleep een mp3/wav/m4a-bestand hierheen.",variant:"destructive"});return}h(!0);let B=0;for(const P of R){const F=P.name.replace(/[^\w.\-]+/g,"_"),G=`${new Date().toISOString().slice(0,10)}/${Date.now()}-${Math.random().toString(36).slice(2,6)}-${F}`,{error:Q}=await A.storage.from("voicemails").upload(G,P,{contentType:P.type||"audio/mpeg",upsert:!1});if(Q){I({title:"Upload mislukt",description:Q.message,variant:"destructive"});continue}const{error:ve}=await A.from("voicemail_messages").insert({caller_number:b.trim()||null,subject:P.name,audio_path:G,status:"nieuw"});ve?(await A.storage.from("voicemails").remove([G]),I({title:"Opslaan mislukt",description:ve.message,variant:"destructive"})):B++}h(!1),p.current&&(p.current.value=""),B>0&&(I({title:`${B} voicemail(s) geüpload`}),l(""),d())},st=t=>{if(t==null)return"";const R=Math.floor(t/60),B=t%60;return`${R}:${B.toString().padStart(2,"0")}`};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ue,{children:[e.jsx("title",{children:"Voicemail — Portaal"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Voicemail-berichten"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Voicemails van de telefooncentrale worden automatisch uit de mailbox opgehaald. Je kunt ze ook handmatig ophalen of zelf een audiobijlage (mp3/wav) uploaden."})]}),g&&e.jsxs(M,{variant:"outline",onClick:k,disabled:w,className:"gap-2",children:[w?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(Rt,{className:"w-4 h-4"}),"Nu ophalen"]})]}),g&&e.jsx("div",{onDragOver:t=>{t.preventDefault(),o(!0)},onDragEnter:t=>{t.preventDefault(),o(!0)},onDragLeave:t=>{t.preventDefault(),o(!1)},onDrop:t=>{t.preventDefault(),o(!1),pe(t.dataTransfer.files)},className:`rounded-lg border-2 border-dashed p-5 transition-colors ${a?"border-accent bg-accent/10":"border-border bg-secondary/30"}`,children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(be,{className:"w-4 h-4"})," Voicemail uploaden"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sleep een mp3/wav-bestand hierheen of klik op “Bestand kiezen”. Vul optioneel het bellernummer in."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{placeholder:"Bellernummer (optioneel)",value:b,onChange:t=>l(t.target.value),className:"w-48"}),e.jsxs(M,{variant:"outline",onClick:()=>{var t;return(t=p.current)==null?void 0:t.click()},disabled:T,className:"gap-2",children:[T?e.jsx(q,{className:"w-4 h-4 animate-spin"}):e.jsx(be,{className:"w-4 h-4"}),"Bestand kiezen"]}),e.jsx("input",{ref:p,type:"file",accept:"audio/*,.mp3,.wav,.m4a,.ogg,.flac",multiple:!0,className:"hidden",onChange:t=>pe(t.target.files)})]})]})}),e.jsx(he,{value:j,onValueChange:t=>C(t),children:e.jsxs(ge,{className:"h-auto w-full grid grid-cols-2 sm:inline-flex sm:w-auto gap-1",children:[e.jsxs(H,{value:"nieuw",className:"w-full sm:w-auto",children:["Nieuw (",V.nieuw,")"]}),e.jsxs(H,{value:"beluisterd",className:"w-full sm:w-auto",children:["Beluisterd (",V.beluisterd,")"]}),e.jsxs(H,{value:"behandeld",className:"w-full sm:w-auto",children:["Behandeld (",V.behandeld,")"]}),e.jsxs(H,{value:"alle",className:"w-full sm:w-auto",children:["Alle (",V.alle,")"]})]})}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(fe,{className:"w-4 h-4 absolute left-2.5 top-2.5 text-muted-foreground"}),e.jsx(ae,{className:"pl-8",placeholder:"Zoek op bellernummer, e-mail, onderwerp, bericht…",value:N,onChange:t=>D(t.target.value)})]}),f?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(q,{className:"w-4 h-4 animate-spin"})," Laden…"]}):K.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-12 text-center",children:"Geen voicemail-berichten."}):e.jsx("div",{className:"space-y-4",children:K.map(t=>e.jsx(ze,{"data-focus-id":t.id,children:e.jsxs(Ee,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold",children:t.caller_number?e.jsx("a",{href:`tel:${t.caller_number}`,className:"hover:underline",children:t.caller_number}):t.subject||"Onbekende beller"}),e.jsx(Xt,{status:t.status}),t.duration_seconds!=null&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",st(t.duration_seconds)]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Ontvangen op ",new Date(t.created_at).toLocaleStr
11ing("nl-NL"),t.handled_at&&t.status!=="nieuw"&&e.jsxs(e.Fragment,{children:[" · Verwerkt op ",new Date(t.handled_at).toLocaleString("nl-NL")]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.status==="nieuw"&&e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>$(t.id,"beluisterd"),className:"gap-1.5",children:[e.jsx(Ie,{className:"w-4 h-4"})," Beluisterd"]}),t.status!=="behandeld"&&e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>$(t.id,"behandeld"),className:"gap-1.5",children:[e.jsx(ee,{className:"w-4 h-4"})," Behandeld"]}),t.status!=="nieuw"&&e.jsxs(M,{size:"sm",variant:"ghost",onClick:()=>$(t.id,"nieuw"),className:"gap-1.5",children:[e.jsx(ie,{className:"w-4 h-4"})," Heropenen"]}),c&&e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>z(t),className:"gap-1.5",children:[e.jsx(Ve,{className:"w-4 h-4"})," Doorsturen"]}),s&&e.jsx(M,{size:"sm",variant:"ghost",onClick:()=>se(t),className:"gap-1.5 text-destructive hover:text-destructive",children:e.jsx(Le,{className:"w-4 h-4"})})]})]}),t.audio_path&&x[t.id]&&e.jsx(tt,{src:x[t.id],onFirstPlay:()=>{W(t)}}),t.body_text&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Transcriptie / bericht"}),e.jsx(Me,{text:t.body_text})]}),e.jsx(kt,{table:"voicemail_messages",id:t.id}),e.jsx(Ae,{table:"voicemail_messages",id:t.id,initialNote:t.handling_note,onSaved:R=>m(B=>B.map(P=>P.id===t.id?{...P,handling_note:R}:P))})]})},t.id))}),e.jsx(Zt,{voicemail:S,onOpenChange:t=>{t||z(null)},currentUserId:(n==null?void 0:n.id)??null})]})}function Xt({status:s}){return s==="behandeld"?e.jsxs(O,{className:"bg-green-600 hover:bg-green-600",children:[e.jsx(ee,{className:"w-3 h-3 mr-1"}),"Behandeld"]}):s==="beluisterd"?e.jsxs(O,{variant:"outline",children:[e.jsx(Ie,{className:"w-3 h-3 mr-1"}),"Beluisterd"]}):e.jsxs(O,{className:"bg-accent text-accent-foreground hover:bg-accent",children:[e.jsx(De,{className:"w-3 h-3 mr-1"}),"Nieuw"]})}function Zt({voicemail:s,onOpenChange:r,currentUserId:n}){const c=!!s,[g,u]=i.useState([]),[m,f]=i.useState(!1),[v,j]=i.useState(new Set),[C,x]=i.useState(""),[y,S]=i.useState(""),[z,N]=i.useState(!1);i.useEffect(()=>{if(!c){j(new Set),x(""),S("");return}(async()=>{f(!0);const{data:h,error:w}=await A.from("profiles").select("id, full_name, email, actief").eq("actief",!0).order("full_name",{ascending:!0});w?I({title:"Kon collega's niet laden",description:w.message,variant:"destructive"}):u((h??[]).filter(E=>E.id!==n)),f(!1)})()},[c,n]);const D=i.useMemo(()=>{const h=y.trim().toLowerCase();return h?g.filter(w=>(w.full_name??"").toLowerCase().includes(h)||(w.email??"").toLowerCase().includes(h)):g},[g,y]),_=h=>j(w=>{const E=new Set(w);return E.has(h)?E.delete(h):E.add(h),E}),T=async()=>{if(!s||v.size===0)return;N(!0);const h=Array.from(v),{data:w,error:E}=await A.rpc("forward_voicemail",{_voicemail_id:s.id,_user_ids:h,_note:C.trim()});if(N(!1),E)return I({title:"Doorsturen mislukt",description:E.message,variant:"destructive"});const a=C.trim();Dt({title:"Voicemail doorgestuurd",body:`Een collega heeft een voicemail met je gedeeld${a?`: ${a}`:""}`,url:`/portaal/meldingen?tab=voicemail&id=${s.id}`,user_ids:h.filter(l=>l!==n),source_table:"voicemail_messages",source_id:s.id});const o=h.filter(l=>l!==n);if(n&&o.length>0){const l=s.caller_number||s.from_email||"onbekende beller",p=[`Doorgestuurde voicemail van ${l}.`,a?`Notitie: ${a}`:"",s.body_text?`Bericht: ${s.body_text}`:"",`Link: /portaal/meldingen?tab=voicemail&id=${s.id}`].filter(Boolean),{data:d,error:k}=await A.from("todos").insert({title:`Voicemail: ${l}`.slice(0,200),description:p.join(`
12
13`).slice(0,4e3),urgency:"urgent",owner_id:n,source_table:"voicemail_messages",source_id:s.id}).select("id").single();!k&&(d!=null&&d.id)&&await A.from("todo_assignees").insert(o.map(L=>({todo_id:d.id,user_id:L,notified_at:new Date().toISOString()})))}const b=typeof w=="number"?w:h.length;I({title:"Voicemail doorgestuurd",description:`Verstuurd naar ${b} collega('s).`}),r(!1)};return e.jsx(ct,{open:c,onOpenChange:r,children:e.jsxs(dt,{className:"max-w-lg",children:[e.jsxs(mt,{children:[e.jsx(ut,{children:"Voicemail doorsturen"}),e.jsx(ft,{children:"Kies één of meerdere collega's. Zij zien de voicemail incl. audiobijlage in hun portaal en krijgen een melding."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(fe,{className:"w-4 h-4 absolute left-2.5 top-2.5 text-muted-foreground"}),e.jsx(ae,{className:"pl-8",placeholder:"Zoek collega…",value:y,onChange:h=>S(h.target.value)})]}),e.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border divide-y",children:m?e.jsxs("div",{className:"p-4 text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 animate-spin"})," Laden…"]}):D.length===0?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Geen collega's gevonden."}):D.map(h=>e.jsxs("label",{className:"flex items-center gap-3 p-2.5 cursor-pointer hover:bg-muted/50",children:[e.jsx(_t,{checked:v.has(h.id),onCheckedChange:()=>_(h.id)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:h.full_name||h.email||"Onbekend"}),h.email&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:h.email})]})]}
13,h.id))}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Notitie (optioneel)"}),e.jsx(ht,{rows:3,placeholder:"Voeg een korte toelichting toe…",value:C,onChange:h=>x(h.target.value)})]})]}),e.jsxs(gt,{children:[e.jsx(M,{variant:"ghost",onClick:()=>r(!1),children:"Annuleren"}),e.jsxs(M,{onClick:T,disabled:z||v.size===0,className:"gap-2",children:[z&&e.jsx(q,{className:"w-4 h-4 animate-spin"}),e.jsx(Ve,{className:"w-4 h-4"})," Doorsturen (",v.size,")"]})]})]})})}function Qt(){const{isAdmin:s}=me(),[r,n]=i.useState([]),[c,g]=i.useState(!0),[u,m]=i.useState("nieuw"),[f,v]=i.useState(""),[j,C]=i.useState({}),[x,y]=i.useState({}),S=Be(!c&&r.length>0);i.useEffect(()=>{if(!S)return;const a=r.find(o=>o.id===S);a&&a.status!=="nieuw"&&m("alle"),a&&y(o=>({...o,[a.from_number??"onbekend"]:!0}))},[S,r]);const z=async()=>{g(!0);const{data:a,error:o}=await A.from("whatsapp_messages").select("*").order("received_at",{ascending:!1});o?I({title:"Laden mislukt",description:o.message,variant:"destructive"}):n(a??[]),g(!1)};i.useEffect(()=>{z()},[]),i.useEffect(()=>{const a=A.channel("whatsapp-messages-live").on("postgres_changes",{event:"INSERT",schema:"public",table:"whatsapp_messages"},()=>z()).subscribe();return()=>{A.removeChannel(a)}},[]),i.useEffect(()=>{let a=!1;return(async()=>{const o=r.filter(l=>l.media_path&&!j[l.id]);if(o.length===0)return;const b=await Promise.all(o.map(async l=>{const{data:p}=await A.storage.from("whatsapp-media").createSignedUrl(l.media_path,3600);return[l.id,(p==null?void 0:p.signedUrl)??""]}));a||C(l=>{const p={...l};for(const[d,k]of b)k&&(p[d]=k);return p})})(),()=>{a=!0}},[r]);const N=i.useMemo(()=>{var b;const a=new Map;for(const l of r){const p=l.from_number??"onbekend",d=a.get(p)??[];d.push(l),a.set(p,d)}const o=[];for(const[l,p]of a){const d=[...p].sort((V,$)=>+new Date(V.received_at)-+new Date($.received_at)),k=d[d.length-1],L=d.filter(V=>V.status==="nieuw").length,U=L>0?"nieuw":d.some(V=>V.status==="gelezen")?"gelezen":"behandeld",K=((b=d.find(V=>V.profile_name))==null?void 0:b.profile_name)||k.from_number||"Onbekende afzender";o.push({key:l,from_number:k.from_number,name:K,messages:d,last:k,status:U,nieuwCount:L})}return o.sort((l,p)=>+new Date(p.last.received_at)-+new Date(l.last.received_at))},[r]),D=f.trim().toLowerCase(),_=N.filter(a=>u==="alle"?!0:a.status===u).filter(a=>!D||a.messages.some(o=>[o.from_number??"",o.profile_name??"",o.body??"",o.handling_note??""].some(b=>b.toLowerCase().includes(D)))),T={alle:N.length,nieuw:N.filter(a=>a.status==="nieuw").length,gelezen:N.filter(a=>a.status==="gelezen").length,behandeld:N.filter(a=>a.status==="behandeld").length},h=async(a,o)=>{const b=a.messages.map(d=>d.id),l={status:o,handled_at:o==="nieuw"?null:new Date().toISOString()},{error:p}=await A.from("whatsapp_messages").update(l).in("id",b);if(p)return I({title:"Bijwerken mislukt",description:p.message,variant:"destructive"});n(d=>d.map(k=>b.includes(k.id)?{...k,...l}:k))},w=async(a,o)=>{const b={status:o,handled_at:o==="nieuw"?null:new Date().toISOString()},{error:l}=await A.from("whatsapp_messages").update(b).eq("id",a.id);if(l)return I({title:"Bijwerken mislukt",description:l.message,variant:"destructive"});n(p=>p.map(d=>d.id===a.id?{...d,...b}:d))},E=async a=>{if(!confirm(`Dit gesprek (${a.messages.length} bericht(en)) definitief verwijderen?`))return;const o=a.messages.map(p=>p.media_path).filter(Boolean);o.length&&await A.storage.from("whatsapp-media").remove(o);const b=a.messages.map(p=>p.id),{error:l}=await A.from("whatsapp_messages").delete().in("id",b);if(l)return I({title:"Verwijderen mislukt",description:l.message,variant:"destructive"});n(p=>p.filter(d=>!b.includes(d.id)))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ue,{children:[e.jsx("title",{children:"WhatsApp — Portaal"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"WhatsApp-berichten"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Binnenkomende WhatsApp-berichten van klanten, inclusief foto's, video's, spraakberichten en documenten."})]}),e.jsx(he,{value:u,onValueChange:a=>m(a),children:e.jsxs(ge,{className:"h-auto w-full grid grid-cols-2 sm:inline-flex sm:w-auto gap-1",children:[e.jsxs(H,{value:"nieuw",className:"w-full sm:w-auto",children:["Nieuw (",T.nieuw,")"]}),e.jsxs(H,{value:"gelezen",className:"w-full sm:w-auto",children:["Gelezen (",T.gelezen,")"]}),e.jsxs(H,{value:"behandeld",className:"w-full sm:w-auto",children:["Behandeld (",T.behandeld,")"]}),e.jsxs(H,{value:"alle",className:"w-full sm:w-auto",children:["Alle (",T.alle,")"]})]})}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(fe,{className:"w-4 h-4 absolute left-2.5 top-2.5 text-muted-foreground"}),e.jsx(ae,{className:"pl-8",placeholder:"Zoek op nummer, naam of bericht…",value:f,onChange:a=>v(a.target.value)})]}),c?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(q,{className:"w-4 h-4 animate-spin"})," Laden…"]}):_.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-12 text-center",children:"Geen WhatsApp-gesprekken."}):e.jsx("div",{className:"space-y-4",children:_.map(a=>{const o=x[a.key]??a.messages.length<=3,b=o?a.messages:a.messages.filter((l,p)=>p>=a.messages.length-3||l.status!=="behandeld");return e.jsx(ze,{"data-focus-id":a.last.id,children:e.jsxs(Ee,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Re,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("h3",{className:"text-lg font-semibold",children:a.name}),e.jsx(Se,{status:a.status}),e.jsxs(O,{variant:"secondary",children:[a.messages.length," bericht",a.messages.length===1?"":"en"]}),a.nieuwCount>0&&a.messages.length>1&&e.jsxs(O,{variant:"outline",children:[a.nieuwCount," nieuw"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[a.from_number&&e.jsxs(e.Fragment,{children:[e.jsxs("a",{href:`tel:+${a.from_number}`,className:"hover:underline",children:["+",a.from_number]})," · "]}
13),"Laatste bericht ",new Date(a.last.received_at).toLocaleString("nl-NL")]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.status==="nieuw"&&e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>h(a,"gelezen"),className:"gap-1.5",children:[e.jsx(Pe,{className:"w-4 h-4"})," Gelezen"]}),a.status!=="behandeld"&&e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>h(a,"behandeld"),className:"gap-1.5",children:[e.jsx(ee,{className:"w-4 h-4"})," Behandeld"]}),a.status!=="nieuw"&&e.jsxs(M,{size:"sm",variant:"ghost",onClick:()=>h(a,"nieuw"),className:"gap-1.5",children:[e.jsx(ie,{className:"w-4 h-4"})," Heropenen"]}),s&&e.jsx(M,{size:"sm",variant:"ghost",onClick:()=>E(a),className:"gap-1.5 text-destructive hover:text-destructive",children:e.jsx(Le,{className:"w-4 h-4"})})]})]}),!o&&e.jsxs(M,{size:"sm",variant:"ghost",className:"gap-1.5",onClick:()=>y(l=>({...l,[a.key]:!0})),children:[e.jsx(xt,{className:"w-4 h-4"})," Toon alle ",a.messages.length," berichten"]}),e.jsx("div",{className:"space-y-3",children:b.map(l=>{var V;const p=j[l.id],d=((V=(l.media_path??"").split(".").pop())==null?void 0:V.toLowerCase())??"";let k=l.media_mime??"";k||(["jpg","jpeg","png","webp","gif","heic"].includes(d)?k=`image/${d}`:["mp4","mov","3gp","3gpp","webm"].includes(d)?k=`video/${d}`:["ogg","oga","mp3","m4a","aac","wav","amr"].includes(d)&&(k=`audio/${d}`));const L=k.startsWith("image/")||l.message_type==="image",U=k.startsWith("video/")||l.message_type==="video",K=k.startsWith("audio/")||l.message_type==="audio"||l.message_type==="voice";return e.jsxs("div",{"data-focus-id":l.id,className:`rounded-lg border border-border p-3 space-y-2 ${l.status==="behandeld"?"bg-green-600/5 border-green-600/30":"bg-secondary/20"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:new Date(l.received_at).toLocaleString("nl-NL")}),e.jsx(Se,{status:l.status})]}),e.jsx("div",{className:"flex items-center gap-1",children:l.status!=="behandeld"?e.jsxs(M,{size:"sm",variant:"outline",className:"h-7 gap-1.5 text-xs",onClick:()=>w(l,"behandeld"),children:[e.jsx(ee,{className:"w-3.5 h-3.5"})," Afvinken"]}):e.jsxs(M,{size:"sm",variant:"ghost",className:"h-7 gap-1.5 text-xs",onClick:()=>w(l,"nieuw"),children:[e.jsx(ie,{className:"w-3.5 h-3.5"})," Heropenen"]})})]}),l.body&&e.jsx(Me,{text:l.body}),l.media_path&&!p&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(q,{className:"w-3 h-3 animate-spin"})," Bijlage laden…"]}),l.media_path&&p&&e.jsxs("div",{className:"space-y-2",children:[L&&e.jsx("img",{src:p,alt:"WhatsApp-bijlage",loading:"lazy",className:"w-full max-w-full max-h-80 rounded-lg object-contain bg-muted"}),U&&e.jsx("video",{src:p,controls:!0,playsInline:!0,preload:"metadata",className:"max-h-80 rounded-lg w-full max-w-full bg-muted"}),K&&e.jsx(tt,{src:p}),e.jsx(M,{asChild:!0,size:"sm",variant:"outline",className:"gap-1.5",children:e.jsxs("a",{href:p,download:!0,target:"_blank",rel:"noreferrer",children:[e.jsx(re,{className:"w-4 h-4"})," ",L||U?"Openen / downloaden":"Bijlage downloaden"]})})]})]},l.id)})}),e.jsx(Ae,{table:"whatsapp_messages",id:a.last.id,initialNote:a.last.handling_note,onSaved:l=>n(p=>p.map(d=>d.id===a.last.id?{...d,handling_note:l}:d))})]})},a.key)})})]})}function Se({status:s}){return s==="behandeld"?e.jsxs(O,{className:"bg-green-600 hover:bg-green-600",children:[e.jsx(ee,{className:"w-3 h-3 mr-1"}),"Behandeld"]}):s==="gelezen"?e.jsxs(O,{variant:"outline",children:[e.jsx(Pe,{className:"w-3 h-3 mr-1"}),"Gelezen"]}):e.jsxs(O,{className:"bg-accent text-accent-foreground hover:bg-accent",children:[e.jsx(De,{className:"w-3 h-3 mr-1"}),"Nieuw"]})}function As(){const[s,r]=pt();me();const n=jt(!0),c=s.get("tab"),g=c==="aanvragen"||c==="website"||c==="voicemail"||c==="whatsapp"?c:"storingen",u=m=>{const f=new URLSearchParams(s);f.set("tab",m),r(f,{replace:!0})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ue,{children:[e.jsx("title",{children:"Meldingen — Portaal"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Meldingen"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Alle binnenkomende meldingen vanuit de website op één plek: storingsmeldingen, offerte aanvragen en berichten uit het contactformulier."})]}),e.jsxs(he,{value:g,onValueChange:u,className:"space-y-6",children:[e.jsxs(ge,{className:"h-auto w-full grid grid-cols-2 sm:flex sm:flex-wrap gap-1.5 p-1.5 rounded-2xl bg-muted/60 border border-border/50 backdrop-blur-sm",children:[e.jsxs(H,{value:"storingen",className:"flex-1 sm:flex-none sm:w-auto 
13sm:min-w-0 gap-2 sm:gap-3 px-2 sm:px-4 py-2.5 sm:py-3.5 rounded-xl text-xs sm:text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-background/40 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:border data-[state=active]:border-border transition-all group",children:[e.jsx(vt,{className:"w-4 h-4 sm:w-5 sm:h-5 shrink-0 text-muted-foreground group-hover:text-destructive group-data-[state=active]:text-destructive"}),e.jsxs("span",{className:"font-semibold tracking-tight truncate sm:overflow-visible sm:text-clip sm:whitespace-nowrap",children:[e.jsx("span",{className:"sm:hidden",children:"Storingen"}),e.jsx("span",{className:"hidden sm:inline",children:"Storingsmeldingen"})]}),n.storingen>0&&e.jsx(O,{variant:"destructive",className:"ml-1 h-5 px-1.5 text-[10px]",children:n.storingen})]}),e.jsxs(H,{value:"aanvragen",className:"flex-1 sm:flex-none sm:w-auto sm:min-w-0 gap-2 sm:gap-3 px-2 sm:px-4 py-2.5 sm:py-3.5 rounded-xl text-xs sm:text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-background/40 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:border data-[state=active]:border-border transition-all group",children:[e.jsx(wt,{className:"w-4 h-4 sm:w-5 sm:h-5 shrink-0 text-muted-foreground group-hover:text-accent group-data-[state=active]:text-accent"}),e.jsxs("span",{className:"font-semibold tracking-tight truncate sm:overflow-visible sm:text-clip sm:whitespace-nowrap",children:[e.jsx("span",{className:"sm:hidden",children:"Offertes"}),e.jsx("span",{className:"hidden sm:inline",children:"Offerte aanvragen"})]}),n.offertes>0&&e.jsx(O,{className:"ml-1 h-5 px-1.5 text-[10px] bg-accent text-accent-foreground hover:bg-accent",children:n.offertes})]}),e.jsxs(H,{value:"website",className:"flex-1 sm:flex-none sm:w-auto sm:min-w-0 gap-2 sm:gap-3 px-2 sm:px-4 py-2.5 sm:py-3.5 rounded-xl text-xs sm:text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-background/40 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:border data-[state=active]:border-border transition-all group",children:[e.jsx(bt,{className:"w-4 h-4 sm:w-5 sm:h-5 shrink-0 text-muted-foreground group-hover:text-primary group-data-[state=active]:text-primary"}),e.jsxs("span",{className:"font-semibold tracking-tight truncate sm:overflow-visible sm:text-clip sm:whitespace-nowrap",children:[e.jsx("span",{className:"sm:hidden",children:"Website"}),e.jsx("span",{className:"hidden sm:inline",children:"Website-meldingen"})]}),n.contact>0&&e.jsx(O,{className:"ml-1 h-5 px-1.5 text-[10px] bg-primary text-primary-foreground hover:bg-primary",children:n.contact})]}),e.jsxs(H,{value:"voicemail",className:"flex-1 sm:flex-none sm:w-auto sm:min-w-0 gap-2 sm:gap-3 px-2 sm:px-4 py-2.5 sm:py-3.5 rounded-xl text-xs sm:text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-background/40 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:border data-[state=active]:border-border transition-all group",children:[e.jsx(Te,{className:"w-4 h-4 sm:w-5 sm:h-5 shrink-0 text-muted-foreground group-hover:text-secondary-foreground group-data-[state=active]:text-secondary-foreground"}),e.jsx("span",{className:"font-semibold tracking-tight truncate sm:overflow-visible sm:text-clip sm:whitespace-nowrap",children:"Voicemail"}),n.voicemail>0&&e.jsx(O,{className:"ml-1 h-5 px-1.5 text-[10px] bg-gray-700 text-primary-foreground hover:bg-gray-700",children:n.voicemail})]}),e.jsxs(H,{value:"whatsapp",className:"flex-1 sm:flex-none sm:w-auto sm:min-w-0 gap-2 sm:gap-3 px-2 sm:px-4 py-2.5 sm:py-3.5 rounded-xl text-xs sm:text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-background/40 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm data-[state=active]:border data-[state=active]:border-border transition-all group",children:[e.jsx(Re,{className:"w-4 h-4 sm:w-5 sm:h-5 shrink-0 text-muted-foreground group-hover:text-green-600 group-data-[state=active]:text-green-600"}),e.jsx("span",{className:"font-semibold tracking-tight truncate sm:overflow-visible sm:text-clip sm:whitespace-nowrap",children:"WhatsApp"}),n.whatsapp>0&&e.jsx(O,{className:"ml-1 h-5 px-1.5 text-[10px] bg-green-600 text-primary-foreground hover:bg-green-600",children:n.whatsapp})]})]}),e.jsx(J,{value:"storingen",className:"mt-0",children:e.jsx(Nt,{})}),e.jsx(J,{value:"aanvragen",className:"mt-0",children:e.jsx(yt,{})}),e.jsx(J,{value:"website",className:"mt-0",children:e.jsx(St,{})}),e.jsx(J,{value:"voicemail",className:"mt-0",children:e.jsx(Yt,{})}),e.jsx(J,{value:"whatsapp",className:"mt-0",children:e.jsx(Qt,{})})]})]})}export{As 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.