@accounter/client
Version:
Accounter client application
1 lines • 39.3 kB
JavaScript
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{Ar as r,Fr as i,G as a,H as o,K as s,Mr as c,Nr as l,Pr as u,Ta as d,U as f,W as p,a as m,ca as h,cn as g,ei as _,es as v,k as y,kr as b,ni as x,q as S,r as C,s as w,sa as T,t as E,ts as D,wa as ee,y as te}from"./error-handling-Bgq5bXpB.js";import{_ as ne,s as re,t as O,y as ie}from"./routes-Cawu7UJi.js";import{n as ae,t as k}from"./loader-circle-CfW9jOIr.js";import{Ar as A,H as oe,Mr as se,Pr as ce,Rr as le,gr as ue}from"./common-DXImSOXZ.js";import{i as j,n as de,o as fe,r as M,t as pe}from"./progress-DJCca4pX.js";import{a as me,ft as he,i as ge,n as N,o as _e,pt as ve,r as P,t as F}from"./select-CGkwaf8-.js";import{t as I}from"./circle-alert-DoKa27yc.js";import{t as ye}from"./circle-check-Cq288m4n.js";import{t as be}from"./download-B7064n9W.js";import{c as xe,o as Se}from"./separator-B1NtWEAX.js";import{t as L}from"./info-CxIWs3QN.js";import{n as Ce,r as we,t as Te}from"./upload-Cp9YJMo1.js";import{t as R}from"./button-DUNsVBiu.js";import{$c as Ee,Bc as z,Ul as De}from"./table-BMPR7vqs.js";import{a as B,i as Oe,n as V,o as ke,r as Ae,t as H}from"./card-DR4aRSHr.js";import{n as U,r as W,t as G}from"./alert-55QsYEfR.js";import{t as je}from"./page-layout-DG1n0oMy.js";import{n as Me}from"./charges-ledger-validation-dsm8h-CB.js";var Ne=ae(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Pe=ae(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),K=e(n(),1),Fe=`setAnnualAuditStepStatus`,Ie=()=>{let[{fetching:e},t]=v(h);return{fetching:e,setStepStatus:(0,K.useCallback)(async e=>{let{stepId:n,ownerId:r,year:i}=e.input,a=e.input.status===p.Completed,o=`Error updating step ${n} status`,s=`${Fe}-${r}-${i}-${n}`;C.loading(a?`Marking as done...`:`Updating step status...`,{id:s});try{let n=await t(e),r=E(n,o,s);return r?(C.success(a?`Step marked as done`:`Step status updated`,{id:s}),r.setAnnualAuditStepStatus):void 0}catch(e){console.error(`${o}: ${e}`),C.error(`Error`,{id:s,description:o});return}},[t])}},q=t(),Le=e=>{switch(e){case`completed`:return(0,q.jsx)(ye,{className:`h-5 w-5 text-green-600`});case`in-progress`:return(0,q.jsx)(le,{className:`h-5 w-5 text-blue-600`});case`pending`:return(0,q.jsx)(le,{className:`h-5 w-5 text-gray-400`});case`blocked`:return(0,q.jsx)(I,{className:`h-5 w-5 text-red-600`});case`loading`:return(0,q.jsx)(k,{className:`h-5 w-5 text-gray-400 animate-spin`})}},Re=e=>(0,q.jsx)(z,{variant:{completed:`default`,"in-progress":`secondary`,pending:`outline`,blocked:`destructive`,loading:`outline`}[e],children:{completed:`Completed`,"in-progress":`In Progress`,pending:`Pending`,blocked:`Blocked`,loading:`Loading...`}[e]}),ze=({children:e,ref:t,level:n})=>(0,q.jsx)(`div`,{ref:t,className:`${n>0?`ml-6 border-l-2 border-gray-200 pl-4`:``} relative`,children:e});function J({id:e,ref:t,title:n,description:r,icon:i,status:a,statusIndicator:o,actions:s,children:c,footer:l,isExpanded:u,onToggleExpanded:d,level:f=0,disabled:p=!1,manualData:m}){let h=(0,K.useMemo)(()=>{if(Array.isArray(m))return m.find(t=>t.stepId===e)},[m,e])?.notes??null;return(0,q.jsxs)(ze,{ref:t,level:f,children:[(0,q.jsxs)(H,{className:`mb-4`,children:[(0,q.jsx)(B,{className:`pb-3`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[u==null?(0,q.jsx)(`div`,{className:`w-4`}):(0,q.jsx)(R,{disabled:p,variant:`ghost`,size:`sm`,onClick:d,className:`p-0 h-auto`,children:u?(0,q.jsx)(ve,{className:`h-4 w-4`}):(0,q.jsx)(he,{className:`h-4 w-4`})}),Le(a),i,(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(ke,{className:`text-lg`,children:[e,`. `,n]}),r&&(0,q.jsx)(Ae,{className:`mt-1`,children:r})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o,Re(a)]})]})}),s&&s.length>0&&(0,q.jsx)(V,{className:`pt-0`,children:(0,q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map((e,t)=>(0,q.jsx)(R,{variant:`outline`,size:`sm`,disabled:e.disabled||p,onClick:e.onClick,asChild:!!e.href&&!p&&!e.disabled,children:e.href?(0,q.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}),(l||h)&&(0,q.jsxs)(Oe,{className:`flex flex-col gap-2 items-start`,children:[l,h&&(0,q.jsxs)(`div`,{className:`mt-2 text-sm text-muted-foreground`,children:[`Notes: `,h]})]}),c]}),p&&(0,q.jsx)(H,{className:`absolute inset-0 bg-gray-500 opacity-50 pointer-events-auto z-10 ${f>0?`ml-4`:``}`})]})}function Y(e){switch(e){case p.Completed:return`completed`;case p.InProgress:return`in-progress`;case p.Blocked:return`blocked`;default:return`pending`}}var Be=[p.Pending,p.InProgress,p.Completed];function X({ownerId:e,stepId:t,year:n,initialStatus:r,initialNotes:i,onSaved:a}){let[o,s]=(0,K.useState)(r??p.Pending),[c,l]=(0,K.useState)(i??``),{fetching:u,setStepStatus:d}=Ie();(0,K.useEffect)(()=>{s(r??p.Pending)},[r]),(0,K.useEffect)(()=>{l(i??``)},[i]);let f=(0,K.useCallback)(async()=>{let r=await d({input:{ownerId:e,year:n,status:o,notes:c||null,stepId:t}});r&&a(Y(r.status))},[d,e,n,o,c,t,a]);return(0,q.jsxs)(H,{className:`mt-3 pl-4`,children:[(0,q.jsxs)(B,{className:`pb-2 pt-3 px-3`,children:[(0,q.jsx)(`div`,{className:`w-4`}),(0,q.jsx)(ke,{className:`text-lg`,children:`Accountant Approval`})]}),(0,q.jsxs)(V,{className:`px-3 pb-3 pt-0 space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(_e,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,q.jsxs)(F,{value:o,onValueChange:e=>s(e),children:[(0,q.jsx)(ge,{className:`h-8 w-48 text-xs`,children:(0,q.jsx)(me,{})}),(0,q.jsx)(N,{children:Be.map(e=>(0,q.jsx)(P,{value:e,className:`text-xs`,children:e.replace(`_`,` `)},e))})]})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(_e,{className:`text-xs text-muted-foreground`,children:`Notes (optional)`}),(0,q.jsx)(Se,{value:c,onChange:e=>l(e.target.value),rows:2,className:`text-xs`,placeholder:`Add any review notes...`})]}),(0,q.jsx)(R,{size:`sm`,className:`w-fit`,disabled:u,onClick:f,children:u?`Saving...`:`Save Approval`})]})]})}function Ve(e){let[t,n]=(0,K.useState)(`loading`),[r,i]=(0,K.useState)({approvedPercentage:0,pendingPercentage:0,unapprovedPercentage:100,totalCharges:1,approvedCount:0,pendingCount:0,unapprovedCount:1}),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(void 0),{adminBusinessId:d,id:f,onStatusChange:p,year:h}=e,[{data:_,fetching:v,error:y},b]=D({query:m,variables:{fromDate:`${h}-01-01`,toDate:`${h}-12-31`},pause:!0}),x=(0,K.useCallback)(async()=>{await b()},[b]),S=(0,K.useMemo)(()=>{if(Array.isArray(e.manualData))return e.manualData.find(e=>e.stepId===f)},[e.manualData,f]),C=(0,K.useMemo)(()=>{let e=S?.status;if(e)return Y(e)},[S]);(0,K.useEffect)(()=>{d&&!C&&!v&&!_&&!y&&x()},[d,C,v,_,y,x]);let T=S?.notes??null;(0,K.useEffect)(()=>{C&&u(C)},[C]),(0,K.useEffect)(()=>{let e=l??t;p&&p(f,e),e===`completed`&&!s?c(!0):e!==`completed`&&s&&c(!1)},[t,l,p,f,s]),(0,K.useEffect)(()=>{d?v&&!C&&n(`loading`):n(`blocked`)},[d,v,C]),(0,K.useEffect)(()=>{if(_?.accountantApprovalStatus){let{totalCharges:e,approvedCount:t,pendingCount:r,unapprovedCount:a}=_.accountantApprovalStatus,o={approvedPercentage:t/e*100||0,pendingPercentage:r/e*100||0,unapprovedPercentage:a/e*100||0,totalCharges:e,approvedCount:t,pendingCount:r,unapprovedCount:a};i(o),o.pendingPercentage===0&&o.unapprovedPercentage===0?n(`completed`):o.pendingPercentage+o.unapprovedPercentage<30?n(`in-progress`):n(`pending`)}},[_]);let E=(0,K.useMemo)(()=>O.CHARGES.ALL({byOwners:d?[d]:void 0,fromAnyDate:`${h}-01-01`,toAnyDate:`${h}-12-31`,accountantStatus:[w.Pending,w.Unapproved],sortBy:{field:g.Date,asc:!1}}),[d,h]),ee=(0,K.useMemo)(()=>C?[{label:`Review Charges`,href:E},{label:`Revalidate`,onClick:x,disabled:v}]:[{label:`Review Charges`,href:E}],[C,E,x,v]),te=l??t,ne=l&&l!==t;return(0,q.jsx)(J,{...e,status:te,statusIndicator:v?(0,q.jsx)(k,{className:`h-5 w-5 animate-spin text-muted-foreground`}):ne?(0,q.jsx)(z,{variant:`outline`,className:`text-xs border-blue-200 text-blue-700`,children:`Manual override`}):void 0,icon:(0,q.jsx)(se,{className:`h-4 w-4`}),actions:ee,isExpanded:a,footer:(0,q.jsxs)(`div`,{className:`w-full flex items-center gap-2 pt-2 border-t`,children:[(0,q.jsx)(`span`,{className:`text-sm font-medium`,children:`Charge Validation Details`}),(0,q.jsxs)(z,{variant:`outline`,className:`text-xs`,children:[r.pendingCount+r.unapprovedCount,` need attention`]})]}),onToggleExpanded:()=>o(e=>!e),children:(0,q.jsx)(M,{open:a,children:(0,q.jsxs)(j,{children:[(0,q.jsx)(V,{className:`pt-0`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex justify-between items-center text-sm`,children:[(0,q.jsx)(`span`,{className:`font-medium`,children:`Charge Review Progress`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[r.totalCharges.toLocaleString(),` total charges`]}),(0,q.jsx)(R,{variant:`ghost`,size:`sm`,onClick:x,disabled:t===`loading`,children:`Refresh`})]})]}),(0,q.jsxs)(`div`,{className:`relative h-6 bg-gray-200 rounded-full overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`absolute left-0 top-0 h-full bg-green-500 transition-all duration-300`,style:{width:`${r.approvedPercentage}%`}}),(0,q.jsx)(`div`,{className:`absolute top-0 h-full bg-orange-500 transition-all duration-300`,style:{left:`${r.approvedPercentage}%`,width:`${r.pendingPercentage}%`}}),(0,q.jsx)(`div`,{className:`absolute top-0 h-full bg-red-500 transition-all duration-300`,style:{left:`${r.approvedPercentage+r.pendingPercentage}%`,width:`${r.unapprovedPercentage}%`}})]}),(0,q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 text-sm`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-3 h-3 bg-green-500 rounded-full`}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`font-medium text-green-700`,children:[`Approved (`,r.approvedPercentage.toFixed(2),`%)`]}),(0,q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.approvedCount.toLocaleString(),` charges`]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-3 h-3 bg-orange-500 rounded-full`}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`font-medium text-orange-700`,children:[`Pending (`,r.pendingPercentage.toFixed(2),`%)`]}),(0,q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.pendingCount.toLocaleString(),` charges`]})]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`w-3 h-3 bg-red-500 rounded-full`}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`font-medium text-red-700`,children:[`Unapproved (`,r.unapprovedPercentage.toFixed(2),`%)`]}),(0,q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.unapprovedCount.toLocaleString(),` charges`]})]})]})]})]}),(r.pendingPercentage>0||r.unapprovedPercentage>0)&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-orange-50 rounded-lg border border-orange-200`,children:[(0,q.jsx)(I,{className:`h-4 w-4 text-orange-600`}),(0,q.jsxs)(`span`,{className:`text-sm text-orange-800`,children:[r.pendingCount+r.unapprovedCount,` charges need review before proceeding`]})]})]})}),d&&(0,q.jsx)(`div`,{className:`px-6 pb-4 pt-2 border-t`,children:(0,q.jsx)(X,{ownerId:d,year:h,stepId:f,initialStatus:S?.status??void 0,initialNotes:T,onSaved:e=>u(e)})})]})})})}function He(e){let[t,n]=(0,K.useState)(`blocked`),[r,i]=(0,K.useState)(1/0),[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(void 0),{year:l,adminBusinessId:u,onStatusChange:d,id:f}=e,[{data:p,fetching:m,error:h},_]=D({query:x,variables:{filters:{byOwners:u?[u]:[],fromAnyDate:`${l}-01-01`,toAnyDate:`${l}-12-31`}},pause:!0}),v=(0,K.useMemo)(()=>{if(Array.isArray(e.manualData))return e.manualData.find(e=>e.stepId===f)},[e.manualData,f]),y=(0,K.useMemo)(()=>{let e=v?.status;if(e)return Y(e)},[v]),b=v?.notes??null;(0,K.useEffect)(()=>{y&&c(y)},[y]),(0,K.useEffect)(()=>{d&&d(f,s??t)},[t,s,d,f]),(0,K.useEffect)(()=>{!p&&!m&&!h&&u&&!y&&_()},[p,m,h,u,y,_]),(0,K.useEffect)(()=>{m&&n(`loading`)},[m]),(0,K.useEffect)(()=>{if(p?.chargesWithLedgerChanges){let e=p.chargesWithLedgerChanges.filter(e=>!!e.charge?.id).length;i(e),n(e===0?`completed`:`in-progress`)}},[p]);let S=(0,K.useMemo)(()=>Me({byOwners:u?[u]:void 0,fromAnyDate:`${l}-01-01`,toAnyDate:`${l}-12-31`,sortBy:{field:g.Date,asc:!1}}),[u,l]),C=(0,K.useMemo)(()=>y?[{label:`View Ledger Status`,href:S},{label:`Revalidate`,onClick:_,disabled:m}]:[{label:`View Ledger Status`,href:S}],[y,S,_,m]),w=s??t,T=s&&s!==t;return(0,q.jsxs)(J,{...e,status:w,statusIndicator:m?(0,q.jsx)(k,{className:`h-5 w-5 animate-spin text-muted-foreground`}):T?(0,q.jsx)(z,{variant:`outline`,className:`text-xs border-blue-200 text-blue-700`,children:`Manual override`}):void 0,icon:(0,q.jsx)(ue,{className:`h-4 w-4`}),actions:C,isExpanded:a,onToggleExpanded:()=>o(e=>!e),children:[r>0&&!y&&(0,q.jsx)(V,{className:`p-2 border-t`,children:m?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-gray-50 rounded-lg border border-gray-200 animate-pulse`,children:[(0,q.jsx)(ue,{className:`h-4 w-4 text-gray-400`}),(0,q.jsx)(`div`,{className:`flex-1`,children:(0,q.jsx)(`span`,{className:`text-sm text-gray-600 font-medium`,children:`Checking for pending ledger changes...`})})]}):(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-red-50 rounded-lg border border-red-200`,children:[(0,q.jsx)(Ce,{className:`h-4 w-4 text-red-600`}),(0,q.jsx)(`div`,{className:`flex-1`,children:(0,q.jsx)(`span`,{className:`text-sm text-red-800 font-medium`,children:r===1/0?`Trigger revalidation manually`:`${r} pending ledger change${r>1?`s`:``} detected`})}),(0,q.jsx)(z,{variant:`destructive`,className:`text-xs`,children:`Action Required`})]})}),(0,q.jsx)(M,{open:a,children:(0,q.jsx)(j,{children:u&&(0,q.jsx)(`div`,{className:`px-6 pb-4 pt-2 border-t`,children:(0,q.jsx)(X,{ownerId:u,year:l,stepId:f,initialStatus:v?.status??void 0,initialNotes:b,onSaved:e=>c(e)})})})})]})}function Ue({year:e,adminBusinessId:t,balanceChargeId:n}){let r=O.REPORTS.DYNAMIC_REPORT({fromDate:`${e-1}-01-01`,toDate:`${e-1}-12-31`,ownerIds:[t]}),[i,a]=(0,K.useState)(!1);return(0,q.jsx)(J,{id:`3a`,title:`Enter Opening Balances`,description:`Create a balance charge and save the opening balance snapshot template to import prior-year balances`,status:n?`completed`:`pending`,level:1,actions:[n?{label:`Balance Charge`,href:O.CHARGES.DETAIL(n)}:{label:`Create Balance Charge`,onClick:()=>a(!0)},{label:`Upload Dynamic Report`,href:r,disabled:!0}],disabled:!1,manualData:[],children:(0,q.jsx)(de,{open:i,onOpenChange:a,onClose:()=>a(!1)})})}function We(e){let[t,n]=(0,K.useState)(!1),[r,i]=(0,K.useState)(null),{adminBusinessId:a,id:s,onStatusChange:c,year:l}=e,[{data:u,fetching:d,error:p}]=D({query:o,variables:{ownerId:a,year:l},pause:!a}),m=(0,K.useMemo)(()=>{if(Array.isArray(e.manualData))return e.manualData.find(e=>e.stepId===s)},[e.manualData,s]),h=(0,K.useMemo)(()=>{let e=m?.status;if(e)return Y(e)},[m]),g=m?.notes??null;(0,K.useEffect)(()=>{i(h??null)},[h]);let _=(0,K.useMemo)(()=>a?d?`loading`:p||!u?.annualAuditOpeningBalanceStatus?`pending`:Y(u.annualAuditOpeningBalanceStatus.derivedStatus):`blocked`,[a,d,p,u]),v=r??_;(0,K.useEffect)(()=>{c?.(s,v)},[v,c,s]);let y=u?.annualAuditOpeningBalanceStatus;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{...e,status:v,icon:(0,q.jsx)(fe,{className:`h-4 w-4`}),isExpanded:t,onToggleExpanded:()=>n(!t)}),a&&(0,q.jsx)(M,{open:t,children:(0,q.jsxs)(j,{className:`space-y-2 pt-2`,children:[y?.userType===f.Error&&(0,q.jsxs)(G,{variant:`destructive`,className:`ml-8`,children:[(0,q.jsx)(I,{className:`h-4 w-4`}),(0,q.jsx)(W,{children:`Configuration Error`}),(0,q.jsx)(U,{children:y.errorMessage})]}),y?.userType===f.New&&(0,q.jsxs)(G,{className:`ml-8`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),(0,q.jsx)(W,{children:`No Opening Balance Required`}),(0,q.jsx)(U,{children:`First year of both business establishment and Accounter usage — opening balance is not required.`})]}),!y&&!d&&(0,q.jsxs)(G,{className:`ml-8`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),(0,q.jsx)(W,{children:`Configuration Incomplete`}),(0,q.jsxs)(U,{children:[`Could not determine user type. Please verify `,(0,q.jsx)(`strong`,{children:`initialAccounterYear`}),` `,`and `,(0,q.jsx)(`strong`,{children:`dateEstablished`}),` are set in Settings › Admin Context.`]})]}),y?.userType===f.Migrating&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ue,{year:l,adminBusinessId:a,balanceChargeId:y.balanceChargeId??null}),(0,q.jsx)(`div`,{className:`pl-8`,children:(0,q.jsx)(X,{ownerId:a,year:l,stepId:e.id,initialStatus:m?.status,initialNotes:g,onSaved:i})})]}),y?.userType===f.Continuing&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(G,{className:`ml-8`,children:[(0,q.jsx)(L,{className:`h-4 w-4`}),(0,q.jsx)(W,{children:`Verify Prior-Year Closing Balance`}),(0,q.jsx)(U,{className:`pb-4`,children:`Prior-year closing balances are already in the system. Review the prior-year data and approve once confirmed.`}),(0,q.jsxs)(`a`,{href:O.REPORTS.TRIAL_BALANCE({toDate:`${l-1}-12-31`,ownerIds:[a]}),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`text-sm text-primary underline-offset-4 hover:underline`,children:[`View prior-year (`,l-1,`) trial balance →`]})]}),(0,q.jsx)(`div`,{className:`pl-8`,children:(0,q.jsx)(X,{ownerId:a,year:l,stepId:e.id,initialStatus:m?.status,initialNotes:g,onSaved:i})})]})]})})]})}var Ge=({chargeId:e,label:t})=>(0,q.jsx)(R,{asChild:!0,variant:`link`,className:`h-auto justify-start p-0`,children:(0,q.jsx)(re,{to:O.CHARGES.DETAIL(e),target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),children:t})},e),Z=function(e){return e.Revaluation=`Revaluation`,e.BankDeposits=`BankDeposits`,e.TaxExpenses=`TaxExpenses`,e.Depreciation=`Depreciation`,e.RecoveryReserve=`RecoveryReserve`,e.VacationReserve=`VacationReserve`,e}({}),Ke=`generateFinancialCharge`,qe=()=>{let[{fetching:e},t]=v(l),[{fetching:n},a]=v(b),[{fetching:o},s]=v(u),[{fetching:d},f]=v(r),[{fetching:p},m]=v(c),[{fetching:h},g]=v(i);return{fetching:e||n||o||d||p||h,generateFinancialCharge:(0,K.useCallback)(async e=>{let{type:n,...r}=e,i=`Error generating financial charge [${n}]`,o=`${Ke}-${n}`;C.loading(`Generating financial charge`,{id:o});let c;try{switch(n){case`Revaluation`:c=await t(r).then(e=>E(e,i,o)?.generateRevaluationCharge);break;case`BankDeposits`:c=await a(r).then(e=>E(e,i,o)?.generateBankDepositsRevaluationCharge);break;case`TaxExpenses`:c=await s(r).then(e=>E(e,i,o)?.generateTaxExpensesCharge);break;case`Depreciation`:c=await f(r).then(e=>E(e,i,o)?.generateDepreciationCharge);break;case`RecoveryReserve`:c=await m(r).then(e=>E(e,i,o)?.generateRecoveryReserveCharge);break;case`VacationReserve`:c=await g(r).then(e=>E(e,i,o)?.generateVacationReserveCharge);break;default:throw Error(`Unknown financial charge type: ${n}`)}if(c?.id)return C.success(`Success`,{id:o,description:Ge({chargeId:c.id,label:`New ${n} charge created`})}),!0}catch(e){return console.error(`${i}: ${e}`),C.error(`Error`,{id:o,description:i,duration:1e5,closeButton:!0}),!1}return!1},[a,f,m,t,s,g])}},Je=[{key:`revaluationCharge`,label:`Revaluation Charge`,generateType:Z.Revaluation,required:!0},{key:`taxExpensesCharge`,label:`Tax Expenses Charge`,generateType:Z.TaxExpenses,required:!0},{key:`bankDepositsRevaluationCharge`,label:`Bank Deposits Revaluation Charge`,generateType:Z.BankDeposits,required:!1},{key:`depreciationCharge`,label:`Depreciation Charge`,generateType:Z.Depreciation,required:!1},{key:`recoveryReserveCharge`,label:`Recovery Reserve Charge`,generateType:Z.RecoveryReserve,required:!1},{key:`vacationReserveCharge`,label:`Vacation Reserve Charge`,generateType:Z.VacationReserve,required:!1}];function Ye(e){let[t,n]=(0,K.useState)(`loading`),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(void 0),{adminBusinessId:s,id:c,onStatusChange:l,year:u}=e,d=`${u}-12-31`,{fetching:f,generateFinancialCharge:p}=qe(),[{data:m,fetching:h,error:g},_]=D({query:S,variables:{ownerId:s,year:d}}),v=(0,K.useMemo)(()=>{if(Array.isArray(e.manualData))return e.manualData.find(e=>e.stepId===c)},[e.manualData,c]),y=(0,K.useMemo)(()=>{let e=v?.status;if(e)return Y(e)},[v]),b=v?.notes??null;(0,K.useEffect)(()=>{y&&o(y)},[y]),(0,K.useEffect)(()=>{l&&l(c,a??t)},[t,a,l,c]);let x=(0,K.useMemo)(()=>{let e=m?.annualFinancialCharges;return Je.map(t=>{let n=e?.[t.key]?.id;return{...t,chargeId:n,exists:!!n}})},[m]);(0,K.useEffect)(()=>{if(!s){n(`blocked`);return}if(h||f){n(`loading`);return}if(g||!m?.annualFinancialCharges){n(`blocked`);return}let e=x.filter(e=>e.required),t=e.filter(e=>e.exists).length;t===e.length?n(`completed`):n(t>0?`in-progress`:`pending`)},[s,x,m,g,h,f]);let C=(0,K.useCallback)(async e=>{s&&await p({type:e,ownerId:s,date:d})&&await _()},[s,p,_,d]),w=e=>e.exists?(0,q.jsx)(ye,{className:`h-4 w-4 text-green-600`}):e.required?(0,q.jsx)(I,{className:`h-4 w-4 text-orange-600`}):(0,q.jsx)(I,{className:`h-4 w-4 text-gray-400`}),T=e=>e.exists?(0,q.jsx)(z,{variant:`default`,children:`Exists`}):e.required?(0,q.jsx)(z,{variant:`outline`,children:`Missing`}):(0,q.jsx)(z,{variant:`secondary`,children:`Optional`}),E=a??t,ee=a&&a!==t;return(0,q.jsx)(J,{...e,status:E,statusIndicator:h?(0,q.jsx)(k,{className:`h-5 w-5 animate-spin text-muted-foreground`}):ee?(0,q.jsx)(z,{variant:`outline`,className:`text-xs border-blue-200 text-blue-700`,children:`Manual override`}):void 0,isExpanded:r,onToggleExpanded:()=>i(e=>!e),children:s&&(0,q.jsx)(M,{open:r,children:(0,q.jsxs)(j,{children:[(0,q.jsx)(V,{className:`pt-0 border-t`,children:(0,q.jsx)(`div`,{className:`space-y-2 mt-3`,children:x.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 p-3 rounded-lg border bg-background`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w(e),(0,q.jsx)(`span`,{className:`text-sm font-medium`,children:e.label}),T(e)]}),e.exists&&e.chargeId?(0,q.jsx)(R,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(`a`,{href:O.CHARGES.DETAIL(e.chargeId),children:`View`})}):(0,q.jsxs)(R,{variant:`outline`,size:`sm`,onClick:()=>C(e.generateType),disabled:f||t===`loading`,children:[(0,q.jsx)(Ne,{className:`h-4 w-4 mr-1`}),`Generate`]})]},e.key))})}),s&&(0,q.jsx)(`div`,{className:`px-6 pb-4 pt-2 border-t`,children:(0,q.jsx)(X,{ownerId:s,year:u,stepId:c,initialStatus:v?.status??void 0,initialNotes:b,onSaved:e=>o(e)})})]})})})}function Xe(e){let[t,n]=(0,K.useState)(`pending`),[r,i]=(0,K.useState)(!1),{adminBusinessId:a,id:o,onStatusChange:s}=e,[{data:c}]=D({query:ee,variables:{ownerId:a??``,year:e.year-1},pause:!a}),l=(0,K.useMemo)(()=>{let e=c?.annualAuditStepStatuses?.find(e=>e.stepId===`9`);if(!e?.evidence)return null;try{return JSON.parse(e.evidence).lockedTemplateName??null}catch{return null}},[c]),u=(0,K.useMemo)(()=>{if(Array.isArray(e.manualData))return e.manualData.find(e=>e.stepId===o)},[e.manualData,o]),d=(0,K.useMemo)(()=>{let e=u?.status;if(e)return Y(e)},[u]),f=u?.notes??null;(0,K.useEffect)(()=>{d&&n(d)},[d]),(0,K.useEffect)(()=>s?.(o,t),[t,s,o]);let p=(0,K.useMemo)(()=>[...l?[{label:`Balance Sheet`,href:O.REPORTS.DYNAMIC_REPORT({ownerIds:a?[a]:void 0,fromDate:`1900-01-01`,toDate:`${e.year}-12-31`,templateName:l})},{label:`Profit and Loss`,href:O.REPORTS.DYNAMIC_REPORT({ownerIds:a?[a]:void 0,fromDate:`${e.year}-01-01`,toDate:`${e.year}-12-31`,templateName:l})}]:[{label:`Create Dynamic Report Template`,href:O.REPORTS.DYNAMIC_REPORT()}],{label:`Trial Balance`,href:O.REPORTS.TRIAL_BALANCE({ownerIds:a?[a]:void 0,fromDate:`1900-01-01`,toDate:`${e.year}-12-31`,isShowZeroedAccounts:!0})},{label:`Review Tax Report`,href:O.REPORTS.TAX(e.year)}],[e.year,a,l]);return(0,q.jsx)(J,{...e,status:t,isExpanded:r,onToggleExpanded:()=>i(e=>!e),actions:p,children:a&&(0,q.jsx)(M,{open:r,children:(0,q.jsx)(j,{children:(0,q.jsx)(`div`,{className:`px-6 pb-4 pt-2 border-t`,children:(0,q.jsx)(X,{ownerId:a,year:e.year,stepId:o,initialStatus:u?.status??void 0,initialNotes:f,onSaved:e=>n(e)})})})})})}var Ze=`ledgerLock`,Qe=()=>{let[{fetching:e},t]=v(_);return{fetching:e,ledgerLock:(0,K.useCallback)(async e=>{let n=`Error locking ledger`,r=`${Ze}-${e.date}`;C.loading(`Locking ledger`,{id:r});try{let i=await t(e),a=E(i,n,r,`lockLedgerRecords`);if(a?.lockLedgerRecords)return C.success(`Success`,{id:r,description:`Payroll file added`}),a.lockLedgerRecords;throw Error(`Server error`)}catch(e){console.error(`${n}: ${e}`),C.error(`Error`,{id:r,description:n,duration:1e5,closeButton:!0})}return!1},[t])}};function $e(e){let[t,n]=(0,K.useState)(`pending`),[r,i]=(0,K.useState)(!1),{fetching:a,ledgerLock:o}=Qe(),{adminBusinessId:s,id:c,onStatusChange:l,year:u}=e,d=`${u}-12-31`,[{data:f,fetching:p},m]=D({query:te,variables:{ownerId:s}});(0,K.useEffect)(()=>l?.(c,t),[t,l,c]),(0,K.useEffect)(()=>{p||a?n(`loading`):f?!f.adminContext?.ledgerLock||f.adminContext.ledgerLock<d?n(`pending`):n(`completed`):n(`blocked`)},[f,p,d,a]);let h=(0,K.useCallback)(async()=>{o({date:d}).then(()=>m())},[d,o,m]),{userContext:g}=(0,K.useContext)(Ee),_=g?.context.ledgerLock;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(J,{...e,status:t,actions:[{label:`Lock Ledger`,onClick:()=>i(!0),disabled:!!_&&_>=d}]}),(0,q.jsx)(oe,{onConfirm:h,title:`Are you sure you want to lock all ledger records until ${De(new Date(d),`MMMM do, yyy`)}?`,open:r,setOpen:i})]})}var et=`setAnnualAuditStep09Status`,tt=()=>{let[{fetching:e},t]=v(T);return{fetching:e,setStep09Status:(0,K.useCallback)(async e=>{let n=`Error saving final dynamic report template selection`,r=`${et}-${e.input.ownerId}-${e.input.year}`;C.loading(`Locking template...`,{id:r});try{let i=await t(e),a=E(i,n,r);if(a)return C.success(`Template locked`,{id:r,description:`"${e.input.templateName}" saved as the final dynamic report template`}),a.setAnnualAuditStep09Status}catch(e){console.error(`${n}: ${e}`),C.error(`Error`,{id:r,description:n});return}},[t])}};function nt(e){let[t,n]=(0,K.useState)(`pending`),{adminBusinessId:r,id:i,onStatusChange:a,year:o}=e,{fetching:s,setStep09Status:c}=tt(),[{data:l,fetching:u},f]=D({query:d,variables:{ownerId:r,year:o},pause:!r}),[{data:m,fetching:h}]=D({query:y});(0,K.useEffect)(()=>a?.(i,t),[t,a,i]);let g=(0,K.useMemo)(()=>l?.annualAuditStepStatuses.find(e=>e.stepId===i),[l,i]),_=(0,K.useMemo)(()=>{if(!g?.evidence)return null;try{return JSON.parse(g.evidence).lockedTemplateName??null}catch{return null}},[g]);(0,K.useEffect)(()=>{r?u||h||s?n(`loading`):g?.status===p.Completed&&_?n(`completed`):n(`pending`):n(`blocked`)},[r,u,h,s,g,_]);let v=(0,K.useMemo)(()=>m?.allDynamicReports??[],[m]),b=(0,K.useMemo)(()=>v.filter(e=>!e.isLocked||e.name===_),[v,_]),x=(0,K.useCallback)(async e=>{r&&(await c({input:{ownerId:r,year:o,templateName:e}}),f())},[r,o,c,f]);return(0,q.jsx)(J,{...e,status:t,description:t===`completed`?`Final template: ${_}`:`Select the final dynamic report template to lock for this fiscal year`,children:r&&!h&&!u&&(0,q.jsx)(`div`,{className:`px-6 pb-4`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(F,{value:_??``,onValueChange:x,disabled:s,children:[(0,q.jsx)(ge,{className:`w-[280px]`,children:(0,q.jsx)(me,{placeholder:`Select a report template...`})}),(0,q.jsx)(N,{children:b.length===0?(0,q.jsx)(P,{value:`__none__`,disabled:!0,children:`No unlocked templates available`}):b.map(e=>(0,q.jsx)(P,{value:e.name,children:e.name},e.id))})]}),_&&(0,q.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Saved: `,_]})]})})})}function rt({stepId:e,adminBusinessId:t,year:n}){let[r,i]=(0,K.useState)(`pending`),{fetching:o,setStepStatus:s}=Ie(),[{data:c,fetching:l},u]=D({query:a,variables:{ownerId:t,year:n},pause:!t}),d=(0,K.useMemo)(()=>c?.annualAuditStepStatuses.find(t=>t.stepId===e),[c,e]);return(0,K.useEffect)(()=>{t?l||o?i(`loading`):d?.status===p.Completed?i(`completed`):i(`pending`):i(`blocked`)},[t,l,o,d]),{status:r,saving:o,fetchingStatus:l,handleMarkDone:(0,K.useCallback)(async()=>{t&&await s({input:{ownerId:t,year:n,stepId:e,status:p.Completed}})&&u()},[t,n,e,s,u]),handleUnmark:(0,K.useCallback)(async()=>{t&&await s({input:{ownerId:t,year:n,stepId:e,status:p.Pending}})&&u()},[t,n,e,s,u])}}function Q({stepId:e,adminBusinessId:t,year:n,linkLabel:r,linkHref:i,...a}){let{status:o,saving:s,fetchingStatus:c,handleMarkDone:l,handleUnmark:u}=rt({stepId:e,adminBusinessId:t,year:n}),{onStatusChange:d,id:f}=a;return(0,K.useEffect)(()=>d?.(f,o),[o,d,f]),(0,q.jsx)(J,{...a,status:o,children:t&&!c&&(0,q.jsx)(`div`,{className:`px-6 pb-4`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(R,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,children:[(0,q.jsx)(ce,{size:16,className:`mr-1.5`}),r]})}),o===`completed`?(0,q.jsx)(R,{variant:`ghost`,size:`sm`,disabled:s,onClick:u,children:`Unmark`}):(0,q.jsx)(R,{variant:`outline`,size:`sm`,disabled:s,onClick:l,children:`Mark as Done`})]})})})}function it({adminBusinessId:e,year:t,...n}){let r=`${t}-01-01`,i=`${t}-12-31`,a=(0,K.useMemo)(()=>O.REPORTS.TRIAL_BALANCE({fromDate:r,toDate:i,ownerIds:e?[e]:void 0}),[r,i,e]);return(0,q.jsx)(Q,{...n,stepId:`10`,adminBusinessId:e,year:t,description:`Download year-end trial balance CSV for future validations`,linkLabel:`Open Trial Balance Report`,linkHref:a})}function at({adminBusinessId:e,year:t,...n}){let r=(0,K.useMemo)(()=>O.REPORTS.DEPRECIATION(e?{year:t,financialEntityId:e}:{year:t}),[t,e]);return(0,q.jsx)(Q,{...n,stepId:`11`,adminBusinessId:e,year:t,description:`Review and export the final depreciation report for the year`,linkLabel:`Open Depreciation Report`,linkHref:r})}function ot({adminBusinessId:e,year:t,...n}){let r=(0,K.useMemo)(()=>O.REPORTS.TAX(t),[t]);return(0,q.jsx)(Q,{...n,stepId:`13`,adminBusinessId:e,year:t,description:`Review and export the tax report for the year`,linkLabel:`Open Tax Report`,linkHref:r})}function st({adminBusinessId:e,year:t,...n}){let r=(0,K.useMemo)(()=>O.REPORTS.CORPORATE_TAX_RULING_COMPLIANCE(t),[t]);return(0,q.jsx)(Q,{...n,stepId:`14`,adminBusinessId:e,year:t,description:`For Yossi's review`,linkLabel:`Open Tax Compliance Report`,linkHref:r})}function $({defaultStatus:e=`pending`,actions:t=[],fetchStatus:n,onStatusChange:r,...i}){let[a,o]=(0,K.useState)(n?`loading`:e);return(0,K.useEffect)(()=>{o(e)},[e]),(0,K.useEffect)(()=>{r&&r(i.id,a)},[a,r,i.id]),(0,K.useEffect)(()=>{n&&n().then(o).catch(()=>o(`blocked`))},[n]),(0,q.jsx)(J,{...i,status:a,actions:t,onStatusChange:r})}var ct=2e3,lt=new Date().getFullYear();function ut(e,t,n){return Math.min(Math.max(e,t),n)}function dt({value:e,onChange:t,minYear:n=ct,maxYear:r=lt}){let i=typeof e==`number`?ut(e,n,r):void 0,a=Array.from({length:r-n+1},(e,t)=>String(r-t));return(0,q.jsxs)(F,{value:i?String(i):void 0,onValueChange:e=>t(Number(e)),children:[(0,q.jsx)(ge,{className:`w-full`,children:(0,q.jsx)(me,{placeholder:`Select year (${n}-${r})`})}),(0,q.jsx)(N,{children:a.map(e=>(0,q.jsx)(P,{value:e,children:e},e))})]})}var ft=()=>{let{setFiltersContext:e}=(0,K.useContext)(xe),{userContext:t}=(0,K.useContext)(Ee),n=t?.context.adminBusinessId,{year:r}=ie(),i=ne(),a=new Date().getFullYear(),o=a-1,c=r?Number(r):o,l=!Number.isNaN(c)&&c>=2e3&&c<=a,u=l?c:o;(0,K.useEffect)(()=>{l||i(O.WORKFLOWS.ANNUAL_AUDIT(o),{replace:!0})},[l,i,o]);let d=(0,K.useCallback)(e=>{e!==u&&i(O.WORKFLOWS.ANNUAL_AUDIT(e))},[u,i]);(0,K.useEffect)(()=>{e((0,q.jsx)(`div`,{className:`flex flex-row gap-x-5`,children:(0,q.jsx)(dt,{value:u,onChange:d})}))},[u,e,d]);let[{data:f,fetching:p}]=D({query:s,variables:{ownerId:n,year:u},pause:!n}),m=!!(n&&p),h=(0,K.useRef)(new Map),[g,_]=(0,K.useState)(0),[v,y]=(0,K.useState)(`pending`),b=(0,K.useCallback)(()=>{let e=h.current.get(`1`),t=h.current.get(`2`),n=e===`completed`&&t===`completed`?`completed`:`pending`;h.current.get(`7`)!==n&&(h.current.set(`7`,n),y(n))},[]),x=(0,K.useCallback)((e,t)=>{if(h.current.get(e)!==t){h.current.set(e,t);let n=Array.from(h.current.values()).filter(e=>e===`completed`).length;_(n)}(e===`1`||e===`2`)&&b()},[b]),S=g/21*100,C=(0,K.useRef)(null),w=(0,K.useRef)(null);return(0,K.useEffect)(()=>{b()},[b]),l?(0,q.jsx)(je,{title:`Annual Audit Flow - ${u}`,description:`Complete audit process for annual financial reporting and compliance`,children:(0,q.jsxs)(`div`,{className:`container mx-auto p-6 max-w-6xl`,children:[(0,q.jsx)(`div`,{className:`mb-8`,children:(0,q.jsxs)(H,{className:`mb-6`,children:[(0,q.jsx)(B,{children:(0,q.jsx)(ke,{className:`text-lg`,children:`Progress Overview`})}),(0,q.jsx)(V,{children:(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(`div`,{className:`flex justify-between text-sm`,children:[(0,q.jsx)(`span`,{children:`Completed Steps`}),(0,q.jsxs)(`span`,{children:[g,` of `,21]})]}),(0,q.jsx)(pe,{value:S,className:`h-2`}),(0,q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[S.toFixed(1),`% Complete`]})]})})]})}),m?(0,q.jsx)(H,{children:(0,q.jsxs)(V,{className:`flex flex-col items-center justify-center gap-3 py-10`,children:[(0,q.jsx)(k,{className:`h-10 w-10 animate-spin text-muted-foreground`}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading annual audit step statuses...`})]})}):(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(Ve,{id:`1`,ref:C,year:u,adminBusinessId:n,title:`Validate All Charges`,description:`Ensure all charges of the year were reviewed, handle pending charges`,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(He,{id:`2`,ref:w,year:u,adminBusinessId:n,title:`Check Pending Ledger Changes`,description:`Ensure no pending ledger changes exist`,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(We,{id:`3`,year:u,adminBusinessId:n,title:`Verify Opening Balance`,description:`Handle opening balance verification based on user type`,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(Ye,{id:`4`,title:`Generate Financial Charges`,description:`Create various financial charges and reserves`,icon:(0,q.jsx)(fe,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,year:u,adminBusinessId:n}),(0,q.jsx)(Xe,{id:`5`,title:`Audit Main Process`,description:`Task management system for comprehensive audit checks`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,year:u,adminBusinessId:n}),(0,q.jsx)($,{id:`6`,title:`Add Shareholders Data (1214)`,description:`For 1214 report preparation`,icon:(0,q.jsx)(Pe,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Manage Shareholders`,href:`/shareholders/manage`},{label:`Import Data`,href:`/shareholders/import`}]}),(0,q.jsx)($,{id:`7`,title:`Revalidate Pending Items`,description:`Ensure no charges approval or ledger regeneration pending`,icon:(0,q.jsx)(se,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,defaultStatus:v,actions:[{label:`Check Pending Approvals`,onClick:()=>{C.current?.scrollIntoView({behavior:`smooth`,block:`start`})}},{label:`Ledger Status`,onClick:()=>{w.current?.scrollIntoView({behavior:`smooth`,block:`start`})}}]}),(0,q.jsx)($e,{id:`8`,title:`Lock Ledger`,description:`Lock ledger by records and by date`,year:u,icon:(0,q.jsx)(we,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(nt,{id:`9`,title:`Save Final Dynamic Report Template`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),year:u,adminBusinessId:n,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(it,{id:`10`,title:`Export Year-end Trial Balance`,icon:(0,q.jsx)(be,{className:`h-4 w-4`}),year:u,adminBusinessId:n,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(at,{id:`11`,title:`Generate Final Depreciation Report`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),year:u,adminBusinessId:n,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)($,{id:`12`,title:`Generate Financial Reports`,description:`With comparison numbers from last year`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Generate Reports`,href:`/reports/financial`}]}),(0,q.jsx)(ot,{id:`13`,title:`Generate Tax Report`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),year:u,adminBusinessId:n,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)(st,{id:`14`,title:`Generate Tax Compliance Reports`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),year:u,adminBusinessId:n,onStatusChange:x,manualData:f?.annualAuditStepStatuses}),(0,q.jsx)($,{id:`15`,title:`Generate Tax Compliance Report`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Generate 973`,href:`/reports/973`},{label:`Generate 901א`,href:`/reports/901a`}]}),(0,q.jsx)($,{id:`16`,title:`Generate 6111 Report`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Generate 6111`,href:O.REPORTS.SHAAM_6111}]}),(0,q.jsx)($,{id:`17`,title:`Generate Dividend Report 1214ב`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Generate Dividend Report`,href:`/reports/dividend-1214b`}]}),(0,q.jsx)($,{id:`18`,title:`Generate 1214 Report`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Generate 1214`,href:`/reports/1214`}]}),(0,q.jsx)($,{id:`19`,title:`Compare Tax Expenses`,description:`Compare 1214 tax expenses with ledger tax expenses`,icon:(0,q.jsx)(fe,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Compare Expenses`,href:`/tax/compare-expenses`}]}),(0,q.jsx)($,{id:`20`,title:`Signing Process`,description:`Handle signing process and accompanying documents`,icon:(0,q.jsx)(A,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Prepare Documents`,href:`/signing/prepare`},{label:`Digital Signing`,href:`/signing/digital`}]}),(0,q.jsx)($,{id:`21`,title:`File Annual Report`,description:`Submit annual report to companies government office`,icon:(0,q.jsx)(Te,{className:`h-4 w-4`}),onStatusChange:x,manualData:f?.annualAuditStepStatuses,actions:[{label:`Prepare Filing`,href:`/filing/prepare`},{label:`Submit Report`,href:`/filing/submit`}]})]}),(0,q.jsxs)(`div`,{className:`mt-8 p-4 bg-muted rounded-lg`,children:[(0,q.jsx)(`h3`,{className:`font-semibold mb-2`,children:`Quick Actions`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(R,{variant:`outline`,size:`sm`,children:[(0,q.jsx)(be,{className:`h-4 w-4 mr-2`}),`Export Progress Report`]}),(0,q.jsxs)(R,{variant:`outline`,size:`sm`,children:[(0,q.jsx)(ue,{className:`h-4 w-4 mr-2`}),`Configure Workflow`]}),(0,q.jsxs)(R,{variant:`outline`,size:`sm`,children:[(0,q.jsx)(se,{className:`h-4 w-4 mr-2`}),`View All Reports`]})]})]})]})}):null};export{ft as AnnualAuditFlow};