PageSourceSearch

https://www.amtaxhub.com/marketplace/assets/Workspace-CkLkx8xm.js

js amtaxhub.com collected 2026-09-24 14:38:44 UTC 9,134 bytes, 1 lines download raw bytes

1import{n as e}from"./rolldown-runtime-BwKqro0g.js";import{ct as s,t as a}from"./vendor-D3b6_2ko.js";import{c as t,d as n,f as l,l as i,m as r,p as c,s as d,u as o}from"./index-BYgo_gji.js";var p=e(s(),1),h=a(),u=[["all","All work"],["progress","In progress"],["review","Client review"],["payment","Payment pending"],["overdue","Overdue"],["completed","Completed"]];function m({contracts:e,data:s,session:a,selectedId:n,onSelect:r,title:m="Your work at a glance"}){const[x,j]=(0,p.useState)("all"),[k,v]=(0,p.useState)(""),[,g]=(0,p.useState)(0),b=e.filter(e=>("all"===x||("overdue"===x?t(e):l(e)===x))&&`${e.title} ${e.clientName||""} ${s.providers.find(s=>s.id===e.providerId)?.name||""}`.toLowerCase().includes(k.toLowerCase())),w=e.reduce((e,t)=>e+c(t,s.messages||[],a.id),0);return(0,h.jsxs)("section",{className:"panel workspace-board",children:[(0,h.jsxs)("div",{className:"panel-heading",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{children:"Your next action, in one place"}),(0,h.jsx)("h2",{children:m})]}),(0,h.jsxs)("span",{className:"workspace-new",children:[w," unread messages on this device"]})]}),(0,h.jsxs)("div",{className:"workspace-summary",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:e.filter(d).length}),(0,h.jsx)("span",{children:"Active tasks"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:e.filter(e=>"submitted"===e.status).length}),(0,h.jsx)("span",{children:"Awaiting approval"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:e.filter(t).length}),(0,h.jsx)("span",{children:"Past deadline"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:e.filter(e=>d(e)&&o(e)>0).length}),(0,h.jsx)("span",{children:"Checklists pending"})]})]}),(0,h.jsxs)("label",{className:"workspace-search",children:["Find a client or task",(0,h.jsx)("input",{type:"search",value:k,onChange:e=>v(e.target.value),placeholder:"Search your work…"})]}),(0,h.jsx)("div",{className:"workspace-tabs",role:"group","aria-label":"Filter tasks",children:u.map(([s,a])=>(0,h.jsxs)("button",{type:"button","aria-pressed":x===s,onClick:()=>j(s),children:[a," ",(0,h.jsx)("span",{children:e.filter(e=>"all"===s||("overdue"===s?t(e):l(e)===s)).length})]},s))}),(0,h.jsx)("div",{className:"workspace-tasks",children:b.map(e=>{const l=c(e,s.messages||[],a.id),d=s.providers.find(s=>s.id===e.providerId);return(0,h.jsxs)("button",{type:"button",className:"workspace-task "+(n===e.id?"is-selected":""),onClick:()=>(e=>{i(e,s.messages||[],a.id),g(e=>e+1),r(e.id)})(e),"aria-pressed":n===e.id,children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"workspace-state "+(t(e)?"is-overdue":""),children:t(e)?"Overdue":e.status.replaceAll("_"," ")}),l>0&&(0,h.jsxs)("span",{className:"workspace-new",children:[l," new"]})]}),(0,h.jsx)("h3",{children:e.title}),(0,h.jsx)("p",{children:a.id===e.clientId?d?.name||"Assigned professional":e.clientName||`Client #${e.clientId}`}),(0,h.jsxs)("small",{children:[e.dueDate?`Due ${e.dueDate}`:"Deadline not set"," · ",o(e)," checklist items left"]}),(0,h.jsx)("div",{className:"workspace-progress","aria-label":`${e.progress}% complete`,children:(0,h.jsx)("span",{style:{width:`${Math.min(100,Math.max(0,e.progress))}%`}})}),(0,h.jsxs)("strong",{children:["submitted"===e.status?"Open delivery & review":["awaiting_payment","payment_review"].includes(e.status)?"Open payment & workroom":"Open task & documents"," →"]})]},e.id)})}),!b.length&&(0,h.jsx)("p",{className:"workspace-empty",children:e.length?"No tasks match this filter.":"Your accepted projects will appear here. Start by posting a requirement or responding to a client."})]})}function x({provider:e}){const[s,a]=(0,p.useState)("");if(!e)return null;const t=`${window.location.origin}${n(e)}`;return(0,h.jsxs)("section",{className:"workspace-share panel",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"kicker",children:"Bring your clients with you"}),(0,h.jsx)("h2",{children:"Your expertise. Your client workspace."}),(0,h.jsx)("p",{children:"Share your invitation link. Clients can send you a private requirement, agree a proposal and manage delivery here."}),(0,h.jsx)("a",{href:n(e),target:"_blank",rel:"noreferrer",children:"View your public professional profile →"})]}),(0,h.jsxs)("div",{children:[(0,h.jsxs)("label",{children:["Your private-requirement invitation link",(0,h.jsx)("input",{readOnly:!0,value:t,onF
1ocus:e=>e.target.select()})]}),(0,h.jsx)("button",{className:"button button--navy",type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(t),a("Invitation link copied.")}catch{a("Select the link above and copy it.")}},children:"Copy invitation link"}),(0,h.jsx)("small",{role:"status",children:s||"Existing platform fees and payment rules still apply."})]})]})}function j({contract:e,canEdit:s}){const[a,t]=(0,p.useState)({dueDate:"",checklist:[],documents:[]}),[n,l]=(0,p.useState)(!0),[i,c]=(0,p.useState)(!1),[d,o]=(0,p.useState)(0),[u,m]=(0,p.useState)(!1),[x,j]=(0,p.useState)(""),[k,v]=(0,p.useState)(""),[g,b]=(0,p.useState)(""),[w,y]=(0,p.useState)(null),[f,N]=(0,p.useState)(0);return(0,p.useEffect)(()=>{let s=!0;return l(!0),r.workspace(e.id).then(e=>{s&&(t(e),c(!0),j(""))}).catch(e=>{s&&j(e.message)}).finally(()=>{s&&l(!1)}),()=>{s=!1}},[e.id,d]),(0,h.jsxs)("section",{className:"workroom-files",children:[(0,h.jsxs)("div",{className:"panel-heading",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{children:"Private client records"}),(0,h.jsx)("h2",{children:"Delivery plan & documents"})]}),(0,h.jsx)("button",{className:"button button--outline",type:"button",disabled:u||n,onClick:()=>o(e=>e+1),children:"Reload saved records"})]}),x&&(0,h.jsx)("p",{role:"alert",className:"workspace-error",children:x}),k&&(0,h.jsx)("p",{role:"status",children:k}),n?(0,h.jsx)("p",{children:"Loading your workroom records…"}):i?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:"workspace-plan",children:[(0,h.jsxs)("label",{children:["Agreed deadline",(0,h.jsx)("input",{type:"date",value:a.dueDate,disabled:!s||u,onChange:e=>t({...a,dueDate:e.target.value})})]}),(0,h.jsx)("p",{children:"Set the deadline agreed with the client. Incomplete items appear in the task overview."})]}),(0,h.jsx)("ul",{className:"workspace-checklist",children:a.checklist.map((e,n)=>(0,h.jsxs)("li",{children:[(0,h.jsxs)("label",{children:[(0,h.jsx)("input",{type:"checkbox",checked:e.done,disabled:!s||u,onChange:e=>t({...a,checklist:a.checklist.map((s,a)=>a===n?{...s,done:e.target.checked}:s)})}),(0,h.jsx)("span",{children:e.label})]}),s&&(0,h.jsx)("button",{type:"button",disabled:u,"aria-label":`Remove ${e.label}`,onClick:()=>t({...a,checklist:a.checklist.filter((e,s)=>s!==n)}),children:"Remove"})]},n))}),s&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("form",{className:"workspace-add",onSubmit:e=>{e.preventDefault(),g.trim()&&a.checklist.length<30&&(t({...a,checklist:[...a.checklist,{label:g.trim(),done:!1}]}),b(""))},children:[(0,h.jsx)("label",{className:"sr-only",htmlFor:`checklist-${e.id}`,children:"Checklist item"}),(0,h.jsx)("input",{id:`checklist-${e.id}`,value:g,maxLength:240,onChange:e=>b(e.target.value),placeholder:"e.g. Receive income documents"}),(0,h.jsx)("button",{type:"submit",disabled:u||a.checklist.length>=30,children:"Add item"})]}),(0,h.jsx)("button",{className:"button button--outline",disabled:u,type:"button",onClick:async function(){m(!0),j(""),v("");try{await r.saveWorkspace(e.id,{dueDate:a.dueDate,checklist:a.checklist}),v("Delivery plan saved."),window.dispatchEvent(new Event("marketplace-workspace-updated"))}catch(s){j(s.message)}finally{m(!1)}},children:"Save delivery plan"})]}),!a.checklist.length&&(0,h.jsx)("p",{children:"No checklist has been added by the professional yet."}),(0,h.jsx)("h3",{children:"Shared documents"}),(0,h.jsx)("p",{className:"small",children:"PDF, JPG, PNG or WebP, up to 5 MB each. Accessible only to this contract’s parties and marketplace administration."}),(0,h.jsx)("ul",{className:"workspace-documents",children:a.documents.map(e=>(0,h.jsxs)("li",{children:[(0,h.jsx)("a",{href:`/marketplace/api/index.php?action=document-file&id=${e.id}`,children:e.original_name}),(0,h.jsx)("small",{children:e.created_at})]},e.id))}),!a.documents.length&&(0,h.jsx)("p",{children:"No documents uploaded yet."}),(0,h.jsxs)("form",{className:"workspace-add",onSubmit:async function(s){if(s.preventDefault(),w){m(!0),j(""),v("");try{await r.uploadDocument(e.id,w),t(await r.workspace(e.id)),y(null),N(e=>e+1),v("Document uploaded privately.")}catch(a){j(a.message)}finally{m(!1)}}},children:[(0,h.jsxs)("label",{children:["Upload a client document",(0,h.jsx)("input",{type:"file",accept:".pdf,.jpg,.jpeg,.png,.webp",disabled:u,onChange:e=>{const s=e.target.files?.[0];s?.size>5242880?(j("Choose a file smaller than 5 MB."),y(null)):(j(""),y(s||null))}},f)]}
1),(0,h.jsx)("button",{className:"button button--navy",disabled:u||!w,children:u?"Saving…":"Upload privately"})]})]}):(0,h.jsx)("p",{children:"Records could not be loaded. Use “Reload saved records” to retry."})]})}export{x as ProfileShare,m as TaskBoard,j as WorkroomFiles};

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.