1import{dn as p,dl as e,K as P,a7 as B,a0 as I,cM as W,d3 as A,cA as z,D as y,aO as F,bW as K,cY as R,cs as q,bx as H,aL as U}from"./ui-CuL8nVZ1.js";import{C as T,a as L,c as X,d as Y}from"./card-qRwMiYTp.js";import{L as n}from"./label-CelJkEJu.js";import{S as o,e as x,f as m,a as h,c as t}from"./select-MR0OG1uO.js";import{S as G}from"./separator-BE2iXt3X.js";import{u as J}from"./use-translations-DCRhm25D.js";import{M as Q}from"./module-sidebar-search-BCE3TJrC.js";import{b as Z,A as $}from"./active-filter-chips-BE3ZLfhA.js";import"./index-PzTGnhVK.js";import"./index-DpESdoWP.js";import"./index-CjzWIa3x.js";import"./index-BbdQ0HBX.js";import"./index-Bio3fqE6.js";import"./index-C4Zoahut.js";import"./floating-ui.react-dom-BOQlUy4c.js";import"./index-CSqkHT-8.js";import"./index-wOsjmRLQ.js";import"./index-CSRjkESU.js";import"./scroll-area-CujPUfN3.js";import"./select-scroll-BoHGZSvk.js";import"./app-CqPVFghJ.js";import"./input-5IPz434l.js";import"./badge-DR6wwkOM.js";import"./translate-stage-DOf6pXWt.js";function Ce({filters:r,users:g,stats:c,onFiltersChange:u,pagination:ee}){var f,w,C,k,S;const[l,j]=p.useState(r),[N,D]=p.useState(!1),{t:s}=J();p.useEffect(()=>{j({search:r.search||"",status:r.status||"all",type:r.type||"all",assigned_to:r.assigned_to||"all",due_date:r.due_date||"all",sort_by:r.sort_by||"created_at",sort_order:r.sort_order||"desc",per_page:r.per_page||50})},[r]);const d=(a,i)=>{j(_=>({..._,[a]:i}))},E=p.useCallback((()=>{let a;return i=>{clearTimeout(a),a=setTimeout(()=>{const _={...l,search:i,status:l.status==="all"?"":l.status,type:l.type==="all"?"":l.type,assigned_to:l.assigned_to==="all"?"":l.assigned_to,due_date:l.due_date==="all"?"":l.due_date,page:1};u(_)},500)}})(),[l,u]),b=()=>{const a={...l,status:l.status==="all"?"":l.status,type:l.type==="all"?"":l.type,assigned_to:l.assigned_to==="all"?"":l.assigned_to,due_date:l.due_date==="all"?"":l.due_date,page:1};u(a)},M=()=>{const a={...l,search:""};j(a);const i={...a,search:"",status:a.status==="all"?"":a.status,type:a.type==="all"?"":a.type,assigned_to:a.assigned_to==="all"?"":a.assigned_to,due_date:a.due_date==="all"?"":a.due_date,page:1};u(i)},O=()=>{const a={...l,status:"all",type:"all",assigned_to:"all",due_date:"all",sort_by:"created_at",sort_order:"desc",per_page:50};j(a);const i={search:l.search||"",status:"",type:"",assigned_to:"",due_date:"",sort_by:"created_at",sort_order:"desc",per_page:50,page:1};u(i)},v=r.status&&r.status!=="all"||r.type&&r.type!=="all"||r.assigned_to&&r.assigned_to!=="all"||r.due_date&&r.due_date!=="all",V=p.useMemo(()=>Z(r,{users:g,t:s}),[r,g,s]);return e.jsxs("div",{className:"space-y-2",children:[e.jsx(Q,{value:l.search||"",onChange:a=>{d("search",a),E(a)},onKeyPress:a=>a.key==="Enter"&&b(),hint:s("search_activities_hint","Search activity by subject, description, type, or assigned user."),showClear:!!r.search,onClear:M}),e.jsx(T,{className:"bg-background/60 backdrop-blur-sm border border-border/50 rounded-2xl shadow-sm p-3",children:e.jsxs(L,{className:"px-0",children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium flex items-center gap-2",children:[e.jsx(P,{className:"h-4 w-4 text-primary/70"}),s("activity_overview","Activity Overview")]}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{children:[s("total_activities","Total Activities"),":"]}),e.jsx("span",{className:"font-medium",children:((f=c==null?void 0:c.total)==null?void 0:f.toLocaleString())||"0"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(B,{className:"h-3 w-3 text-orange-500"}),s("pending","Pending"),":"]}),e.jsx("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:((w=c==null?void 0:c.pending)==null?void 0:w.toLocaleString())||"0"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{className:"h-3 w-3 text-green-500"}),s("completed","Completed"),":"]}),e.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:((C=c==null?void 0:c.completed)==null?void 0:C.toLocaleStr
1ing())||"0"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"h-3 w-3 text-red-500"}),s("overdue","Overdue"),":"]}),e.jsx("span",{className:"font-medium text-red-600 dark:text-red-400",children:((k=c==null?void 0:c.overdue)==null?void 0:k.toLocaleString())||"0"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(A,{className:"h-3 w-3 text-gray-500"}),s("cancelled","Cancelled"),":"]}),e.jsx("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:((S=c==null?void 0:c.cancelled)==null?void 0:S.toLocaleString())||"0"})]}),e.jsx(G,{className:"my-2"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3 text-blue-500"}),s("completion_rate","Completion Rate"),":"]}),e.jsxs("span",{className:"font-medium text-blue-600 dark:text-blue-400",children:[(c==null?void 0:c.total)>0?Math.round(c.completed/c.total*100):0,"%"]})]})]})]})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>D(!N),className:"flex items-center gap-2 flex-1 border border-border/50 rounded-2xl",children:[e.jsx(F,{className:"h-4 w-4"}),s("advanced_filters","Advanced Filters"),v&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/20 dark:text-blue-300 rounded",children:s("active","Active")}
1)]})}),v&&e.jsx($,{chips:V}),N&&e.jsxs(T,{className:"border-0 bg-background/60 backdrop-blur-sm border border-border/50 rounded-2xl p-3",children:[e.jsx(X,{className:"px-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Y,{className:"text-xs flex items-center gap-2",children:[e.jsx(F,{className:"h-3 w-3"}),s("filter_options","Filter Options")]}),v&&e.jsxs(y,{variant:"ghost",size:"sm",onClick:O,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground h-7 px-2 text-xs",children:[e.jsx(A,{className:"h-3 w-3"}),s("clear_all","Clear All")]})]})}),e.jsxs(L,{className:"space-y-2 px-0",children:[e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"status",className:"text-xs font-medium",children:s("status","Status")}),e.jsxs(o,{value:l.status,onValueChange:a=>d("status",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{placeholder:s("all_statuses","All statuses")})}),e.jsxs(h,{children:[e.jsx(t,{value:"all",children:s("all_statuses","All statuses")}),e.jsx(t,{value:"pending",children:s("pending","Pending")}),e.jsx(t,{value:"completed",children:s("completed","Completed")}),e.jsx(t,{value:"cancelled",children:s("cancelled","Cancelled")})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"type",className:"text-xs font-medium",children:s("activity_type","Activity Type")}),e.jsxs(o,{value:l.type,onValueChange:a=>d("type",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{placeholder:s("all_types","All types")})}),e.jsxs(h,{children:[e.jsx(t,{value:"all",children:s("all_types","All types")}),e.jsx(t,{value:"call",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:"h-3 w-3 text-blue-600"}),s("call","Call")]})}),e.jsx(t,{value:"meeting",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-3 text-purple-600"}),s("meeting","Meeting")]})}),e.jsx(t,{value:"task",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-3 w-3 text-green-600"}),s("task","Task")]})}),e.jsx(t,{value:"email",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-3 w-3 text-orange-600"}),s("email","Email")]})}),e.jsx(t,{value:"note",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-3 w-3 text-gray-600"}),s("note","Note")]})})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"assigned",className:"text-xs font-medium",children:s("assigned_to","Assigned to")}),e.jsxs(o,{value:l.assigned_to,onValueChange:a=>d("assigned_to",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{placeholder:s("all_users","All users")})}),e.jsxs(h,{children:[e.jsx(t,{value:"all",children:s("all_users","All users")}),(g||[]).map(a=>e.jsx(t,{value:a.id.toString(),children:a.name},a.id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"due_date",className:"text-xs font-medium",children:s("due_date","Due Date")}),e.jsxs(o,{value:l.due_date,onValueChange:a=>d("due_date",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{placeholder:s("all_dates","All dates")})}),e.jsxs(h,{children:[e.jsx(t,{value:"all",children:s("all_dates","All dates")}),e.jsx(t,{value:"overdue",children:s("overdue","Overdue")}),e.jsx(t,{value:"today",children:s("today","Today")}),e.jsx(t,{value:"tomorrow",children:s("tomorrow","Tomorrow")}),e.jsx(t,{value:"this_week",children:s("this_week","This Week")}),e.jsx(t,{value:"next_week",children:s("next_week","Next Week")})]})]})]})]})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:s("sorting_options","Sorting Options")}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"sort_by",className:"text-xs font-medium",children:s("sort_by","Sort by")}),e.jsxs(o,{value:l.sort_by,onValueChange:a=>d("sort_by",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{})}),e.jsxs(h,{children:[e.jsx(t,{value:"created_at",children:s("created_date","Created Date")}),e.jsx(t,{value:"subject",children:s("subject","Subject")}),e.jsx(t,{value:"status",children:s("status","Status")}),e.jsx(t,{value:"type",children:s("type","Type")}),e.jsx(t,{value:"due_date",children:s("due_date","Due Date")}),e.jsx(t,{value:"assigned_to",children:s("assigned_to","Assigned To")})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n,{htmlFor:"sort_order",className:"text-xs font-medium",children:s("order","Order")}),e.jsxs(o,{value:l.sort_order,onValueChange:a=>d("sort_order",a),children:[e.jsx(x,{className:"h-8 text-sm",children:e.jsx(m,{})}),e.jsxs(h,{children:[e.jsx(t,{value:"desc",children:s("descending","Descending")}),e.jsx(t,{value:"asc",children:s("ascending","Ascending")})]})]})]})]})]}),e.jsx("div",{className:"pt-1",children:e.jsx(y,{onClick:b,className:"w-full h-8 text-sm",children:s("apply_filters","Apply Filters")})})]})]})]})}export{Ce 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.