PageSourceSearch

https://taxease360.ai/assets/TaxTasks-Bz0QEJRU.js

js taxease360.ai collected 2026-10-05 14:25:53 UTC 7,096 bytes, 1 lines download raw bytes

1import{r as n,p as o,j as t,q as S,t as P,a5 as W,w as c,I as _,E as C,C as Y,z as q,a1 as Q}from"./index-CfXbMZ_V.js";import{P as G}from"./PortalHeader-BREe-gcq.js";import{T as J}from"./textarea-D5CbgVJ9.js";import{D as K,f as X,a as Z,b as k,c as ee}from"./dialog-D3H816yE.js";import{M as h}from"./MobileSelect-DpkP9x0T.js";import{F as te}from"./flag-BXnP9JYZ.js";import{P as se}from"./pencil-DCKB3rA6.js";import"./chevron-left-BFeklwt6.js";import"./use-mobile-B8OYdRMq.js";import"./select-BB6bDIs2.js";import"./index-BU0D2mz3.js";const w={Low:"bg-gray-100 text-gray-600",Medium:"bg-blue-100 text-blue-700",High:"bg-orange-100 text-orange-700",Urgent:"bg-red-100 text-red-700"},ie=["Low","Medium","High","Urgent"],ae=["Pending","In Progress","Completed"],A={Pending:"bg-amber-100 text-amber-700","In Progress":"bg-blue-100 text-blue-700",Completed:"bg-green-100 text-green-700"};function he(){const[D,d]=n.useState([]),[u,O]=n.useState([]),[M,I]=n.useState(!0),[f,L]=n.useState("All"),[j,z]=n.useState("All"),[E,p]=n.useState(!1),[x,N]=n.useState(null),[b,y]=n.useState(!1),[a,v]=n.useState({title:"",description:"",client_id:"",due_date:"",priority:"Medium",status:"Pending",assigned_to:""});n.useEffect(()=>{H()},[]);const H=async()=>{var e;try{const s=await o.functions.invoke("loadStaffClients"),i=((e=s==null?void 0:s.data)==null?void 0:e.clients)||[],l=new Set(i.map(g=>g.id));O(i);const m=await o.entities.Task.list();d(m.filter(g=>!g.client_id||l.has(g.client_id)))}catch{}I(!1)},R=e=>{var s;return((s=u.find(i=>i.id===e))==null?void 0:s.full_name)||"Unassigned"},F=()=>{N(null),v({title:"",description:"",client_id:"",due_date:"",priority:"Medium",status:"Pending",assigned_to:""}),p(!0)},U=e=>{N(e),v({title:e.title||"",description:e.description||"",client_id:e.client_id||"",due_date:e.due_date||"",priority:e.priority||"Medium",status:e.status||"Pending",assigned_to:e.assigned_to||""}),p(!0)},V=async()=>{if(a.title){y(!0);try{if(x){const e=u.find(i=>i.id===a.client_id),s=await o.entities.Task.update(x.id,{...a,owner_user_id:e==null?void 0:e.user_id});d(i=>i.map(l=>l.id===x.id?s:l))}else{const e=u.find(i=>i.id===a.client_id),s=await o.entities.Task.create({...a,owner_user_id:e==null?void 0:e.user_id});d(i=>[s,...i])}p(!1)}catch{}y(!1)}},$=async e=>{const s=e.status==="Completed"?"Pending":"Completed";d(i=>i.map(l=>l.id===e.id?{...l,status:s}:l));try{await o.entities.Task.update(e.id,{status:s})}catch{d(l=>l.map(m=>m.id===e.id?{...m,status:e.status}:m))}},B=async e=>{d(s=>s.filter(i=>i.id!==e));try{await o.entities.Task.delete(e)}catch{}},T=D.filter(e=>(f==="All"||e.status===f)&&(j==="All"||e.client_id===j)),r=(e,s)=>v(i=>({...i,[e]:s}));return M?t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx(S,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):t.jsxs("div",{className:"space-y-5 pb-10",children:[t.jsx(G,{title:"Tax Tasks",subtitle:"Deadlines & follow-ups",backTo:"/portal"}),t.jsxs(K,{open:E,onOpenChange:p,children:[t.jsx(X,{asChild:!0,children:t.jsxs(P,{onClick:F,className:"w-full gap-2",children:[t.jsx(W,{size:16})," New Task"]})}),t.jsxs(Z,{children:[t.jsx(k,{children:t.jsx(ee,{children:x?"Edit Task":"Create Task"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Title *"}),t.jsx(_,{value:a.title,onChange:e=>r("title",e.target.value),placeholder:"e.g. Lodge BAS Q1"})]}),t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Assign to Client"}),t.jsx(h,{value:a.client_id,onValueChange:e=>r("client_id",e),placeholder:"Select client",options:u.map(e=>({value:e.id,label:e.full_name}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Due Date"}),t.jsx(_,{type:"date",value:a.due_date,onChange:e=>r("due_date",e.target.value)})]}),t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Priority"}),t.jsx(h,{value:a.priority,onValueChange:e=>r("priority",e),placeholder:"Priority",options:ie.map(e=>({value:e,label:e}))})]})]}),t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Assigned To (staff)"}),t.jsx(_,{value:a.assigned_to,onChange:e=>r("assigned_to",e.target.value),placeholder:"Accountant name"})]}),t.jsxs("div",{children:[t.jsx(c,{className:"text-xs",children:"Description"}),t.jsx(J,{rows:2,value:a.description,onChange:e=>r("description",e.target.value),placeholder:"Task details"})]}),t.jsxs(P,{onClick:V,disabled:!a.title||b,className:"w-full gap-2",children:[b?t.jsx(S,{size:15,className:"animate-spin"}):null,x?"Save Changes":"Create Task"]})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx(h,{value:f,onValueChange:L,placeholder:"All statuses",options:[{value:"All",label:"All Statuses"},...ae.map(e=>({value:e,label:e}))]}),t.jsx(h,{value:j,onValueChange:z,placeholder:"All clients",options:[{value:"All",label:"All Clients"},...u.map(e=>({value:e.id,label:e.full_name}))]})]}),T.length===0?t.jsx("div",{className:"text-center py-12 text-muted-foreground",children:t.jsx("p",{className:"text-sm",children:"No tasks foun
1d"})}):t.jsx("div",{className:"space-y-2",children:T.map(e=>{const s=e.due_date&&e.status!=="Completed"&&C(e.due_date).isBefore(C(),"day");return t.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("button",{onClick:()=>$(e),className:"mt-0.5 shrink-0",style:{minHeight:32,minWidth:32},"aria-label":"Toggle complete",children:t.jsx(Y,{size:20,className:e.status==="Completed"?"text-green-600":"text-gray-300"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:`text-sm font-medium ${e.status==="Completed"?"text-muted-foreground line-through":"text-foreground"}`,children:e.title}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.description}),t.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:R(e.client_id)}),e.due_date&&t.jsxs("span",{className:`inline-flex items-center gap-0.5 text-[10px] font-medium ${s?"text-red-600":"text-muted-foreground"}`,children:[t.jsx(q,{size:10})," ",C(e.due_date).format("D MMM"),s?" · overdue":""]}),t.jsxs("span",{className:`inline-flex items-center gap-0.5 text-[10px] font-medium px-1.5 py-0.5 rounded-full ${w[e.priority]||w.Medium}`,children:[t.jsx(te,{size:9})," ",e.priority]}),t.jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded-full ${A[e.status]||A.Pending}`,children:e.status})]})]}),t.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[t.jsx("button",{onClick:()=>U(e),className:"text-muted-foreground hover:text-foreground rounded",style:{minHeight:32,minWidth:32},children:t.jsx(se,{size:14,className:"mx-auto"})}),t.jsx("button",{onClick:()=>B(e.id),className:"text-muted-foreground hover:text-red-500 rounded",style:{minHeight:32,minWidth:32},children:t.jsx(Q,{size:14,className:"mx-auto"})})]})]})},e.id)})})]})}export{he 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.