import{v as p,p as k,E as d,u as _,cd as x,j as r}from"./bundle.CHKSNOJF.js";import{g as h,i as c}from"./useProductColumns-DDQWs8XU.js";function g(){const e=p(),[i,u]=k.useState([]);return k.useEffect(()=>{let s=d.clone(e?.settings.pdf_variables.task_columns)||[],a=d.clone(e?.settings.pdf_variables.task_columns)||[];const f=a.length;s.includes("$task.service")||(s=["$task.service",...s],a=["$task.service",...a]),f||s.push("$task.description"),s.includes("$task.rate")||(s.push("$task.rate"),a.push("$task.rate")),s.includes("$task.hours")||(s.push("$task.hours"),a.push("$task.hours"));const n=[],o=e?.enabled_item_tax_rates||0;o>0&&n.push("$task.tax_rate1"),o>1&&n.push("$task.tax_rate2"),o>2&&n.push("$task.tax_rate3");const $=h("$task.tax",a,s);s=c($,n,s),a=c($,n,a),s=s.filter(t=>t!=="$task.tax"),a=a.filter(t=>t!=="$task.tax"),e.enable_product_discount||(s=s.filter(t=>t!=="$task.discount"),a=a.filter(t=>t!=="$task.discount")),e.enable_product_discount&&!s.includes("$task.discount")&&(s.push("$task.discount"),a.push("$task.discount")),["task1","task2","task3","task4"].forEach(t=>{e?.custom_fields[t]&&!a.includes(`$task.${t}`)&&(s=c(s.length,[`$task.${t}`],s)),!e?.custom_fields[t]&&a.includes(`$task.${t}`)&&(s=s.filter(l=>l!==`$task.${t}`),a=a.filter(l=>l!==`$task.${t}`))}),s.includes("$task.tax_amount")&&(s=s.filter(t=>t!=="$task.tax_amount"),s.push("$task.tax_amount")),s.includes("$task.gross_line_total")&&(s=s.filter(t=>t!=="$task.gross_line_total"),s.push("$task.gross_line_total")),s.includes("$task.line_total")&&(s=s.filter(t=>t!=="$task.line_total"),s.push("$task.line_total")),u(s)},[e]),i}function v({lineItems:e}){const[i]=_(),u=k.useMemo(()=>e.filter(s=>s.type_id===x.Task).reduce((s,a)=>s+a.quantity,0),[e]);return u?r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("span",{children:i("tasks")}),r.jsxs("span",{className:"font-medium",children:["(",Math.round(u)," h)"]})]}):r.jsx("span",{children:i("tasks")})}export{v as T,g as u};
