PageSourceSearch

https://autosleutelspecialist.lovable.app/assets/TasksPage-D14jQLv0.js

js autosleutelspecialist.lovable.app collected 2026-10-03 03:23:54 UTC 5,055 bytes, 1 lines download raw bytes

1import{j as e,H as _,g as w,ac as k,ad as T,h as b,aj as C,ak as D,al as l,an as d,bp as S,a as I,r as L,p as q,E as f,B as u,w as F,a9 as O,br as g,e as B,a$ as K,d as v,bF as A,s as x,bs as N}from"./index-hWVpbWs7.js";import{T as H}from"./TenantBadge-C9kCLeMG.js";const z={low:"secondary",normal:"outline",high:"default",urgent:"destructive"};function E(t){const c=new Date().toISOString(),i=(()=>{const s=new Date;return s.setHours(23,59,59,999),s.toISOString()})();return s=>t==="today"?s.eq("status","open").lte("due_at",i):t==="overdue"?s.eq("status","open").lt("due_at",c):t==="upcoming"?s.eq("status","open").gt("due_at",i):s.in("status",["done","dismissed"])}function o({scope:t}){const c=S(),{toast:i}=I(),[s,p]=L.useState(null),{data:m,isLoading:y}=q({queryKey:["comm-followup-tasks",t],queryFn:async()=>{const a=x.from("comm_follow_up_tasks").select("id, conversation_id, customer_id, title, description, due_at, status, priority, source, created_at, completed_at, conversation:comm_conversations(brand_label)").order("due_at",{ascending:t!=="done",nullsFirst:!1}).limit(1e4),{data:n,error:r}=await E(t)(a);if(r)throw r;return n??[]},refetchInterval:2e4}),h=async(a,n)=>{p(a);const{data:{user:r}}=await x.auth.getUser(),{error:j}=await x.from("comm_follow_up_tasks").update({status:n,completed_at:new Date().toISOString(),completed_by:(r==null?void 0:r.id)??null}).eq("id",a);p(null),j?i({title:"Fout",description:j.message,variant:"destructive"}):(i({title:n==="done"?"Taak afgerond":"Taak verwijderd"}),c.invalidateQueries({queryKey:["comm-followup-tasks"]}))};return y?e.jsx("div",{className:"text-sm text-muted-foreground p-6",children:"Laden…"}):!m||m.length===0?e.jsxs("div",{className:"text-sm text-muted-foreground p-6 flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4 text-emerald-500"}),"Geen taken in deze categorie."]}):e.jsx("div",{className:"space-y-2",children:m.map(a=>{var n;return e.jsx(w,{className:"border-border/60",children:e.jsxs(b,{className:"p-4 flex items-start gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(H,{brandLabel:(n=a.conversation)==null?void 0:n.brand_label}),e.jsx(u,{variant:z[a.priority]??"outline",className:"text-[10px]",children:a.priority}),e.jsx(u,{variant:"outline",className:"text-[10px]",children:a.source}),a.source==="ai"&&e.jsx(u,{variant:"secondary",className:"text-[10px]",children:"AI"}),e.jsx("span",{className:"font-medium text-foreground truncate",children:a.title})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:a.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[a.due_at&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(F,{className:"h-3 w-3"}),new Date(a.due_at)<new Date&&t!=="done"?e.jsxs("span",{className:"text-destructive font-medium inline-flex items-center gap-1",children:[e.jsx(O,{className:"h-3 w-3"}),g(new Date(a.due_at),{locale:N,addSuffix:!0})]}):e.jsx(e.Fragment,{children:g(new Date(a.due_at),{locale:N,addSuffix:!0})})]}),a.conversation_id&&e.jsxs(B,{to:`/admin/communicatie/conversaties/${a.conversation_id}`,className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(K,{className:"h-3 w-3"}),"Open gesprek"]})]})]}),t!=="done"&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs(v,{size:"sm",variant:"outline",disabled:s===a.id,onClick:()=>h(a.id,"done"),className:"h-8",children:[e.jsx(f,{className:"h-3.5 w-3.5 mr-1"})," Klaar"]}),e.jsxs(v,{size:"sm",variant:"ghost",disabled:s===a.id,onClick:()=>h(a.id,"dismissed"),className:"h-8 text-muted-foreground",children:[e.jsx(A,{className:"h-3.5 w-3.5 mr-1"})," Negeer"]})]})]})},a.id)})})}function $(){return e.jsxs("div",{className:"container mx-auto py-6 max-w-5xl",children:[e.jsx(_,{children:e.jsx("title",{children:"Communicatie · Taken · Autosleutel Limburg"})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Communicatie · Taken"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Door AI of admins aangemaakte opvolgtaken per gesprek."})]}),e.jsxs(w,{children:[e.jsx(k,{className:"pb-2",children:e.jsx(T,{className:"text-base",children:"Inbox van opvolgwerk"})}),e.jsx(b,{children:e.jsxs(C,{defaultValue:"today",className:"w-full",children:[e.jsxs(D,{className:"grid w-full max-w-md grid-cols-4",children:[e.jsx(l,{value:"today",children:"Vandaag"}),e.jsx(l,{value:"overdue",children:"Overdue"}),e.jsx(l,{value:"upcoming",children:"Komende"}),e.jsx(l,{value:"done",children:"Klaar"})]}),e.jsx(d,{value:"today",className:"mt-4",children:e.jsx(o,{scope:"today"})}),e.jsx(d,{value:"overdue",className:"mt-4",children:e.jsx(o,{scope:"overdue"})}),e.jsx(d,{value:"upcoming",className:"mt-4",children:e.jsx(o,{scope:"upcoming"})}),e.jsx(d,{value:"done",className:"mt-4",children:e.jsx(o,{scope:"done"})})]})})]})]})}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.