@accounter/client 0.0.8-alpha-20251030162303-87017b2c2addf0e61478260aac336b9343f15c98 → 0.0.8-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
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 +49 -1
- package/dist/assets/{Checkbox-CLE7WylX.js → Checkbox-CMTNcrRo.js} +1 -1
- package/dist/assets/{MultiSelect-SsgUtHuW.js → MultiSelect-DP26KzMa.js} +1 -1
- package/dist/assets/{Progress-D7j8SJRp.js → Progress-C3jVWDXK.js} +1 -1
- package/dist/assets/{Table-DpZKU9e6.js → Table-c1ug6Rpw.js} +1 -1
- package/dist/assets/{Typography-DOCvIzjw.js → Typography-BC-9NaKB.js} +1 -1
- package/dist/assets/{YearPickerInput-BbyQMsmW.js → YearPickerInput-CNSe9Fno.js} +1 -1
- package/dist/assets/{accordion-KRd9M_7N.js → accordion-CLvZdMsA.js} +1 -1
- package/dist/assets/{accountant-approvals-BWkXiUJx.js → accountant-approvals-BbNBYszL.js} +1 -1
- package/dist/assets/{accounter-table-BvOYdMv2.js → accounter-table-C7UgjlTA.js} +1 -1
- package/dist/assets/{addDays-HTdY9JyJ.js → addDays-CB-j-d4t.js} +1 -1
- package/dist/assets/{all-charges-uOrXkSoe.js → all-charges-vuUUzmwW.js} +1 -1
- package/dist/assets/{arrow-up-down-D0e6luFS.js → arrow-up-down-DWlT-GED.js} +1 -1
- package/dist/assets/{building-2-BScQAy2y.js → building-2-Dkd3B-3N.js} +1 -1
- package/dist/assets/business-BuVKb8Oy.js +37 -0
- package/dist/assets/{business-extended-info-BPdDug4k.js → business-extended-info-B4Wt-Sq3.js} +1 -1
- package/dist/assets/{business-header-ScM944FH.js → business-header-BpYfBk40.js} +1 -1
- package/dist/assets/{business-ledger-filters-C6zdPVNQ.js → business-ledger-filters-ByAYFfgh.js} +1 -1
- package/dist/assets/{business-ledger-single-D_gxQY7c.js → business-ledger-single-cLd56KYs.js} +1 -1
- package/dist/assets/{business-trip-BD6qMULS.js → business-trip-BWUbbHEK.js} +1 -1
- package/dist/assets/{charge-CXgCTI2e.js → charge-DyLqPZn0.js} +1 -1
- package/dist/assets/{charges-filters-DhYogrgu.js → charges-filters-CUyYbpwk.js} +1 -1
- package/dist/assets/{charges-ledger-validation-K96Gpr99.js → charges-ledger-validation-Br2BBUCN.js} +1 -1
- package/dist/assets/{charges-table-Cff0tibm.js → charges-table-Cw-X1ZkK.js} +6 -6
- package/dist/assets/{chart-Rag7RVt5.js → chart-TrN24kVd.js} +1 -1
- package/dist/assets/contracts-CbwbCzFG.js +16 -0
- package/dist/assets/{data-table-pagination-BenxjRXY.js → data-table-pagination-BZmytrQe.js} +2 -2
- package/dist/assets/{download-csv-button-8ow10rSS.js → download-csv-button-r9hq7Mun.js} +1 -1
- package/dist/assets/{edit-issue-document-modal-2d_PTbvO.js → edit-issue-document-modal-aZgmep8e.js} +1 -1
- package/dist/assets/{editable-business-trip-BFJ_Mqji.js → editable-business-trip-BCj8haJN.js} +2 -2
- package/dist/assets/{eye-off-BNMLF-BO.js → eye-off-Cd4HW5Ki.js} +1 -1
- package/dist/assets/{funnel-DW3_rS_8.js → funnel-DlU6IKDd.js} +1 -1
- package/dist/assets/{index-4ufIi3AX.js → index-4Zj8Hp3W.js} +2 -2
- package/dist/assets/{index-2unHvdGT.js → index-BGcp3XaM.js} +1 -1
- package/dist/assets/{index-B0Je179L.js → index-BM_DgFX-.js} +1 -1
- package/dist/assets/{index-Bo2SK7RM.js → index-BnDJ3EgW.js} +1 -1
- package/dist/assets/{index-DyLWk3js.js → index-Bo91VSNv.js} +1 -1
- package/dist/assets/{index-BHA96r33.js → index-BovGiTUZ.js} +1 -1
- package/dist/assets/{index-1iKxq5ag.js → index-Bt94reMP.js} +2 -2
- package/dist/assets/index-BwqfmUGW.js +1 -0
- package/dist/assets/index-C4ozKIHg.js +1 -0
- package/dist/assets/{index-BPS5RB7_.js → index-CLyrvG5S.js} +1 -1
- package/dist/assets/{index-CKNxDyu9.js → index-CS2mkstk.js} +1 -1
- package/dist/assets/index-CsxUWF65.js +1 -0
- package/dist/assets/index-Cuu0j4Ul.js +1 -0
- package/dist/assets/{index-BDUyPP2c.js → index-DOzNNsNU.js} +1 -1
- package/dist/assets/{index-Bp6IHcih.js → index-DPLJ9sZn.js} +1 -1
- package/dist/assets/index-Dl3yi4zQ.js +1 -0
- package/dist/assets/{index-VD71ra9C.js → index-DmC4088R.js} +2 -2
- package/dist/assets/{index-B2VI47XT.js → index-DnkSW9Wf.js} +1 -1
- package/dist/assets/{index-lMXNkFuw.js → index-Dzi5mI80.js} +2 -2
- package/dist/assets/{index-Bd-SKdyy.js → index-UOt3vExk.js} +196 -196
- package/dist/assets/{index-BQyZXdTq.js → index-VYPC3lji.js} +2 -2
- package/dist/assets/index-Wu-q9oyp.js +1 -0
- package/dist/assets/{index-DvvRs9Ha.js → index-as7vp0Ty.js} +1 -1
- package/dist/assets/{index-BCiHeRl-.js → index-jFDc_D4d.js} +1 -1
- package/dist/assets/{index-CEiIgRJ2.js → index-jpqj1MvA.js} +7 -7
- package/dist/assets/{index.es-C9I2aTP4.js → index.es-CuvVRlqN.js} +1 -1
- package/dist/assets/{insert-business-trip-modal-DVcWpJHr.js → insert-business-trip-modal-DyHAvuG6.js} +2 -2
- package/dist/assets/issue-document-BvIvdS89.js +1 -0
- package/dist/assets/{list-plus-B7wBrICK.js → list-plus-CYtq--On.js} +1 -1
- package/dist/assets/login-page-DcZw6k7i.js +1 -0
- package/dist/assets/{match-document-modal-CqP2SE2c.js → match-document-modal-Bs-5Zbj9.js} +4 -4
- package/dist/assets/{missing-info-charges-CIs_kE3P.js → missing-info-charges-e6O9it1V.js} +1 -1
- package/dist/assets/{modal-CwuHXtxz.js → modal-CqL_DX_G.js} +1 -1
- package/dist/assets/modify-contract-dialog-C8WuljxW.js +1 -0
- package/dist/assets/{page-layout-XgNPsCmr.js → page-layout-DfZJtWW1.js} +1 -1
- package/dist/assets/{page-not-found-CrFJMQNO.js → page-not-found-DnA0E-xR.js} +1 -1
- package/dist/assets/{panel-top-open-DU7alj-S.js → panel-top-open-D0lkFvhk.js} +1 -1
- package/dist/assets/{pencil-9DTTP5vx.js → pencil-DhN5v-Lb.js} +1 -1
- package/dist/assets/{report-commentary-row-BdS3qqMS.js → report-commentary-row-DvvXelmb.js} +1 -1
- package/dist/assets/{save-i8sPy_OW.js → save-CCZ-i4rw.js} +1 -1
- package/dist/assets/{similar-transactions-modal-CZAOYt-d.js → similar-transactions-modal-kFlTMg9C.js} +1 -1
- package/dist/assets/{sub-BL9nfaPD.js → sub-BKVGhLrr.js} +1 -1
- package/dist/assets/subMonths-Cbkj4M6-.js +1 -0
- package/dist/assets/{summary-Dfiju7xJ.js → summary-BuSv6nwb.js} +1 -1
- package/dist/assets/{toggle-expansion-button-BbVh8z6s.js → toggle-expansion-button-CojtDNtC.js} +1 -1
- package/dist/assets/tooltip-CoQF2skM.js +1 -0
- package/dist/assets/{use-url-query-5TFyEk1x.js → use-url-query-90MrwS1C.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/src/components/business/admin-business-section.tsx +282 -103
- package/src/components/clients/contracts/modify-contract-dialog.tsx +1 -7
- package/src/components/contracts/cells/date.tsx +5 -1
- package/src/components/contracts/columns.tsx +1 -1
- package/src/components/contracts/contracts-filter.tsx +8 -9
- package/src/components/contracts/index.tsx +0 -1
- package/src/components/contracts/issue-documents-modal.tsx +5 -3
- package/src/components/screens/businesses/clients/contracts/contracts.tsx +2 -4
- package/src/gql/gql.ts +3 -3
- package/src/gql/graphql.ts +52 -17
- package/dist/assets/business-qHY5sNtm.js +0 -37
- package/dist/assets/contracts-C26gq1yS.js +0 -16
- package/dist/assets/index-B86FoQmY.js +0 -1
- package/dist/assets/index-BZLSFBEt.js +0 -1
- package/dist/assets/index-CqIav7Xr.js +0 -1
- package/dist/assets/index-Dp9F68vS.js +0 -1
- package/dist/assets/index-NdA_oCxx.js +0 -1
- package/dist/assets/index-q3ev6JER.js +0 -1
- package/dist/assets/issue-document-BxTTlJ1T.js +0 -1
- package/dist/assets/login-page-BpgscuKm.js +0 -1
- package/dist/assets/modify-contract-dialog-BoeamC68.js +0 -1
- package/dist/assets/subMonths-DHPWOZP6.js +0 -1
- package/dist/assets/tooltip-C-fd9L1l.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @accounter/client
|
|
2
2
|
|
|
3
|
-
## 0.0.8-alpha-
|
|
3
|
+
## 0.0.8-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -145,6 +145,20 @@
|
|
|
145
145
|
[`lucide-react@0.548.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.548.0) (from
|
|
146
146
|
`0.547.0`, in `dependencies`)
|
|
147
147
|
|
|
148
|
+
- [#2644](https://github.com/Urigo/accounter-fullstack/pull/2644)
|
|
149
|
+
[`7f9f9be`](https://github.com/Urigo/accounter-fullstack/commit/7f9f9be25556b5f66f430a5f660a71ef1b1b3464)
|
|
150
|
+
Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
|
|
151
|
+
- Updated dependency
|
|
152
|
+
[`react-router-dom@7.9.5` ↗︎](https://www.npmjs.com/package/react-router-dom/v/7.9.5) (from
|
|
153
|
+
`7.9.4`, in `dependencies`)
|
|
154
|
+
|
|
155
|
+
- [#2646](https://github.com/Urigo/accounter-fullstack/pull/2646)
|
|
156
|
+
[`1c8d288`](https://github.com/Urigo/accounter-fullstack/commit/1c8d28840c2c54a3948cd965695e16f84f0fccf2)
|
|
157
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - dependencies updates:
|
|
158
|
+
- Updated dependency
|
|
159
|
+
[`react-router-dom@7.9.5` ↗︎](https://www.npmjs.com/package/react-router-dom/v/7.9.5) (from
|
|
160
|
+
`7.9.4`, in `dependencies`)
|
|
161
|
+
|
|
148
162
|
- [#2631](https://github.com/Urigo/accounter-fullstack/pull/2631)
|
|
149
163
|
[`86c8b3e`](https://github.com/Urigo/accounter-fullstack/commit/86c8b3ebea4e3be0c0e99a108ec1cdad8b39e5d8)
|
|
150
164
|
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Update**: A new
|
|
@@ -325,6 +339,21 @@
|
|
|
325
339
|
streamline the process of adding new businesses, specifically by simplifying the handling of tax
|
|
326
340
|
category insertions.
|
|
327
341
|
|
|
342
|
+
- [#2645](https://github.com/Urigo/accounter-fullstack/pull/2645)
|
|
343
|
+
[`9d8f87a`](https://github.com/Urigo/accounter-fullstack/commit/9d8f87ad54b583964ba731b8478742c09c5600df)
|
|
344
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Refactor**: The
|
|
345
|
+
`businesses_admin` table is updated to replace single-value fields for tax and social security
|
|
346
|
+
identifiers with array-based JSONB columns, allowing for multiple annual IDs and historical tax
|
|
347
|
+
rates.
|
|
348
|
+
- **GraphQL Schema Update**: The GraphQL `AdminBusiness` type and related input types
|
|
349
|
+
(`CreateAdminBusinessInput`, `UpdateAdminBusinessInput`) are modified to reflect the new array
|
|
350
|
+
structures, introducing `AnnualId` and `TaxAdvancesRate` types.
|
|
351
|
+
- **Frontend Form Overhaul**: The `admin-business-section.tsx` component is refactored to use
|
|
352
|
+
`react-hook-form`'s `useFieldArray` for dynamic management of annual IDs and tax rates,
|
|
353
|
+
providing a more flexible user interface.
|
|
354
|
+
- **Backend Logic Adaptation**: New Zod schemas and resolver logic are implemented on the server
|
|
355
|
+
to validate and process the updated array-based data for admin business updates.
|
|
356
|
+
|
|
328
357
|
- [#2640](https://github.com/Urigo/accounter-fullstack/pull/2640)
|
|
329
358
|
[`26618ff`](https://github.com/Urigo/accounter-fullstack/commit/26618ff2d4a47d63e16ecec59f39887f48df52cf)
|
|
330
359
|
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Renaming and Restructuring**: Key
|
|
@@ -339,6 +368,25 @@
|
|
|
339
368
|
support fetching ledger records and transactions specifically by financial entity, catering to
|
|
340
369
|
the new UI structure.
|
|
341
370
|
|
|
371
|
+
- [#2646](https://github.com/Urigo/accounter-fullstack/pull/2646)
|
|
372
|
+
[`1c8d288`](https://github.com/Urigo/accounter-fullstack/commit/1c8d28840c2c54a3948cd965695e16f84f0fccf2)
|
|
373
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **New Contracts Screen**: A dedicated
|
|
374
|
+
user interface has been introduced for viewing and managing client contracts, accessible via a new
|
|
375
|
+
sidebar link.
|
|
376
|
+
- **Enhanced Contract Management**: The new screen features a comprehensive data table for
|
|
377
|
+
contracts, offering functionalities like sorting, filtering by various criteria (product type,
|
|
378
|
+
billing cycle, subscription plan, active status), column visibility toggling, and pagination.
|
|
379
|
+
- **Contract Editing Functionality**: Users can now edit existing contracts directly from the
|
|
380
|
+
contracts table through a modified dialog that fetches and pre-fills contract details for a
|
|
381
|
+
seamless editing experience.
|
|
382
|
+
- **Bulk Document Issuance**: A new modal allows users to select multiple contracts and generate
|
|
383
|
+
document drafts for a specified month, streamlining the process of creating invoices or other
|
|
384
|
+
contract-related documents.
|
|
385
|
+
- **Backend API and Caching Improvements**: New GraphQL queries and resolvers have been added to
|
|
386
|
+
support fetching contracts by administrator ID and individual contract details. The backend also
|
|
387
|
+
includes refined cache invalidation logic for contract operations, ensuring data consistency and
|
|
388
|
+
improved performance.
|
|
389
|
+
|
|
342
390
|
## 0.0.7
|
|
343
391
|
|
|
344
392
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as fr,r as w,c7 as Q,ep as ur,
|
|
1
|
+
import{v as fr,r as w,c7 as Q,ep as ur,ag as t,eq as R,c5 as X,c6 as D,c8 as n,er as I,c9 as z,es as vr,et as _r,eu as yr}from"./index-UOt3vExk.js";/**
|
|
2
2
|
* @license lucide-react v0.548.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c5 as Ee,c8 as f,c6 as _,aa as p,eC as Lr,ht as be,r as E,c7 as jr,eD as Fr,hu as Hr,eu as Wr,et as Ar,ep as _e,hv as Kr,hw as Ur,fP as ae,eq as Oe,hx as te,hy as qr,eA as Tr,hz as Zr,hA as Gr}from"./index-Bd-SKdyy.js";const Ve={xs:f(16),sm:f(22),md:f(26),lg:f(30),xl:f(36)},Jr={xs:f(10),sm:f(12),md:f(14),lg:f(16),xl:f(18)};var Qr=Ee((e,{disabled:r,radius:a,readOnly:n},{size:v,variant:y})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:r?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:y==="filled"?e.white:e.colors.gray[1],color:r?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:_({size:v,sizes:Ve}),paddingLeft:`calc(${_({size:v,sizes:e.spacing})} / 1.5)`,paddingRight:r||n?_({size:v,sizes:e.spacing}):0,fontWeight:500,fontSize:_({size:v,sizes:Jr}),borderRadius:_({size:a,sizes:e.radius}),cursor:r?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${f(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${_({size:v,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}})),Xr=Object.defineProperty,G=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,Pe=(e,r,a)=>r in e?Xr(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,Yr=(e,r)=>{for(var a in r||(r={}))$e.call(r,a)&&Pe(e,a,r[a]);if(G)for(var a of G(r))Re.call(r,a)&&Pe(e,a,r[a]);return e},ea=(e,r)=>{var a={};for(var n in e)$e.call(e,n)&&r.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&G)for(var n of G(e))r.indexOf(n)<0&&Re.call(e,n)&&(a[n]=e[n]);return a};const ra={xs:16,sm:22,md:24,lg:26,xl:30};function ze(e){var r=e,{label:a,classNames:n,styles:v,className:y,onRemove:N,disabled:I,readOnly:s,size:u,radius:h="sm",variant:O,unstyled:K}=r,Q=ea(r,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:H,cx:M}=Qr({disabled:I,readOnly:s,radius:h},{name:"MultiSelect",classNames:n,styles:v,unstyled:K,size:u,variant:O});return p.createElement("div",Yr({className:M(H.defaultValue,y)},Q),p.createElement("span",{className:H.defaultValueLabel},a),!I&&!s&&p.createElement(Lr,{"aria-hidden":!0,onMouseDown:N,size:ra[u],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:H.defaultValueRemove,tabIndex:-1,unstyled:K}))}ze.displayName="@mantine/core/MultiSelect/DefaultValue";function aa({data:e,searchable:r,limit:a,searchValue:n,filter:v,value:y,disableSelectedItemFiltering:N}){if(!r&&y.length===0)return e;if(!r){const s=[];for(let u=0;u<e.length;u+=1)(N||!y.some(h=>h===e[u].value&&!e[u].disabled))&&s.push(e[u]);return s}const I=[];for(let s=0;s<e.length&&(v(n,!N&&y.some(u=>u===e[s].value&&!e[s].disabled),e[s])&&I.push(e[s]),!(I.length>=a));s+=1);return I}var ta=Object.defineProperty,na=Object.defineProperties,la=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertySymbols,oa=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,Ie=(e,r,a)=>r in e?ta(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,ia=(e,r)=>{for(var a in r||(r={}))oa.call(r,a)&&Ie(e,a,r[a]);if(xe)for(var a of xe(r))sa.call(r,a)&&Ie(e,a,r[a]);return e},ca=(e,r)=>na(e,la(r)),ua=Ee((e,{invalid:r},{size:a})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${_({size:a,sizes:be})} - ${f(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:_({size:a,sizes:be})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${f(2)}) calc(${e.spacing.xs} / 2)`},searchInput:ca(ia({},e.fn.fontStyles()),{flex:1,minWidth:f(60),backgroundColor:"transparent",border:0,outline:0,fontSize:_({size:a,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:_({size:a,sizes:Ve}),"&::placeholder":{opacity:1,color:r?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}})),da=Object.defineProperty,pa=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,Ce=(e,r,a)=>r in e?da(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,F=(e,r)=>{for(var a in r||(r={}))Ne.call(r,a)&&Ce(e,a,r[a]);if(J)for(var a of J(r))Me.call(r,a)&&Ce(e,a,r[a]);return e},De=(e,r)=>pa(e,fa(r)),ha=(e,r)=>{var a={};for(var n in e)Ne.call(e,n)&&r.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&J)for(var n of J(e))r.indexOf(n)<0&&Me.call(e,n)&&(a[n]=e[n]);return a};function ga(e,r,a){return r?!1:a.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function ma(e,r){return!!e&&!r.some(a=>a.value.toLowerCase()===e.toLowerCase())}function ke(e,r){if(!Array.isArray(e))return;if(r.length===0)return[];const a=r.map(n=>typeof n=="object"?n.value:n);return e.filter(n=>a.includes(n))}const va={size:"sm",valueComponent:ze,itemComponent:Hr,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:ga,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:ma,switchDirectionOnFlip:!1,zIndex:Fr("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},wa=E.forwardRef((e,r)=>{const a=jr("MultiSelect",va,e),{className:n,style:v,required:y,label:N,description:I,size:s,error:u,classNames:h,styles:O,wrapperProps:K,value:Q,defaultValue:H,data:M,onChange:Be,valueComponent:Le,itemComponent:je,id:Fe,transitionProps:He,maxDropdownHeight:We,shadow:ya,nothingFound:ne,onFocus:le,onBlur:oe,searchable:S,placeholder:Ae,filter:Ke,limit:Ue,clearSearchOnChange:qe,clearable:se,clearSearchOnBlur:Te,variant:B,onSearchChange:Ze,searchValue:Ge,disabled:P,initiallyOpened:Je,radius:ie,icon:Qe,rightSection:Xe,rightSectionWidth:Ye,creatable:ce,getCreateLabel:ue,shouldCreate:er,onCreate:de,sx:rr,dropdownComponent:ar,onDropdownClose:tr,onDropdownOpen:nr,maxSelectedValues:g,withinPortal:lr,portalProps:or,switchDirectionOnFlip:sr,zIndex:ir,selectOnBlur:cr,name:ur,dropdownPosition:dr,errorProps:pr,labelProps:fr,descriptionProps:hr,form:gr,positionDependencies:mr,onKeyDown:pe,unstyled:W,inputContainer:vr,inputWrapperOrder:wr,readOnly:V,withAsterisk:yr,clearButtonProps:Sr,hoverOnSearchChange:fe,disableSelectedItemFiltering:br}=a,_r=ha(a,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:C,cx:he,theme:Or}=ua({invalid:!!u},{name:"MultiSelect",classNames:h,styles:O,unstyled:W,size:s,variant:B}),{systemStyles:Pr,rest:xr}=Wr(_r),X=E.useRef(),Y=E.useRef({}),L=Ar(Fe),[d,c]=E.useState(Je),[Ir,D]=E.useState(-1),[ge,Cr]=E.useState("column"),[b,U]=_e({value:Ge,defaultValue:"",finalValue:void 0,onChange:Ze}),[Dr,me]=E.useState(!1),{scrollIntoView:q,targetRef:ve,scrollableRef:kr}=Kr({duration:0,offset:5,cancelable:!1,isList:!0}),we=ce&&typeof ue=="function";let ee=null;const Er=M.map(t=>typeof t=="string"?{label:t,value:t}:t),re=Ur({data:Er}),[o,j]=_e({value:ke(Q,M),defaultValue:ke(H,M),finalValue:[],onChange:Be}),w=E.useRef(!!g&&g<o.length),ye=t=>{if(!V){const l=o.filter(m=>m!==t);j(l),g&&l.length<g&&(w.current=!1)}},Vr=t=>{U(t.currentTarget.value),!P&&!w.current&&S&&c(!0)},$r=t=>{typeof le=="function"&&le(t),!P&&!w.current&&S&&c(!0)},i=aa({data:re,searchable:S,searchValue:b,limit:Ue,filter:Ke,value:o,disableSelectedItemFiltering:br});we&&er(b,re)&&(ee=ue(b),i.push({label:b,value:b,creatable:!0}));const $=Math.min(Ir,i.length-1),Se=(t,l,m)=>{let k=t;for(;m(k);)if(k=l(k),!i[k].disabled)return k;return t};ae(()=>{D(fe&&b?0:-1)},[b,fe]),ae(()=>{!P&&o.length>M.length&&c(!1),g&&o.length<g&&(w.current=!1),g&&o.length>=g&&(w.current=!0,c(!1))},[o]);const T=t=>{if(!V)if(qe&&U(""),o.includes(t.value))ye(t.value);else{if(t.creatable&&typeof de=="function"){const l=de(t.value);typeof l<"u"&&l!==null&&j(typeof l=="string"?[...o,l]:[...o,l.value])}else j([...o,t.value]);o.length===g-1&&(w.current=!0,c(!1)),i.length===1&&c(!1)}},Rr=t=>{typeof oe=="function"&&oe(t),cr&&i[$]&&d&&T(i[$]),Te&&U(""),c(!1)},zr=t=>{if(Dr||(pe?.(t),V)||t.key!=="Backspace"&&g&&w.current)return;const l=ge==="column",m=()=>{D(R=>{var x;const A=Se(R,z=>z+1,z=>z<i.length-1);return d&&(ve.current=Y.current[(x=i[A])==null?void 0:x.value],q({alignment:l?"end":"start"})),A})},k=()=>{D(R=>{var x;const A=Se(R,z=>z-1,z=>z>0);return d&&(ve.current=Y.current[(x=i[A])==null?void 0:x.value],q({alignment:l?"start":"end"})),A})};switch(t.key){case"ArrowUp":{t.preventDefault(),c(!0),l?k():m();break}case"ArrowDown":{t.preventDefault(),c(!0),l?m():k();break}case"Enter":{t.preventDefault(),i[$]&&d?T(i[$]):c(!0);break}case" ":{S||(t.preventDefault(),i[$]&&d?T(i[$]):c(!0));break}case"Backspace":{o.length>0&&b.length===0&&(j(o.slice(0,-1)),c(!0),g&&(w.current=!1));break}case"Home":{if(!S){t.preventDefault(),d||c(!0);const R=i.findIndex(x=>!x.disabled);D(R),q({alignment:l?"end":"start"})}break}case"End":{if(!S){t.preventDefault(),d||c(!0);const R=i.map(x=>!!x.disabled).lastIndexOf(!1);D(R),q({alignment:l?"end":"start"})}break}case"Escape":c(!1)}},Nr=o.map(t=>{let l=re.find(m=>m.value===t&&!m.disabled);return!l&&we&&(l={value:t,label:t}),l}).filter(t=>!!t).map((t,l)=>p.createElement(Le,De(F({},t),{variant:B,disabled:P,className:C.value,readOnly:V,onRemove:m=>{m.preventDefault(),m.stopPropagation(),ye(t.value)},key:t.value,size:s,styles:O,classNames:h,radius:ie,index:l}))),Mr=t=>o.includes(t),Br=()=>{var t;U(""),j([]),(t=X.current)==null||t.focus(),g&&(w.current=!1)},Z=!V&&(i.length>0?d:d&&!!ne);return ae(()=>{const t=Z?nr:tr;typeof t=="function"&&t()},[Z]),p.createElement(Oe.Wrapper,F(F({required:y,id:L,label:N,error:u,description:I,size:s,className:n,style:v,classNames:h,styles:O,__staticSelector:"MultiSelect",sx:rr,errorProps:pr,descriptionProps:hr,labelProps:fr,inputContainer:vr,inputWrapperOrder:wr,unstyled:W,withAsterisk:yr,variant:B},Pr),K),p.createElement(te,{opened:Z,transitionProps:He,shadow:"sm",withinPortal:lr,portalProps:or,__staticSelector:"MultiSelect",onDirectionChange:Cr,switchDirectionOnFlip:sr,zIndex:ir,dropdownPosition:dr,positionDependencies:[...mr,b],classNames:h,styles:O,unstyled:W,variant:B},p.createElement(te.Target,null,p.createElement("div",{className:C.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":d&&Z?`${L}-items`:null,"aria-controls":L,"aria-expanded":d,onMouseLeave:()=>D(-1),tabIndex:-1},p.createElement("input",{type:"hidden",name:ur,value:o.join(","),form:gr,disabled:P}),p.createElement(Oe,F({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:s,variant:B,disabled:P,error:u,required:y,radius:ie,icon:Qe,unstyled:W,onMouseDown:t=>{var l;t.preventDefault(),!P&&!w.current&&c(!d),(l=X.current)==null||l.focus()},classNames:De(F({},h),{input:he({[C.input]:!S},h?.input)})},qr({theme:Or,rightSection:Xe,rightSectionWidth:Ye,styles:O,size:s,shouldClear:se&&o.length>0,onClear:Br,error:u,disabled:P,clearButtonProps:Sr,readOnly:V})),p.createElement("div",{className:C.values,"data-clearable":se||void 0},Nr,p.createElement("input",F({ref:Tr(r,X),type:"search",id:L,className:he(C.searchInput,{[C.searchInputPointer]:!S,[C.searchInputInputHidden]:!d&&o.length>0||!S&&o.length>0,[C.searchInputEmpty]:o.length===0}),onKeyDown:zr,value:b,onChange:Vr,onFocus:$r,onBlur:Rr,readOnly:!S||w.current||V,placeholder:o.length===0?Ae:void 0,disabled:P,"data-mantine-stop-propagation":d,autoComplete:"off",onCompositionStart:()=>me(!0),onCompositionEnd:()=>me(!1)},xr)))))),p.createElement(te.Dropdown,{component:ar||Zr,maxHeight:We,direction:ge,id:L,innerRef:kr,__staticSelector:"MultiSelect",classNames:h,styles:O},p.createElement(Gr,{data:i,hovered:$,classNames:h,styles:O,uuid:L,__staticSelector:"MultiSelect",onItemHover:D,onItemSelect:T,itemsRefs:Y,itemComponent:je,size:s,nothingFound:ne,isItemSelected:Mr,creatable:ce&&!!ee,createLabel:ee,unstyled:W,variant:B}))))});wa.displayName="@mantine/core/MultiSelect";export{wa as M};
|
|
1
|
+
import{c5 as Ee,c8 as f,c6 as _,ag as p,eC as Lr,ht as be,r as E,c7 as jr,eD as Fr,hu as Hr,eu as Wr,et as Ar,ep as _e,hv as Kr,hw as Ur,fP as ae,eq as Oe,hx as te,hy as qr,eA as Tr,hz as Zr,hA as Gr}from"./index-UOt3vExk.js";const Ve={xs:f(16),sm:f(22),md:f(26),lg:f(30),xl:f(36)},Jr={xs:f(10),sm:f(12),md:f(14),lg:f(16),xl:f(18)};var Qr=Ee((e,{disabled:r,radius:a,readOnly:n},{size:v,variant:y})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:r?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:y==="filled"?e.white:e.colors.gray[1],color:r?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:_({size:v,sizes:Ve}),paddingLeft:`calc(${_({size:v,sizes:e.spacing})} / 1.5)`,paddingRight:r||n?_({size:v,sizes:e.spacing}):0,fontWeight:500,fontSize:_({size:v,sizes:Jr}),borderRadius:_({size:a,sizes:e.radius}),cursor:r?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${f(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${_({size:v,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}})),Xr=Object.defineProperty,G=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,Pe=(e,r,a)=>r in e?Xr(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,Yr=(e,r)=>{for(var a in r||(r={}))$e.call(r,a)&&Pe(e,a,r[a]);if(G)for(var a of G(r))Re.call(r,a)&&Pe(e,a,r[a]);return e},ea=(e,r)=>{var a={};for(var n in e)$e.call(e,n)&&r.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&G)for(var n of G(e))r.indexOf(n)<0&&Re.call(e,n)&&(a[n]=e[n]);return a};const ra={xs:16,sm:22,md:24,lg:26,xl:30};function ze(e){var r=e,{label:a,classNames:n,styles:v,className:y,onRemove:N,disabled:I,readOnly:s,size:u,radius:h="sm",variant:O,unstyled:K}=r,Q=ea(r,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:H,cx:M}=Qr({disabled:I,readOnly:s,radius:h},{name:"MultiSelect",classNames:n,styles:v,unstyled:K,size:u,variant:O});return p.createElement("div",Yr({className:M(H.defaultValue,y)},Q),p.createElement("span",{className:H.defaultValueLabel},a),!I&&!s&&p.createElement(Lr,{"aria-hidden":!0,onMouseDown:N,size:ra[u],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:H.defaultValueRemove,tabIndex:-1,unstyled:K}))}ze.displayName="@mantine/core/MultiSelect/DefaultValue";function aa({data:e,searchable:r,limit:a,searchValue:n,filter:v,value:y,disableSelectedItemFiltering:N}){if(!r&&y.length===0)return e;if(!r){const s=[];for(let u=0;u<e.length;u+=1)(N||!y.some(h=>h===e[u].value&&!e[u].disabled))&&s.push(e[u]);return s}const I=[];for(let s=0;s<e.length&&(v(n,!N&&y.some(u=>u===e[s].value&&!e[s].disabled),e[s])&&I.push(e[s]),!(I.length>=a));s+=1);return I}var ta=Object.defineProperty,na=Object.defineProperties,la=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertySymbols,oa=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,Ie=(e,r,a)=>r in e?ta(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,ia=(e,r)=>{for(var a in r||(r={}))oa.call(r,a)&&Ie(e,a,r[a]);if(xe)for(var a of xe(r))sa.call(r,a)&&Ie(e,a,r[a]);return e},ca=(e,r)=>na(e,la(r)),ua=Ee((e,{invalid:r},{size:a})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${_({size:a,sizes:be})} - ${f(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:_({size:a,sizes:be})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${f(2)}) calc(${e.spacing.xs} / 2)`},searchInput:ca(ia({},e.fn.fontStyles()),{flex:1,minWidth:f(60),backgroundColor:"transparent",border:0,outline:0,fontSize:_({size:a,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:_({size:a,sizes:Ve}),"&::placeholder":{opacity:1,color:r?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}})),da=Object.defineProperty,pa=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,Ce=(e,r,a)=>r in e?da(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,F=(e,r)=>{for(var a in r||(r={}))Ne.call(r,a)&&Ce(e,a,r[a]);if(J)for(var a of J(r))Me.call(r,a)&&Ce(e,a,r[a]);return e},De=(e,r)=>pa(e,fa(r)),ha=(e,r)=>{var a={};for(var n in e)Ne.call(e,n)&&r.indexOf(n)<0&&(a[n]=e[n]);if(e!=null&&J)for(var n of J(e))r.indexOf(n)<0&&Me.call(e,n)&&(a[n]=e[n]);return a};function ga(e,r,a){return r?!1:a.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function ma(e,r){return!!e&&!r.some(a=>a.value.toLowerCase()===e.toLowerCase())}function ke(e,r){if(!Array.isArray(e))return;if(r.length===0)return[];const a=r.map(n=>typeof n=="object"?n.value:n);return e.filter(n=>a.includes(n))}const va={size:"sm",valueComponent:ze,itemComponent:Hr,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:ga,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:ma,switchDirectionOnFlip:!1,zIndex:Fr("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},wa=E.forwardRef((e,r)=>{const a=jr("MultiSelect",va,e),{className:n,style:v,required:y,label:N,description:I,size:s,error:u,classNames:h,styles:O,wrapperProps:K,value:Q,defaultValue:H,data:M,onChange:Be,valueComponent:Le,itemComponent:je,id:Fe,transitionProps:He,maxDropdownHeight:We,shadow:ya,nothingFound:ne,onFocus:le,onBlur:oe,searchable:S,placeholder:Ae,filter:Ke,limit:Ue,clearSearchOnChange:qe,clearable:se,clearSearchOnBlur:Te,variant:B,onSearchChange:Ze,searchValue:Ge,disabled:P,initiallyOpened:Je,radius:ie,icon:Qe,rightSection:Xe,rightSectionWidth:Ye,creatable:ce,getCreateLabel:ue,shouldCreate:er,onCreate:de,sx:rr,dropdownComponent:ar,onDropdownClose:tr,onDropdownOpen:nr,maxSelectedValues:g,withinPortal:lr,portalProps:or,switchDirectionOnFlip:sr,zIndex:ir,selectOnBlur:cr,name:ur,dropdownPosition:dr,errorProps:pr,labelProps:fr,descriptionProps:hr,form:gr,positionDependencies:mr,onKeyDown:pe,unstyled:W,inputContainer:vr,inputWrapperOrder:wr,readOnly:V,withAsterisk:yr,clearButtonProps:Sr,hoverOnSearchChange:fe,disableSelectedItemFiltering:br}=a,_r=ha(a,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:C,cx:he,theme:Or}=ua({invalid:!!u},{name:"MultiSelect",classNames:h,styles:O,unstyled:W,size:s,variant:B}),{systemStyles:Pr,rest:xr}=Wr(_r),X=E.useRef(),Y=E.useRef({}),L=Ar(Fe),[d,c]=E.useState(Je),[Ir,D]=E.useState(-1),[ge,Cr]=E.useState("column"),[b,U]=_e({value:Ge,defaultValue:"",finalValue:void 0,onChange:Ze}),[Dr,me]=E.useState(!1),{scrollIntoView:q,targetRef:ve,scrollableRef:kr}=Kr({duration:0,offset:5,cancelable:!1,isList:!0}),we=ce&&typeof ue=="function";let ee=null;const Er=M.map(t=>typeof t=="string"?{label:t,value:t}:t),re=Ur({data:Er}),[o,j]=_e({value:ke(Q,M),defaultValue:ke(H,M),finalValue:[],onChange:Be}),w=E.useRef(!!g&&g<o.length),ye=t=>{if(!V){const l=o.filter(m=>m!==t);j(l),g&&l.length<g&&(w.current=!1)}},Vr=t=>{U(t.currentTarget.value),!P&&!w.current&&S&&c(!0)},$r=t=>{typeof le=="function"&&le(t),!P&&!w.current&&S&&c(!0)},i=aa({data:re,searchable:S,searchValue:b,limit:Ue,filter:Ke,value:o,disableSelectedItemFiltering:br});we&&er(b,re)&&(ee=ue(b),i.push({label:b,value:b,creatable:!0}));const $=Math.min(Ir,i.length-1),Se=(t,l,m)=>{let k=t;for(;m(k);)if(k=l(k),!i[k].disabled)return k;return t};ae(()=>{D(fe&&b?0:-1)},[b,fe]),ae(()=>{!P&&o.length>M.length&&c(!1),g&&o.length<g&&(w.current=!1),g&&o.length>=g&&(w.current=!0,c(!1))},[o]);const T=t=>{if(!V)if(qe&&U(""),o.includes(t.value))ye(t.value);else{if(t.creatable&&typeof de=="function"){const l=de(t.value);typeof l<"u"&&l!==null&&j(typeof l=="string"?[...o,l]:[...o,l.value])}else j([...o,t.value]);o.length===g-1&&(w.current=!0,c(!1)),i.length===1&&c(!1)}},Rr=t=>{typeof oe=="function"&&oe(t),cr&&i[$]&&d&&T(i[$]),Te&&U(""),c(!1)},zr=t=>{if(Dr||(pe?.(t),V)||t.key!=="Backspace"&&g&&w.current)return;const l=ge==="column",m=()=>{D(R=>{var x;const A=Se(R,z=>z+1,z=>z<i.length-1);return d&&(ve.current=Y.current[(x=i[A])==null?void 0:x.value],q({alignment:l?"end":"start"})),A})},k=()=>{D(R=>{var x;const A=Se(R,z=>z-1,z=>z>0);return d&&(ve.current=Y.current[(x=i[A])==null?void 0:x.value],q({alignment:l?"start":"end"})),A})};switch(t.key){case"ArrowUp":{t.preventDefault(),c(!0),l?k():m();break}case"ArrowDown":{t.preventDefault(),c(!0),l?m():k();break}case"Enter":{t.preventDefault(),i[$]&&d?T(i[$]):c(!0);break}case" ":{S||(t.preventDefault(),i[$]&&d?T(i[$]):c(!0));break}case"Backspace":{o.length>0&&b.length===0&&(j(o.slice(0,-1)),c(!0),g&&(w.current=!1));break}case"Home":{if(!S){t.preventDefault(),d||c(!0);const R=i.findIndex(x=>!x.disabled);D(R),q({alignment:l?"end":"start"})}break}case"End":{if(!S){t.preventDefault(),d||c(!0);const R=i.map(x=>!!x.disabled).lastIndexOf(!1);D(R),q({alignment:l?"end":"start"})}break}case"Escape":c(!1)}},Nr=o.map(t=>{let l=re.find(m=>m.value===t&&!m.disabled);return!l&&we&&(l={value:t,label:t}),l}).filter(t=>!!t).map((t,l)=>p.createElement(Le,De(F({},t),{variant:B,disabled:P,className:C.value,readOnly:V,onRemove:m=>{m.preventDefault(),m.stopPropagation(),ye(t.value)},key:t.value,size:s,styles:O,classNames:h,radius:ie,index:l}))),Mr=t=>o.includes(t),Br=()=>{var t;U(""),j([]),(t=X.current)==null||t.focus(),g&&(w.current=!1)},Z=!V&&(i.length>0?d:d&&!!ne);return ae(()=>{const t=Z?nr:tr;typeof t=="function"&&t()},[Z]),p.createElement(Oe.Wrapper,F(F({required:y,id:L,label:N,error:u,description:I,size:s,className:n,style:v,classNames:h,styles:O,__staticSelector:"MultiSelect",sx:rr,errorProps:pr,descriptionProps:hr,labelProps:fr,inputContainer:vr,inputWrapperOrder:wr,unstyled:W,withAsterisk:yr,variant:B},Pr),K),p.createElement(te,{opened:Z,transitionProps:He,shadow:"sm",withinPortal:lr,portalProps:or,__staticSelector:"MultiSelect",onDirectionChange:Cr,switchDirectionOnFlip:sr,zIndex:ir,dropdownPosition:dr,positionDependencies:[...mr,b],classNames:h,styles:O,unstyled:W,variant:B},p.createElement(te.Target,null,p.createElement("div",{className:C.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":d&&Z?`${L}-items`:null,"aria-controls":L,"aria-expanded":d,onMouseLeave:()=>D(-1),tabIndex:-1},p.createElement("input",{type:"hidden",name:ur,value:o.join(","),form:gr,disabled:P}),p.createElement(Oe,F({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:s,variant:B,disabled:P,error:u,required:y,radius:ie,icon:Qe,unstyled:W,onMouseDown:t=>{var l;t.preventDefault(),!P&&!w.current&&c(!d),(l=X.current)==null||l.focus()},classNames:De(F({},h),{input:he({[C.input]:!S},h?.input)})},qr({theme:Or,rightSection:Xe,rightSectionWidth:Ye,styles:O,size:s,shouldClear:se&&o.length>0,onClear:Br,error:u,disabled:P,clearButtonProps:Sr,readOnly:V})),p.createElement("div",{className:C.values,"data-clearable":se||void 0},Nr,p.createElement("input",F({ref:Tr(r,X),type:"search",id:L,className:he(C.searchInput,{[C.searchInputPointer]:!S,[C.searchInputInputHidden]:!d&&o.length>0||!S&&o.length>0,[C.searchInputEmpty]:o.length===0}),onKeyDown:zr,value:b,onChange:Vr,onFocus:$r,onBlur:Rr,readOnly:!S||w.current||V,placeholder:o.length===0?Ae:void 0,disabled:P,"data-mantine-stop-propagation":d,autoComplete:"off",onCompositionStart:()=>me(!0),onCompositionEnd:()=>me(!1)},xr)))))),p.createElement(te.Dropdown,{component:ar||Zr,maxHeight:We,direction:ge,id:L,innerRef:kr,__staticSelector:"MultiSelect",classNames:h,styles:O},p.createElement(Gr,{data:i,hovered:$,classNames:h,styles:O,uuid:L,__staticSelector:"MultiSelect",onItemHover:D,onItemSelect:T,itemsRefs:Y,itemComponent:je,size:s,nothingFound:ne,isItemSelected:Mr,creatable:ce&&!!ee,createLabel:ee,unstyled:W,variant:B}))))});wa.displayName="@mantine/core/MultiSelect";export{wa as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c5 as q,c6 as _,c8 as o,dA as G,r as H,c7 as J,
|
|
1
|
+
import{c5 as q,c6 as _,c8 as o,dA as G,r as H,c7 as J,ag as s,T as K,c9 as w,bc as O}from"./index-UOt3vExk.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},Q=G({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var U=q((a,{color:r,radius:e},{size:t})=>({root:{position:"relative",height:_({size:t,sizes:k}),backgroundColor:a.colorScheme==="dark"?a.colors.dark[4]:a.colors.gray[2],borderRadius:a.fn.radius(e),overflow:"hidden"},bar:{position:"absolute",top:0,bottom:0,left:0,height:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:a.fn.variant({variant:"filled",primaryFallback:!1,color:r||a.primaryColor}).background,transition:"width 100ms linear","&[data-animate]":{animation:`${Q} 1000ms linear infinite`},"&[data-striped]":{backgroundSize:`${o(20)} ${o(20)}`,backgroundImage:"linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent)"},"&:last-of-type":{borderTopRightRadius:a.fn.radius(e),borderBottomRightRadius:a.fn.radius(e)},"&:first-of-type":{borderTopLeftRadius:a.fn.radius(e),borderBottomLeftRadius:a.fn.radius(e)},"@media (prefers-reduced-motion)":{transitionDuration:a.respectReducedMotion?"0ms":void 0}},label:{color:a.white,fontSize:`calc(${_({size:t,sizes:k})} * 0.65)`,fontWeight:700,userSelect:"none",overflow:"hidden",whiteSpace:"nowrap"}})),X=Object.defineProperty,Y=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?X(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e,c=(a,r)=>{for(var e in r||(r={}))R.call(r,e)&&N(a,e,r[e]);if(n)for(var e of n(r))S.call(r,e)&&N(a,e,r[e]);return a},h=(a,r)=>Y(a,Z(r)),x=(a,r)=>{var e={};for(var t in a)R.call(a,t)&&r.indexOf(t)<0&&(e[t]=a[t]);if(a!=null&&n)for(var t of n(a))r.indexOf(t)<0&&S.call(a,t)&&(e[t]=a[t]);return e};function aa(a){return a.reduce((r,e)=>(r.sections.push(h(c({},e),{accumulated:r.accumulated})),r.accumulated+=e.value,r),{accumulated:0,sections:[]}).sections}const ea={size:"md",radius:"sm",striped:!1,animate:!1,label:""},ra=H.forwardRef((a,r)=>{const e=J("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:T,sections:p,unstyled:A,variant:D}=e,I=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=U({color:C,radius:$},{name:"Progress",classNames:z,styles:T,unstyled:A,variant:D,size:E}),L=Array.isArray(p)?aa(p).map((B,F)=>{var v=B,{tooltip:g,accumulated:V,value:M,label:y,color:W}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(K.Floating,{label:g,disabled:!g,key:F},s.createElement(w,h(c({},P),{className:f(l.bar,P.className),"data-striped":u||i||void 0,"data-animate":i||void 0,sx:{width:`${M}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:W||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},I),L||s.createElement("div",{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":d,"aria-label":j,className:l.bar,style:{width:`${d}%`},"data-striped":u||i||void 0,"data-animate":i||void 0},m?s.createElement(O,{className:l.label},m):""))});ra.displayName="@mantine/core/Progress";export{ra as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c5 as $,c8 as k,c6 as s,r as j,c7 as m,
|
|
1
|
+
import{c5 as $,c8 as k,c6 as s,r as j,c7 as m,ag as x,c9 as T}from"./index-UOt3vExk.js";var B=Object.defineProperty,E=Object.defineProperties,N=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,p=(r,o,t)=>o in r?B(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t,D=(r,o)=>{for(var t in o||(o={}))R.call(o,t)&&p(r,t,o[t]);if(c)for(var t of c(o))C.call(o,t)&&p(r,t,o[t]);return r},H=(r,o)=>E(r,N(o)),I=$((r,{captionSide:o,horizontalSpacing:t,verticalSpacing:e,fontSize:n,withBorder:d,withColumnBorders:i})=>{const a=`${k(1)} solid ${r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[3]}`;return{root:H(D({},r.fn.fontStyles()),{width:"100%",borderCollapse:"collapse",captionSide:o,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,border:d?a:void 0,"& > caption":{marginTop:o==="top"?0:r.spacing.xs,marginBottom:o==="bottom"?0:r.spacing.xs,fontSize:r.fontSizes.sm,color:r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]},"& > thead > tr > th, & > tfoot > tr > th, & > tbody > tr > th":{textAlign:"left",fontWeight:"bold",color:r.colorScheme==="dark"?r.colors.dark[0]:r.colors.gray[7],fontSize:s({size:n,sizes:r.fontSizes}),padding:`${s({size:e,sizes:r.spacing})} ${s({size:t,sizes:r.spacing})}`},"& > thead > tr > th":{borderBottom:a},"& > tfoot > tr > th, & > tbody > tr > th":{borderTop:a},"& > tbody > tr > td":{padding:`${s({size:e,sizes:r.spacing})} ${s({size:t,sizes:r.spacing})}`,borderTop:a,fontSize:s({size:n,sizes:r.fontSizes})},"& > tbody > tr:first-of-type > td, & > tbody > tr:first-of-type > th":{borderTop:"none"},"& > thead > tr > th, & > tbody > tr > td":{borderRight:i?a:"none","&:last-of-type":{borderRight:"none",borderLeft:i?a:"none"}},"& > tbody > tr > th":{borderRight:i?a:"none"},"&[data-striped] > tbody > tr:nth-of-type(odd)":{backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[0]},"&[data-hover] > tbody > tr":r.fn.hover({backgroundColor:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[1]})})}}),V=Object.defineProperty,A=Object.defineProperties,L=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,f=(r,o,t)=>o in r?V(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t,W=(r,o)=>{for(var t in o||(o={}))g.call(o,t)&&f(r,t,o[t]);if(l)for(var t of l(o))b.call(o,t)&&f(r,t,o[t]);return r},q=(r,o)=>A(r,L(o)),F=(r,o)=>{var t={};for(var e in r)g.call(r,e)&&o.indexOf(e)<0&&(t[e]=r[e]);if(r!=null&&l)for(var e of l(r))o.indexOf(e)<0&&b.call(r,e)&&(t[e]=r[e]);return t};const G={striped:!1,highlightOnHover:!1,captionSide:"top",horizontalSpacing:"xs",fontSize:"sm",verticalSpacing:7,withBorder:!1,withColumnBorders:!1},J=j.forwardRef((r,o)=>{const t=m("Table",G,r),{className:e,children:n,striped:d,highlightOnHover:i,captionSide:a,horizontalSpacing:_,verticalSpacing:v,fontSize:y,unstyled:O,withBorder:S,withColumnBorders:P,variant:z}=t,h=F(t,["className","children","striped","highlightOnHover","captionSide","horizontalSpacing","verticalSpacing","fontSize","unstyled","withBorder","withColumnBorders","variant"]),{classes:u,cx:w}=I({captionSide:a,verticalSpacing:v,horizontalSpacing:_,fontSize:y,withBorder:S,withColumnBorders:P},{unstyled:O,name:"Table",variant:z});return x.createElement(T,q(W({},h),{component:"table",ref:o,className:w(u.root,e),"data-striped":d||void 0,"data-hover":i||void 0}),n)});J.displayName="@mantine/core/Table";export{J as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dQ as S,dR as K,dS as Q,dT as X,dU as E,dV as Y,d6 as Z,d5 as z,r as A,da as N,dW as tt,j as et,
|
|
1
|
+
import{dQ as S,dR as K,dS as Q,dT as X,dU as E,dV as Y,d6 as Z,d5 as z,r as A,da as N,dW as tt,j as et,ah as rt,dB as _}from"./index-UOt3vExk.js";function kt(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}const $=t=>t,nt=()=>{let t=$;return{configure(e){t=e},generate(e){return t(e)},reset(){t=$}}},ot=nt(),st={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function H(t,e,r="Mui"){const n=st[e];return n?`${r}-${n}`:`${ot.generate(t)}-${e}`}function it(t,e,r="Mui"){const n={};return e.forEach(o=>{n[o]=H(t,o,r)}),n}function G(t){const{variants:e,...r}=t,n={variants:e,style:S(r),isProcessed:!0};return n.style===r||e&&e.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const at=K();function F(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}function g(t,e){return e&&t&&typeof t=="object"&&t.styles&&!t.styles.startsWith("@layer")&&(t.styles=`@layer ${e}{${String(t.styles)}}`),t}function lt(t){return t?(e,r)=>r[t]:null}function ut(t,e,r){t.theme=ht(t.theme)?r:t.theme[e]||t.theme}function M(t,e,r){const n=typeof e=="function"?e(t):e;if(Array.isArray(n))return n.flatMap(o=>M(t,o,r));if(Array.isArray(n?.variants)){let o;if(n.isProcessed)o=r?g(n.style,r):n.style;else{const{variants:s,...i}=n;o=r?g(S(i),r):i}return I(t,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(t,e,r=[],n=void 0){let o;t:for(let s=0;s<e.length;s+=1){const i=e[s];if(typeof i.props=="function"){if(o??={...t,...t.ownerState,ownerState:t.ownerState},!i.props(o))continue}else for(const a in i.props)if(t[a]!==i.props[a]&&t.ownerState?.[a]!==i.props[a])continue t;typeof i.style=="function"?(o??={...t,...t.ownerState,ownerState:t.ownerState},r.push(n?g(S(i.style(o)),n):i.style(o))):r.push(n?g(S(i.style),n):i.style)}return r}function ct(t={}){const{themeId:e,defaultTheme:r=at,rootShouldForwardProp:n=F,slotShouldForwardProp:o=F}=t;function s(a){ut(a,e,r)}return(a,y={})=>{Q(a,u=>u.filter(c=>c!==E));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=lt(dt(h)),...T}=y,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,k=C||!1;let x=F;h==="Root"||h==="root"?x=n:h?x=o:pt(a)&&(x=void 0);const V=X(a,{shouldForwardProp:x,label:ft(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return M(m,u,m.theme.modularCssLayers?w:void 0)};if(Y(u)){const c=G(u);return function(d){return c.variants?M(d,c,d.theme.modularCssLayers?w:void 0):d.theme.modularCssLayers?g(c.style,w):c.style}}return u},B=(...u)=>{const c=[],m=u.map(q),d=[];if(c.push(s),l&&v&&d.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const W={};for(const j in p)W[j]=M(f,p[j],f.theme.modularCssLayers?"theme":void 0);return v(f,W)}),l&&!P&&d.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),k||d.push(E),Array.isArray(m[0])){const R=m.shift(),f=new Array(c.length).fill(""),O=new Array(d.length).fill("");let p;p=[...f,...R,...O],p.raw=[...f,...R.raw,...O],c.unshift(p)}const J=[...c,...m,...d],L=V(...J);return a.muiName&&(L.muiName=a.muiName),L};return V.withConfig&&(B.withConfig=V.withConfig),B}}function ft(t,e){return void 0}function ht(t){for(const e in t)return!1;return!0}function pt(t){return typeof t=="string"&&t.charCodeAt(0)>96}function dt(t){return t&&t.charAt(0).toLowerCase()+t.slice(1)}const U={theme:void 0};function yt(t){let e,r;return function(o){let s=e;return(s===void 0||o.theme!==r)&&(U.theme=o.theme,s=G(t(U)),e=s,r=o.theme),s}}function mt(t,e,r=void 0){const n={};for(const o in t){const s=t[o];let i="",a=!0;for(let y=0;y<s.length;y+=1){const l=s[y];l&&(i+=(a===!0?"":" ")+e(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function gt(t){return t!=="ownerState"&&t!=="theme"&&t!=="sx"&&t!=="as"}const St=t=>gt(t)&&t!=="classes",vt=ct({themeId:Z,defaultTheme:z,rootShouldForwardProp:St}),wt=yt;function Vt(...t){const e=A.useRef(void 0),r=A.useCallback(n=>{const o=t.map(s=>{if(s==null)return null;if(typeof s=="function"){const i=s,a=i(n);return typeof a=="function"?a:()=>{i(null)}}return s.current=n,()=>{s.current=null}});return()=>{o.forEach(s=>s?.())}},t);return A.useMemo(()=>t.every(n=>n==null)?null:n=>{e.current&&(e.current(),e.current=void 0),n!=null&&(e.current=r(n))},t)}function xt(t){return typeof t.main=="string"}function bt(t,e=[]){if(!xt(t))return!1;for(const r of e)if(!t.hasOwnProperty(r)||typeof t[r]!="string")return!1;return!0}function Ct(t=[]){return([,e])=>e&&bt(e,t)}function Tt(t){return H("MuiTypography",t)}it("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pt={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Rt=tt(),Ot=t=>{const{align:e,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=t,a={root:["root",s,t.align!=="inherit"&&`align${_(e)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return mt(a,Tt,i)},At=vt("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.variant&&e[r.variant],r.align!=="inherit"&&e[`align${_(r.align)}`],r.noWrap&&e.noWrap,r.gutterBottom&&e.gutterBottom,r.paragraph&&e.paragraph]}})(wt(({theme:t})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(t.typography).filter(([e,r])=>e!=="inherit"&&r&&typeof r=="object").map(([e,r])=>({props:{variant:e},style:r})),...Object.entries(t.palette).filter(Ct()).map(([e])=>({props:{color:e},style:{color:(t.vars||t).palette[e].main}})),...Object.entries(t.palette?.text||{}).filter(([,e])=>typeof e=="string").map(([e])=>({props:{color:`text${_(e)}`},style:{color:(t.vars||t).palette.text[e]}})),{props:({ownerState:e})=>e.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:e})=>e.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),D={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ft=A.forwardRef(function(e,r){const{color:n,...o}=N({props:e,name:"MuiTypography"}),s=!Pt[n],i=Rt({...o,...s&&{color:n}}),{align:a="inherit",className:y,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=D,...w}=i,P={...i,align:a,color:n,className:y,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},k=l||(C?"p":T[v]||D[v])||"span",x=Ot(P);return et.jsx(At,{as:k,ref:r,className:rt(x.root,y),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ft as T,kt as _,it as a,F as b,mt as c,Ct as d,H as g,wt as m,vt as s,Vt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as E,c7 as j,go as B,
|
|
1
|
+
import{r as E,c7 as j,go as B,ag as C,gp as G,gq as J,gr as K,gs as Q,gt as S}from"./index-UOt3vExk.js";var U=Object.defineProperty,v=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,h=(e,a,r)=>a in e?U(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,Y=(e,a)=>{for(var r in a||(a={}))R.call(a,r)&&h(e,r,a[r]);if(v)for(var r of v(a))V.call(a,r)&&h(e,r,a[r]);return e},W=(e,a)=>{var r={};for(var t in e)R.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&v)for(var t of v(e))a.indexOf(t)<0&&V.call(e,t)&&(r[t]=e[t]);return r};const X={type:"default"},$=E.forwardRef((e,a)=>{const r=j("YearPicker",X,e),{type:t,defaultValue:g,value:m,onChange:y,__staticSelector:O,getYearControlProps:p,allowSingleDateInRange:i,allowDeselect:c,onMouseLeave:u,onYearSelect:n}=r,w=W(r,["type","defaultValue","value","onChange","__staticSelector","getYearControlProps","allowSingleDateInRange","allowDeselect","onMouseLeave","onYearSelect"]),{onDateChange:f,onRootMouseLeave:d,onHoveredDateChange:_,getControlProps:D}=B({type:t,level:"year",allowDeselect:c,allowSingleDateInRange:i,value:m,defaultValue:g,onChange:y,onMouseLeave:u});return C.createElement(G,Y({ref:a,minLevel:"decade",__updateDateOnYearSelect:!1,__staticSelector:O||"YearPicker",onMouseLeave:d,onYearMouseEnter:(o,l)=>_(l),onYearSelect:o=>{f(o),n?.(o)},getYearControlProps:o=>Y(Y({},D(o)),p?.(o))},w))});$.displayName="@mantine/dates/YearPicker";var Z=Object.defineProperty,ee=Object.defineProperties,ae=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,I=(e,a,r)=>a in e?Z(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,b=(e,a)=>{for(var r in a||(a={}))k.call(a,r)&&I(e,r,a[r]);if(P)for(var r of P(a))x.call(a,r)&&I(e,r,a[r]);return e},re=(e,a)=>ee(e,ae(a)),te=(e,a)=>{var r={};for(var t in e)k.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&P)for(var t of P(e))a.indexOf(t)<0&&x.call(e,t)&&(r[t]=e[t]);return r};const oe={type:"default",valueFormat:"YYYY",closeOnChange:!0,sortDates:!0,dropdownType:"popover"},ne=E.forwardRef((e,a)=>{const r=j("YearPickerInput",oe,e),{type:t,value:g,defaultValue:m,onChange:y,valueFormat:O,labelSeparator:p,locale:i,classNames:c,styles:u,unstyled:n,closeOnChange:w,size:f,variant:d,dropdownType:_,sortDates:D,minDate:o,maxDate:l}=r,N=te(r,["type","value","defaultValue","onChange","valueFormat","labelSeparator","locale","classNames","styles","unstyled","closeOnChange","size","variant","dropdownType","sortDates","minDate","maxDate"]),{calendarProps:L,others:M}=J(N),{_value:s,setValue:F,formattedValue:T,dropdownHandlers:z,dropdownOpened:A,onClear:H,shouldClear:q}=K({type:t,value:g,defaultValue:m,onChange:y,locale:i,format:O,labelSeparator:p,closeOnChange:w,sortDates:D});return C.createElement(Q,b({formattedValue:T,dropdownOpened:A,dropdownHandlers:z,classNames:c,styles:u,unstyled:n,__staticSelector:"YearPickerInput",ref:a,onClear:H,shouldClear:q,value:s,type:t,size:f,variant:d,dropdownType:_},M),C.createElement($,re(b({},L),{size:f,variant:d,type:t,value:s,defaultDate:Array.isArray(s)?s[0]||S({maxDate:l,minDate:o}):s||S({maxDate:l,minDate:o}),onChange:F,locale:i,classNames:c,styles:u,unstyled:n,__staticSelector:"YearPickerInput",__stopPropagation:_==="popover",minDate:o,maxDate:l})))});ne.displayName="@mantine/dates/YearPickerInput";export{ne as Y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ag as l,j as t,g$ as Q,h0 as W,h1 as O,h2 as X,h3 as Z,h4 as T,h5 as ee,h6 as oe,h7 as M,h8 as re,h9 as te,ha as ne,m as P,bL as ae}from"./index-UOt3vExk.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=Q(d),[b]=W(d,[se,O]),E=O(),V=l.forwardRef((e,n)=>{const{type:o,...a}=e,c=a,r=a;return t.jsx(k.Provider,{scope:e.__scopeAccordion,children:o==="multiple"?t.jsx(ue,{...r,ref:n}):t.jsx(pe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[$,de]=b(d,{collapsible:!1}),pe=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},collapsible:r=!1,...s}=e,[i,p]=M({prop:o,defaultProp:a??"",onChange:c,caller:d});return t.jsx(H,{scope:e.__scopeAccordion,value:l.useMemo(()=>i?[i]:[],[i]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:t.jsx($,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx(K,{...s,ref:n})})})}),ue=l.forwardRef((e,n)=>{const{value:o,defaultValue:a,onValueChange:c=()=>{},...r}=e,[s,i]=M({prop:o,defaultProp:a??[],onChange:c,caller:d}),p=l.useCallback(x=>i((f=[])=>[...f,x]),[i]),v=l.useCallback(x=>i((f=[])=>f.filter(C=>C!==x)),[i]);return t.jsx(H,{scope:e.__scopeAccordion,value:s,onItemOpen:p,onItemClose:v,children:t.jsx($,{scope:e.__scopeAccordion,collapsible:!0,children:t.jsx(K,{...r,ref:n})})})}),[fe,h]=b(d),K=l.forwardRef((e,n)=>{const{__scopeAccordion:o,disabled:a,dir:c,orientation:r="vertical",...s}=e,i=l.useRef(null),p=re(i,n),v=ie(o),f=te(c)==="ltr",C=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const F=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===F),D=I.length;if(g===-1)return;m.preventDefault();let u=g;const j=0,w=D-1,_=()=>{u=g+1,u>w&&(u=j)},y=()=>{u=g-1,u<j&&(u=w)};switch(m.key){case"Home":u=j;break;case"End":u=w;break;case"ArrowRight":r==="horizontal"&&(f?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(f?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const J=u%D;I[J].ref.current?.focus()});return t.jsx(fe,{scope:o,disabled:a,direction:c,orientation:r,children:t.jsx(k.Slot,{scope:o,children:t.jsx(T.div,{...s,"data-orientation":r,ref:p,onKeyDown:a?void 0:C})})})}),A="AccordionItem",[ve,S]=b(A),L=l.forwardRef((e,n)=>{const{__scopeAccordion:o,value:a,...c}=e,r=h(A,o),s=le(A,o),i=E(o),p=X(),v=a&&s.value.includes(a)||!1,x=r.disabled||e.disabled;return t.jsx(ve,{scope:o,open:v,disabled:x,triggerId:p,children:t.jsx(Z,{"data-orientation":r.orientation,"data-state":B(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:f=>{f?s.onItemOpen(a):s.onItemClose(a)}})})});L.displayName=A;var z="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=h(d,o),r=S(z,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":B(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=z;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=h(d,o),r=S(N,o),s=de(N,o),i=E(o);return t.jsx(k.ItemSlot,{scope:o,children:t.jsx(ee,{"aria-disabled":r.open&&!s.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...i,...a,ref:n})})});U.displayName=N;var Y="AccordionContent",q=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=h(d,o),r=S(Y,o),s=E(o);return t.jsx(oe,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...s,...a,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});q.displayName=Y;function B(e){return e?"open":"closed"}var xe=V,me=L,ge=G,Ae=U,be=q;function Ce({...e}){return t.jsx(xe,{"data-slot":"accordion",...e})}function Ie({className:e,...n}){return t.jsx(me,{"data-slot":"accordion-item",className:P("border-b last:border-b-0",e),...n})}function je({className:e,children:n,...o}){return t.jsx(ge,{className:"flex",children:t.jsxs(Ae,{"data-slot":"accordion-trigger",className:P("focus-visible:border-gray-950 focus-visible:ring-gray-950/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50",e),...o,children:[n,t.jsx(ae,{className:"text-gray-500 pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200 dark:text-gray-400"})]})})}function we({className:e,children:n,...o}){return t.jsx(be,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...o,children:t.jsx("div",{className:P("pt-0 pb-4",e),children:n})})}export{Ce as A,Ie as a,we as b,je as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,F as h,
|
|
1
|
+
import{r as s,F as h,ad as v,af as C,u as P,j as e,L as A,hb as F}from"./index-UOt3vExk.js";import{u as b}from"./use-url-query-90MrwS1C.js";import{C as y}from"./charges-filters-CUyYbpwk.js";import{P as j}from"./page-layout-DfZJtWW1.js";import{P as D}from"./Progress-C3jVWDXK.js";import"./modal-CqL_DX_G.js";import"./funnel-DlU6IKDd.js";import"./sub-BKVGhLrr.js";import"./addDays-CB-j-d4t.js";import"./subMonths-Cbkj4M6-.js";import"./MultiSelect-DP26KzMa.js";const L=()=>{const{setFiltersContext:c}=s.useContext(h),{get:i}=b(),{userContext:p}=s.useContext(v),[a,m]=s.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:C.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=P({query:F,variables:{filters:a,page:1,limit:999999}}),t=r?.allCharges?.nodes.length??0;let o=0,l=0,n=0;r?.allCharges?.nodes.map(f=>{switch(f.accountantApproval){case"APPROVED":o+=1;break;case"PENDING":l+=1;break;case"UNAPPROVED":n+=1;break}});const x=100*o/t,d=100*l/t,g=100*n/t;return s.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(y,{filter:a,setFilter:m,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,m]),e.jsx(j,{title:"Accountant Approvals Status",children:u?e.jsx(A,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs("div",{className:"mx-10 mt-5 flex flex-col gap-5",children:[`Total charges: ${t}`,e.jsx(D,{color:"green",radius:"xl",size:"xl",sections:[{value:x,color:"green",label:`${x.toFixed(1)}% (${o})`},{value:d,color:"orange",label:`${d.toFixed(1)}% (${l})`},{value:g,color:"red",label:`${g.toFixed(1)}% (${n})`}]})]})})};export{L as AccountantApprovals};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as t,B as r,d$ as a}from"./index-
|
|
1
|
+
import{r as s,j as t,B as r,d$ as a}from"./index-UOt3vExk.js";import{T as c}from"./Table-c1ug6Rpw.js";function h(e){const[i,o]=s.useState(!1),l=e.moreInfo?e.moreInfo(e.item):null;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{children:[e.columns.map((n,d)=>n.disabled?null:t.jsx("td",{style:n.style,children:n.value(e.item,e.rowContext?e.rowContext(e.item):void 0)},String(d))),e.moreInfo&&t.jsx("td",{children:l===null?t.jsx("p",{children:"No Data Related"}):t.jsx(r,{onClick:()=>o(!i),className:"ml-auto",children:"More Info"})})]}),(e.isShowAll||i)&&l!==null&&t.jsx("tr",{children:t.jsx("td",{colSpan:12,children:t.jsx(a,{style:{width:"100%"},withBorder:!0,shadow:"lg",children:l})})})]})}function u(e){const[i,o]=s.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-row justify-end w-full",children:e.showButton===!0?t.jsx(r,{type:"button",onClick:()=>{o(l=>!l)},children:i?"Hide All":"Show All"}):null}),t.jsxs(c,{striped:e.striped,highlightOnHover:e.highlightOnHover,children:[t.jsx("thead",{style:e.stickyHeader?{position:"sticky",top:0,zIndex:20}:{},children:t.jsxs("tr",{className:"px-10 py-10 title-font tracking-wider font-medium text-gray-900 text-sm bg-gray-100 rounded-tl rounded-bl",children:[e.columns.map((l,n)=>l.disabled?null:t.jsx("th",{children:l.title},String(n))),e.moreInfo&&t.jsx("th",{children:"More Info"})]})}),t.jsx("tbody",{children:e.items.map((l,n)=>t.jsx(h,{columns:e.columns,item:l,moreInfo:e.moreInfo,isShowAll:i,rowContext:e.rowContext},n))})]})]})}export{h as A,u as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fO as s,gx as i}from"./index-
|
|
1
|
+
import{fO as s,gx as i}from"./index-UOt3vExk.js";function o(a,r,e){const t=s(a,e?.in);return isNaN(r)?i(a,NaN):(r&&t.setDate(t.getDate()+r),t)}export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,F as y,u as A,j as e,T as N,B as b,L as w,A as O}from"./index-
|
|
1
|
+
import{r as t,F as y,u as A,j as e,T as N,B as b,L as w,A as O}from"./index-UOt3vExk.js";import{u as T}from"./use-url-query-90MrwS1C.js";import{C as z}from"./charges-filters-CUyYbpwk.js";import{C as B}from"./charges-table-Cw-X1ZkK.js";import{M as L}from"./index-CS2mkstk.js";import{E as R,I as k,M as Q}from"./match-document-modal-Bs-5Zbj9.js";import{P as U}from"./page-layout-DfZJtWW1.js";import{P as q,a as J}from"./panel-top-open-D0lkFvhk.js";import"./modal-CqL_DX_G.js";import"./funnel-DlU6IKDd.js";import"./sub-BKVGhLrr.js";import"./addDays-CB-j-d4t.js";import"./subMonths-Cbkj4M6-.js";import"./MultiSelect-DP26KzMa.js";import"./toggle-expansion-button-CojtDNtC.js";import"./index-Dzi5mI80.js";import"./similar-transactions-modal-kFlTMg9C.js";import"./list-plus-CYtq--On.js";import"./tooltip-CoQF2skM.js";import"./Table-c1ug6Rpw.js";import"./summary-BuSv6nwb.js";import"./Checkbox-CMTNcrRo.js";import"./YearPickerInput-CNSe9Fno.js";import"./insert-business-trip-modal-DyHAvuG6.js";import"./accounter-table-C7UgjlTA.js";const he=()=>{const{setFiltersContext:h}=t.useContext(y),[i,C]=t.useState(void 0),[n,f]=t.useState(void 0),[l,x]=t.useState(void 0),[c,j]=t.useState(!1),[a,m]=t.useState([]),{get:p}=T(),[d,M]=t.useState(p("page")?Number(p("page")):1),g=p("chargesFilters"),v=t.useMemo(()=>{if(g)try{return JSON.parse(decodeURIComponent(g))}catch{return}},[g]),[r,S]=t.useState(v),D=t.useCallback((s,F)=>{a.map(u=>u.id).includes(s)?m(a.filter(u=>u.id!==s)):m([...a,{id:s,onChange:F}])},[a]),[{data:o,fetching:I},P]=A({query:O,variables:{filters:r,page:d,limit:100},pause:!0});t.useEffect(()=>{r&&P()},[r,P]);function E(){m([])}return t.useEffect(()=>{h(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx(z,{filter:r,setFilter:S,activePage:d,setPage:M,totalPages:o?.allCharges?.pageInfo.totalPages,initiallyOpened:!r}),e.jsx(N,{label:"Expand all accounts",children:e.jsx(b,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(s=>!s),children:c?e.jsx(q,{className:"size-5"}):e.jsx(J,{className:"size-5"})})}),e.jsx(L,{selected:a,resetMerge:E})]}))},[o,I,r,d,c,h,M,S,j,a,v]),e.jsxs(U,{title:"All Charges",description:"Manage charges",children:[I?e.jsx(w,{className:"h-10 w-10 animate-spin mr-2 self-center"}):o?.allCharges.nodes?e.jsx(B,{setEditChargeId:C,setInsertDocument:f,setMatchDocuments:x,toggleMergeCharge:D,mergeSelectedCharges:new Set(a.map(s=>s.id)),data:o?.allCharges?.nodes,isAllOpened:c}):e.jsx("span",{children:"Please apply filters"}),i&&e.jsx(R,{chargeId:i?.id,close:()=>C(void 0),onChange:i.onChange}),n&&e.jsx(k,{chargeId:n.id,onChange:n.onChange,close:()=>f(void 0)}),l&&e.jsx(Q,{chargeId:l.id,ownerId:l.ownerId,setMatchDocuments:()=>x(void 0)})]})};export{he as AllCharges};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import{v as ae,w as es,u as te,S as vs,r as g,j as e,D as ss,x as as,E as ys,c as ts,g as ns,t as le,i as is,U as Ns,y as Oe,z as rs,G as ge,H as fe,J as U,K as G,N as ls,O as q,Q as W,V as Fe,W as K,X as y,Y as N,Z as b,_ as k,I as T,$ as C,a0 as B,a1 as pe,B as I,a2 as X,a3 as J,a4 as ce,a5 as _e,a6 as bs,a7 as Ne,a8 as Re,a9 as re,aa as z,ab as cs,ac as Cs,ad as Ve,ae as ws,P as As,af as Is,ag as O,ah as $e,ai as Ss,aj as ks,ak as Ds,al as Z,am as ee,an as Ts,ao as Bs,ap as Es,aq as De,ar as Ps,as as Ls,at as Os,au as Fs,av as _s,aw as Rs,ax as Vs,ay as Ms,az as se,aA as zs,aB as $s,aC as Te,aD as Ue,aE as os,aF as Us,aG as Be,aH as Gs,aI as qs,aJ as Ge,aK as Ws,aL as Ks,aM as Hs,aN as Ys,aO as Xs,aP as Js,aQ as Qs,aR as Zs,aS as ea,aT as v,aU as sa,aV as Me,aW as aa,aX as ta,aY as na,aZ as ia,a_ as ra,a$ as la,b0 as ca,b1 as oa,b2 as da,F as ma,b3 as ua,b4 as ha,b5 as Y,b6 as xa,b7 as pa,b8 as M,b9 as ja,a as ga,b as fa,ba as va}from"./index-UOt3vExk.js";import{S as ze}from"./save-CCZ-i4rw.js";import{B as ya}from"./business-extended-info-B4Wt-Sq3.js";import{B as Na}from"./business-header-BpYfBk40.js";import{S as ba,C as Ca,L as wa}from"./charges-table-Cw-X1ZkK.js";import{i as Aa,D as Ia,f as Sa,E as ka,L as we,a as ve,C as Da,A as Ta,b as he,c as Ba,d as Ee,h as Ea,e as Pa,g as ds,u as La,G as Oa,j as qe,k as Fa,X as ms,Y as us,l as _a,m as Ra,R as Va,n as Ma,o as za,p as $a}from"./chart-TrN24kVd.js";import{M as Ua,s as Ga,a as qa}from"./modify-contract-dialog-C8WuljxW.js";import{P as Wa}from"./pencil-DhN5v-Lb.js";import{E as Ka,T as Ha}from"./index-Dzi5mI80.js";import{A as Ya,a as Ae,b as Ie,c as We}from"./accordion-CLvZdMsA.js";import{B as Xa}from"./building-2-Dkd3B-3N.js";import"./download-csv-button-r9hq7Mun.js";import"./Table-c1ug6Rpw.js";import"./toggle-expansion-button-CojtDNtC.js";import"./panel-top-open-D0lkFvhk.js";import"./summary-BuSv6nwb.js";import"./list-plus-CYtq--On.js";import"./sequential-CAnleQny.js";import"./similar-transactions-modal-kFlTMg9C.js";import"./addDays-CB-j-d4t.js";import"./tooltip-CoQF2skM.js";/**
|
|
2
|
+
* @license lucide-react v0.548.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ja=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Qa=ae("chart-line",Ja);/**
|
|
7
|
+
* @license lucide-react v0.548.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Za=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ke=ae("circle-check",Za);/**
|
|
12
|
+
* @license lucide-react v0.548.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const et=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ye=ae("dollar-sign",et);/**
|
|
17
|
+
* @license lucide-react v0.548.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const st=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],at=ae("file-check",st);/**
|
|
22
|
+
* @license lucide-react v0.548.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const tt=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]],nt=ae("notebook",tt);/**
|
|
27
|
+
* @license lucide-react v0.548.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const it=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],rt=ae("plug",it);/**
|
|
32
|
+
* @license lucide-react v0.548.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const lt=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Se=ae("trending-up",lt);function ct(s){return es(s,"yyyy-MM-dd")}function ot({businessId:s,tagIds:a,description:t,open:n,onOpenChange:c,onClose:o}){const[{data:l,fetching:i},r]=te({pause:!0,query:vs,variables:{businessId:s,tagsDifferentThan:a?a.map(m=>m.id):void 0,descriptionDifferentThan:t}});g.useEffect(()=>{n&&(a||t)&&!l&&r()},[n,a,t,r,l]);const d=g.useCallback(m=>{c(m),n&&!m&&o?.()},[c,o,n]),h=g.useMemo(()=>n&&(!!a||!!t)&&l&&l?.similarChargesByBusiness.length>0,[n,a,t,l]);return e.jsx(ss,{open:h,onOpenChange:d,children:e.jsx(as,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",onClick:m=>m.stopPropagation(),children:e.jsx(ys,{fallback:e.jsx("div",{children:"Error fetching similar charges"}),children:i?e.jsx(ts,{}):a||t?e.jsx(ba,{data:l?.similarChargesByBusiness??[],tagIds:a,description:t,onOpenChange:d,title:"Similar Charges by Business"}):null})})})}const dt="updateAdminBusiness",mt=()=>{const[{fetching:s},a]=ns(Ns),t=g.useCallback(async n=>{const c=`Error updating admin business ID [${n.adminBusinessId}]`,o=`${dt}-${n.adminBusinessId}`;le.loading("Updating admin business",{id:o});try{const l=await a(n),i=is(l,c,o,"updateAdminBusiness");if(i)return le.success("Success",{id:o,description:"Admin Business Updated"}),i.updateAdminBusiness}catch(l){console.error(`${c}: ${l}`),le.error("Error",{id:o,description:c,duration:1e5,closeButton:!0})}},[a]);return{fetching:s,updateAdminBusiness:t}},ke=Ne({year:cs().min(2e3).max(2100),id:z().min(1,{message:"ID is required"})}),ut=Ne({registrationDate:z().min(1,{message:"Business Registration Start Date is required"}),withholdingTaxAnnualIds:re(ke),withholdingTaxCompanyId:z().min(1,{message:"Withholding Tax Company ID is required"}),socialSecurityEmployerIds:re(ke),socialSecurityDeductionsId:z().min(1,{message:"Social Security Deductions ID is required"}),taxAdvancesAnnualIds:re(ke),taxAdvancesRates:re(Ne({date:Cs(),rate:cs().min(0,{message:"Rate must be at least 0"}).max(100,{message:"Rate must be at most 100"})}))});function He(s){return!s||s.__typename!=="LtdFinancialEntity"||!s.adminInfo?{}:{registrationDate:s.adminInfo.registrationDate,withholdingTaxAnnualIds:s.adminInfo.withholdingTaxAnnualIds.sort((a,t)=>t.year-a.year),withholdingTaxCompanyId:s.adminInfo.withholdingTaxCompanyId??void 0,socialSecurityEmployerIds:s.adminInfo.socialSecurityEmployerIds.sort((a,t)=>t.year-a.year),socialSecurityDeductionsId:s.adminInfo.socialSecurityDeductionsId??void 0,taxAdvancesAnnualIds:s.adminInfo.taxAdvancesAnnualIds.sort((a,t)=>t.year-a.year),taxAdvancesRates:s.adminInfo.taxAdvancesRates?.map(a=>({date:a.date,rate:a.rate*100}))}}function ht(s){return{registrationDate:s.registrationDate?ct(new Date(s.registrationDate)):void 0,withholdingTaxAnnualIds:s.withholdingTaxAnnualIds,withholdingTaxCompanyId:s.withholdingTaxCompanyId,socialSecurityEmployerIds:s.socialSecurityEmployerIds,taxAdvancesRates:s.taxAdvancesRates?.map(a=>({date:a.date,rate:a.rate/100})),taxAdvancesAnnualIds:s.taxAdvancesAnnualIds}}function xt({data:s,refetchBusiness:a}){const t=ge(bs,s),[n,c]=g.useState(He(t)),{updateAdminBusiness:o,fetching:l}=mt(),i=Oe({resolver:rs(ut),defaultValues:n}),r=async u=>{if(!t)return;const p=Re(u,i.formState.dirtyFields);if(!p)return;const S=ht(p);await o({adminBusinessId:t.id,fields:S}),a?.()};g.useEffect(()=>{if(t){const u=He(t);c(u),i.reset(u)}},[t,i]);const{fields:d,append:h,remove:m}=fe({control:i.control,name:"taxAdvancesAnnualIds"}),{fields:x,append:w,remove:f}=fe({control:i.control,name:"withholdingTaxAnnualIds"}),{fields:A,append:D,remove:E}=fe({control:i.control,name:"socialSecurityEmployerIds"}),P={withholdingTaxAnnualIds:{append:w,remove:f},taxAdvancesAnnualIds:{append:h,remove:m},socialSecurityEmployerIds:{append:D,remove:E}},F=u=>{P[u].append({year:new Date().getFullYear(),id:""})},_=(u,p)=>{P[u].remove(p)},{fields:L,append:H,remove:V}=fe({control:i.control,name:"taxAdvancesRates"}),Q=()=>{H({date:es(new Date,"yyyy-MM-dd"),rate:0})},j=u=>{V(u)};return e.jsxs(U,{children:[e.jsxs(G,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ls,{className:"h-5 w-5 text-primary"}),e.jsx(q,{children:"Admin Business Configuration"})]}),e.jsx(W,{children:"Tax and registration information for the business operating this application"})]}),e.jsx(Fe,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(r),className:"space-y-6",children:[e.jsx(K,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground md:col-span-2",children:"Withholding Tax"}),e.jsx(y,{control:i.control,name:"withholdingTaxCompanyId",render:({field:u,fieldState:p})=>e.jsxs(N,{children:[e.jsx(b,{children:"Company Tax ID"}),e.jsx(k,{children:e.jsx(T,{placeholder:"Enter company ID",...u,className:C(p)})}),e.jsx(B,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(pe,{children:"Annual IDs"}),e.jsx(I,{type:"button",variant:"outline",size:"sm",onClick:()=>F("withholdingTaxAnnualIds"),children:e.jsx(X,{className:"size-4"})})]}),e.jsx("div",{className:"space-y-3",children:x.map((u,p)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[e.jsx(T,{placeholder:"Year",type:"number",...i.register(`withholdingTaxAnnualIds.${p}.year`,{valueAsNumber:!0})}),e.jsx(T,{placeholder:"ID",...i.register(`withholdingTaxAnnualIds.${p}.id`)})]}),e.jsx(I,{type:"button",variant:"ghost",size:"icon",onClick:()=>_("withholdingTaxAnnualIds",p),children:e.jsx(J,{className:"size-4"})})]},u.id))})]}),e.jsx(ce,{className:"md:col-span-2"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground md:col-span-2",children:"Tax Advances"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(pe,{children:"Annual IDs"}),e.jsx(I,{type:"button",variant:"outline",size:"sm",onClick:()=>F("taxAdvancesAnnualIds"),children:e.jsx(X,{className:"size-4"})})]}),e.jsx("div",{className:"space-y-3",children:d.map((u,p)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[e.jsx(T,{placeholder:"Year",type:"number",...i.register(`taxAdvancesAnnualIds.${p}.year`,{valueAsNumber:!0})}),e.jsx(T,{placeholder:"ID",...i.register(`taxAdvancesAnnualIds.${p}.id`)})]}),e.jsx(I,{type:"button",variant:"ghost",size:"icon",onClick:()=>_("taxAdvancesAnnualIds",p),children:e.jsx(J,{className:"size-4"})})]},u.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(pe,{children:"Rates (%)"}),e.jsx(I,{type:"button",variant:"outline",size:"sm",onClick:Q,children:e.jsx(X,{className:"size-4"})})]}),e.jsx("div",{className:"space-y-3",children:L.map((u,p)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[e.jsx(T,{placeholder:"Date",type:"date",...i.register(`taxAdvancesRates.${p}.date`)}),e.jsx(T,{placeholder:"Rate",...i.register(`taxAdvancesRates.${p}.rate`,{valueAsNumber:!0})})]}),e.jsx(I,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(p),children:e.jsx(J,{className:"size-4"})})]},u.id))})]}),e.jsx(ce,{className:"md:col-span-2"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground md:col-span-2",children:"Social Security"}),e.jsx(y,{control:i.control,name:"socialSecurityDeductionsId",render:({field:u,fieldState:p})=>e.jsxs(N,{children:[e.jsx(b,{children:"Deductions ID"}),e.jsx(k,{children:e.jsx(T,{placeholder:"Enter deductions ID",...u,className:C(p)})}),e.jsx(B,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(pe,{children:"Annual Employer IDs"}),e.jsx(I,{type:"button",variant:"outline",size:"sm",onClick:()=>F("socialSecurityEmployerIds"),children:e.jsx(X,{className:"size-4"})})]}),e.jsx("div",{className:"space-y-3",children:A.map((u,p)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[e.jsx(T,{placeholder:"Year",type:"number",...i.register(`socialSecurityEmployerIds.${p}.year`,{valueAsNumber:!0})}),e.jsx(T,{placeholder:"ID",...i.register(`socialSecurityEmployerIds.${p}.id`)})]}),e.jsx(I,{type:"button",variant:"ghost",size:"icon",onClick:()=>_("socialSecurityEmployerIds",p),children:e.jsx(J,{className:"size-4"})})]},u.id))})]}),e.jsx(ce,{className:"md:col-span-2"}),e.jsx(y,{control:i.control,name:"registrationDate",render:({field:u,fieldState:p})=>e.jsxs(N,{children:[e.jsx(b,{children:"Business Registration Start Date"}),e.jsx(k,{children:e.jsx(T,{type:"date",...u,className:C(p)})}),e.jsx(B,{})]})})]})}),e.jsx(_e,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(I,{type:"submit",disabled:l||Object.keys(i.formState.dirtyFields).length===0||!i.formState.isValid,children:[e.jsx(ze,{className:"h-4 w-4"}),"Save Changes"]})})]})})]})}function pt({businessId:s}){return e.jsxs(U,{children:[e.jsx(G,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(q,{children:"Balance"}),e.jsx(W,{children:"Business balance overview"})]})})}),e.jsx(K,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(ya,{businessID:s,filter:{}})})})]})}function jt({businessId:s}){const{userContext:a}=g.useContext(Ve),[t,n]=g.useState(0),[{data:c,fetching:o}]=te({query:ws,variables:{filters:{byOwners:a?.context.adminBusinessId?[a.context.adminBusinessId]:void 0,sortBy:{field:Is.Date,asc:!1},byBusinesses:[s]},page:t-1,limit:10}}),l=c?.allCharges?.pageInfo.totalPages??1,i=c?.allCharges?.nodes??[];return o?e.jsx("div",{children:"Loading charges..."}):e.jsxs(U,{children:[e.jsxs(G,{className:"flex w-full justify-between items-center",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(q,{children:"Charges"}),e.jsx(W,{children:"Recurring and one-time charges for this business"})]})}),l>1&&e.jsx(As,{className:"flex-fit w-fit mx-0",value:t,onChange:n,total:l})]}),e.jsx(K,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Ca,{data:i,isAllOpened:!1})})})]})}var gt=["type","layout","connectNulls","ref"],ft=["key"];function oe(s){"@babel/helpers - typeof";return oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},oe(s)}function Ye(s,a){if(s==null)return{};var t=vt(s,a),n,c;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);for(c=0;c<o.length;c++)n=o[c],!(a.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(s,n)&&(t[n]=s[n])}return t}function vt(s,a){if(s==null)return{};var t={};for(var n in s)if(Object.prototype.hasOwnProperty.call(s,n)){if(a.indexOf(n)>=0)continue;t[n]=s[n]}return t}function je(){return je=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},je.apply(this,arguments)}function Xe(s,a){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(s);a&&(n=n.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),t.push.apply(t,n)}return t}function R(s){for(var a=1;a<arguments.length;a++){var t=arguments[a]!=null?arguments[a]:{};a%2?Xe(Object(t),!0).forEach(function(n){$(s,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Xe(Object(t)).forEach(function(n){Object.defineProperty(s,n,Object.getOwnPropertyDescriptor(t,n))})}return s}function ie(s){return Ct(s)||bt(s)||Nt(s)||yt()}function yt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
37
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nt(s,a){if(s){if(typeof s=="string")return Pe(s,a);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Pe(s,a)}}function bt(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function Ct(s){if(Array.isArray(s))return Pe(s)}function Pe(s,a){(a==null||a>s.length)&&(a=s.length);for(var t=0,n=new Array(a);t<a;t++)n[t]=s[t];return n}function wt(s,a){if(!(s instanceof a))throw new TypeError("Cannot call a class as a function")}function Je(s,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,xs(n.key),n)}}function At(s,a,t){return a&&Je(s.prototype,a),t&&Je(s,t),Object.defineProperty(s,"prototype",{writable:!1}),s}function It(s,a,t){return a=be(a),St(s,hs()?Reflect.construct(a,t||[],be(s).constructor):a.apply(s,t))}function St(s,a){if(a&&(oe(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kt(s)}function kt(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function hs(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hs=function(){return!!s})()}function be(s){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},be(s)}function Dt(s,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(a&&a.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),a&&Le(s,a)}function Le(s,a){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,c){return n.__proto__=c,n},Le(s,a)}function $(s,a,t){return a=xs(a),a in s?Object.defineProperty(s,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[a]=t,s}function xs(s){var a=Tt(s,"string");return oe(a)=="symbol"?a:a+""}function Tt(s,a){if(oe(s)!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,a);if(oe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var de=(function(s){function a(){var t;wt(this,a);for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];return t=It(this,a,[].concat(c)),$(t,"state",{isAnimationFinished:!0,totalLength:0}),$(t,"generateSimpleStrokeDasharray",function(l,i){return"".concat(i,"px ").concat(l-i,"px")}),$(t,"getStrokeDasharray",function(l,i,r){var d=r.reduce(function(E,P){return E+P});if(!d)return t.generateSimpleStrokeDasharray(i,l);for(var h=Math.floor(l/d),m=l%d,x=i-l,w=[],f=0,A=0;f<r.length;A+=r[f],++f)if(A+r[f]>m){w=[].concat(ie(r.slice(0,f)),[m-A]);break}var D=w.length%2===0?[0,x]:[x];return[].concat(ie(a.repeat(r,h)),ie(w),D).map(function(E){return"".concat(E,"px")}).join(", ")}),$(t,"id",La("recharts-line-")),$(t,"pathRef",function(l){t.mainCurve=l}),$(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),$(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return Dt(a,s),At(a,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,c){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,l=o.points,i=o.xAxis,r=o.yAxis,d=o.layout,h=o.children,m=Sa(h,ka);if(!m)return null;var x=function(A,D){return{x:A.x,y:A.y,value:A.value,errorVal:ds(A.payload,D)}},w={clipPath:n?"url(#clipPath-".concat(c,")"):null};return O.createElement(we,w,m.map(function(f){return O.cloneElement(f,{key:"bar-".concat(f.props.dataKey),data:l,xAxis:i,yAxis:r,layout:d,dataPointFormatter:x})}))}},{key:"renderDots",value:function(n,c,o){var l=this.props.isAnimationActive;if(l&&!this.state.isAnimationFinished)return null;var i=this.props,r=i.dot,d=i.points,h=i.dataKey,m=ve(this.props,!1),x=ve(r,!0),w=d.map(function(A,D){var E=R(R(R({key:"dot-".concat(D),r:3},m),x),{},{index:D,cx:A.x,cy:A.y,value:A.value,dataKey:h,payload:A.payload,points:d});return a.renderDotItem(r,E)}),f={clipPath:n?"url(#clipPath-".concat(c?"":"dots-").concat(o,")"):null};return O.createElement(we,je({className:"recharts-line-dots",key:"dots"},f),w)}},{key:"renderCurveStatically",value:function(n,c,o,l){var i=this.props,r=i.type,d=i.layout,h=i.connectNulls;i.ref;var m=Ye(i,gt),x=R(R(R({},ve(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(o,")"):null,points:n},l),{},{type:r,layout:d,connectNulls:h});return O.createElement(Da,je({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,c){var o=this,l=this.props,i=l.points,r=l.strokeDasharray,d=l.isAnimationActive,h=l.animationBegin,m=l.animationDuration,x=l.animationEasing,w=l.animationId,f=l.animateNewValues,A=l.width,D=l.height,E=this.state,P=E.prevPoints,F=E.totalLength;return O.createElement(Ta,{begin:h,duration:m,isActive:d,easing:x,from:{t:0},to:{t:1},key:"line-".concat(w),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(_){var L=_.t;if(P){var H=P.length/i.length,V=i.map(function(S,Ce){var me=Math.floor(Ce*H);if(P[me]){var ue=P[me],ne=he(ue.x,S.x),js=he(ue.y,S.y);return R(R({},S),{},{x:ne(L),y:js(L)})}if(f){var gs=he(A*2,S.x),fs=he(D/2,S.y);return R(R({},S),{},{x:gs(L),y:fs(L)})}return R(R({},S),{},{x:S.x,y:S.y})});return o.renderCurveStatically(V,n,c)}var Q=he(0,F),j=Q(L),u;if(r){var p="".concat(r).split(/[,\s]+/gim).map(function(S){return parseFloat(S)});u=o.getStrokeDasharray(j,F,p)}else u=o.generateSimpleStrokeDasharray(F,j);return o.renderCurveStatically(i,n,c,{strokeDasharray:u})})}},{key:"renderCurve",value:function(n,c){var o=this.props,l=o.points,i=o.isAnimationActive,r=this.state,d=r.prevPoints,h=r.totalLength;return i&&l&&l.length&&(!d&&h>0||!Ba(d,l))?this.renderCurveWithAnimation(n,c):this.renderCurveStatically(l,n,c)}},{key:"render",value:function(){var n,c=this.props,o=c.hide,l=c.dot,i=c.points,r=c.className,d=c.xAxis,h=c.yAxis,m=c.top,x=c.left,w=c.width,f=c.height,A=c.isAnimationActive,D=c.id;if(o||!i||!i.length)return null;var E=this.state.isAnimationFinished,P=i.length===1,F=$e("recharts-line",r),_=d&&d.allowDataOverflow,L=h&&h.allowDataOverflow,H=_||L,V=Ee(D)?this.id:D,Q=(n=ve(l,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},j=Q.r,u=j===void 0?3:j,p=Q.strokeWidth,S=p===void 0?2:p,Ce=Ea(l)?l:{},me=Ce.clipDot,ue=me===void 0?!0:me,ne=u*2+S;return O.createElement(we,{className:F},_||L?O.createElement("defs",null,O.createElement("clipPath",{id:"clipPath-".concat(V)},O.createElement("rect",{x:_?x:x-w/2,y:L?m:m-f/2,width:_?w:w*2,height:L?f:f*2})),!ue&&O.createElement("clipPath",{id:"clipPath-dots-".concat(V)},O.createElement("rect",{x:x-ne/2,y:m-ne/2,width:w+ne,height:f+ne}))):null,!P&&this.renderCurve(H,V),this.renderErrorBar(H,V),(P||l)&&this.renderDots(H,ue,V),(!A||E)&&Pa.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(n,c){return n.animationId!==c.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:c.curPoints}:n.points!==c.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,c){for(var o=n.length%2!==0?[].concat(ie(n),[0]):n,l=[],i=0;i<c;++i)l=[].concat(ie(l),ie(o));return l}},{key:"renderDotItem",value:function(n,c){var o;if(O.isValidElement(n))o=O.cloneElement(n,c);else if(Aa(n))o=n(c);else{var l=c.key,i=Ye(c,ft),r=$e("recharts-line-dot",typeof n!="boolean"?n.className:"");o=O.createElement(Ia,je({key:l},i,{className:r}))}return o}}])})(g.PureComponent);$(de,"displayName","Line");$(de,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Oa.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});$(de,"getComposedData",function(s){var a=s.props,t=s.xAxis,n=s.yAxis,c=s.xAxisTicks,o=s.yAxisTicks,l=s.dataKey,i=s.bandSize,r=s.displayedData,d=s.offset,h=a.layout,m=r.map(function(x,w){var f=ds(x,l);return h==="horizontal"?{x:qe({axis:t,ticks:c,bandSize:i,entry:x,index:w}),y:Ee(f)?null:n.scale(f),value:f,payload:x}:{x:Ee(f)?null:t.scale(f),y:qe({axis:n,ticks:o,bandSize:i,entry:x,index:w}),value:f,payload:x}});return R({points:m,layout:h},d)});var Bt=Fa({chartName:"LineChart",GraphicalChild:de,axisComponents:[{axisType:"xAxis",AxisComp:ms},{axisType:"yAxis",AxisComp:us}],formatAxisMap:_a});const xe=[{month:"Jan",revenue:12500,expenses:8200},{month:"Feb",revenue:15800,expenses:9100},{month:"Mar",revenue:18200,expenses:10500},{month:"Apr",revenue:16900,expenses:9800},{month:"May",revenue:21300,expenses:11200},{month:"Jun",revenue:24500,expenses:12800},{month:"Jul",revenue:22800,expenses:11900},{month:"Aug",revenue:26100,expenses:13500},{month:"Sep",revenue:28900,expenses:14200},{month:"Oct",revenue:31200,expenses:15100}];function Et(){const s=xe.reduce((t,n)=>t+n.revenue,0),a=s/xe.length;return e.jsxs(U,{children:[e.jsxs(G,{children:[e.jsx(q,{children:"Revenue Analytics"}),e.jsx(W,{children:"Revenue and expenses over time"})]}),e.jsxs(K,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3 mb-6",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ye,{className:"h-4 w-4"}),"Total Revenue"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",s.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Se,{className:"h-3 w-3"}),e.jsx("span",{children:"+24.5% from last period"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ye,{className:"h-4 w-4"}),"Average Monthly"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",a.toLocaleString(void 0,{maximumFractionDigits:0})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Se,{className:"h-3 w-3"}),e.jsx("span",{children:"+18.2% growth rate"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ye,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",xe[xe.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Se,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx(Ra,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Va,{width:"100%",height:"100%",children:e.jsxs(Bt,{data:xe,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(Ma,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(ms,{dataKey:"month",className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(us,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(za,{content:e.jsx($a,{})}),e.jsx(de,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(de,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Pt="updateBusiness",ps=()=>{const[{fetching:s},a]=ns(Ss),t=g.useCallback(async n=>{const c=`Error updating business ID [${n.businessId}]`,o=`${Pt}-${n.businessId}`;le.loading("Updating business",{id:o});try{const l=await a(n),i=is(l,c,o,"updateBusiness");if(i)return le.success("Success",{id:o,description:"Business updated"}),i.updateBusiness}catch(l){console.error(`${c}: ${l}`),le.error("Error",{id:o,description:c,duration:1e5,closeButton:!0})}},[a]);return{fetching:s,updateBusiness:t}},Lt=Object.values(zs);function Qe(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{isClient:!!s.clientInfo?.id,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough??void 0,isDocumentsOptional:s.isDocumentsOptional??void 0,isVatOptional:s.optionalVAT??void 0,isExemptDealer:s.exemptDealer??void 0,sortCode:s.sortCode?.key?.toString()??void 0,taxCategory:s.taxCategory?.id??void 0,pcn874RecordType:s?.pcn874RecordType??void 0,irsCode:s?.irsCode??void 0,description:s.suggestions?.description??void 0,tags:s.suggestions?.tags?.map(a=>a.id)??[],phrases:s.suggestions?.phrases??[],emails:s.suggestions?.emails??[],internalLinks:s.suggestions?.emailListener?.internalEmailLinks??[],attachmentTypes:s.suggestions?.emailListener?.attachments??[],useMessageBody:s.suggestions?.emailListener?.emailBody??void 0}}function Ot(s){const t=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,c=s.description||s.tags||s.phrases||s.emails||t?{description:s.description,tags:s.tags?.map(o=>({id:o})),phrases:s.phrases,emails:s.emails,emailListener:t}:void 0;return{optionalVAT:s.isVatOptional,exemptDealer:s.isExemptDealer,sortCode:s.sortCode?parseInt(s.sortCode):void 0,taxCategory:s.taxCategory,pcn874RecordType:s.pcn874RecordType,irsCode:s.irsCode,isActive:s.isActive,isReceiptEnough:s.isReceiptEnough,isDocumentsOptional:s.isDocumentsOptional,suggestions:c}}function Ft({data:s,refetchBusiness:a}){const t=ge(Ds,s),[n,c]=g.useState(Qe(t)),{userContext:o}=g.useContext(Ve),{updateBusiness:l,fetching:i}=ps(),[r,d]=g.useState(!1),[h,m]=g.useState(void 0),x=Oe({defaultValues:n}),w=async A=>{if(!t||!o?.context.adminBusinessId)return;const D=Re(A,x.formState.dirtyFields);if(!D)return;const E=Ot(D);await l({businessId:t.id,ownerId:o.context.adminBusinessId,fields:E}),D.tags?.length||D.description?(m({tagIds:D.tags?.map(P=>({id:P})),description:D.description}),d(!0)):a?.()};if(g.useEffect(()=>{if(t){const A=Qe(t);c(A),x.reset(A)}},[t,x]),!t)return e.jsx("div",{});const f=x.watch("isClient");return e.jsxs(U,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Configurations"}),e.jsx(W,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!f&&e.jsx(ks,{businessId:t.id,onDone:a})]})}),e.jsx(Fe,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(w),children:[e.jsxs(K,{className:"space-y-6",children:[e.jsx(_t,{form:x}),e.jsx(ce,{}),e.jsx(Rt,{form:x}),e.jsx(ce,{}),e.jsx(Vt,{form:x}),e.jsx(ce,{}),e.jsx(Mt,{form:x})]}),e.jsx(_e,{className:"flex justify-end border-t pt-6",children:e.jsxs(I,{type:"submit",disabled:i||Object.keys(x.formState.dirtyFields).length===0,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(ot,{businessId:t.id,tagIds:h?.tagIds,description:h?.description,open:r,onOpenChange:d,onClose:a})]})}function _t({form:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Business Status & Behavior"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(y,{control:s.control,name:"isClient",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Is Client"}),e.jsx(Z,{children:"Mark this business as a client"})]}),e.jsx(k,{children:e.jsx(ee,{disabled:!0,checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})}),e.jsx(y,{control:s.control,name:"isActive",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Is Active"}),e.jsx(Z,{children:"Business is currently active"})]}),e.jsx(k,{children:e.jsx(ee,{checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})}),e.jsx(y,{control:s.control,name:"isReceiptEnough",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Is Receipt Enough"}),e.jsx(Z,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(k,{children:e.jsx(ee,{checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})}),e.jsx(y,{control:s.control,name:"isDocumentsOptional",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"No Docs Required"}),e.jsx(Z,{children:"Skip document validation for common charges"})]}),e.jsx(k,{children:e.jsx(ee,{checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})}),e.jsx(y,{control:s.control,name:"isVatOptional",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Is VAT Optional"}),e.jsx(Z,{children:"Mute missing VAT indicator"})]}),e.jsx(k,{children:e.jsx(ee,{checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})}),e.jsx(y,{control:s.control,name:"isExemptDealer",render:({field:a,fieldState:t})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Is Exempt Dealer"}),e.jsx(Z,{children:"Business is exempt from VAT requirements"})]}),e.jsx(k,{children:e.jsx(ee,{checked:a.value,onCheckedChange:a.onChange,className:C(t)})})]})})]})]})}function Rt({form:s}){const{selectableTaxCategories:a,fetching:t}=Ts(),{selectableSortCodes:n,fetching:c,sortCodes:o}=Bs(),{selectableTags:l,fetching:i}=Es(),r=g.useCallback(d=>{if(d){const h=o.find(m=>Number(m.key)===Number(d));h&&(h.defaultIrsCode?s.setValue("irsCode",h.defaultIrsCode,{shouldDirty:!0}):s.setValue("irsCode",null,{shouldDirty:!0}))}},[s,o]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Default Settings"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{control:s.control,name:"sortCode",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Sort Code"}),e.jsx(k,{children:e.jsx(De,{onChange:m=>{r(m),d.onChange(m)},data:n,value:d.value,disabled:c,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:C(h)}})}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"taxCategory",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Tax Category"}),e.jsx(k,{children:e.jsx(De,{data:a,disabled:t,value:d.value,onChange:d.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:C(h)}})}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"pcn874RecordType",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"PCN874 Record Type"}),e.jsxs(Ps,{onValueChange:d.onChange,value:d.value,children:[e.jsx(k,{children:e.jsx(Ls,{className:C(h),children:e.jsx(Os,{})})}),e.jsx(Fs,{children:Object.entries(_s).map(([m,x])=>e.jsx(Rs,{value:m,children:`${x} (${m})`},m))})]}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"irsCode",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"IRS Code"}),e.jsx(k,{children:e.jsx(Vs,{value:d.value??void 0,onValueChange:m=>d.onChange(m??null),hideControls:!0,decimalScale:0,className:C(h)})}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"description",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Charge Description"}),e.jsx(k,{children:e.jsx(T,{placeholder:"Enter default charge description",...d,className:C(h)})}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"tags",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Tags"}),e.jsx(k,{children:e.jsx(Ms,{options:Object.values(l).map(({value:m,label:x})=>({label:x,value:m})),onValueChange:d.onChange,defaultValue:d.value,value:d.value,placeholder:"Select Default Tags",variant:"default",disabled:i,className:C(h)})}),e.jsx(B,{})]})})]})]})}function Vt({form:s}){const[a,t]=g.useState(""),[n,c]=g.useState(""),o=()=>{if(a.trim()){const d=s.getValues("phrases");s.setValue("phrases",[...d,a.trim()],{shouldDirty:!0}),t("")}},l=()=>{if(n.trim()){const d=s.getValues("emails");s.setValue("emails",[...d,n.trim()],{shouldDirty:!0}),c("")}},i=d=>{const h=s.getValues("phrases");s.setValue("phrases",h.filter((m,x)=>x!==d),{shouldDirty:!0})},r=d=>{const h=s.getValues("emails");s.setValue("emails",h.filter((m,x)=>x!==d),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Auto-matching Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure patterns for automatic matching of bank transactions and documents"}),e.jsx(y,{control:s.control,name:"phrases",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{placeholder:"Add phrase...",value:a,onChange:m=>t(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),o())},className:C(h)}),e.jsx(I,{type:"button",size:"sm",onClick:o,children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((m,x)=>e.jsxs(se,{variant:"secondary",className:"gap-1",children:[m,e.jsx(I,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>i(x),children:e.jsx(J,{className:"size-3 cursor-pointer",onClick:()=>i(x)})})]},x))}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"emails",render:({field:d,fieldState:h})=>e.jsxs(N,{children:[e.jsx(b,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"email",placeholder:"Add email...",value:n,onChange:m=>c(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),l())},className:C(h)}),e.jsx(I,{type:"button",size:"sm",onClick:l,children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((m,x)=>e.jsxs(se,{variant:"secondary",className:"gap-1",children:[m,e.jsx(I,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>r(x),children:e.jsx(J,{className:"size-3 cursor-pointer"})})]},x))}),e.jsx(B,{})]})})]})}function Mt({form:s}){const[a,t]=g.useState(""),n=()=>{if(a.trim()){const l=s.getValues("internalLinks");s.setValue("internalLinks",[...l,a.trim()],{shouldDirty:!0}),t("")}},c=l=>{const i=s.getValues("attachmentTypes");s.setValue("attachmentTypes",i?.includes(l)?i.filter(r=>r!==l):[...i,l],{shouldDirty:!0})},o=l=>{const i=s.getValues("internalLinks");s.setValue("internalLinks",i.filter((r,d)=>d!==l),{shouldDirty:!0})};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Gmail Feature Configuration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Gmail integration settings for document processing"}),e.jsx(y,{control:s.control,name:"attachmentTypes",render:({field:l,fieldState:i})=>e.jsxs(N,{children:[e.jsx(b,{children:"Attachment Types"}),e.jsx("div",{className:C(i)+" rounded-md flex flex-wrap gap-2",children:Lt.map(r=>e.jsx(se,{variant:l.value?.includes(r)?"default":"outline",className:"cursor-pointer",onClick:()=>c(r),children:r},r))}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"internalLinks",render:({field:l,fieldState:i})=>e.jsxs(N,{children:[e.jsx(b,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"url",placeholder:"Add internal link...",value:a,onChange:r=>t(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),n())}}),e.jsx(I,{type:"button",size:"sm",onClick:n,children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:C(i)+" flex flex-wrap gap-2 rounded-md",children:l.value?.map((r,d)=>e.jsxs(se,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[r,e.jsx(I,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(d),children:e.jsx(J,{className:"size-3 cursor-pointer flex-shrink-0"})})]},d))}),e.jsx(B,{})]})}),e.jsx(y,{control:s.control,name:"useMessageBody",render:({field:l,fieldState:i})=>e.jsxs(N,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:"Should Use Message Body"}),e.jsx(Z,{children:"Extract information from email message body"})]}),e.jsx(k,{children:e.jsx(ee,{checked:l.value,onCheckedChange:l.onChange,className:C(i)})})]})})]})}const zt=Ne({businessName:z().min(1,"Business name is required"),locality:z().min(1,"Locality is required"),localName:z().optional(),govId:z().optional(),address:z().optional(),localAddress:z().optional(),phone:z().optional(),website:qs("Invalid URL").optional().or(Ws("")),generalContacts:re(Ge()).optional(),billingEmails:re(Ge()).optional()});function Ze(s){return!s||s.__typename!=="LtdFinancialEntity"?{}:{businessName:s.name,locality:s.country,localName:s.hebrewName??void 0,govId:s.governmentId??void 0,address:s.address??void 0,phone:s.phoneNumber??void 0,website:s.website??void 0,generalContacts:s.email?.split(",").map(a=>a.trim()),billingEmails:s.clientInfo?.emails}}function $t(s){return{name:s.businessName,country:s.locality,hebrewName:s.localName,governmentId:s.govId,address:s.address,phoneNumber:s.phone,website:s.website,email:s.generalContacts?.join(", ")}}function Ut({data:s,refetchBusiness:a}){const t=ge(Gs,s),[n,c]=g.useState(Ze(t)),{userContext:o}=g.useContext(Ve),{updateBusiness:l,fetching:i}=ps(),r=Oe({resolver:rs(zt),defaultValues:n}),{countries:d,fetching:h}=$s(),[m,x]=g.useState(""),[w,f]=g.useState(""),A=r.watch("locality"),D=r.watch("address"),E=r.watch("localAddress");g.useEffect(()=>{D!==n.address&&r.setValue("address",D,{shouldDirty:!0})},[D,n.address,r]),g.useEffect(()=>{E!==n.localAddress&&r.setValue("localAddress",E,{shouldDirty:!0})},[E,n.localAddress,r]);const P=t&&"clientInfo"in t&&!!t.clientInfo,F=A===o?.context.locality,_=j=>{m.trim()&&(r.setValue("generalContacts",[...j,m.trim()],{shouldDirty:!0}),x(""))},L=(j,u)=>{r.setValue("generalContacts",j.filter((p,S)=>S!==u),{shouldDirty:!0})},H=j=>{w.trim()&&(r.setValue("billingEmails",[...j,w.trim()],{shouldDirty:!0}),f(""))},V=(j,u)=>{r.setValue("billingEmails",j.filter((p,S)=>S!==u),{shouldDirty:!0})},Q=async j=>{if(!t||!o?.context.adminBusinessId)return;const u=Re(j,r.formState.dirtyFields);if(!u)return;const p=$t(u);await l({businessId:t.id,ownerId:o.context.adminBusinessId,fields:p}),a?.()};return g.useEffect(()=>{if(t){const j=Ze(t);c(j),r.reset(j)}},[t,r]),e.jsxs(U,{children:[e.jsxs(G,{children:[e.jsx(q,{children:"Contact Information"}),e.jsx(W,{children:"Business contact details and address information"})]}),e.jsx(Fe,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(Q),children:[e.jsx(K,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(y,{control:r.control,name:"businessName",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsx(b,{children:"Business Name"}),e.jsx(k,{children:e.jsx(T,{...j,className:C(u)})}),e.jsx(B,{})]})}),e.jsx(y,{control:r.control,name:"locality",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsx(b,{children:"Locality / Country"}),e.jsx(De,{onChange:j.onChange,data:d.map(p=>({value:p.code,label:p.name})),value:j.value,disabled:h,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:C(u)}}),e.jsx(B,{})]})}),F&&e.jsx(y,{control:r.control,name:"localName",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsx(b,{children:"Local Name"}),e.jsx(k,{children:e.jsx(T,{...j,placeholder:"Business name in local language",className:C(u)})}),e.jsx(B,{})]})}),F&&e.jsx(y,{control:r.control,name:"govId",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsx(b,{children:"Government ID"}),e.jsx(k,{children:e.jsx(T,{...j,placeholder:"Enter Government ID",className:C(u)})}),e.jsx(B,{})]})}),e.jsx(y,{control:r.control,name:"address",render:({field:j,fieldState:u})=>e.jsxs(N,{className:"md:col-span-2",children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Address"]}),e.jsx(k,{children:e.jsx(Ue,{...j,rows:3,placeholder:"Enter business address",className:C(u)})}),e.jsx(B,{})]})}),F&&e.jsx(y,{control:r.control,name:"localAddress",render:({field:j,fieldState:u})=>e.jsxs(N,{className:"md:col-span-2",children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(k,{children:e.jsx(Ue,{...j,rows:3,placeholder:"Enter address in local language",className:C(u)})}),e.jsx(B,{})]})}),e.jsx(y,{control:r.control,name:"phone",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"Phone"]}),e.jsx(k,{children:e.jsx(T,{...j,type:"tel",placeholder:"+1 (555) 123-4567",className:C(u)})}),e.jsx(B,{})]})}),e.jsx(y,{control:r.control,name:"website",render:({field:j,fieldState:u})=>e.jsxs(N,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Us,{className:"h-4 w-4"}),"Website"]}),e.jsx(k,{children:e.jsx(T,{...j,type:"url",placeholder:"https://example.com",className:C(u)})}),e.jsx(B,{})]})}),e.jsx(y,{control:r.control,name:"generalContacts",render:({field:j,fieldState:u})=>e.jsxs(N,{className:"md:col-span-2",children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(k,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:C(u)+" flex flex-wrap gap-2 mb-2 rounded-md",children:j.value?.map((p,S)=>e.jsxs(se,{variant:"secondary",className:"gap-1 pr-1",children:[p,e.jsx("button",{type:"button",onClick:()=>L(j.value??[],S),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(J,{className:"h-3 w-3"})})]},S))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:m,onChange:p=>x(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),_(j.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(I,{type:"button",variant:"outline",size:"icon",disabled:!m.trim(),onClick:()=>_(j.value??[]),children:e.jsx(X,{className:"h-4 w-4"})})]})]})}),e.jsx(B,{})]})}),P&&e.jsx(y,{control:r.control,name:"billingEmails",render:({field:j,fieldState:u})=>e.jsxs(N,{className:"md:col-span-2",children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(k,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:C(u)+" flex flex-wrap gap-2 mb-2 rounded-md",children:j.value?.map((p,S)=>e.jsxs(se,{variant:"secondary",className:"gap-1 pr-1",children:[p,e.jsx("button",{type:"button",onClick:()=>V(j.value??[],S),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(J,{className:"h-3 w-3"})})]},S))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:w,onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),H(j.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(I,{type:"button",variant:"outline",size:"icon",disabled:!w.trim(),onClick:()=>H(j.value??[]),children:e.jsx(X,{className:"h-4 w-4"})})]})]})}),e.jsx(B,{})]})})]})}),e.jsx(_e,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(I,{type:"submit",disabled:i||Object.keys(r.formState.dirtyFields).length===0,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}function Gt(s){return{id:s.id,pos:s.purchaseOrders??void 0,startDate:s.startDate,endDate:s.endDate,paymentAmount:s.amount.raw,paymentCurrency:s.amount.currency,productType:s.product??void 0,billingCycle:s.billingCycle,msCloudLink:s.msCloud?.toString(),isActive:s.isActive,subscriptionPlan:s.plan??void 0,defaultRemark:s.remarks??void 0,defaultDocumentType:s.documentType??void 0,operationsLimit:s.operationsLimit}}function qt({clientId:s}){const[a,t]=g.useState(null),[{data:n,fetching:c},o]=te({query:Ks,variables:{clientId:s}}),l=n?.contractsByClient??[];return c?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(U,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Contracts"}),e.jsx(W,{children:"Current and past contracts sorted by start date"})]}),e.jsx(Ua,{clientId:s,contract:a,onDone:o})]})}),e.jsx(K,{className:"space-y-4",children:l.map(i=>{const r=!!i.isActive;return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:i.product}),e.jsx(se,{variant:r?"default":"secondary",children:i.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:i.id})]}),e.jsx(I,{variant:"ghost",size:"sm",onClick:()=>t(Gt(i)),children:e.jsx(Wa,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(Hs,{className:"h-3 w-3"}),"Contract Period"]}),e.jsxs("p",{className:"text-sm font-medium",children:[new Date(i.startDate).toLocaleDateString()," →"," ",new Date(i.endDate).toLocaleDateString()]})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"PO Numbers"}),e.jsx("p",{className:"text-sm font-medium font-mono",children:i.purchaseOrders.toReversed()[0]??""}),i.purchaseOrders.length>1&&e.jsx("div",{className:"space-x-1",children:i.purchaseOrders.toReversed().slice(1).map(d=>e.jsx("span",{className:"text-xs font-thin font-mono",children:d},d))})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Payment"}),e.jsx("p",{className:"text-sm font-medium",children:Ys(i.amount.raw,i.amount.currency)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Billing Cycle"}),e.jsx("p",{className:"text-sm font-medium",children:Ga(i.billingCycle)})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscription Plan"}),e.jsx("p",{className:"text-sm font-medium",children:i.plan?qa(i.plan):"N/A"})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Operations Limit"}),e.jsx("p",{className:"text-sm font-medium",children:i.operationsLimit.toLocaleString()})]}),e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Document Type"}),e.jsx("p",{className:"text-sm font-medium",children:Xs(i.documentType)})]})]}),i.remarks&&e.jsxs("div",{className:"space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remark"}),e.jsx("p",{className:"text-sm",children:i.remarks})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.msCloud&&e.jsx(I,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:i.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Js,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(Ka,{className:"h-3 w-3 ml-1"})]})})})]},i.id)})})]})}function Wt({businessId:s}){return e.jsxs(U,{children:[e.jsx(G,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(q,{children:"Documents"}),e.jsx(W,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(K,{children:e.jsx(Qs,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}const Kt=[{id:"hive",name:"Hive",description:"Schema registry, analytics, metrics and gateway for GraphQL federation and other GraphQL APIs",status:"disconnected",lastSync:"Never"},{id:"slack",name:"Slack",description:"Team communication and notifications",status:"disconnected",lastSync:"Never"},{id:"retool",name:"Retool",description:"Internal tools and dashboards",status:"disconnected",lastSync:"Never"},{id:"linear",name:"Linear",description:"Issue tracking and project management",status:"disconnected",lastSync:"Never"},{id:"workflowy",name:"Workflowy",description:"Task management and note taking",status:"disconnected",lastSync:"Never"}];function Ht({data:s}){const a=ge(aa,s),[{data:t,fetching:n},c]=te({query:Zs,variables:{clientId:a?.id??""},pause:!a?.clientInfo?.greenInvoiceId||!a?.id}),{updateClient:o}=ea(),l=g.useCallback((r,d)=>{if(!a?.id)return;const h={};h[d]=r,o({businessId:a?.id,fields:h})},[a?.id,o]);g.useEffect(()=>{a?.clientInfo?.greenInvoiceId&&a?.id&&c()},[a?.clientInfo?.greenInvoiceId,a?.id,c]);const i=t?.greenInvoiceClient;return e.jsxs(U,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Integrations"}),e.jsx(W,{children:"Connected external services and providers"})]}),e.jsxs(I,{size:"sm",children:[e.jsx(X,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(K,{className:"space-y-6",children:e.jsxs(Ya,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[n?e.jsxs(Ae,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(v,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"h-6 w-32"}),e.jsx(v,{className:"h-5 w-5 rounded-full"})]}),e.jsx(v,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{className:"h-8 w-24"}),e.jsx(v,{className:"h-8 w-8"})]})]})}),e.jsx(Ie,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-32"}),e.jsx(v,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{className:"h-4 w-40"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"h-3 w-24"}),e.jsx(v,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs(Ae,{value:"green-invoice",className:"rounded-lg border-2 border-green-600/20 bg-green-600/5",children:[e.jsx("div",{className:"px-4 py-3 bg-green-600/10 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-green-600 flex items-center justify-center text-white font-bold",children:"GI"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Green Invoice"}),e.jsx(Ke,{className:"h-5 w-5 text-green-600"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Israeli invoicing system integration"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{id:a?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async r=>l(r,"greenInvoiceId")}),e.jsx(We,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Ie,{children:i&&e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Business Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Integration ID"}),e.jsx("p",{className:"text-sm font-mono",children:a?.clientInfo?.greenInvoiceId})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Business Name"}),e.jsx("p",{className:"text-sm",children:i.name})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Country"}),e.jsx("p",{className:"text-sm",children:i.country})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"text-sm font-mono",children:i.taxId})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:"Contact Information"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Be,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.emails?.map((r,d)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:r},d))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(os,{className:"h-3.5 w-3.5"}),"Phone"]}),e.jsx("p",{className:"text-sm font-mono",children:i.phone})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Mobile"}),e.jsx("p",{className:"text-sm font-mono",children:i.mobile})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Fax"}),e.jsx("p",{className:"text-sm font-mono",children:i.fax})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:[e.jsx(Te,{className:"h-3.5 w-3.5"}),"Address"]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Street Address"}),e.jsx("p",{className:"text-sm",children:i.address})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"City"}),e.jsx("p",{className:"text-sm",children:i.city})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Zip Code"}),e.jsx("p",{className:"text-sm font-mono",children:i.zip})]})]})]})]})})]}),Kt.map(r=>e.jsxs(Ae,{value:r.id,className:"rounded-lg border",children:[e.jsx("div",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-3 flex-1",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-semibold",children:r.name}),r.status==="connected"?e.jsx(Ke,{className:"h-4 w-4 text-green-600"}):e.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r.description})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{variant:"ghost",size:"sm",onClick:d=>d.stopPropagation(),children:e.jsx(Me,{className:"h-4 w-4"})}),e.jsx(We,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Ie,{children:e.jsx("div",{className:"px-4 pb-4 pt-2 border-t",children:e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last sync: "}),e.jsx("span",{className:"font-medium",children:r.lastSync})]})})})]},r.id))]})})]})}function Yt({id:s,provider:a,updateClient:t}){const[n,c]=g.useState(!1),[o,l]=g.useState(s),i=g.useCallback(async()=>{await t(o),c(!1)},[o,t]);return e.jsxs(ss,{open:n,onOpenChange:c,children:[e.jsx(ta,{asChild:!0,children:e.jsxs(I,{variant:"outline",size:"sm",onClick:r=>r.stopPropagation(),children:[e.jsx(Me,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(as,{onClick:r=>r.stopPropagation(),children:[e.jsxs(na,{children:[e.jsxs(ia,{children:["Configure ",a]}),e.jsxs(ra,{children:["Update your ",a," integration settings"]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(pe,{htmlFor:"id",children:[a," ID"]}),e.jsx(T,{id:"id",value:o,onChange:r=>l(r.target.value),placeholder:`Enter ${a} ID`})]})}),e.jsxs(la,{children:[e.jsx(I,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(I,{onClick:i,disabled:!o,children:"Save Changes"})]})]})]})}function Xt({businessId:s}){const[{data:a,fetching:t}]=te({query:ca,variables:{businessId:s}});return t?e.jsx("div",{children:"Loading ledger records..."}):e.jsxs(U,{children:[e.jsx(G,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(q,{children:"Ledger Records"}),e.jsx(W,{children:"Complete ledger history for this business"})]})})}),e.jsx(K,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(wa,{ledgerRecordsData:a?.ledgerRecordsByFinancialEntity??[]})})})]})}function Jt({businessId:s}){const[{data:a,fetching:t}]=te({query:oa,variables:{businessId:s}});return t?e.jsx("div",{children:"Loading transactions..."}):e.jsxs(U,{children:[e.jsx(G,{className:"flex w-full justify-between items-center",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(q,{children:"Transactions"}),e.jsx(W,{children:"Complete transaction history for this business"})]})})}),e.jsx(K,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Ha,{transactionsProps:a?.transactionsByFinancialEntity??[]})})})]})}function Qt({data:s,refetchBusiness:a}){const t=ge(ja,s),[n,c]=da(),{setFiltersContext:o}=g.useContext(ma);g.useEffect(()=>{o(null)},[o]);const l=n.get("tab")||"contact",i=h=>{c({tab:h})};if(!t)return e.jsx("div",{children:"Business not found"});const r="clientInfo"in t&&!!t.clientInfo,d="adminInfo"in t&&!!t.adminInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Na,{data:t}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(ua,{value:l,onValueChange:i,className:"w-full",children:[e.jsxs(ha,{className:"grid w-full lg:grid-cols-8 sm:grid-cols-4 grid-cols-8 mb-6 h-auto gap-1 bg-muted/50 p-1",children:[e.jsxs(Y,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Xa,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(Y,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(Y,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(ye,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(Y,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(xa,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(Y,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(pa,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),e.jsxs(Y,{value:"ledger",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Ledger"})]}),e.jsxs(Y,{value:"balance",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Qa,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Balance"})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs(Y,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(at,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(Y,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(rt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]}),d&&e.jsxs(Y,{value:"admin",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(ls,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Admin"})]})]}),e.jsx(M,{value:"contact",className:"mt-0",children:e.jsx(Ut,{data:t,refetchBusiness:a})}),e.jsx(M,{value:"config",className:"mt-0",children:e.jsx(Ft,{data:t,refetchBusiness:a})}),e.jsx(M,{value:"charges",className:"mt-0",children:e.jsx(jt,{businessId:t.id})}),e.jsx(M,{value:"transactions",className:"mt-0",children:e.jsx(Jt,{businessId:t.id})}),e.jsx(M,{value:"documents",className:"mt-0",children:e.jsx(Wt,{businessId:t.id})}),e.jsx(M,{value:"ledger",className:"mt-0",children:e.jsx(Xt,{businessId:t.id})}),e.jsx(M,{value:"balance",className:"mt-0",children:e.jsx(pt,{businessId:t.id})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{value:"contracts",className:"mt-0",children:e.jsx(qt,{clientId:t.id})}),e.jsx(M,{value:"integrations",className:"mt-0",children:e.jsx(Ht,{data:t})}),e.jsx(M,{value:"charts",className:"mt-0",children:e.jsx(Et,{})})]}),d&&e.jsx(M,{value:"admin",className:"mt-0",children:e.jsx(xt,{data:t})})]})})]})}const Nn=()=>{const{businessId:s}=ga();let a;try{a=fa()}catch{}const[{data:t,fetching:n},c]=te({query:va,pause:!s||!!a,variables:{businessId:s??""}}),o=a||t;return!a&&n&&!o?.business?e.jsx(ts,{}):!s||!o?.business?e.jsx("div",{children:"Business not found"}):e.jsx(Qt,{data:o.business,refetchBusiness:async()=>c()})};export{Nn as BusinessScreen};
|