@accounter/client 0.0.8-alpha-20251028104443-6b90cabe7ee7130c620071b538fad7f55aadfde0 → 0.0.8-alpha-20251028104723-d7150deb91ef4f0b4cb8615dd9764727e684a57f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/assets/{Checkbox-StVWX8SV.js → Checkbox-DZRvdOms.js} +2 -2
- package/dist/assets/{Progress-mCoilW8a.js → Progress-q0wCJ1UC.js} +1 -1
- package/dist/assets/{Typography-nwkjB2uH.js → Typography-C5saFL6-.js} +1 -1
- package/dist/assets/{accordion-BJgt5vqo.js → accordion-D9XwOUmu.js} +1 -1
- package/dist/assets/{accountant-approvals-DjkngqVI.js → accountant-approvals-BhOzTeuA.js} +1 -1
- package/dist/assets/{all-charges-BTWHzN8W.js → all-charges-CYRxr_qd.js} +1 -1
- package/dist/assets/{arrow-up-down-Dc_JXNej.js → arrow-up-down-BfYH_pwc.js} +2 -2
- package/dist/assets/{building-2-ClFm6mRd.js → building-2-DqaB5WSN.js} +2 -2
- package/dist/assets/{business-Rici9LJV.js → business-Dqyv_ugH.js} +7 -7
- package/dist/assets/{business-header-BdKqniFy.js → business-header-CL1vzUOx.js} +1 -1
- package/dist/assets/{business-transactions-single-C9O13CYq.js → business-transactions-single-CGYQ-apS.js} +1 -1
- package/dist/assets/{business-trip-BX8ibyls.js → business-trip-B6_-ALpj.js} +1 -1
- package/dist/assets/{charges-filters-DOzODl9I.js → charges-filters-CT8dt66y.js} +1 -1
- package/dist/assets/{charges-ledger-validation-CGhcwN-9.js → charges-ledger-validation-C_DL7Lq7.js} +1 -1
- package/dist/assets/{chart-DJ8eRZgf.js → chart-ZfbORzFl.js} +1 -1
- package/dist/assets/{data-table-pagination-BxG_nDcy.js → data-table-pagination-Ce334A09.js} +3 -3
- package/dist/assets/{editable-business-trip-Ci_VRH4_.js → editable-business-trip-Dd4S7eQj.js} +4 -4
- package/dist/assets/{index-BSGULXKk.js → index-7ceVeTRP.js} +1 -1
- package/dist/assets/{index-Bicl-N_l.js → index-B-w1H4G3.js} +1 -1
- package/dist/assets/{index-DzOBVc67.js → index-BM6plSHM.js} +1 -1
- package/dist/assets/{index-Cb1trfXZ.js → index-BPiJ9iYW.js} +1 -1
- package/dist/assets/{index-DtE5Y1ZB.css → index-BU7S_VxQ.css} +1 -1
- package/dist/assets/{index-BNyi9p4R.js → index-Bf6ndVFc.js} +2 -2
- package/dist/assets/{index-DEUtVf1q.js → index-BnvMN72r.js} +1 -1
- package/dist/assets/{index-Hh1wVSCb.js → index-BtKdRCQe.js} +3 -3
- package/dist/assets/{index-CruPjjz7.js → index-CFTIgOI-.js} +2 -2
- package/dist/assets/{index-ChD_fUFd.js → index-CGv4kFW0.js} +1 -1
- package/dist/assets/{index-Dbp9vffm.js → index-CM-CbHGE.js} +1 -1
- package/dist/assets/{index-wr9WcP9o.js → index-COlBbozY.js} +1 -1
- package/dist/assets/{index-BoX2wDaq.js → index-CR8lcGOQ.js} +1 -1
- package/dist/assets/{index-CUVdKjE4.js → index-CXfqIsDH.js} +1 -1
- package/dist/assets/{index-DTqMRf6z.js → index-CdQf5E8A.js} +1 -1
- package/dist/assets/{index-BcEle39T.js → index-CnW2ZwKj.js} +1 -1
- package/dist/assets/{index-ilIoUSGi.js → index-D7MaHyb4.js} +1 -1
- package/dist/assets/{index-COkkiGA7.js → index-DI4mJpKP.js} +1 -1
- package/dist/assets/{index-DgNqZKRT.js → index-DNtBbGPw.js} +1 -1
- package/dist/assets/{index-Ch50_8Vf.js → index-DZA2tbPL.js} +7 -7
- package/dist/assets/{index-fkBrNyzZ.js → index-M4WwlLru.js} +1 -1
- package/dist/assets/{index-BMF6LQA_.js → index-dfcKnWhi.js} +1 -1
- package/dist/assets/{index-BgI9TyP-.js → index-tFhlrNVI.js} +1 -1
- package/dist/assets/{index-B9S5s-Ek.js → index-uGJdLMor.js} +93 -93
- package/dist/assets/{index.es-Cx9yITXs.js → index.es-CYOEeQjh.js} +1 -1
- package/dist/assets/{issue-document-BcS5_dW5.js → issue-document-BdHLgmKu.js} +1 -1
- package/dist/assets/{login-page-BsqoZbOr.js → login-page-BpXRAy5I.js} +1 -1
- package/dist/assets/{missing-info-charges-jo3EazSy.js → missing-info-charges-Dvasyf5Z.js} +1 -1
- package/dist/assets/{page-not-found-Bg4Wi3Ik.js → page-not-found-CAP6mm4E.js} +1 -1
- package/dist/assets/{pencil-BArynLn7.js → pencil-C-e1VTLc.js} +2 -2
- package/dist/assets/{report-commentary-row-5CDlBkOP.js → report-commentary-row-CUhx3OgM.js} +1 -1
- package/dist/assets/{save-ZDLsO-Uf.js → save-DpdtWX3y.js} +2 -2
- package/dist/assets/{sub-DWCpbavW.js → sub-ctZ8a-ge.js} +1 -1
- package/dist/assets/subMonths-DI8FVkDh.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +4 -4
- package/dist/assets/subMonths-DpFGzG8Q.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as e,c_ as u,eK as f,B as y,c$ as R,bp as D,F as T,a as E,c as b,L as w,ca as F,eM as g}from"./index-
|
|
1
|
+
import{r as h,j as e,c_ as u,eK as f,B as y,c$ as R,bp as D,F as T,a as E,c as b,L as w,ca as F,eM as g}from"./index-uGJdLMor.js";import{d as v}from"./graphql-document-dedupe-fragments-ByT8-wlV.js";import{R as d}from"./report-commentary-row-CUhx3OgM.js";function B({year:c,setYear:m,referenceYears:x,setReferenceYears:j}){const[i,o]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(u,{opened:i,onClose:()=>o(!1),withCloseButton:!0,content:e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Change report year",value:new Date(c,0,1),onChange:n=>n&&m(n?.getFullYear()),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date}),e.jsx(f,{type:"multiple",label:"Pick reference years",value:x?.map(n=>new Date(n,0,1)),onChange:n=>j(n.map(l=>l.getFullYear()).filter(l=>c!==l)),popoverProps:{withinPortal:!0},minDate:new Date(2010,0,1),maxDate:new Date})]})}),e.jsx(y,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>o(!0),children:e.jsx(R,{className:"size-5"})})]})}const Y=()=>{const{year:c}=D(),{setFiltersContext:m}=h.useContext(T),[x,j]=h.useState(c?Number(c):new Date().getFullYear()),[i,o]=h.useState([]),[{data:n,fetching:l}]=E({query:v(g),variables:{reportYear:x,referenceYears:i}});h.useEffect(()=>{m(e.jsx("div",{className:"flex flex-row gap-2",children:e.jsx(B,{year:x,setYear:j,referenceYears:i,setReferenceYears:o})}))},[x,l,m,i,o]);const p=n?.taxReport,s=p?.report,r=p?.reference??[];return e.jsx(b,{title:"Tax Report",children:l?e.jsx(w,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsx("div",{className:"flex flex-col gap-4",children:s&&e.jsxs(F,{highlightOnHover:!0,fontSize:"md",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{children:x},x),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.year},t.year))]})}),e.jsxs("tbody",{children:[e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("th",{children:"Profit Before Tax"}),e.jsx("th",{children:s.profitBeforeTax.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("th",{children:a.profitBeforeTax.amount.formatted},a.year))]}),commentaryData:s.profitBeforeTax}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses By Records"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesByRecords.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.researchAndDevelopmentExpensesByRecords.amount.formatted},a.year))]}),commentaryData:s.researchAndDevelopmentExpensesByRecords}),e.jsxs("tr",{children:[e.jsx("td",{children:"R&D Expenses For Tax"}),e.jsx("td",{children:s.researchAndDevelopmentExpensesForTax.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.researchAndDevelopmentExpensesForTax.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Fines"}),e.jsx("td",{children:s.fines.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.fines.amount.formatted},a.year))]}),commentaryData:s.fines}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Untaxable Gifts"}),e.jsx("td",{children:s.untaxableGifts.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.untaxableGifts.amount.formatted},a.year))]}),commentaryData:s.untaxableGifts}),e.jsxs("tr",{children:[e.jsx("td",{children:"Business Trips Excess Expenses"}),e.jsx("td",{children:s.businessTripsExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.businessTripsExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Salary Excess Expenses"}),e.jsx("td",{children:s.salaryExcessExpensesAmount.formatted}),e.jsx("td",{}),r.map(t=>e.jsx("td",{children:t.salaryExcessExpensesAmount.formatted},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Reserves"}),e.jsx("td",{children:s.reserves.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.reserves.amount.formatted},a.year))]}),commentaryData:s.reserves}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Nontaxable Linkage"}),e.jsx("td",{children:s.nontaxableLinkage.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.nontaxableLinkage.amount.formatted},a.year))]}),commentaryData:s.nontaxableLinkage}),e.jsxs("tr",{children:[e.jsx("th",{children:"Taxable Income"}),e.jsx("th",{children:s.taxableIncome.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.taxableIncome.formatted},t.year)),e.jsx("td",{})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Tax Rate"}),e.jsxs("td",{children:[(s.taxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.taxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]}),e.jsx(d,{dataRow:t=>e.jsxs("tr",{children:[e.jsx("td",{children:"Income with Special Tax Rate"}),e.jsx("td",{children:s.specialTaxableIncome.amount.formatted}),e.jsx("th",{children:t}),r.map(a=>e.jsx("td",{children:a.specialTaxableIncome.amount.formatted},a.year))]}),commentaryData:s.specialTaxableIncome}),e.jsxs("tr",{children:[e.jsx("td",{children:"Special Tax Rate"}),e.jsxs("td",{children:[(s.specialTaxRate*100).toFixed(1),"%"]}),e.jsx("td",{}),r.map(t=>e.jsxs("td",{children:[(t.specialTaxRate*100).toFixed(1),"%"]},t.year)),e.jsx("td",{})]})]}),e.jsx("tfoot",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Annual Tax Expense"}),e.jsx("th",{children:s.annualTaxExpense.formatted}),e.jsx("th",{}),r.map(t=>e.jsx("th",{children:t.annualTaxExpense.formatted},t.year)),e.jsx("td",{})]})})]})})})};export{Y as TaxReport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as v,fX as U,r as u,t as m,l as F,aK as H,j as e,a2 as C,a3 as j,a4 as f,a5 as p,v as L,a6 as y,a7 as S,bO as K,bP as V,aO as z,aI as _,K as D,an as E,B as h,N as M,ap as A,aq as R,V as O,a0 as k,fY as G,c7 as Q,a as P,fZ as X,L as $,F as Y,dj as Z,c as J,dm as W,dn as ee,dp as T,dq as se,dr as b,ds as te,dt as w,f_ as ae,dz as re,dA as oe,dB as ne}from"./index-
|
|
1
|
+
import{i as v,fX as U,r as u,t as m,l as F,aK as H,j as e,a2 as C,a3 as j,a4 as f,a5 as p,v as L,a6 as y,a7 as S,bO as K,bP as V,aO as z,aI as _,K as D,an as E,B as h,N as M,ap as A,aq as R,V as O,a0 as k,fY as G,c7 as Q,a as P,fZ as X,L as $,F as Y,dj as Z,c as J,dm as W,dn as ee,dp as T,dq as se,dr as b,ds as te,dt as w,f_ as ae,dz as re,dA as oe,dB as ne}from"./index-uGJdLMor.js";import{D as ie}from"./data-table-pagination-Ce334A09.js";import{A as N}from"./arrow-up-down-BfYH_pwc.js";const de="insertTaxCategory",ce=()=>{const[{fetching:s},n]=v(U),t=u.useCallback(async a=>{const d="Error creating tax category",r=de;m.loading("Adding Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r);if(l)return m.success("Success",{id:r,description:`${l.insertTaxCategory.name} was created`}),l.insertTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,insertTaxCategory:t}};function q({formManager:s,setFetching:n,isInsert:t}){const{control:a,watch:d,setValue:r}=s,{selectableSortCodes:i,fetching:l,sortCodes:x}=H();u.useEffect(()=>{n(l)},[n,l]);const c=d("sortCode");return u.useEffect(()=>{if(c){const o=x.find(g=>g.key===c);o?.defaultIrsCode&&r("irsCode",o.defaultIrsCode,{shouldDirty:!0})}},[c,x,r]),e.jsxs(e.Fragment,{children:[e.jsx(C,{name:"name",control:a,rules:{required:"Required",minLength:{value:2,message:"Must be at least 2 characters"}},render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"Name"}),e.jsx(p,{children:e.jsx(L,{...o,value:o.value??void 0,required:!0,className:t?"":y(g)})}),e.jsx(S,{})]})}),e.jsx(K,{name:"sortCode",control:a,render:({field:o,fieldState:g})=>e.jsx(V,{...o,onChange:B=>{o.onChange(Number(B))},data:i,value:o.value?.toString(),disabled:l,label:"Sort Code",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,className:t?"":y(g)})}),e.jsx(C,{name:"irsCode",control:a,render:({field:o,fieldState:g})=>e.jsxs(j,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(p,{children:e.jsx(z,{...o,className:t?"":y(g),value:o.value??void 0,hideControls:!0,decimalScale:0})}),e.jsx(S,{})]})}),e.jsx(C,{control:a,name:"taxExcluded",render:({field:o})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{children:"Tax excluded category"})}),e.jsx(p,{children:e.jsx(_,{onCheckedChange:o.onChange,checked:o.value??void 0})})]})})]})}function le({onAdd:s}){const[n,t]=u.useState(!1);return e.jsxs(D,{open:n,onOpenChange:t,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{children:"Add Tax Category"})}),e.jsxs(M,{className:"w-[90vw] max-w-screen-md",children:[e.jsx(A,{children:e.jsx(R,{children:"Add New Tax Category"})}),e.jsx(xe,{close:()=>t(!1),onAdd:s})]})]})}function xe({close:s,onAdd:n}){const t=O({}),{handleSubmit:a}=t,[d,r]=u.useState(!1),{insertTaxCategory:i,fetching:l}=ce(),x=c=>{c.sortCode&&=parseInt(c.sortCode.toString()),i({fields:c}).then(o=>{o?.id&&(n?.(o.id),s())})};return e.jsx(k,{...t,children:e.jsxs("form",{onSubmit:a(x),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!0,formManager:t,setFetching:r})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:l||d,children:"Add Tax Category"})})]})})}const ue="updateTaxCategory",ge=()=>{const[{fetching:s},n]=v(G),t=u.useCallback(async a=>{const d="Error updating tax category",r=`${ue}-${a.taxCategoryId}`;m.loading("Uploading Tax Category",{id:r});try{const i=await n(a),l=F(i,d,r,"updateTaxCategory");if(l)return m.success("Success",{id:r,description:`${l.updateTaxCategory.name} was updated`}),l.updateTaxCategory}catch(i){console.error(`${d}: ${i}`),m.error("Error",{id:r,description:d,duration:1e5,closeButton:!0})}},[n]);return{fetching:s,updateTaxCategory:t}};function me({taxCategoryId:s,onAdd:n}){const[t,a]=u.useState(!1);return e.jsxs(D,{open:t,onOpenChange:a,children:[e.jsx(E,{asChild:!0,children:e.jsx(h,{variant:"outline",size:"icon",children:e.jsx(Q,{})})}),e.jsxs(M,{className:"w-[400px] max-w-screen-md",children:[e.jsx(A,{children:e.jsx(R,{children:"Edit Tax Category"})}),e.jsx(he,{taxCategoryId:s,close:()=>a(!1),onAdd:n})]})]})}function he({taxCategoryId:s,close:n,onAdd:t}){const[{data:a,fetching:d}]=P({query:X,variables:{id:s}}),r=a?.taxCategory;return!r&&!d&&m.error("Error",{description:"Couldn'nt find tax category"}),d?e.jsx($,{className:"h-10 w-10 animate-spin"}):e.jsx(Ce,{taxCategory:r,close:n,onAdd:t})}function Ce({taxCategory:s,close:n,onAdd:t}){const a=O({defaultValues:{sortCode:s.sortCode?.key,name:s.name,irsCode:s.irsCode}}),{handleSubmit:d}=a,[r,i]=u.useState(!1),{updateTaxCategory:l,fetching:x}=ge(),c=o=>{o.sortCode&&=parseInt(o.sortCode.toString()),l({fields:o,taxCategoryId:s.id}).then(g=>{g?.id&&(t?.(g.id),n())})};return e.jsx(k,{...a,children:e.jsxs("form",{onSubmit:d(c),children:[e.jsx("div",{className:"flex flex-col gap-4 my-4",children:e.jsx(q,{isInsert:!1,formManager:a,setFetching:i})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx(h,{type:"submit",disabled:x||r,children:"Update"})})]})})}const je=({data:s})=>e.jsx("td",{children:s.name}),fe=({data:s})=>e.jsx("td",{children:s.sortCode?e.jsxs("span",{children:[s.sortCode?.name," (",s.sortCode?.id,")"]}):"N/A"}),I=[{id:"name",accessorKey:"name",cell:({row:s})=>e.jsx(je,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Name",e.jsx(N,{})]})},{id:"sortCode",accessorKey:"sortCode.key",cell:({row:s})=>e.jsx(fe,{data:s.original}),header:({column:s})=>e.jsxs(h,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Sort Code",e.jsx(N,{})]})},{id:"edit",cell:({row:s})=>e.jsx(me,{taxCategoryId:s.original.id})}],Se=()=>{const[{data:s,fetching:n,error:t},a]=P({query:ae}),{setFiltersContext:d}=u.useContext(Y),r=s?.taxCategories??[],i=Z({data:r,columns:I,getCoreRowModel:ne(),getPaginationRowModel:oe(),getSortedRowModel:re(),initialState:{pagination:{pageSize:30}}}),l=i.getPageOptions();return u.useEffect(()=>{d(e.jsx("div",{className:"flex items-center justify-end gap-10 space-x-2 py-4",children:e.jsx("div",{className:"flex items-center justify-between px-2",children:e.jsx(ie,{table:i})})}))},[d,i,l]),u.useEffect(()=>{t&&m.error("Error",{description:"Error fetching tax categories"})},[t]),e.jsx(J,{title:`Tax Categories (${r.length})`,description:"All tax categories",headerActions:e.jsx(le,{onAdd:()=>a()}),children:n?e.jsx("div",{className:"flex flex-row justify-center",children:e.jsx($,{className:"h-10 w-10 animate-spin mr-2"})}):e.jsx("div",{className:"flex flex-col gap-4 rounded-md border",children:e.jsxs(W,{children:[e.jsx(ee,{children:i.getHeaderGroups().map(x=>e.jsx(T,{children:x.headers.map(c=>e.jsx(se,{children:c.isPlaceholder?null:b(c.column.columnDef.header,c.getContext())},c.id))},x.id))}),e.jsx(te,{children:i.getRowModel().rows.length===0?e.jsx(T,{children:e.jsx(w,{colSpan:I.length,className:"text-center py-8",children:"No tax categories found"})}):i.getRowModel().rows.map(x=>e.jsx(T,{children:x.getVisibleCells().map(c=>e.jsx(w,{children:b(c.column.columnDef.cell,c.getContext())},c.id))},x.id))})]})})})};export{Se as TaxCategories};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as P,j as r,g as Q,a as W,fc as $,L as E,u as Y,ae as q,cZ as K,c_ as X,B as U,c$ as ee,V as te,cd as ne,bO as se,bP as oe,db as O,H as S,fd as Z,d0 as re,F as ie,c as le,Y as ae,_ as ce,a1 as ue}from"./index-
|
|
1
|
+
import{r as P,j as r,g as Q,a as W,fc as $,L as E,u as Y,ae as q,cZ as K,c_ as X,B as U,c$ as ee,V as te,cd as ne,bO as se,bP as oe,db as O,H as S,fd as Z,d0 as re,F as ie,c as le,Y as ae,_ as ce,a1 as ue}from"./index-uGJdLMor.js";import{A as fe,a as he,c as de,b as pe}from"./accordion-D9XwOUmu.js";var v={},z;function ye(){if(z)return v;z=1,Object.defineProperty(v,"__esModule",{value:!0}),v.calcSlices=v.applyPatch=v.calcPatch=v.lcs=v.diff=v.diff_core=void 0;function c(e,n){const{b:t,eq:s,stack_base:i}=e;let{i:l,N:o,j:h,M:a,Z:u,stack_top:x}=e;for(;;)switch(n){case 0:{e:for(;o>0&&a>0;){t.fill(0,0,2*u);const R=o-a,_=o+a,B=_&1,G=l+o-1,H=h+a-1,J=(_+B)/2;let F;t:for(let M=0;M<=J;M++){const I=2*Math.max(0,M-a)-M,L=M-2*Math.max(0,M-o);for(let f=I;f<=L;f+=2){const A=t[f-1-u*Math.floor((f-1)/u)],V=t[f+1-u*Math.floor((f+1)/u)],w=f===-M||f!==M&&A<V?V:A+1,k=w-f;let b=w,C=k;for(;b<o&&C<a&&s(l+b,h+C);)b++,C++;if(t[f-u*Math.floor(f/u)]=b,B===1&&(F=R-f)>=1-M&&F<M&&b+t[u+F-u*Math.floor(F/u)]>=o)if(M>1||b!==w){i[x++]=l+b,i[x++]=o-b,i[x++]=h+C,i[x++]=a-C,o=w,a=k,u=2*(Math.min(o,a)+1);continue e}else break t}for(let f=I;f<=L;f+=2){const A=t[u+f-1-u*Math.floor((f-1)/u)],V=t[u+f+1-u*Math.floor((f+1)/u)],w=f===-M||f!==M&&A<V?V:A+1,k=w-f;let b=w,C=k;for(;b<o&&C<a&&s(G-b,H-C);)b++,C++;if(t[u+f-u*Math.floor(f/u)]=b,B===0&&(F=R-f)>=-M&&F<=M&&b+t[F-u*Math.floor(F/u)]>=o)if(M>0||b!==w){i[x++]=l+o-w,i[x++]=w,i[x++]=h+a-k,i[x++]=k,o=o-b,a=a-C,u=2*(Math.min(o,a)+1);continue e}else break t}}if(o!==a){a>o?(l+=o,h+=o,a-=o,o=0):(l+=a,h+=a,o-=a,a=0);break}}if(o+a!==0)if(e.pxe===l||e.pye===h)e.pxe=l+o,e.pye=h+a;else{const R=e.pxs;if(e.oxs=e.pxs,e.oxe=e.pxe,e.oys=e.pys,e.oye=e.pye,e.pxs=l,e.pxe=l+o,e.pys=h,e.pye=h+a,R>=0)return e.i=l,e.N=o,e.j=h,e.M=a,e.Z=u,e.stack_top=x,1}}case 1:{if(x===0)return 2;a=i[--x],h=i[--x],o=i[--x],l=i[--x],u=2*(Math.min(o,a)+1),n=0}}}class m{constructor(n){this.state=n,this.c=0,this.result={value:null,done:!1}}[Symbol.iterator](){return this}next(){const{state:n,result:t}=this;if(this.c>1)return t.done=!0,t.value=void 0,t;const s=c(n,this.c);return this.c=s,s===1?(t.value=[n.oxs,n.oxe,n.oys,n.oye],t):n.pxs>=0?(t.value=[n.pxs,n.pxe,n.pys,n.pye],t):(t.done=!0,t.value=void 0,t)}}function D(e,n,t,s,i){const l=(Math.min(n,s)+1)*2,o=n+s,h=new(o<256?Uint8Array:o<65536?Uint16Array:Uint32Array)(2*l);return new m({i:e,N:n,j:t,M:s,Z:l,b:h,eq:i,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[]})}v.diff_core=D;function d(e,n,t){let[s,i,l]=[0,e.length,n.length];if(typeof t=="function"){for(;s<i&&s<l&&t(s,s);)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;t(--i,--l)&&i>s&&l>s;);}else{for(;s<i&&s<l&&e[s]===n[s];)s++;if(s===i&&s===l)return[][Symbol.iterator]();for(;e[--i]===n[--l]&&i>s&&l>s;);t=(o,h)=>e[o]===n[h]}return D(s,i+1-s,s,l+1-s,t)}v.diff=d;class p{constructor(n,t){this.diff=n,this.N=t,this.i=0,this.j=0}[Symbol.iterator](){return this}next(){const n=this.diff.next();if(n.done){const{i:a,j:u,N:x}=this;return a<x&&(n.done=!1,n.value=[a,u,x-a],this.i=x),n}const t=n.value,s=t[0],i=t[1],l=t[3],{i:o,j:h}=this;return o!==s&&(t.length--,t[0]=o,t[1]=h,t[2]=s-o),this.i=i,this.j=l,n}}function y(e,n,t){return new p(d(e,n,t),e.length)}v.lcs=y;function*g(e,n,t){const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const i of d(e,n,t))i[2]=s.call(n,i[2],i[3]),yield i}v.calcPatch=g;function*N(e,n){let t=0;const s=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[i,l,o]of n)t<i&&(yield s.call(e,t,i)),o.length>0&&(yield o),t=l;t<e.length&&(yield s.call(e,t))}v.applyPatch=N;function*j(e,n,t){let s=0;const i=ArrayBuffer.isView(e)?Uint8Array.prototype.subarray:e.slice;for(const[l,o,h,a]of d(e,n,t))s<l&&(yield[0,i.call(e,s,l)]),l<o&&(yield[-1,i.call(e,l,o)]),h<a&&(yield[1,i.call(n,h,a)]),s=o;s<e.length&&(yield[0,e.slice(s)])}return v.calcSlices=j,v}var xe=ye();const me=({children:c})=>r.jsx("span",{className:"bg-green-100",children:c}),je=({children:c})=>r.jsx("span",{className:"bg-red-100 line-through",children:c}),T=({children:c})=>r.jsx("span",{children:c}),ge=({content:c,contentOrigin:m,monthDate:D})=>{const d=P.useMemo(()=>{const p=[];if(!m)return p;const y=c.split(""),g=m.split(""),N=Array.from(xe.calcPatch(g,y)),j=[];let e=0;for(const[t,s,i]of N)if(j.length===0&&t>=17&&s<=25&&i.length===s-t){if(N.length===1)return p;continue}else e<t&&j.push([g.slice(e,t).join(""),T]),s>t&&j.push([g.slice(t,s).join(""),je]),i.length>0&&j.push([i.join(""),me]),e=s;e<g.length&&j.push([g.slice(e).join(""),T]);let n=[];for(const[t,s]of j){const i=t.split(`
|
|
2
2
|
`);i.length===1?n.push(r.jsx(s,{children:t},`unchanged-${n.length}`)):i.map((l,o)=>{n.push(r.jsx(s,{children:l},o)),p.push(r.jsx("div",{children:n},p.length-1)),n=[]})}return n.length>0&&p.push(r.jsx("div",{children:n},p.length-1)),p},[c,m]);return r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"text-sm text-gray-500 flex flex-row gap-2",children:[r.jsx("span",{className:"font-bold",children:"Month:"}),r.jsx("span",{children:D.slice(0,7)}),!d.length&&r.jsx(Q,{className:"text-green-500"})]}),!!d.length&&d]})},Me=({filter:c})=>{const[{data:m,fetching:D,hasNext:d}]=W({query:$,variables:c}),p=P.useMemo(()=>m?.pcnByDate?m.pcnByDate.sort((y,g)=>g.date>y.date?1:g.date<y.date?-1:0):[],[m?.pcnByDate]);return D?r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}):r.jsxs("div",{className:"flex flex-col gap-4",children:[!!m&&d&&r.jsx("div",{className:"w-full h-full flex justify-center",children:r.jsx(E,{className:"h-10 w-10 animate-spin mr-2 self-center"})}),p.map((y,g)=>r.jsx(ge,{content:y.content,contentOrigin:y.diffContent,monthDate:y.date},g))]})};function be({filter:c,setFilter:m,closeModal:D}){const{control:d,handleSubmit:p,setValue:y}=te({defaultValues:{...c}}),{selectableBusinesses:g,fetching:N}=ne(),j=e=>{m(e),D()};return r.jsxs(r.Fragment,{children:[N?r.jsx("div",{children:"Loading..."}):r.jsx("div",{}),r.jsxs("form",{onSubmit:p(j),children:[r.jsx(se,{name:"businessId",control:d,defaultValue:void 0,render:({field:e,fieldState:n})=>r.jsx(oe,{...e,data:g,value:e.value,disabled:N,label:"Businesses",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message})}),r.jsx(O,{label:"From date",defaultValue:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,defaultDate:c?.fromMonthDate?new Date(c.fromMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("fromMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsx(O,{label:"To date",defaultValue:c?.toMonthDate?new Date(c.toMonthDate):new Date,defaultDate:c?.toMonthDate?new Date(c.toMonthDate):new Date,onChange:e=>{const n=new Date(e.getFullYear(),e.getMonth(),15);y("toMonthDate",S(n,"yyyy-MM-dd"))},popoverProps:{withinPortal:!0}}),r.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[r.jsx(U,{type:"submit",children:"Filter"}),r.jsx(U,{type:"button",onClick:D,children:"Cancel"})]})]})]})}function ve({filter:c,setFilter:m}){const[D,d]=P.useState(!1),{get:p,set:y}=Y(),{userContext:g}=P.useContext(q);function N(j){j||={businessId:g?.context.adminBusinessId??c.businessId,fromMonthDate:S(Z(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")},re(j,c)||m(j)}return P.useEffect(()=>{const j=K(c??{})?null:encodeURIComponent(JSON.stringify(c)),e=p("validateReportsFilters");j!==e&&y("validateReportsFilters",j)},[c,p,y]),r.jsxs(r.Fragment,{children:[r.jsx(X,{opened:D,onClose:()=>d(!1),content:r.jsx(be,{filter:c,setFilter:N,closeModal:()=>d(!1)})}),r.jsx(U,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>d(!0),children:r.jsx(ee,{className:"size-5"})})]})}const Ce=()=>{const{get:c}=Y(),{setFiltersContext:m}=P.useContext(ie),D=P.useMemo(()=>{try{if(c("validateReportsFilters"))return JSON.parse(decodeURIComponent(c("validateReportsFilters")))}catch(y){console.error("Error parsing filter from URL",y)}return{fromMonthDate:S(Z(new Date),"yyyy-MM-15"),toMonthDate:S(new Date,"yyyy-MM-15")}},[c]),[d,p]=P.useState(D);return P.useEffect(()=>{m(r.jsx("div",{className:"flex flex-row gap-2",children:r.jsx(ve,{filter:{...d},setFilter:p})}))},[d,m]),r.jsx(le,{title:"Report Validations",children:r.jsx(fe,{type:"single",collapsible:!0,children:r.jsx(he,{value:"pcn874",children:r.jsxs(ae,{className:"p-4",children:[r.jsx(de,{children:r.jsx(ce,{children:"Monthly VAT (PCN874)"})}),r.jsx(pe,{children:r.jsx(ue,{children:r.jsx(Me,{filter:d})})})]})})})})};export{Ce as ValidateReportsScreen};
|