@accounter/client 0.0.8-alpha-20251028124234-328844c99a42b68aa9e2f32fd86da80b4832f631 → 0.0.8-alpha-20251028124537-8b0946b10a6e597c997017c33fb80fbf674e2feb
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 +84 -13
- package/dist/assets/{Checkbox-BR6kGuhg.js → Checkbox-DBiOK2wr.js} +3 -3
- package/dist/assets/{Progress-7xtiFwK3.js → Progress-3b9RPwUr.js} +1 -1
- package/dist/assets/Typography-BjOvYDtJ.js +1 -0
- package/dist/assets/accordion-gDGB9JKa.js +1 -0
- package/dist/assets/accountant-approvals-aQMSAP78.js +1 -0
- package/dist/assets/all-charges-X9R8PfNk.js +1 -0
- package/dist/assets/{arrow-up-down-DPG1l9S1.js → arrow-up-down-B3nz1j1G.js} +2 -2
- package/dist/assets/{building-2-BgvPBt2Z.js → building-2-DyCA1u9z.js} +2 -2
- package/dist/assets/business-BOAeYn9N.js +27 -0
- package/dist/assets/{business-header-u2sfE_d8.js → business-header-Ck0v04Iw.js} +1 -1
- package/dist/assets/business-transactions-single-_OIHJEfY.js +1 -0
- package/dist/assets/business-trip-CYZP6qrZ.js +1 -0
- package/dist/assets/charges-filters-Dc9JkkaM.js +1 -0
- package/dist/assets/charges-ledger-validation-BiBZ2pEf.js +1 -0
- package/dist/assets/{chart-ByngRufj.js → chart-xV-krckX.js} +6 -6
- package/dist/assets/{data-table-pagination-D4OEFmX_.js → data-table-pagination-BtKmZaSS.js} +3 -3
- package/dist/assets/editable-business-trip-BIRxgXHu.js +16 -0
- package/dist/assets/index-2x_26B9B.js +1 -0
- package/dist/assets/index-4yVbIKWS.js +1 -0
- package/dist/assets/index-B-uojS_H.js +1 -0
- package/dist/assets/index-BFRBCjVk.css +1 -0
- package/dist/assets/index-BVffhJ_X.js +2 -0
- package/dist/assets/index-BZFydPbo.js +1 -0
- package/dist/assets/index-BazMRdI3.js +6 -0
- package/dist/assets/index-BsTpXlvi.js +891 -0
- package/dist/assets/{index-CLUhAJ3t.js → index-C3BnUF_U.js} +3 -3
- package/dist/assets/index-CD_kl3oZ.js +1 -0
- package/dist/assets/{index-UMFH47hN.js → index-CWM7AEkA.js} +4 -4
- package/dist/assets/index-CaXjK2fb.js +2 -0
- package/dist/assets/index-CbJd62Hp.js +1 -0
- package/dist/assets/index-CdKoH7Cz.js +9 -0
- package/dist/assets/index-Crc98w5p.js +1 -0
- package/dist/assets/index-Cs-QBGd0.js +1 -0
- package/dist/assets/index-D2ada9K2.js +1 -0
- package/dist/assets/index-DAkukoD_.js +1 -0
- package/dist/assets/index-DML4EmHc.js +1 -0
- package/dist/assets/{index-Bsl7tJp_.js → index-DuBbCD-l.js} +22 -22
- package/dist/assets/{index-BetG0HVN.js → index-DypFylYK.js} +3 -3
- package/dist/assets/{index-vChLJwSt.js → index-KFd7K_WR.js} +3 -3
- package/dist/assets/index-rwlm4BcW.js +1 -0
- package/dist/assets/index-xA-DiOzv.js +1 -0
- package/dist/assets/{index.es-NphQjU3m.js → index.es-C6nk1zNp.js} +1 -1
- package/dist/assets/issue-document-BezTjH4r.js +1 -0
- package/dist/assets/login-page-I-7tCrbB.js +1 -0
- package/dist/assets/missing-info-charges-BDgEJ4mj.js +1 -0
- package/dist/assets/page-not-found-CIT5vwb-.js +1 -0
- package/dist/assets/{pencil-tV0FsM6V.js → pencil-BHXyXIP9.js} +2 -2
- package/dist/assets/report-commentary-row-DHfnYhMN.js +1 -0
- package/dist/assets/{save-Czmh3tvC.js → save-NUZuyPEH.js} +2 -2
- package/dist/assets/sub-3UcXQDsZ.js +1 -0
- package/dist/assets/subMonths-BbuiFsxa.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +5 -5
- package/src/components/business/admin-business-section.tsx +74 -36
- package/src/components/business/contracts-section.tsx +25 -4
- package/src/components/business-transactions/business-extended-info.tsx +5 -5
- package/src/components/business-transactions/index.tsx +28 -1
- package/src/components/businesses/index.tsx +2 -6
- package/src/components/charges/cells/business-trip.tsx +1 -6
- package/src/components/charges/cells/counterparty.tsx +28 -4
- package/src/components/charges/helpers.ts +15 -0
- package/src/components/clients/contracts/modify-contract-dialog.tsx +70 -14
- package/src/components/clients/modify-client-dialog.tsx +27 -9
- package/src/components/common/business-trip-report/parts/core-expense-row.tsx +2 -2
- package/src/components/common/business-trip-report/parts/report-header.tsx +1 -2
- package/src/components/common/business-trip-report/parts/uncategorized-transactions.tsx +2 -2
- package/src/components/common/buttons/charge-navigate-button.tsx +11 -12
- package/src/components/common/modals/edit-charge-modal.tsx +2 -2
- package/src/components/common/modals/insert-business.tsx +88 -36
- package/src/components/common/modals/insert-document-modal.tsx +2 -2
- package/src/components/common/modals/match-document-modal.tsx +2 -2
- package/src/components/common/new-documents-list.tsx +2 -2
- package/src/components/documents-table/cells/creditor.tsx +11 -2
- package/src/components/documents-table/cells/debtor.tsx +11 -2
- package/src/components/layout/user-nav.tsx +22 -3
- package/src/components/ledger-table/counterparty-cell.tsx +33 -4
- package/src/components/reports/conto/index.tsx +18 -1
- package/src/components/reports/trial-balance-report/index.tsx +17 -1
- package/src/components/screens/businesses/business.tsx +4 -0
- package/src/components/screens/charges/all-charges.tsx +17 -1
- package/src/components/screens/charges/charge.tsx +4 -0
- package/src/components/screens/reports/balance-report/index.tsx +14 -0
- package/src/components/screens/reports/depreciation-report/index.tsx +14 -0
- package/src/components/transactions-table/cells/counterparty.tsx +23 -2
- package/src/components/transactions-table/cells-legacy/counterparty.tsx +26 -3
- package/src/gql/gql.ts +9 -9
- package/src/gql/graphql.ts +29 -23
- package/src/hooks/use-get-all-contracts.ts +1 -1
- package/src/providers/urql.tsx +2 -2
- package/dist/assets/MultiSelect-BqcJrWnD.js +0 -1
- package/dist/assets/Pagination-6Sv5LXxl.js +0 -1
- package/dist/assets/Table-C5zxD95i.js +0 -1
- package/dist/assets/Typography-CMzSQZKD.js +0 -1
- package/dist/assets/YearPickerInput-CllwSjcn.js +0 -1
- package/dist/assets/accordion-CMR2fANH.js +0 -1
- package/dist/assets/accountant-approvals-BHFXpHHc.js +0 -1
- package/dist/assets/accounter-table-CpeQD4PG.js +0 -1
- package/dist/assets/addDays-DvwuJbUs.js +0 -1
- package/dist/assets/all-charges-At7WJXuW.js +0 -1
- package/dist/assets/business-DKvbSnga.js +0 -32
- package/dist/assets/business-extended-info-7CM8px2e.js +0 -13
- package/dist/assets/business-transactions-filters-DmpO9Bwo.js +0 -1
- package/dist/assets/business-transactions-single-rF6JbAL7.js +0 -1
- package/dist/assets/business-trip-BGrp09N7.js +0 -1
- package/dist/assets/charge-C-EaA1Xc.js +0 -1
- package/dist/assets/charges-filters-Dq-8QHH-.js +0 -1
- package/dist/assets/charges-ledger-validation-DlkzVow7.js +0 -1
- package/dist/assets/charges-table-Cncs1HLi.js +0 -62
- package/dist/assets/create-event-handler-BiA-1lGu.js +0 -1
- package/dist/assets/download-csv-button-Df5rDeDc.js +0 -1
- package/dist/assets/editable-business-trip-Bav24z0u.js +0 -16
- package/dist/assets/funnel-BJ71hzoq.js +0 -6
- package/dist/assets/index-BRv0JZw4.js +0 -1
- package/dist/assets/index-BXlS8oD_.js +0 -1
- package/dist/assets/index-BplSRMAq.css +0 -1
- package/dist/assets/index-Cix5qjA-.js +0 -2
- package/dist/assets/index-CizLtiES.js +0 -1
- package/dist/assets/index-DKBzv0gc.js +0 -1
- package/dist/assets/index-DR_5jpS4.js +0 -6
- package/dist/assets/index-DTmtILfq.js +0 -1
- package/dist/assets/index-DU0G7FZm.js +0 -1
- package/dist/assets/index-DUWRgLfu.js +0 -9
- package/dist/assets/index-DYZPWG4k.js +0 -2
- package/dist/assets/index-DdUE2_44.js +0 -1
- package/dist/assets/index-De5dvO0S.js +0 -1
- package/dist/assets/index-Des3eR4f.js +0 -1
- package/dist/assets/index-DpYwi5kf.js +0 -6
- package/dist/assets/index-GzyQZkbY.js +0 -1
- package/dist/assets/index-HzLXi-qB.js +0 -1
- package/dist/assets/index-Ji28AZwq.js +0 -1
- package/dist/assets/index-fuT9duEO.js +0 -1
- package/dist/assets/index-wck8Xuay.js +0 -1
- package/dist/assets/index-wyU9I4Kz.js +0 -768
- package/dist/assets/insert-business-trip-modal-vS1QrUJz.js +0 -6
- package/dist/assets/issue-document-pIswc_8i.js +0 -1
- package/dist/assets/list-plus-Dy3vzJVy.js +0 -6
- package/dist/assets/login-page-YXRfklK1.js +0 -1
- package/dist/assets/match-document-modal-BPG_hljb.js +0 -16
- package/dist/assets/missing-info-charges-D8dUfChs.js +0 -1
- package/dist/assets/modal-D47umnak.js +0 -1
- package/dist/assets/page-layout-BG0XvWfD.js +0 -1
- package/dist/assets/page-not-found-Cy6oIIb1.js +0 -1
- package/dist/assets/panel-top-open-B1rhJYjQ.js +0 -11
- package/dist/assets/report-commentary-row-BL2RkIHq.js +0 -1
- package/dist/assets/similar-transactions-modal-MQeC2gtu.js +0 -1
- package/dist/assets/sub-B4_VmmF9.js +0 -1
- package/dist/assets/subMonths-DG7w6bCY.js +0 -1
- package/dist/assets/summary-DvHtnArZ.js +0 -1
- package/dist/assets/switch-GSloW_Ey.js +0 -1
- package/dist/assets/toggle-expansion-button-lwJYTklN.js +0 -1
- package/dist/assets/tooltip-BbKSwLCX.js +0 -1
- package/dist/assets/use-url-query-CUVSXgm0.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-20251028124537-8b0946b10a6e597c997017c33fb80fbf674e2feb
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -110,6 +110,53 @@
|
|
|
110
110
|
[`@radix-ui/react-progress@^1.1.7` ↗︎](https://www.npmjs.com/package/@radix-ui/react-progress/v/1.1.7)
|
|
111
111
|
(to `dependencies`)
|
|
112
112
|
|
|
113
|
+
- [#2621](https://github.com/Urigo/accounter-fullstack/pull/2621)
|
|
114
|
+
[`164cdb9`](https://github.com/Urigo/accounter-fullstack/commit/164cdb9240ae333c7eb6542610378a8c11229764)
|
|
115
|
+
Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
|
|
116
|
+
- Updated dependency
|
|
117
|
+
[`lucide-react@0.547.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.547.0) (from
|
|
118
|
+
`0.546.0`, in `dependencies`)
|
|
119
|
+
|
|
120
|
+
- [#2626](https://github.com/Urigo/accounter-fullstack/pull/2626)
|
|
121
|
+
[`b2049c0`](https://github.com/Urigo/accounter-fullstack/commit/b2049c0a242afb4dc1f63366a6e4611050b3c7c0)
|
|
122
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - dependencies updates:
|
|
123
|
+
- Updated dependency
|
|
124
|
+
[`lucide-react@0.548.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.548.0) (from
|
|
125
|
+
`0.546.0`, in `dependencies`)
|
|
126
|
+
|
|
127
|
+
- [#2629](https://github.com/Urigo/accounter-fullstack/pull/2629)
|
|
128
|
+
[`6244c1b`](https://github.com/Urigo/accounter-fullstack/commit/6244c1bbafa7029f426bdaf796d830ff62cee006)
|
|
129
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - dependencies updates:
|
|
130
|
+
- Updated dependency
|
|
131
|
+
[`lucide-react@0.548.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.548.0) (from
|
|
132
|
+
`0.546.0`, in `dependencies`)
|
|
133
|
+
|
|
134
|
+
- [#2631](https://github.com/Urigo/accounter-fullstack/pull/2631)
|
|
135
|
+
[`8b0946b`](https://github.com/Urigo/accounter-fullstack/commit/8b0946b10a6e597c997017c33fb80fbf674e2feb)
|
|
136
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - dependencies updates:
|
|
137
|
+
- Updated dependency
|
|
138
|
+
[`lucide-react@0.548.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.548.0) (from
|
|
139
|
+
`0.546.0`, in `dependencies`)
|
|
140
|
+
|
|
141
|
+
- [#2635](https://github.com/Urigo/accounter-fullstack/pull/2635)
|
|
142
|
+
[`f7d7dda`](https://github.com/Urigo/accounter-fullstack/commit/f7d7ddaf9e7e1a76649c5d9609659a737ec80c6c)
|
|
143
|
+
Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
|
|
144
|
+
- Updated dependency
|
|
145
|
+
[`lucide-react@0.548.0` ↗︎](https://www.npmjs.com/package/lucide-react/v/0.548.0) (from
|
|
146
|
+
`0.547.0`, in `dependencies`)
|
|
147
|
+
|
|
148
|
+
- [#2631](https://github.com/Urigo/accounter-fullstack/pull/2631)
|
|
149
|
+
[`7756b76`](https://github.com/Urigo/accounter-fullstack/commit/7756b764d5667639c45d3192bd79abcc04e39e99)
|
|
150
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Update**: A new
|
|
151
|
+
"operations_count" column has been added to the "clients_contracts" table to store the operational
|
|
152
|
+
limit for each contract.
|
|
153
|
+
- **GraphQL API Extension**: The GraphQL schema, resolvers, and database providers have been
|
|
154
|
+
updated to support the "operationsLimit" field for creating, updating, and querying contract
|
|
155
|
+
data.
|
|
156
|
+
- **User Interface Integration**: The client application now includes a dedicated input field for
|
|
157
|
+
setting the "operationsLimit" in the contract modification dialog and displays this value in the
|
|
158
|
+
contract details section.
|
|
159
|
+
|
|
113
160
|
- [#2584](https://github.com/Urigo/accounter-fullstack/pull/2584)
|
|
114
161
|
[`549a2a6`](https://github.com/Urigo/accounter-fullstack/commit/549a2a6fed7959795d7ca130b0ad567c5f4f62c8)
|
|
115
162
|
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Update**: Introduced a
|
|
@@ -174,6 +221,42 @@
|
|
|
174
221
|
(e.g., `FORBIDDEN`) continue to trigger navigation to the login page, with these errors
|
|
175
222
|
explicitly skipped by the new toast notification system to avoid redundant alerts.
|
|
176
223
|
|
|
224
|
+
- [#2629](https://github.com/Urigo/accounter-fullstack/pull/2629)
|
|
225
|
+
[`6244c1b`](https://github.com/Urigo/accounter-fullstack/commit/6244c1bbafa7029f426bdaf796d830ff62cee006)
|
|
226
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Update**: The
|
|
227
|
+
`clients_contracts` table in the database has been updated to replace the single `purchase_order`
|
|
228
|
+
column (string) with a new `purchase_orders` column, which is an array of text (`text[]`),
|
|
229
|
+
allowing multiple POs per contract.
|
|
230
|
+
- **GraphQL API Evolution**: The GraphQL schema has been modified to reflect this change, updating
|
|
231
|
+
`purchaseOrder: String` to `purchaseOrders: [String!]!` across the `Contract` type,
|
|
232
|
+
`CreateContractInput`, and `UpdateContractInput`.
|
|
233
|
+
- **Frontend User Interface**: The client-side application now supports displaying and managing
|
|
234
|
+
multiple Purchase Orders. Users can add new POs, view all associated POs (with the latest one
|
|
235
|
+
highlighted), and remove POs directly from the contract modification dialog.
|
|
236
|
+
- **Backend Logic Adaptation**: Server-side resolvers and database providers have been updated to
|
|
237
|
+
correctly handle the new `purchase_orders` array when creating, updating, and querying
|
|
238
|
+
contracts.
|
|
239
|
+
- **Green Invoice Integration**: The integration with Green Invoice has been adjusted to use the
|
|
240
|
+
first Purchase Order from the `purchase_orders` array when generating document remarks, ensuring
|
|
241
|
+
compatibility with external systems that might expect a single PO reference.
|
|
242
|
+
|
|
243
|
+
- [#2626](https://github.com/Urigo/accounter-fullstack/pull/2626)
|
|
244
|
+
[`b2049c0`](https://github.com/Urigo/accounter-fullstack/commit/b2049c0a242afb4dc1f63366a6e4611050b3c7c0)
|
|
245
|
+
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Client Creation Flow Enhancement**: The
|
|
246
|
+
"Create New Business" dialog now includes an option to immediately create a client associated with
|
|
247
|
+
the new business. If selected, a `ModifyClientDialog` will automatically open after business
|
|
248
|
+
creation, streamlining the onboarding process.
|
|
249
|
+
- **`ModifyClientDialog` Flexibility**: The `ModifyClientDialog` component has been enhanced with
|
|
250
|
+
a `showTrigger` prop, allowing it to be rendered without its default trigger button, making it
|
|
251
|
+
suitable for programmatic opening. It also now consistently calls the `onDone` callback when
|
|
252
|
+
closed, improving callback reliability.
|
|
253
|
+
- **User Navigation Improvements**: The user dropdown menu now displays the actual logged-in
|
|
254
|
+
username from the `UserContext` and includes a direct link to the "Admin Configurations" page
|
|
255
|
+
for the user's primary business, providing quicker access to administrative settings.
|
|
256
|
+
- **Form Schema Refinements**: The business creation form schema has been updated to use more
|
|
257
|
+
direct Zod validators (`z.email()`, `z.url()`) for better type safety and includes a new
|
|
258
|
+
`isClient` boolean field to indicate if the business is also a client.
|
|
259
|
+
|
|
177
260
|
- [#2582](https://github.com/Urigo/accounter-fullstack/pull/2582)
|
|
178
261
|
[`32276b4`](https://github.com/Urigo/accounter-fullstack/commit/32276b47e164f0976fcdd5523fa5e26f0704014f)
|
|
179
262
|
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **New Business/Client Page**: Introduced
|
|
@@ -195,18 +278,6 @@
|
|
|
195
278
|
- **UI Library Integration**: Integrated the `@radix-ui/react-progress` component and refactored
|
|
196
279
|
the `pcn874RecordType` enum definition into a shared helper for better code organization.
|
|
197
280
|
|
|
198
|
-
- [#2634](https://github.com/Urigo/accounter-fullstack/pull/2634)
|
|
199
|
-
[`328844c`](https://github.com/Urigo/accounter-fullstack/commit/328844c99a42b68aa9e2f32fd86da80b4832f631)
|
|
200
|
-
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Centralized Routing**: Introduced a new
|
|
201
|
-
`ROUTES` object to centralize and standardize all application routing, replacing numerous ad-hoc
|
|
202
|
-
URL construction functions and hardcoded paths.
|
|
203
|
-
- **Removed Redundant Functions**: Eliminated several `getHref` and `encodeFilters` utility
|
|
204
|
-
functions across various components, simplifying the codebase and reducing duplication.
|
|
205
|
-
- **Improved Navigation Consistency**: Updated `Link` components and navigation calls to
|
|
206
|
-
consistently use the new `ROUTES` object, ensuring a uniform approach to client-side routing.
|
|
207
|
-
- **Enhanced UX for Table Rows**: Modified table rows in `BusinessExtendedInfo` to make the entire
|
|
208
|
-
row clickable for navigation to charge detail pages, improving user experience.
|
|
209
|
-
|
|
210
281
|
- [#2605](https://github.com/Urigo/accounter-fullstack/pull/2605)
|
|
211
282
|
[`863a592`](https://github.com/Urigo/accounter-fullstack/commit/863a592f83b480a82156c829914b7e7a270a3f96)
|
|
212
283
|
Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **New Admin Business Configuration Tab**:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
2
|
-
* @license lucide-react v0.
|
|
1
|
+
import{D as fr,r as w,bI as Q,eG as ur,aj as t,eH as R,bG as X,bH as D,bJ as n,eI as I,bK as z,eJ as _r,eK as vr,eL as br}from"./index-BsTpXlvi.js";/**
|
|
2
|
+
* @license lucide-react v0.548.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const yr=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],
|
|
6
|
+
*/const yr=[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]],Kr=fr("merge",yr),Z=w.createContext(null),mr=Z.Provider,gr=()=>w.useContext(Z);var Pr=Object.defineProperty,h=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable,M=(r,e,a)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,W=(r,e)=>{for(var a in e||(e={}))rr.call(e,a)&&M(r,a,e[a]);if(h)for(var a of h(e))er.call(e,a)&&M(r,a,e[a]);return r},Or=(r,e)=>{var a={};for(var o in r)rr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&h)for(var o of h(r))e.indexOf(o)<0&&er.call(r,o)&&(a[o]=r[o]);return a};const wr={size:"sm"},ar=w.forwardRef((r,e)=>{const a=Q("CheckboxGroup",wr,r),{children:o,value:f,defaultValue:u,onChange:i,size:c,wrapperProps:s}=a,d=Or(a,["children","value","defaultValue","onChange","size","wrapperProps"]),[l,y]=ur({value:f,defaultValue:u,finalValue:[],onChange:i}),m=_=>{const v=_.currentTarget.value;y(l.includes(v)?l.filter($=>$!==v):[...l,v])};return t.createElement(mr,{value:{value:l,onChange:m,size:c}},t.createElement(R.Wrapper,W(W({labelElement:"div",size:c,__staticSelector:"CheckboxGroup",ref:e},s),d),o))});ar.displayName="@mantine/core/CheckboxGroup";var $r=Object.defineProperty,xr=Object.defineProperties,hr=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,J=(r,e,a)=>e in r?$r(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,K=(r,e)=>{for(var a in e||(e={}))kr.call(e,a)&&J(r,a,e[a]);if(F)for(var a of F(e))Sr.call(e,a)&&J(r,a,e[a]);return r},Y=(r,e)=>xr(r,hr(e));const Cr={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Er=X((r,{radius:e,color:a,transitionDuration:o,labelPosition:f,error:u,indeterminate:i},{size:c})=>{const s=D({size:c,sizes:Cr}),d=r.fn.variant({variant:"filled",color:a});return{icon:Y(K({},r.fn.cover()),{ref:I("icon"),color:i?"inherit":r.white,transform:i?"none":`translateY(${n(5)}) scale(0.5)`,opacity:i?1:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${o}ms`,pointerEvents:"none",width:"60%",position:"absolute",zIndex:1,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:r.respectReducedMotion?"0ms":void 0}}),inner:{position:"relative",width:s,height:s,order:f==="left"?2:1},input:Y(K({},r.fn.focusStyles()),{appearance:"none",backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.white,border:`${n(1)} solid ${u?r.fn.variant({variant:"filled",color:"red"}).background:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4]}`,width:s,height:s,borderRadius:r.fn.radius(e),padding:0,display:"block",margin:0,transition:`border-color ${o}ms ease, background-color ${o}ms ease`,cursor:r.cursorType,"&:checked":{backgroundColor:d.background,borderColor:d.background,[`& + .${I("icon")}`]:{opacity:1,color:r.white,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[2],borderColor:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[3],cursor:"not-allowed",pointerEvents:"none",[`& + .${I("icon")}`]:{color:r.colorScheme==="dark"?r.colors.dark[6]:r.colors.gray[5]}}})}}),Nr=Object.defineProperty,Ir=Object.defineProperties,zr=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,U=(r,e,a)=>e in r?Nr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Dr=(r,e)=>{for(var a in e||(e={}))jr.call(e,a)&&U(r,a,e[a]);if(B)for(var a of B(e))Rr.call(e,a)&&U(r,a,e[a]);return r},Gr=(r,e)=>Ir(r,zr(e));const j={xs:n(16),sm:n(20),md:n(24),lg:n(30),xl:n(36)};var Vr=X((r,{labelPosition:e},{size:a})=>({root:{},body:{display:"flex","&:has(input:disabled) label":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}},labelWrapper:Gr(Dr({},r.fn.fontStyles()),{display:"inline-flex",flexDirection:"column",WebkitTapHighlightColor:"transparent",fontSize:a in j?D({size:a,sizes:r.fontSizes}):void 0,lineHeight:a in j?D({size:a,sizes:j}):void 0,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,cursor:r.cursorType,order:e==="left"?1:2}),description:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},error:{marginTop:`calc(${r.spacing.xs} / 2)`,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm},label:{cursor:r.cursorType,[e==="left"?"paddingRight":"paddingLeft"]:r.spacing.sm,"&:disabled, &[data-disabled]":{color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]}}})),Tr=Object.defineProperty,k=Object.getOwnPropertySymbols,or=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable,q=(r,e,a)=>e in r?Tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,Lr=(r,e)=>{for(var a in e||(e={}))or.call(e,a)&&q(r,a,e[a]);if(k)for(var a of k(e))tr.call(e,a)&&q(r,a,e[a]);return r},Hr=(r,e)=>{var a={};for(var o in r)or.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&k)for(var o of k(r))e.indexOf(o)<0&&tr.call(r,o)&&(a[o]=r[o]);return a};const nr=w.forwardRef((r,e)=>{var a=r,{__staticSelector:o,className:f,classNames:u,styles:i,unstyled:c,children:s,label:d,description:l,id:y,disabled:m,error:_,size:v,labelPosition:$,bodyElement:g="div",labelElement:P="label",variant:C}=a,E=Hr(a,["__staticSelector","className","classNames","styles","unstyled","children","label","description","id","disabled","error","size","labelPosition","bodyElement","labelElement","variant"]);const{classes:p,cx:O}=Vr({labelPosition:$},{name:o,styles:i,classNames:u,unstyled:c,variant:C,size:v});return t.createElement(z,Lr({className:O(p.root,f),ref:e},E),t.createElement(z,{component:g,htmlFor:g==="label"?y:void 0,className:O(p.body)},s,t.createElement("div",{className:p.labelWrapper},d!=null&&t.createElement(z,{component:P,htmlFor:P==="label"?y:void 0,className:p.label,"data-disabled":m||void 0},d),l&&t.createElement(R.Description,{className:p.description},l),_&&_!=="boolean"&&t.createElement(R.Error,{className:p.error},_))))});nr.displayName="@mantine/core/InlineInput";var Mr=Object.defineProperty,S=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,A=(r,e,a)=>e in r?Mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,x=(r,e)=>{for(var a in e||(e={}))sr.call(e,a)&&A(r,a,e[a]);if(S)for(var a of S(e))lr.call(e,a)&&A(r,a,e[a]);return r},Wr=(r,e)=>{var a={};for(var o in r)sr.call(r,o)&&e.indexOf(o)<0&&(a[o]=r[o]);if(r!=null&&S)for(var o of S(r))e.indexOf(o)<0&&lr.call(r,o)&&(a[o]=r[o]);return a};const Fr={size:"sm",transitionDuration:100,icon:_r,labelPosition:"right"},ir=w.forwardRef((r,e)=>{const a=Q("Checkbox",Fr,r),{className:o,style:f,sx:u,checked:i,disabled:c,color:s,label:d,indeterminate:l,id:y,size:m,radius:_,wrapperProps:v,children:$,classNames:g,styles:P,transitionDuration:C,icon:E,unstyled:p,labelPosition:O,description:cr,error:G,variant:V}=a,dr=Wr(a,["className","style","sx","checked","disabled","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","unstyled","labelPosition","description","error","variant"]),b=gr(),T=vr(y),{systemStyles:pr,rest:L}=br(dr),{classes:N}=Er({radius:_,color:s,transitionDuration:C,labelPosition:O,error:!!G,indeterminate:l},{name:"Checkbox",classNames:g,styles:P,unstyled:p,variant:V,size:b?.size||m}),H=b?{checked:b.value.includes(L.value),onChange:b.onChange}:{};return t.createElement(nr,x(x({className:o,sx:u,style:f,id:T,size:b?.size||m,labelPosition:O,label:d,description:cr,error:G,disabled:c,__staticSelector:"Checkbox",classNames:g,styles:P,unstyled:p,"data-checked":H.checked||void 0,variant:V},pr),v),t.createElement("div",{className:N.inner},t.createElement("input",x(x({id:T,ref:e,type:"checkbox",className:N.input,checked:i,disabled:c},L),H)),t.createElement(E,{indeterminate:l,className:N.icon})))});ir.displayName="@mantine/core/Checkbox";ir.Group=ar;export{ir as C,Kr as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bG as J,bH as _,bJ as o,dY as K,r as M,bI as W,aj as s,T as Y,bK as w,c1 as O}from"./index-BsTpXlvi.js";const k={xs:o(3),sm:o(5),md:o(8),lg:o(12),xl:o(16)},q=K({from:{backgroundPosition:"0 0"},to:{backgroundPosition:`${o(40)} 0`}});var Q=J((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"}})),U=Object.defineProperty,X=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,N=(a,r,e)=>r in a?U(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)=>X(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=M.forwardRef((a,r)=>{const e=W("Progress",ea,a),{className:t,value:d,color:C,size:E,radius:$,striped:u,animate:i,label:m,"aria-label":j,classNames:z,styles:I,sections:p,unstyled:T,variant:D}=e,L=x(e,["className","value","color","size","radius","striped","animate","label","aria-label","classNames","styles","sections","unstyled","variant"]),{classes:l,cx:f,theme:b}=Q({color:C,radius:$},{name:"Progress",classNames:z,styles:I,unstyled:T,variant:D,size:E}),A=Array.isArray(p)?aa(p).map((B,F)=>{var v=B,{tooltip:g,accumulated:V,value:G,label:y,color:H}=v,P=x(v,["tooltip","accumulated","value","label","color"]);return s.createElement(Y.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:`${G}%`,left:`${V}%`,backgroundColor:b.fn.variant({variant:"filled",primaryFallback:!1,color:H||b.primaryColor}).background}}),y&&s.createElement(O,{className:l.label},y)))}):null;return s.createElement(w,c({className:f(l.root,t),ref:r},L),A||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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ef as S,eg as K,eh as Z,ei as Q,ej as W,ek as X,d8 as Y,d7 as z,r as k,dc as N,el as ee,j as te,ak as re,dZ as _}from"./index-BsTpXlvi.js";function Me(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}const $=e=>e,ne=()=>{let e=$;return{configure(t){e=t},generate(t){return e(t)},reset(){e=$}}},oe=ne(),se={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 U(e,t,r="Mui"){const n=se[t];return n?`${r}-${n}`:`${oe.generate(e)}-${t}`}function ie(e,t,r="Mui"){const n={};return t.forEach(o=>{n[o]=U(e,o,r)}),n}function G(e){const{variants:t,...r}=e,n={variants:t,style:S(r),isProcessed:!0};return n.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=S(o.style))}),n}const ae=K();function V(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function g(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function le(e){return e?(t,r)=>r[e]:null}function ue(e,t,r){e.theme=he(e.theme)?r:e.theme[t]||e.theme}function A(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(o=>A(e,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(e,n.variants,[o],r)}return n?.isProcessed?r?g(S(n.style),r):n.style:r?g(S(n),r):n}function I(e,t,r=[],n=void 0){let o;e:for(let s=0;s<t.length;s+=1){const i=t[s];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const a in i.props)if(e[a]!==i.props[a]&&e.ownerState?.[a]!==i.props[a])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.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 ce(e={}){const{themeId:t,defaultTheme:r=ae,rootShouldForwardProp:n=V,slotShouldForwardProp:o=V}=e;function s(a){ue(a,t,r)}return(a,d={})=>{Z(a,u=>u.filter(c=>c!==W));const{name:l,slot:h,skipVariantsResolver:b,skipSx:C,overridesResolver:v=le(ye(h)),...T}=d,w=l&&l.startsWith("Mui")||h?"components":"custom",P=b!==void 0?b:h&&h!=="Root"&&h!=="root"||!1,M=C||!1;let x=V;h==="Root"||h==="root"?x=n:h?x=o:pe(a)&&(x=void 0);const F=Q(a,{shouldForwardProp:x,label:fe(),...T}),q=u=>{if(u.__emotion_real===u)return u;if(typeof u=="function")return function(m){return A(m,u,m.theme.modularCssLayers?w:void 0)};if(X(u)){const c=G(u);return function(y){return c.variants?A(y,c,y.theme.modularCssLayers?w:void 0):y.theme.modularCssLayers?g(c.style,w):c.style}}return u},j=(...u)=>{const c=[],m=u.map(q),y=[];if(c.push(s),l&&v&&y.push(function(f){const p=f.theme.components?.[l]?.styleOverrides;if(!p)return null;const B={};for(const E in p)B[E]=A(f,p[E],f.theme.modularCssLayers?"theme":void 0);return v(f,B)}),l&&!P&&y.push(function(f){const p=f.theme?.components?.[l]?.variants;return p?I(f,p,[],f.theme.modularCssLayers?"theme":void 0):null}),M||y.push(W),Array.isArray(m[0])){const O=m.shift(),f=new Array(c.length).fill(""),R=new Array(y.length).fill("");let p;p=[...f,...O,...R],p.raw=[...f,...O.raw,...R],c.unshift(p)}const J=[...c,...m,...y],L=F(...J);return a.muiName&&(L.muiName=a.muiName),L};return F.withConfig&&(j.withConfig=F.withConfig),j}}function fe(e,t){return void 0}function he(e){for(const t in e)return!1;return!0}function pe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ye(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const D={theme:void 0};function de(e){let t,r;return function(o){let s=t;return(s===void 0||o.theme!==r)&&(D.theme=o.theme,s=G(e(D)),t=s,r=o.theme),s}}function me(e,t,r=void 0){const n={};for(const o in e){const s=e[o];let i="",a=!0;for(let d=0;d<s.length;d+=1){const l=s[d];l&&(i+=(a===!0?"":" ")+t(l),a=!1,r&&r[l]&&(i+=" "+r[l]))}n[o]=i}return n}function ge(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Se=e=>ge(e)&&e!=="classes",ve=ce({themeId:Y,defaultTheme:z,rootShouldForwardProp:Se}),we=de;function Fe(...e){const t=k.useRef(void 0),r=k.useCallback(n=>{const o=e.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?.())}},e);return k.useMemo(()=>e.every(n=>n==null)?null:n=>{t.current&&(t.current(),t.current=void 0),n!=null&&(t.current=r(n))},e)}function xe(e){return typeof e.main=="string"}function be(e,t=[]){if(!xe(e))return!1;for(const r of t)if(!e.hasOwnProperty(r)||typeof e[r]!="string")return!1;return!0}function Ce(e=[]){return([,t])=>t&&be(t,e)}function Te(e){return U("MuiTypography",e)}ie("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const Pe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Oe=ee(),Re=e=>{const{align:t,gutterBottom:r,noWrap:n,paragraph:o,variant:s,classes:i}=e,a={root:["root",s,e.align!=="inherit"&&`align${_(t)}`,r&&"gutterBottom",n&&"noWrap",o&&"paragraph"]};return me(a,Te,i)},ke=ve("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.variant&&t[r.variant],r.align!=="inherit"&&t[`align${_(r.align)}`],r.noWrap&&t.noWrap,r.gutterBottom&&t.gutterBottom,r.paragraph&&t.paragraph]}})(we(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([t,r])=>t!=="inherit"&&r&&typeof r=="object").map(([t,r])=>({props:{variant:t},style:r})),...Object.entries(e.palette).filter(Ce()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,t])=>typeof t=="string").map(([t])=>({props:{color:`text${_(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:t})=>t.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:t})=>t.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:t})=>t.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:t})=>t.paragraph,style:{marginBottom:16}}]}))),H={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Ve=k.forwardRef(function(t,r){const{color:n,...o}=N({props:t,name:"MuiTypography"}),s=!Pe[n],i=Oe({...o,...s&&{color:n}}),{align:a="inherit",className:d,component:l,gutterBottom:h=!1,noWrap:b=!1,paragraph:C=!1,variant:v="body1",variantMapping:T=H,...w}=i,P={...i,align:a,color:n,className:d,component:l,gutterBottom:h,noWrap:b,paragraph:C,variant:v,variantMapping:T},M=l||(C?"p":T[v]||H[v])||"span",x=Re(P);return te.jsx(ke,{as:M,ref:r,className:re(x.root,d),...w,ownerState:P,style:{...a!=="inherit"&&{"--Typography-textAlign":a},...w.style}})});export{Ve as T,Me as _,ie as a,V as b,me as c,Ce as d,U as g,we as m,ve as s,Fe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aj as l,j as t,fg as J,fh as Q,fi as O,fj as X,fk as Z,fl as T,fm as ee,fn as oe,fo as M,fp as re,fq as te,fr as ne,p as P,dW as ae}from"./index-BsTpXlvi.js";var d="Accordion",ce=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[k,ie,se]=J(d),[b]=Q(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(fe,{...r,ref:n}):t.jsx(pe,{...c,ref:n})})});V.displayName=d;var[H,le]=b(d),[K,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(K,{scope:e.__scopeAccordion,collapsible:r,children:t.jsx($,{...s,ref:n})})})}),fe=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((u=[])=>[...u,x]),[i]),v=l.useCallback(x=>i((u=[])=>u.filter(h=>h!==x)),[i]);return t.jsx(H,{scope:e.__scopeAccordion,value:s,onItemOpen:p,onItemClose:v,children:t.jsx(K,{scope:e.__scopeAccordion,collapsible:!0,children:t.jsx($,{...r,ref:n})})})}),[ue,C]=b(d),$=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),u=te(c)==="ltr",h=ne(e.onKeyDown,m=>{if(!ce.includes(m.key))return;const B=m.target,I=v().filter(R=>!R.ref.current?.disabled),g=I.findIndex(R=>R.ref.current===B),D=I.length;if(g===-1)return;m.preventDefault();let f=g;const j=0,w=D-1,_=()=>{f=g+1,f>w&&(f=j)},y=()=>{f=g-1,f<j&&(f=w)};switch(m.key){case"Home":f=j;break;case"End":f=w;break;case"ArrowRight":r==="horizontal"&&(u?_():y());break;case"ArrowDown":r==="vertical"&&_();break;case"ArrowLeft":r==="horizontal"&&(u?y():_());break;case"ArrowUp":r==="vertical"&&y();break}const F=f%D;I[F].ref.current?.focus()});return t.jsx(ue,{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:h})})})}),A="AccordionItem",[ve,S]=b(A),z=l.forwardRef((e,n)=>{const{__scopeAccordion:o,value:a,...c}=e,r=C(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":Y(v),...i,...c,ref:n,disabled:x,open:v,onOpenChange:u=>{u?s.onItemOpen(a):s.onItemClose(a)}})})});z.displayName=A;var L="AccordionHeader",G=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(L,o);return t.jsx(T.h3,{"data-orientation":c.orientation,"data-state":Y(r.open),"data-disabled":r.disabled?"":void 0,...a,ref:n})});G.displayName=L;var N="AccordionTrigger",U=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(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 q="AccordionContent",W=l.forwardRef((e,n)=>{const{__scopeAccordion:o,...a}=e,c=C(d,o),r=S(q,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}})});W.displayName=q;function Y(e){return e?"open":"closed"}var xe=V,me=z,ge=G,Ae=U,be=W;function he({...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{he as A,Ie as a,we as b,je as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,F as h,u as v,ag as C,ai as A,a as F,j as e,c as P,L as b,fs as y}from"./index-BsTpXlvi.js";import{C as j}from"./charges-filters-Dc9JkkaM.js";import{P as D}from"./Progress-3b9RPwUr.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";const w=()=>{const{setFiltersContext:c}=t.useContext(h),{get:i}=v(),{userContext:p}=t.useContext(C),[a,x]=t.useState(i("chargesFilters")?JSON.parse(decodeURIComponent(i("chargesFilters"))):{byOwners:p?.context.adminBusinessId?[p?.context.adminBusinessId]:[],sortBy:{field:A.Date,asc:!1},toAnyDate:null,fromAnyDate:null}),[{data:r,fetching:u}]=F({query:y,variables:{filters:a,page:1,limit:999999}}),s=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 d=100*o/s,g=100*l/s,m=100*n/s;return t.useEffect(()=>{c(e.jsx("div",{className:"flex flex-row gap-x-5",children:e.jsx(j,{filter:a,setFilter:x,activePage:1,setPage:()=>{},totalPages:1})}))},[r,u,a,c,x]),e.jsx(P,{title:"Accountant Approvals Status",children:u?e.jsx(b,{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: ${s}`,e.jsx(D,{color:"green",radius:"xl",size:"xl",sections:[{value:d,color:"green",label:`${d.toFixed(1)}% (${o})`},{value:g,color:"orange",label:`${g.toFixed(1)}% (${l})`},{value:m,color:"red",label:`${m.toFixed(1)}% (${n})`}]})]})})};export{w as AccountantApprovals};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,F as D,u as E,a as N,j as e,T as b,B as w,P as z,b as O,c as T,L,C as R,E as q,I as B,M as U,A as k}from"./index-BsTpXlvi.js";import{e as Q,C as $}from"./charges-filters-Dc9JkkaM.js";import{M as H}from"./index-CWM7AEkA.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";import"./Checkbox-DBiOK2wr.js";function Y(l,n){const a=new URLSearchParams;n&&a.append("page",String(n));const o=Q(l);return o&&a.append("chargesFilters",o),`/charges${a.size>0?`?${a}`:""}`}const Z=()=>{const{setFiltersContext:l}=s.useContext(D),[n,a]=s.useState(void 0),[o,g]=s.useState(void 0),[d,x]=s.useState(void 0),[u,j]=s.useState(!1),[r,h]=s.useState([]),{get:m}=E(),[p,M]=s.useState(m("page")?Number(m("page")):1),C=m("chargesFilters"),S=s.useMemo(()=>{if(C)try{return JSON.parse(decodeURIComponent(C))}catch{return}},[C]),[i,v]=s.useState(S),I=s.useCallback((t,A)=>{r.map(f=>f.id).includes(t)?h(r.filter(f=>f.id!==t)):h([...r,{id:t,onChange:A}])},[r]),[{data:c,fetching:P},F]=N({query:k,variables:{filters:i,page:p,limit:100},pause:!0});s.useEffect(()=>{i&&F()},[i,F]);function y(){h([])}return s.useEffect(()=>{l(e.jsxs("div",{className:"flex flex-row gap-x-5",children:[e.jsx($,{filter:i,setFilter:v,activePage:p,setPage:M,totalPages:c?.allCharges?.pageInfo.totalPages,initiallyOpened:!i}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>j(t=>!t),children:u?e.jsx(z,{className:"size-5"}):e.jsx(O,{className:"size-5"})})}),e.jsx(H,{selected:r,resetMerge:y})]}))},[c,P,i,p,u,l,M,v,j,r,S]),e.jsxs(T,{title:"All Charges",description:"Manage charges",children:[P?e.jsx(L,{className:"h-10 w-10 animate-spin mr-2 self-center"}):c?.allCharges.nodes?e.jsx(R,{setEditChargeId:a,setInsertDocument:g,setMatchDocuments:x,toggleMergeCharge:I,mergeSelectedCharges:new Set(r.map(t=>t.id)),data:c?.allCharges?.nodes,isAllOpened:u}):e.jsx("span",{children:"Please apply filters"}),n&&e.jsx(q,{chargeId:n?.id,close:()=>a(void 0),onChange:n.onChange}),o&&e.jsx(B,{chargeId:o.id,onChange:o.onChange,close:()=>g(void 0)}),d&&e.jsx(U,{chargeId:d.id,ownerId:d.ownerId,setMatchDocuments:()=>x(void 0)})]})};export{Z as AllCharges,Y as getAllChargesHref};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
* @license lucide-react v0.
|
|
1
|
+
import{D as o}from"./index-BsTpXlvi.js";/**
|
|
2
|
+
* @license lucide-react v0.548.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
* @license lucide-react v0.
|
|
1
|
+
import{D as a}from"./index-BsTpXlvi.js";/**
|
|
2
|
+
* @license lucide-react v0.548.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{D as Ne,G as ye,S as Se,H as he,a as be,J as Rs,r as b,j as e,K as Ge,N as We,O as Ms,n as ps,Q as $s,i as Ie,t as M,l as De,U as Us,V as Te,W as Ke,X as Ce,Y as q,Z as G,_ as js,$ as W,a0 as K,a1 as Ee,a2 as H,a3 as j,a4 as g,a5 as f,a6 as N,v as T,a7 as A,a8 as C,a9 as ae,aa as He,B as P,ab as zs,ac as Xe,ad as Je,ae as _,af as gs,ag as Qe,ah as qs,s as Gs,C as Ws,ai as Ks,aj as V,ak as ts,al as Hs,am as Xs,an as Js,ao as ee,ap as Q,aq as Qs,ar as Ys,as as Zs,at as Ve,au as xe,av as pe,aw as je,ax as ge,ay as et,az as fe,aA as st,aB as tt,aC as Y,aD as Z,aE as ie,aF as nt,aG as at,aH as _e,aI as Re,aJ as fs,aK as it,aL as Me,aM as rt,aN as $e,aO as vs,aP as ns,aQ as ys,aR as lt,aS as ct,aT as Ye,aU as Ns,aV as Ze,aW as bs,aX as Cs,aY as ws,aZ as As,a_ as Ss,a$ as ks,b0 as ot,b1 as de,b2 as dt,b3 as as,b4 as mt,b5 as ut,b6 as ht,b7 as xt,b8 as pt,b9 as jt,ba as gt,bb as ft,bc as vt,bd as k,be as yt,bf as es,bg as Nt,bh as bt,bi as Ct,bj as wt,bk as At,bl as St,bm as J,bn as kt,bo as It,bp as z,bq as Dt,br as Tt,bs as Et,bt as Bt}from"./index-BsTpXlvi.js";import{S as ss}from"./save-NUZuyPEH.js";import{B as Pt}from"./business-header-Ck0v04Iw.js";import{i as Ot,D as Lt,f as Ft,E as Vt,L as Pe,a as we,C as _t,A as Rt,b as me,c as Mt,d as Ue,h as $t,e as Ut,g as Is,u as zt,G as qt,j as is,k as Gt,X as Ds,Y as Ts,l as Wt,m as Kt,R as Ht,n as Xt,o as Jt,p as Qt}from"./chart-xV-krckX.js";import{P as Yt}from"./pencil-BHXyXIP9.js";import{A as Zt,a as Oe,b as Le,c as rs}from"./accordion-gDGB9JKa.js";import{B as en}from"./building-2-DyCA1u9z.js";import"./sequential-CAnleQny.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 sn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ls=Ne("circle-check",sn);/**
|
|
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 tn=[["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"}]],Ae=Ne("dollar-sign",tn);/**
|
|
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 nn=[["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"}]],an=Ne("file-check",nn);/**
|
|
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 rn=[["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"}]],ln=Ne("plug",rn);/**
|
|
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 cn=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Fe=Ne("trending-up",cn);function Es(s){switch(s){case ye.Annual:return"Annual";case ye.Monthly:return"Monthly";default:throw new Error(`Unsupported Billing Cycle: ${s}`)}}function Bs(s){switch(s){case Se.Enterprise:return"Enterprise";case Se.Pro:return"Pro";default:throw new Error(`Unsupported Subscription plan: ${s}`)}}function on(s){return he(s,"yyyy-MM-dd")}function dn({businessId:s,tagIds:t,description:n,open:a,onOpenChange:l,onClose:o}){const[{data:r,fetching:i},c]=be({pause:!0,query:Rs,variables:{businessId:s,tagsDifferentThan:t?t.map(h=>h.id):void 0,descriptionDifferentThan:n}});b.useEffect(()=>{a&&(t||n)&&!r&&c()},[a,t,n,c,r]);const d=b.useCallback(h=>{l(h),a&&!h&&o?.()},[l,o,a]),u=b.useMemo(()=>a&&(!!t||!!n)&&r&&r?.similarChargesByBusiness.length>0,[a,t,n,r]);return e.jsx(Ge,{open:u,onOpenChange:d,children:e.jsx(We,{className:"overflow-scroll max-h-screen w-full sm:max-w-[640px] md:max-w-[768px] lg:max-w-[900px]",onClick:h=>h.stopPropagation(),children:e.jsx(Ms,{fallback:e.jsx("div",{children:"Error fetching similar charges"}),children:i?e.jsx(ps,{}):t||n?e.jsx($s,{data:r?.similarChargesByBusiness??[],tagIds:t,description:n,onOpenChange:d,title:"Similar Charges by Business"}):null})})})}const mn="updateAdminBusiness",un=()=>{const[{fetching:s},t]=Ie(Us),n=b.useCallback(async a=>{const l=`Error updating admin business ID [${a.adminBusinessId}]`,o=`${mn}-${a.adminBusinessId}`;M.loading("Updating admin business",{id:o});try{const r=await t(a),i=De(r,l,o,"updateAdminBusiness");if(i)return M.success("Success",{id:o,description:"Admin Business Updated"}),i.updateAdminBusiness}catch(r){console.error(`${l}: ${r}`),M.error("Error",{id:o,description:l,duration:1e5,closeButton:!0})}},[t]);return{fetching:s,updateAdminBusiness:n}},hn=Xe({withholdingTaxBookNumber:_().min(1,{message:"Withholding Tax Book Number is required"}),withholdingTaxFileNumber:_().min(1,{message:"Withholding Tax File Number is required"}),socialSecurityEmployerId:_().min(1,{message:"National Insurance Employer ID is required"}),taxAdvancesRate:gs().min(0,{message:"Advance Tax Rate must be at least 0"}).max(100,{message:"Advance Tax Rate must be at most 100"}),taxAdvancesId:_().min(1,{message:"Tax Advances ID is required"}),registrationDate:_().min(1,{message:"Business Registration Start Date is required"})});function cs(s){return!s||s.__typename!=="LtdFinancialEntity"||!s.adminInfo?{}:{withholdingTaxBookNumber:s.adminInfo.withholdingTaxBookNumber??"",withholdingTaxFileNumber:s.adminInfo.withholdingTaxFileNumber??"",socialSecurityEmployerId:s.adminInfo.socialSecurityEmployerId??"",taxAdvancesRate:s.adminInfo.taxAdvancesRate??0,taxAdvancesId:s.adminInfo.taxAdvancesId??"",registrationDate:s.adminInfo.registrationDate??""}}function xn(s){return{withholdingTaxBookNumber:s.withholdingTaxBookNumber,withholdingTaxFileNumber:s.withholdingTaxFileNumber,socialSecurityEmployerId:s.socialSecurityEmployerId,taxAdvancesRate:s.taxAdvancesRate,taxAdvancesId:s.taxAdvancesId,registrationDate:s.registrationDate?on(new Date(s.registrationDate)):void 0}}function pn({data:s,refetchBusiness:t}){const n=Ce(zs,s),[a,l]=b.useState(cs(n)),{updateAdminBusiness:o,fetching:r}=un(),i=Te({resolver:Ke(hn),defaultValues:a}),c=async d=>{if(!n)return;const u=Je(d,i.formState.dirtyFields);if(!u)return;const h=xn(u);await o({adminBusinessId:n.id,fields:h}),t?.()};return b.useEffect(()=>{if(n){const d=cs(n);l(d),i.reset(d)}},[n,i]),e.jsxs(q,{children:[e.jsxs(G,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(js,{className:"h-5 w-5 text-primary"}),e.jsx(W,{children:"Admin Business Configuration"})]}),e.jsx(K,{children:"Tax and registration information for the business operating this application"})]}),e.jsx(Ee,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(c),className:"space-y-6",children:[e.jsx(H,{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(j,{control:i.control,name:"withholdingTaxBookNumber",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Book Number"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter book number",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(j,{control:i.control,name:"withholdingTaxFileNumber",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"File Number"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter file number",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(ae,{className:"md:col-span-2"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground md:col-span-2",children:"Tax Advances"}),e.jsx(j,{control:i.control,name:"taxAdvancesId",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Identification number"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter tax advances ID",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(j,{control:i.control,name:"taxAdvancesRate",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Rate (%)"}),e.jsx(N,{children:e.jsx(T,{type:"number",step:"0.01",min:"0",max:"100",placeholder:"Enter tax rate",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(ae,{className:"md:col-span-2"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground md:col-span-2",children:"Social Security"}),e.jsx(j,{control:i.control,name:"socialSecurityEmployerId",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Employer Identifier"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter employer ID",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(ae,{className:"md:col-span-2"}),e.jsx(j,{control:i.control,name:"registrationDate",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Business Registration Start Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...d,className:A(u)})}),e.jsx(C,{})]})})]})}),e.jsx(He,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(P,{type:"submit",disabled:r||Object.keys(i.formState.dirtyFields).length===0||!i.formState.isValid,children:[e.jsx(ss,{className:"h-4 w-4"}),"Save Changes"]})})]})})]})}function jn({businessId:s}){const{userContext:t}=b.useContext(Qe),[n,a]=b.useState(1),[{data:l,fetching:o}]=be({query:qs,variables:{filters:{byOwners:t?.context.adminBusinessId?[t.context.adminBusinessId]:void 0,sortBy:{field:Ks.Date,asc:!1},byBusinesses:[s]},page:n,limit:100}}),r=l?.allCharges?.pageInfo.totalPages??1,i=l?.allCharges?.nodes??[];return o?e.jsx("div",{children:"Loading charges..."}):e.jsxs(q,{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(W,{children:"Charges"}),e.jsx(K,{children:"Recurring and one-time charges for this business"})]})}),r>1&&e.jsx(Gs,{className:"flex-fit",value:n,onChange:a,total:r})]}),e.jsx(H,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Ws,{data:i,isAllOpened:!1})})})]})}var gn=["type","layout","connectNulls","ref"],fn=["key"];function re(s){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re(s)}function os(s,t){if(s==null)return{};var n=vn(s,t),a,l;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);for(l=0;l<o.length;l++)a=o[l],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(s,a)&&(n[a]=s[a])}return n}function vn(s,t){if(s==null)return{};var n={};for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){if(t.indexOf(a)>=0)continue;n[a]=s[a]}return n}function ve(){return ve=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s[a]=n[a])}return s},ve.apply(this,arguments)}function ds(s,t){var n=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);t&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(s,l).enumerable})),n.push.apply(n,a)}return n}function R(s){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ds(Object(n),!0).forEach(function(a){$(s,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(n)):ds(Object(n)).forEach(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(n,a))})}return s}function ne(s){return Cn(s)||bn(s)||Nn(s)||yn()}function yn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nn(s,t){if(s){if(typeof s=="string")return ze(s,t);var n=Object.prototype.toString.call(s).slice(8,-1);if(n==="Object"&&s.constructor&&(n=s.constructor.name),n==="Map"||n==="Set")return Array.from(s);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(s,t)}}function bn(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function Cn(s){if(Array.isArray(s))return ze(s)}function ze(s,t){(t==null||t>s.length)&&(t=s.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=s[n];return a}function wn(s,t){if(!(s instanceof t))throw new TypeError("Cannot call a class as a function")}function ms(s,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,Os(a.key),a)}}function An(s,t,n){return t&&ms(s.prototype,t),n&&ms(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s}function Sn(s,t,n){return t=ke(t),kn(s,Ps()?Reflect.construct(t,n||[],ke(s).constructor):t.apply(s,n))}function kn(s,t){if(t&&(re(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return In(s)}function In(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Ps(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ps=function(){return!!s})()}function ke(s){return ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ke(s)}function Dn(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(t&&t.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),t&&qe(s,t)}function qe(s,t){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,l){return a.__proto__=l,a},qe(s,t)}function $(s,t,n){return t=Os(t),t in s?Object.defineProperty(s,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[t]=n,s}function Os(s){var t=Tn(s,"string");return re(t)=="symbol"?t:t+""}function Tn(s,t){if(re(s)!="object"||!s)return s;var n=s[Symbol.toPrimitive];if(n!==void 0){var a=n.call(s,t);if(re(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var le=(function(s){function t(){var n;wn(this,t);for(var a=arguments.length,l=new Array(a),o=0;o<a;o++)l[o]=arguments[o];return n=Sn(this,t,[].concat(l)),$(n,"state",{isAnimationFinished:!0,totalLength:0}),$(n,"generateSimpleStrokeDasharray",function(r,i){return"".concat(i,"px ").concat(r-i,"px")}),$(n,"getStrokeDasharray",function(r,i,c){var d=c.reduce(function(O,m){return O+m});if(!d)return n.generateSimpleStrokeDasharray(i,r);for(var u=Math.floor(r/d),h=r%d,x=i-r,p=[],w=0,I=0;w<c.length;I+=c[w],++w)if(I+c[w]>h){p=[].concat(ne(c.slice(0,w)),[h-I]);break}var E=p.length%2===0?[0,x]:[x];return[].concat(ne(t.repeat(c,u)),ne(p),E).map(function(O){return"".concat(O,"px")}).join(", ")}),$(n,"id",zt("recharts-line-")),$(n,"pathRef",function(r){n.mainCurve=r}),$(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),$(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return Dn(t,s),An(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();this.setState({totalLength:a})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var a=this.getTotalLength();a!==this.state.totalLength&&this.setState({totalLength:a})}}},{key:"getTotalLength",value:function(){var a=this.mainCurve;try{return a&&a.getTotalLength&&a.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(a,l){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,r=o.points,i=o.xAxis,c=o.yAxis,d=o.layout,u=o.children,h=Ft(u,Vt);if(!h)return null;var x=function(I,E){return{x:I.x,y:I.y,value:I.value,errorVal:Is(I.payload,E)}},p={clipPath:a?"url(#clipPath-".concat(l,")"):null};return V.createElement(Pe,p,h.map(function(w){return V.cloneElement(w,{key:"bar-".concat(w.props.dataKey),data:r,xAxis:i,yAxis:c,layout:d,dataPointFormatter:x})}))}},{key:"renderDots",value:function(a,l,o){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var i=this.props,c=i.dot,d=i.points,u=i.dataKey,h=we(this.props,!1),x=we(c,!0),p=d.map(function(I,E){var O=R(R(R({key:"dot-".concat(E),r:3},h),x),{},{index:E,cx:I.x,cy:I.y,value:I.value,dataKey:u,payload:I.payload,points:d});return t.renderDotItem(c,O)}),w={clipPath:a?"url(#clipPath-".concat(l?"":"dots-").concat(o,")"):null};return V.createElement(Pe,ve({className:"recharts-line-dots",key:"dots"},w),p)}},{key:"renderCurveStatically",value:function(a,l,o,r){var i=this.props,c=i.type,d=i.layout,u=i.connectNulls;i.ref;var h=os(i,gn),x=R(R(R({},we(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:l?"url(#clipPath-".concat(o,")"):null,points:a},r),{},{type:c,layout:d,connectNulls:u});return V.createElement(_t,ve({},x,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(a,l){var o=this,r=this.props,i=r.points,c=r.strokeDasharray,d=r.isAnimationActive,u=r.animationBegin,h=r.animationDuration,x=r.animationEasing,p=r.animationId,w=r.animateNewValues,I=r.width,E=r.height,O=this.state,m=O.prevPoints,v=O.totalLength;return V.createElement(Rt,{begin:u,duration:h,isActive:d,easing:x,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(L){var F=L.t;if(m){var X=m.length/i.length,U=i.map(function(B,Be){var ce=Math.floor(Be*X);if(m[ce]){var oe=m[ce],te=me(oe.x,B.x),Fs=me(oe.y,B.y);return R(R({},B),{},{x:te(F),y:Fs(F)})}if(w){var Vs=me(I*2,B.x),_s=me(E/2,B.y);return R(R({},B),{},{x:Vs(F),y:_s(F)})}return R(R({},B),{},{x:B.x,y:B.y})});return o.renderCurveStatically(U,a,l)}var se=me(0,v),y=se(F),S;if(c){var D="".concat(c).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});S=o.getStrokeDasharray(y,v,D)}else S=o.generateSimpleStrokeDasharray(v,y);return o.renderCurveStatically(i,a,l,{strokeDasharray:S})})}},{key:"renderCurve",value:function(a,l){var o=this.props,r=o.points,i=o.isAnimationActive,c=this.state,d=c.prevPoints,u=c.totalLength;return i&&r&&r.length&&(!d&&u>0||!Mt(d,r))?this.renderCurveWithAnimation(a,l):this.renderCurveStatically(r,a,l)}},{key:"render",value:function(){var a,l=this.props,o=l.hide,r=l.dot,i=l.points,c=l.className,d=l.xAxis,u=l.yAxis,h=l.top,x=l.left,p=l.width,w=l.height,I=l.isAnimationActive,E=l.id;if(o||!i||!i.length)return null;var O=this.state.isAnimationFinished,m=i.length===1,v=ts("recharts-line",c),L=d&&d.allowDataOverflow,F=u&&u.allowDataOverflow,X=L||F,U=Ue(E)?this.id:E,se=(a=we(r,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},y=se.r,S=y===void 0?3:y,D=se.strokeWidth,B=D===void 0?2:D,Be=$t(r)?r:{},ce=Be.clipDot,oe=ce===void 0?!0:ce,te=S*2+B;return V.createElement(Pe,{className:v},L||F?V.createElement("defs",null,V.createElement("clipPath",{id:"clipPath-".concat(U)},V.createElement("rect",{x:L?x:x-p/2,y:F?h:h-w/2,width:L?p:p*2,height:F?w:w*2})),!oe&&V.createElement("clipPath",{id:"clipPath-dots-".concat(U)},V.createElement("rect",{x:x-te/2,y:h-te/2,width:p+te,height:w+te}))):null,!m&&this.renderCurve(X,U),this.renderErrorBar(X,U),(m||r)&&this.renderDots(X,oe,U),(!I||O)&&Ut.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(a,l){return a.animationId!==l.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,prevPoints:l.curPoints}:a.points!==l.curPoints?{curPoints:a.points}:null}},{key:"repeat",value:function(a,l){for(var o=a.length%2!==0?[].concat(ne(a),[0]):a,r=[],i=0;i<l;++i)r=[].concat(ne(r),ne(o));return r}},{key:"renderDotItem",value:function(a,l){var o;if(V.isValidElement(a))o=V.cloneElement(a,l);else if(Ot(a))o=a(l);else{var r=l.key,i=os(l,fn),c=ts("recharts-line-dot",typeof a!="boolean"?a.className:"");o=V.createElement(Lt,ve({key:r},i,{className:c}))}return o}}])})(b.PureComponent);$(le,"displayName","Line");$(le,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!qt.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});$(le,"getComposedData",function(s){var t=s.props,n=s.xAxis,a=s.yAxis,l=s.xAxisTicks,o=s.yAxisTicks,r=s.dataKey,i=s.bandSize,c=s.displayedData,d=s.offset,u=t.layout,h=c.map(function(x,p){var w=Is(x,r);return u==="horizontal"?{x:is({axis:n,ticks:l,bandSize:i,entry:x,index:p}),y:Ue(w)?null:a.scale(w),value:w,payload:x}:{x:Ue(w)?null:n.scale(w),y:is({axis:a,ticks:o,bandSize:i,entry:x,index:p}),value:w,payload:x}});return R({points:h,layout:u},d)});var En=Gt({chartName:"LineChart",GraphicalChild:le,axisComponents:[{axisType:"xAxis",AxisComp:Ds},{axisType:"yAxis",AxisComp:Ts}],formatAxisMap:Wt});const ue=[{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 Bn(){const s=ue.reduce((n,a)=>n+a.revenue,0),t=s/ue.length;return e.jsxs(q,{children:[e.jsxs(G,{children:[e.jsx(W,{children:"Revenue Analytics"}),e.jsx(K,{children:"Revenue and expenses over time"})]}),e.jsxs(H,{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(Ae,{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(Fe,{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(Ae,{className:"h-4 w-4"}),"Average Monthly"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",t.toLocaleString(void 0,{maximumFractionDigits:0})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Fe,{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(Ae,{className:"h-4 w-4"}),"Current Month"]}),e.jsxs("p",{className:"text-2xl font-bold",children:["$",ue[ue.length-1].revenue.toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-green-600",children:[e.jsx(Fe,{className:"h-3 w-3"}),e.jsx("span",{children:"+8.0% from last month"})]})]})]}),e.jsx(Kt,{config:{revenue:{label:"Revenue",color:"hsl(var(--chart-1))"},expenses:{label:"Expenses",color:"hsl(var(--chart-2))"}},className:"h-[400px]",children:e.jsx(Ht,{width:"100%",height:"100%",children:e.jsxs(En,{data:ue,margin:{top:5,right:10,left:10,bottom:5},children:[e.jsx(Xt,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Ds,{dataKey:"month",className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ts,{className:"text-xs",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Jt,{content:e.jsx(Qt,{})}),e.jsx(le,{type:"monotone",dataKey:"revenue",stroke:"var(--color-revenue)",strokeWidth:2,dot:{fill:"var(--color-revenue)",r:4}}),e.jsx(le,{type:"monotone",dataKey:"expenses",stroke:"var(--color-expenses)",strokeWidth:2,dot:{fill:"var(--color-expenses)",r:4}})]})})})]})]})}const Pn="updateBusiness",Ls=()=>{const[{fetching:s},t]=Ie(Hs),n=b.useCallback(async a=>{const l=`Error updating business ID [${a.businessId}]`,o=`${Pn}-${a.businessId}`;M.loading("Updating business",{id:o});try{const r=await t(a),i=De(r,l,o,"updateBusiness");if(i)return M.success("Success",{id:o,description:"Business updated"}),i.updateBusiness}catch(r){console.error(`${l}: ${r}`),M.error("Error",{id:o,description:l,duration:1e5,closeButton:!0})}},[t]);return{fetching:s,updateBusiness:n}},On=Object.values(nt);function us(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(t=>t.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 Ln(s){const n=s.internalLinks||s.useMessageBody||s.attachmentTypes?{internalEmailLinks:s.internalLinks,emailBody:s.useMessageBody,attachments:s.attachmentTypes}:void 0,l=s.description||s.tags||s.phrases||s.emails||n?{description:s.description,tags:s.tags?.map(o=>({id:o})),phrases:s.phrases,emails:s.emails,emailListener:n}: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:l}}function Fn({data:s,refetchBusiness:t}){const n=Ce(Js,s),[a,l]=b.useState(us(n)),{userContext:o}=b.useContext(Qe),{updateBusiness:r,fetching:i}=Ls(),[c,d]=b.useState(!1),[u,h]=b.useState(void 0),x=Te({defaultValues:a}),p=async I=>{if(!n||!o?.context.adminBusinessId)return;const E=Je(I,x.formState.dirtyFields);if(!E)return;const O=Ln(E);await r({businessId:n.id,ownerId:o.context.adminBusinessId,fields:O}),E.tags?.length||E.description?(h({tagIds:E.tags?.map(m=>({id:m})),description:E.description}),d(!0)):t?.()};if(b.useEffect(()=>{if(n){const I=us(n);l(I),x.reset(I)}},[n,x]),!n)return e.jsx("div",{});const w=x.watch("isClient");return e.jsxs(q,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(W,{children:"Configurations"}),e.jsx(K,{children:"Business status, tax settings, automation rules, and integration preferences"})]}),!w&&e.jsx(Xs,{businessId:n.id,onDone:t})]})}),e.jsx(Ee,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(p),children:[e.jsxs(H,{className:"space-y-6",children:[e.jsx(Vn,{form:x}),e.jsx(ae,{}),e.jsx(_n,{form:x}),e.jsx(ae,{}),e.jsx(Rn,{form:x}),e.jsx(ae,{}),e.jsx(Mn,{form:x})]}),e.jsx(He,{className:"flex justify-end border-t pt-6",children:e.jsxs(P,{type:"submit",disabled:i||Object.keys(x.formState.dirtyFields).length===0,children:[e.jsx(ss,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsx(dn,{businessId:n.id,tagIds:u?.tagIds,description:u?.description,open:c,onOpenChange:d,onClose:t})]})}function Vn({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(j,{control:s.control,name:"isClient",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Client"}),e.jsx(ee,{children:"Mark this business as a client"})]}),e.jsx(N,{children:e.jsx(Q,{disabled:!0,checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})}),e.jsx(j,{control:s.control,name:"isActive",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Active"}),e.jsx(ee,{children:"Business is currently active"})]}),e.jsx(N,{children:e.jsx(Q,{checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})}),e.jsx(j,{control:s.control,name:"isReceiptEnough",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Receipt Enough"}),e.jsx(ee,{children:"Generate ledger for receipt documents if no invoice available"})]}),e.jsx(N,{children:e.jsx(Q,{checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})}),e.jsx(j,{control:s.control,name:"isDocumentsOptional",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"No Docs Required"}),e.jsx(ee,{children:"Skip document validation for common charges"})]}),e.jsx(N,{children:e.jsx(Q,{checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})}),e.jsx(j,{control:s.control,name:"isVatOptional",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is VAT Optional"}),e.jsx(ee,{children:"Mute missing VAT indicator"})]}),e.jsx(N,{children:e.jsx(Q,{checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})}),e.jsx(j,{control:s.control,name:"isExemptDealer",render:({field:t,fieldState:n})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Is Exempt Dealer"}),e.jsx(ee,{children:"Business is exempt from VAT requirements"})]}),e.jsx(N,{children:e.jsx(Q,{checked:t.value,onCheckedChange:t.onChange,className:A(n)})})]})})]})]})}function _n({form:s}){const{selectableTaxCategories:t,fetching:n}=Qs(),{selectableSortCodes:a,fetching:l,sortCodes:o}=Ys(),{selectableTags:r,fetching:i}=Zs(),c=b.useCallback(d=>{if(d){const u=o.find(h=>Number(h.key)===Number(d));u&&(u.defaultIrsCode?s.setValue("irsCode",u.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(j,{control:s.control,name:"sortCode",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Sort Code"}),e.jsx(N,{children:e.jsx(Ve,{onChange:h=>{c(h),d.onChange(h)},data:a,value:d.value,disabled:l,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(u)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"taxCategory",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tax Category"}),e.jsx(N,{children:e.jsx(Ve,{data:t,disabled:n,value:d.value,onChange:d.onChange,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(u)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"pcn874RecordType",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"PCN874 Record Type"}),e.jsxs(xe,{onValueChange:d.onChange,value:d.value,children:[e.jsx(N,{children:e.jsx(pe,{className:A(u),children:e.jsx(je,{})})}),e.jsx(ge,{children:Object.entries(et).map(([h,x])=>e.jsx(fe,{value:h,children:`${x} (${h})`},h))})]}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"irsCode",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"IRS Code"}),e.jsx(N,{children:e.jsx(st,{value:d.value??void 0,onValueChange:h=>d.onChange(h??null),hideControls:!0,decimalScale:0,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"description",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Charge Description"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Enter default charge description",...d,className:A(u)})}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"tags",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Tags"}),e.jsx(N,{children:e.jsx(tt,{options:Object.values(r).map(({value:h,label:x})=>({label:x,value:h})),onValueChange:d.onChange,defaultValue:d.value,value:d.value,placeholder:"Select Default Tags",variant:"default",disabled:i,className:A(u)})}),e.jsx(C,{})]})})]})]})}function Rn({form:s}){const[t,n]=b.useState(""),[a,l]=b.useState(""),o=()=>{if(t.trim()){const d=s.getValues("phrases");s.setValue("phrases",[...d,t.trim()],{shouldDirty:!0}),n("")}},r=()=>{if(a.trim()){const d=s.getValues("emails");s.setValue("emails",[...d,a.trim()],{shouldDirty:!0}),l("")}},i=d=>{const u=s.getValues("phrases");s.setValue("phrases",u.filter((h,x)=>x!==d),{shouldDirty:!0})},c=d=>{const u=s.getValues("emails");s.setValue("emails",u.filter((h,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(j,{control:s.control,name:"phrases",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Phrases"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{placeholder:"Add phrase...",value:t,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),o())},className:A(u)}),e.jsx(P,{type:"button",size:"sm",onClick:o,children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((h,x)=>e.jsxs(Z,{variant:"secondary",className:"gap-1",children:[h,e.jsx(P,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>i(x),children:e.jsx(ie,{className:"size-3 cursor-pointer",onClick:()=>i(x)})})]},x))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"emails",render:({field:d,fieldState:u})=>e.jsxs(g,{children:[e.jsx(f,{children:"Email Addresses"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"email",placeholder:"Add email...",value:a,onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),r())},className:A(u)}),e.jsx(P,{type:"button",size:"sm",onClick:r,children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:d.value?.map((h,x)=>e.jsxs(Z,{variant:"secondary",className:"gap-1",children:[h,e.jsx(P,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>c(x),children:e.jsx(ie,{className:"size-3 cursor-pointer"})})]},x))}),e.jsx(C,{})]})})]})}function Mn({form:s}){const[t,n]=b.useState(""),a=()=>{if(t.trim()){const r=s.getValues("internalLinks");s.setValue("internalLinks",[...r,t.trim()],{shouldDirty:!0}),n("")}},l=r=>{const i=s.getValues("attachmentTypes");s.setValue("attachmentTypes",i?.includes(r)?i.filter(c=>c!==r):[...i,r],{shouldDirty:!0})},o=r=>{const i=s.getValues("internalLinks");s.setValue("internalLinks",i.filter((c,d)=>d!==r),{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(j,{control:s.control,name:"attachmentTypes",render:({field:r,fieldState:i})=>e.jsxs(g,{children:[e.jsx(f,{children:"Attachment Types"}),e.jsx("div",{className:A(i)+" rounded-md flex flex-wrap gap-2",children:On.map(c=>e.jsx(Z,{variant:r.value?.includes(c)?"default":"outline",className:"cursor-pointer",onClick:()=>l(c),children:c},c))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"internalLinks",render:({field:r,fieldState:i})=>e.jsxs(g,{children:[e.jsx(f,{children:"Internal Links"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{type:"url",placeholder:"Add internal link...",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),a())}}),e.jsx(P,{type:"button",size:"sm",onClick:a,children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsx("div",{className:A(i)+" flex flex-wrap gap-2 rounded-md",children:r.value?.map((c,d)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[c,e.jsx(P,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>o(d),children:e.jsx(ie,{className:"size-3 cursor-pointer flex-shrink-0"})})]},d))}),e.jsx(C,{})]})}),e.jsx(j,{control:s.control,name:"useMessageBody",render:({field:r,fieldState:i})=>e.jsxs(g,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{children:"Should Use Message Body"}),e.jsx(ee,{children:"Extract information from email message body"})]}),e.jsx(N,{children:e.jsx(Q,{checked:r.value,onCheckedChange:r.onChange,className:A(i)})})]})})]})}const $n=Xe({businessName:_().min(1,"Business name is required"),locality:_().min(1,"Locality is required"),localName:_().optional(),govId:_().optional(),address:_().optional(),localAddress:_().optional(),phone:_().optional(),website:vs("Invalid URL").optional().or(ys("")),generalContacts:$e(ns()).optional(),billingEmails:$e(ns()).optional()});function hs(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(t=>t.trim()),billingEmails:s.clientInfo?.emails}}function Un(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 zn({data:s,refetchBusiness:t}){const n=Ce(rt,s),[a,l]=b.useState(hs(n)),{userContext:o}=b.useContext(Qe),{updateBusiness:r,fetching:i}=Ls(),c=Te({resolver:Ke($n),defaultValues:a}),{countries:d,fetching:u}=at(),[h,x]=b.useState(""),[p,w]=b.useState(""),I=c.watch("locality"),E=c.watch("address"),O=c.watch("localAddress");b.useEffect(()=>{E!==a.address&&c.setValue("address",E,{shouldDirty:!0})},[E,a.address,c]),b.useEffect(()=>{O!==a.localAddress&&c.setValue("localAddress",O,{shouldDirty:!0})},[O,a.localAddress,c]);const m=n&&"clientInfo"in n&&!!n.clientInfo,v=I===o?.context.locality,L=y=>{h.trim()&&(c.setValue("generalContacts",[...y,h.trim()],{shouldDirty:!0}),x(""))},F=(y,S)=>{c.setValue("generalContacts",y.filter((D,B)=>B!==S),{shouldDirty:!0})},X=y=>{p.trim()&&(c.setValue("billingEmails",[...y,p.trim()],{shouldDirty:!0}),w(""))},U=(y,S)=>{c.setValue("billingEmails",y.filter((D,B)=>B!==S),{shouldDirty:!0})},se=async y=>{if(!n||!o?.context.adminBusinessId)return;const S=Je(y,c.formState.dirtyFields);if(!S)return;const D=Un(S);await r({businessId:n.id,ownerId:o.context.adminBusinessId,fields:D}),t?.()};return b.useEffect(()=>{if(n){const y=hs(n);l(y),c.reset(y)}},[n,c]),e.jsxs(q,{children:[e.jsxs(G,{children:[e.jsx(W,{children:"Contact Information"}),e.jsx(K,{children:"Business contact details and address information"})]}),e.jsx(Ee,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(se),children:[e.jsx(H,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(j,{control:c.control,name:"businessName",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsx(f,{children:"Business Name"}),e.jsx(N,{children:e.jsx(T,{...y,className:A(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:c.control,name:"locality",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsx(f,{children:"Locality / Country"}),e.jsx(Ve,{onChange:y.onChange,data:d.map(D=>({value:D.code,label:D.name})),value:y.value,disabled:u,placeholder:"Scroll to see all options",formPart:!0,triggerProps:{className:A(S)}}),e.jsx(C,{})]})}),v&&e.jsx(j,{control:c.control,name:"localName",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsx(f,{children:"Local Name"}),e.jsx(N,{children:e.jsx(T,{...y,placeholder:"Business name in local language",className:A(S)})}),e.jsx(C,{})]})}),v&&e.jsx(j,{control:c.control,name:"govId",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsx(f,{children:"Government ID"}),e.jsx(N,{children:e.jsx(T,{...y,placeholder:"Enter Government ID",className:A(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:c.control,name:"address",render:({field:y,fieldState:S})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),"Address"]}),e.jsx(N,{children:e.jsx(Re,{...y,rows:3,placeholder:"Enter business address",className:A(S)})}),e.jsx(C,{})]})}),v&&e.jsx(j,{control:c.control,name:"localAddress",render:({field:y,fieldState:S})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),"Local Address"]}),e.jsx(N,{children:e.jsx(Re,{...y,rows:3,placeholder:"Enter address in local language",className:A(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:c.control,name:"phone",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4"}),"Phone"]}),e.jsx(N,{children:e.jsx(T,{...y,type:"tel",placeholder:"+1 (555) 123-4567",className:A(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:c.control,name:"website",render:({field:y,fieldState:S})=>e.jsxs(g,{children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(it,{className:"h-4 w-4"}),"Website"]}),e.jsx(N,{children:e.jsx(T,{...y,type:"url",placeholder:"https://example.com",className:A(S)})}),e.jsx(C,{})]})}),e.jsx(j,{control:c.control,name:"generalContacts",render:({field:y,fieldState:S})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(Me,{className:"h-4 w-4"}),"General Contacts"]}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:A(S)+" flex flex-wrap gap-2 mb-2 rounded-md",children:y.value?.map((D,B)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 pr-1",children:[D,e.jsx("button",{type:"button",onClick:()=>F(y.value??[],B),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ie,{className:"h-3 w-3"})})]},B))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:h,onChange:D=>x(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),L(y.value??[]))},placeholder:"Add contact email",type:"email"}),e.jsx(P,{type:"button",variant:"outline",size:"icon",disabled:!h.trim(),onClick:()=>L(y.value??[]),children:e.jsx(Y,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})}),m&&e.jsx(j,{control:c.control,name:"billingEmails",render:({field:y,fieldState:S})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsxs(f,{className:"flex items-center gap-2",children:[e.jsx(Me,{className:"h-4 w-4"}),"Billing Emails"]}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:A(S)+" flex flex-wrap gap-2 mb-2 rounded-md",children:y.value?.map((D,B)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 pr-1",children:[D,e.jsx("button",{type:"button",onClick:()=>U(y.value??[],B),className:"ml-1 hover:bg-muted rounded-sm p-0.5",children:e.jsx(ie,{className:"h-3 w-3"})})]},B))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{value:p,onChange:D=>w(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),X(y.value??[]))},placeholder:"Add billing email",type:"email"}),e.jsx(P,{type:"button",variant:"outline",size:"icon",disabled:!p.trim(),onClick:()=>X(y.value??[]),children:e.jsx(Y,{className:"h-4 w-4"})})]})]})}),e.jsx(C,{})]})})]})}),e.jsx(He,{className:"flex justify-end border-t mt-4 pt-6",children:e.jsxs(P,{type:"submit",disabled:i||Object.keys(c.formState.dirtyFields).length===0,children:[e.jsx(ss,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})})]})}const qn="createContract",Gn=()=>{const[{fetching:s},t]=Ie(lt),n=b.useCallback(async a=>{const l=`Error creating new contract for client[${a.input.clientId}]`,o=`${qn}-${a.input.clientId}`;M.loading("Creating contract",{id:o});try{const r=await t(a);De(r,l,o)&&M.success("Success",{id:o,description:`Contract for client ${a.input.clientId} was successfully created`})}catch(r){console.error(`${l}: ${r}`),M.error("Error",{id:o,description:l,duration:1e5,closeButton:!0})}},[t]);return{creating:s,createContract:n}},Wn="updateContract",Kn=()=>{const[{fetching:s},t]=Ie(ct),n=b.useCallback(async a=>{const l=`Error updating contract ID [${a.contractId}]`,o=`${Wn}-${a.contractId}`;M.loading("Updating contract",{id:o});try{const r=await t(a),i=De(r,l,o,"updateContract");if(i)return M.success("Success",{id:o,description:"Contract updated"}),i.updateContract}catch(r){console.error(`${l}: ${r}`),M.error("Error",{id:o,description:l,duration:1e5,closeButton:!0})}},[t]);return{updating:s,updateContract:n}},Hn=Xe({id:mt().optional(),startDate:as("Start date is required"),endDate:as("End date is required"),pos:$e(_()),paymentAmount:gs().min(0,"Payment amount must be non-negative"),paymentCurrency:de(Object.values(Ze),"Currency is required"),productType:de(Object.values(Ns)).optional(),msCloudLink:vs().optional().or(ys("")),billingCycle:de(Object.values(ye)).optional(),subscriptionPlan:de(Object.values(Se)).optional(),isActive:dt(),defaultRemark:_().optional(),defaultDocumentType:de(Object.values(Ye)),operationsLimit:ot().min(0,"Operations limit must be non-negative")}),xs={startDate:"",endDate:"",pos:[],paymentAmount:0,paymentCurrency:Ze.Usd,productType:Ns.Hive,msCloudLink:void 0,billingCycle:ye.Monthly,subscriptionPlan:void 0,isActive:!0,defaultRemark:void 0,defaultDocumentType:Ye.Proforma,operationsLimit:0};function Xn({clientId:s,contract:t,onDone:n}){const[a,l]=b.useState(!1),[o,r]=b.useState(null),[i,c]=b.useState(""),{updateContract:d,updating:u}=Kn(),{createContract:h,creating:x}=Gn(),p=Te({resolver:Ke(Hn),defaultValues:t||xs}),w=()=>{const m=i.trim();if(m){const v=p.getValues("pos");v.includes(m)||p.setValue("pos",[...v,m],{shouldDirty:!0}),c("")}},I=m=>{const v=p.getValues("pos");p.setValue("pos",v.filter((L,F)=>F!==m),{shouldDirty:!0})};b.useEffect(()=>{t&&(r(t),p.reset({startDate:t.startDate,endDate:t.endDate,pos:t.pos,paymentAmount:t.paymentAmount,paymentCurrency:t.paymentCurrency,productType:t.productType,msCloudLink:t.msCloudLink,billingCycle:t.billingCycle,subscriptionPlan:t.subscriptionPlan,isActive:t.isActive,defaultRemark:t.defaultRemark,defaultDocumentType:t.defaultDocumentType,operationsLimit:t.operationsLimit}),l(!0))},[t,p]);const E=()=>{r(null),p.reset(xs),l(!0)},O=b.useCallback(async m=>{if(o)await d({contractId:o.id,input:{amount:{raw:m.paymentAmount,currency:m.paymentCurrency},billingCycle:m.billingCycle,documentType:m.defaultDocumentType,endDate:he(new Date(m.endDate),"yyyy-MM-dd"),isActive:m.isActive,msCloud:m.msCloudLink,plan:m.subscriptionPlan,product:m.productType,purchaseOrders:m.pos,remarks:m.defaultRemark,startDate:he(new Date(m.startDate),"yyyy-MM-dd"),operationsLimit:m.operationsLimit}});else{if(!m.billingCycle){p.setError("billingCycle",{message:"Billing cycle is required"});return}await h({input:{clientId:s,amount:{raw:m.paymentAmount,currency:m.paymentCurrency},billingCycle:m.billingCycle,documentType:m.defaultDocumentType,endDate:he(new Date(m.endDate),"yyyy-MM-dd"),isActive:m.isActive,msCloud:m.msCloudLink,plan:m.subscriptionPlan,product:m.productType,purchaseOrders:m.pos,remarks:m.defaultRemark,startDate:he(new Date(m.startDate),"yyyy-MM-dd"),operationsLimit:m.operationsLimit}})}l(!1),r(null),n?.()},[o,n,h,d,s,p]);return e.jsxs(Ge,{open:a,onOpenChange:l,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(P,{size:"sm",onClick:E,children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"New Contract"]})}),e.jsxs(We,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Cs,{children:[e.jsx(ws,{children:o?"Edit Contract":"Create New Contract"}),e.jsx(As,{children:o?"Update contract details":"Add a new contract with all required details"})]}),e.jsx(Ee,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(O),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"operationsLimit",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Operations Limit"}),e.jsx(N,{children:e.jsx(T,{type:"number",placeholder:"500",...m})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"pos",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Purchase Orders"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{placeholder:"Add PO...",value:i,onChange:v=>c(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),w())}}),e.jsx(P,{type:"button",size:"sm",onClick:w,children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:m.value?.map((v,L)=>e.jsxs(Z,{variant:"secondary",className:"gap-1 max-w-xs truncate",children:[v,L===m.value.length-1&&e.jsx(P,{variant:"ghost",size:"icon",className:"p-0 size-3",onClick:()=>I(L),children:e.jsx(ie,{className:"size-3 cursor-pointer flex-shrink-0"})})]},v))}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"startDate",render:({field:{onChange:m,...v}})=>e.jsxs(g,{children:[e.jsx(f,{children:"Start Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...v,onInput:L=>m(L)})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"endDate",render:({field:{onChange:m,...v}})=>e.jsxs(g,{children:[e.jsx(f,{children:"End Date"}),e.jsx(N,{children:e.jsx(T,{type:"date",...v,onInput:L=>m(L)})}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(j,{control:p.control,name:"paymentAmount",render:({field:m})=>e.jsxs(g,{className:"md:col-span-2",children:[e.jsx(f,{children:"Payment Amount"}),e.jsx(N,{children:e.jsx(T,{type:"number",placeholder:"24000",...m,onChange:v=>{m.onChange(v?.target.value?Number(v?.target.value):void 0)}})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"paymentCurrency",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Currency"}),e.jsxs(xe,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(N,{children:e.jsx(pe,{children:e.jsx(je,{})})}),e.jsx(ge,{children:Object.values(Ze).map(v=>e.jsx(fe,{value:v,children:v},v))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"productType",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Product Type"}),e.jsx(N,{children:e.jsx(T,{placeholder:"Cloud Services",...m})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"billingCycle",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Billing Cycle"}),e.jsxs(xe,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(N,{children:e.jsx(pe,{children:e.jsx(je,{})})}),e.jsx(ge,{children:Object.values(ye).map(v=>e.jsx(fe,{value:v,children:Es(v)},v))})]}),e.jsx(C,{})]})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(j,{control:p.control,name:"subscriptionPlan",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Subscription Plan"}),e.jsx(N,{children:e.jsxs(xe,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(N,{children:e.jsx(pe,{children:e.jsx(je,{})})}),e.jsx(ge,{children:Object.values(Se).map(v=>e.jsx(fe,{value:v,children:Bs(v)},v))})]})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"isActive",render:({field:m})=>e.jsxs(g,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(f,{className:"text-base",children:"Active Status"})}),e.jsx(N,{children:e.jsx(Q,{checked:m.value,onCheckedChange:m.onChange})})]})})]}),e.jsx(j,{control:p.control,name:"msCloudLink",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"MS Cloud Link"}),e.jsx(N,{children:e.jsx(T,{type:"url",placeholder:"https://portal.azure.com/contract-id",...m})}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"defaultDocumentType",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Document Type"}),e.jsxs(xe,{onValueChange:m.onChange,defaultValue:m.value,children:[e.jsx(N,{children:e.jsx(pe,{children:e.jsx(je,{})})}),e.jsx(ge,{children:Object.values(Ye).map(v=>e.jsx(fe,{value:v,children:Ss(v)},v))})]}),e.jsx(C,{})]})}),e.jsx(j,{control:p.control,name:"defaultRemark",render:({field:m})=>e.jsxs(g,{children:[e.jsx(f,{children:"Default Remark"}),e.jsx(N,{children:e.jsx(Re,{placeholder:"Enter default remark for this contract...",rows:3,...m})}),e.jsx(C,{})]})})]}),e.jsxs(ks,{children:[e.jsx(P,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(P,{type:"submit",disabled:x||u,children:o?"Update Contract":"Create Contract"})]})]})})]})]})}function Jn(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 Qn({clientId:s}){const[t,n]=b.useState(null),[{data:a,fetching:l},o]=be({query:ut,variables:{clientId:s}}),r=a?.contractsByClient??[];return l?e.jsx("div",{children:"Loading contracts..."}):e.jsxs(q,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(W,{children:"Contracts"}),e.jsx(K,{children:"Current and past contracts sorted by start date"})]}),e.jsx(Xn,{clientId:s,contract:t,onDone:o})]})}),e.jsx(H,{className:"space-y-4",children:r.map(i=>{const c=!!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(Z,{variant:c?"default":"secondary",children:i.isActive?"Active":"Inactive"})]}),e.jsx("p",{className:"text-sm text-muted-foreground font-mono",children:i.id})]}),e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>n(Jn(i)),children:e.jsx(Yt,{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(ht,{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:xt(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:Es(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?Bs(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:Ss(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(P,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:i.msCloud.toString(),target:"_blank",rel:"noopener noreferrer",children:[e.jsx(pt,{className:"h-4 w-4 mr-2"}),"MS Cloud",e.jsx(jt,{className:"h-3 w-3 ml-1"})]})})})]},i.id)})})]})}function Yn({businessId:s}){return e.jsxs(q,{children:[e.jsx(G,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(W,{children:"Documents"}),e.jsx(K,{children:"Invoices, proformas, receipts, and other accounting documents"})]})})}),e.jsx(H,{children:e.jsx(gt,{businessId:s,linkedDocumentIds:[],limit:1e3})})]})}const Zn=[{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 ea({data:s}){const t=Ce(Nt,s),[{data:n,fetching:a},l]=be({query:ft,variables:{clientId:t?.id??""},pause:!t?.clientInfo?.greenInvoiceId||!t?.id}),{updateClient:o}=vt(),r=b.useCallback((c,d)=>{if(!t?.id)return;const u={};u[d]=c,o({businessId:t?.id,fields:u})},[t?.id,o]);b.useEffect(()=>{t?.clientInfo?.greenInvoiceId&&t?.id&&l()},[t?.clientInfo?.greenInvoiceId,t?.id,l]);const i=n?.greenInvoiceClient;return e.jsxs(q,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(W,{children:"Integrations"}),e.jsx(K,{children:"Connected external services and providers"})]}),e.jsxs(P,{size:"sm",children:[e.jsx(Y,{className:"h-4 w-4 mr-2"}),"Add Integration"]})]})}),e.jsx(H,{className:"space-y-6",children:e.jsxs(Zt,{type:"multiple",defaultValue:["green-invoice"],className:"space-y-4",children:[a?e.jsxs(Oe,{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(k,{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(k,{className:"h-6 w-32"}),e.jsx(k,{className:"h-5 w-5 rounded-full"})]}),e.jsx(k,{className:"h-4 w-64"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-8 w-24"}),e.jsx(k,{className:"h-8 w-8"})]})]})}),e.jsx(Le,{children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-32"}),e.jsx(k,{className:"h-6 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{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(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-3 w-24"}),e.jsx(k,{className:"h-4 w-full"})]})]})]})]})})]}):e.jsxs(Oe,{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(ls,{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(sa,{id:t?.clientInfo?.greenInvoiceId,provider:"Green Invoice",updateClient:async c=>r(c,"greenInvoiceId")}),e.jsx(rs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Le,{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:t?.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(Me,{className:"h-3.5 w-3.5"}),"Email Addresses"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.emails?.map((c,d)=>e.jsx("span",{className:"text-sm px-2 py-1 bg-muted rounded",children:c},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(fs,{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(_e,{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})]})]})]})]})})]}),Zn.map(c=>e.jsxs(Oe,{value:c.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:c.name}),c.status==="connected"?e.jsx(ls,{className:"h-4 w-4 text-green-600"}):e.jsx(yt,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:"ghost",size:"sm",onClick:d=>d.stopPropagation(),children:e.jsx(es,{className:"h-4 w-4"})}),e.jsx(rs,{className:"hover:no-underline p-2"})]})]})}),e.jsx(Le,{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:c.lastSync})]})})})]},c.id))]})})]})}function sa({id:s,provider:t,updateClient:n}){const[a,l]=b.useState(!1),[o,r]=b.useState(s),i=b.useCallback(async()=>{await n(o),l(!1)},[o,n]);return e.jsxs(Ge,{open:a,onOpenChange:l,children:[e.jsx(bs,{asChild:!0,children:e.jsxs(P,{variant:"outline",size:"sm",onClick:c=>c.stopPropagation(),children:[e.jsx(es,{className:"h-4 w-4 mr-2"}),"Configure"]})}),e.jsxs(We,{onClick:c=>c.stopPropagation(),children:[e.jsxs(Cs,{children:[e.jsxs(ws,{children:["Configure ",t]}),e.jsxs(As,{children:["Update your ",t," integration settings"]})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(bt,{htmlFor:"id",children:[t," ID"]}),e.jsx(T,{id:"id",value:o,onChange:c=>r(c.target.value),placeholder:`Enter ${t} ID`})]})}),e.jsxs(ks,{children:[e.jsx(P,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(P,{onClick:i,disabled:!o,children:"Save Changes"})]})]})]})}function ta({businessId:s}){return e.jsxs(q,{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(W,{children:"Transactions"}),e.jsx(K,{children:"Complete transaction history for this business"})]})})}),e.jsx(H,{children:e.jsx("div",{className:"rounded-md border",children:e.jsx(Ct,{businessID:s,filter:{}})})})]})}function na({data:s,refetchBusiness:t}){const n=Ce(Dt,s),[a,l]=wt(),o=a.get("tab")||"contact",r=d=>{l({tab:d})};if(!n)return e.jsx("div",{children:"Business not found"});const i="clientInfo"in n&&!!n.clientInfo,c="adminInfo"in n&&!!n.adminInfo;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Pt,{data:n}),e.jsx("main",{className:"container mx-auto px-4 py-6 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs(At,{value:o,onValueChange:r,className:"w-full",children:[e.jsxs(St,{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(J,{value:"contact",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(en,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contact"})]}),e.jsxs(J,{value:"config",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(es,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Config"})]}),e.jsxs(J,{value:"charges",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(Ae,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Charges"})]}),e.jsxs(J,{value:"transactions",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(kt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Transactions"})]}),e.jsxs(J,{value:"documents",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Documents"})]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{value:"contracts",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(an,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Contracts"})]}),e.jsxs(J,{value:"integrations",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(ln,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Integrations"})]})]}),c&&e.jsxs(J,{value:"admin",className:"flex items-center gap-2 data-[state=active]:bg-background",children:[e.jsx(js,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Admin"})]})]}),e.jsx(z,{value:"contact",className:"mt-0",children:e.jsx(zn,{data:n,refetchBusiness:t})}),e.jsx(z,{value:"config",className:"mt-0",children:e.jsx(Fn,{data:n,refetchBusiness:t})}),e.jsx(z,{value:"charges",className:"mt-0",children:e.jsx(jn,{businessId:n.id})}),e.jsx(z,{value:"transactions",className:"mt-0",children:e.jsx(ta,{businessId:n.id})}),e.jsx(z,{value:"documents",className:"mt-0",children:e.jsx(Yn,{businessId:n.id})}),i&&e.jsxs(e.Fragment,{children:[e.jsx(z,{value:"contracts",className:"mt-0",children:e.jsx(Qn,{clientId:n.id})}),e.jsx(z,{value:"integrations",className:"mt-0",children:e.jsx(ea,{data:n})}),e.jsx(z,{value:"charts",className:"mt-0",children:e.jsx(Bn,{})})]}),c&&e.jsx(z,{value:"admin",className:"mt-0",children:e.jsx(pn,{data:n})})]})})]})}function ua(s){return`/businesses/${s}`}const ha=()=>{const{businessId:s}=Tt();let t;try{t=Et()}catch{}const[{data:n,fetching:a},l]=be({query:Bt,pause:!s||!!t,variables:{businessId:s??""}}),o=t||n;return!t&&a&&!o?.business?e.jsx(ps,{}):!s||!o?.business?e.jsx("div",{children:"Business not found"}):e.jsx(na,{data:o.business,refetchBusiness:async()=>l()})};export{ha as BusinessScreen,ua as getBusinessHref};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{X as l,j as e,aD as t,H as m,bu as x}from"./index-BsTpXlvi.js";import{B as o}from"./building-2-DyCA1u9z.js";function h({data:n}){const s=l(x,n);if(!s||s.__typename!=="LtdFinancialEntity")return e.jsx("div",{});const{isActive:i,adminInfo:r,clientInfo:a}=s,d=!!r?.id,c=!!a?.id;return e.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border bg-card/95 backdrop-blur supports-[backdrop-filter]:bg-card/60",children:e.jsx("div",{className:"container mx-auto px-4 md:px-6 lg:px-8 max-w-7xl",children:e.jsxs("div",{className:"flex h-16 items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-accent",children:e.jsx(o,{className:"h-5 w-5 text-accent-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:s.name}),i?e.jsx(t,{variant:"secondary",children:"Active"}):e.jsx(t,{variant:"destructive",children:"Inactive"}),d&&e.jsx(t,{variant:"outline",children:"Admin"}),c&&e.jsx(t,{variant:"outline",children:"Client"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground truncate",children:["Business ID: ",s.id]})]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-6 text-sm",children:[s.governmentId&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Tax ID"}),e.jsx("p",{className:"font-medium text-foreground",children:s.governmentId})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-muted-foreground",children:"Since"}),e.jsx("p",{className:"font-medium text-foreground",children:m(s.createdAt,"MMM yyyy")})]})]})]})})})}export{h as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{br as S,u as g,r as m,F as x,a as y,j as o,bv as C,n as T,bw as h,bx as b,aV as n,bi as F,by as v}from"./index-BsTpXlvi.js";const I=({businessId:t})=>{const{businessId:r}=S(),{get:s}=g(),{setFiltersContext:u}=m.useContext(x),l=t||r,[c,d]=m.useState(s("transactionsFilters")?{...JSON.parse(decodeURIComponent(s("transactionsFilters"))),businessIDs:l?[l]:[]}:{businessIDs:l?[l]:[]}),[{data:i,fetching:f}]=y({query:v,variables:{filters:c}});m.useEffect(()=>{u(o.jsx(C,{filter:c,setFilter:d}))},[i,c,u,d]);const p=m.useMemo(()=>i?.businessTransactionsSumFromLedgerRecords.__typename==="CommonError"?[]:i?.businessTransactionsSumFromLedgerRecords.businessTransactionsSum?i.businessTransactionsSumFromLedgerRecords.businessTransactionsSum.sort((e,w)=>e.business.name.localeCompare(w.business.name)):[],[i?.businessTransactionsSumFromLedgerRecords]);return f?o.jsx(T,{}):o.jsx(h,{moreInfo:e=>o.jsx(F,{businessID:e.business.id,filter:c}),striped:!0,highlightOnHover:!0,stickyHeader:!0,items:p,columns:[{title:"Business Name",value:e=>e.business.name},{title:"Debit",value:e=>e.debit.formatted,style:{whiteSpace:"nowrap"}},{title:"Credit",value:e=>e.credit.formatted,style:{whiteSpace:"nowrap"}},{title:"Total",value:e=>e.total.raw&&(e.total.raw<-1e-4||e.total.raw>1e-4)?o.jsx(b,{color:e.total.raw>0?"green":"red",children:e.total.formatted}):e.total.formatted,style:{whiteSpace:"nowrap"}},...a(n.Eur),...a(n.Usd),...a(n.Gbp),...a(n.Cad),...a(n.Jpy),...a(n.Aud),...a(n.Sek)]})};function a(t){return[{title:`${t} Debit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.debit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Credit`,value:r=>r.foreignCurrenciesSum.find(s=>s.currency===t)?.credit?.formatted,style:{whiteSpace:"nowrap"}},{title:`${t} Total`,value:r=>{const s=r.foreignCurrenciesSum.find(u=>u.currency===t);return s?.total?.raw&&(s.total.raw<-1e-4||s.total.raw>1e-4)?o.jsx(b,{color:s.total.raw>0?"green":"red",children:s.total.formatted}):s?.total?.formatted},style:{whiteSpace:"nowrap"}}]}export{I as BusinessTransactionsSingle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{br as u,r as n,F as p,a as c,j as s,n as x,c as d,bF as l}from"./index-BsTpXlvi.js";import{P as m,C as b,E as T}from"./editable-business-trip-BIRxgXHu.js";const E=({businessTripId:a})=>{const{businessTripId:o}=u(),{setFiltersContext:i}=n.useContext(p),e=a??o??"",[{data:r,fetching:t}]=c({query:l,variables:{businessTripId:e}});return n.useEffect(()=>{i(s.jsx("div",{className:"flex flex-row gap-x-5",children:s.jsx(m,{filename:"business_trip_report"})}))},[r,t,i]),t||!r?.businessTrip?s.jsx(x,{}):s.jsx(d,{title:`Business Trip: ${r.businessTrip.name}`,description:"Manage business trip",children:s.jsx(b,{className:"mt-5",children:e&&s.jsx(T,{tripId:e,isExtended:!0})})})};export{E as BusinessTrip};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c$ as B,r as i,u as R,d2 as W,j as e,d0 as z,s as U,bB as G,B as _,d1 as Q,ag as q,V as J,H as N,ai as D,dj as X,as as $,a1 as K,dk as Y,bQ as h,cj as k,ft as Z,bV as L,bW as O,bR as V,eB as A,ap as x,fu as ee,bh as se,a3 as m,a4 as j,a5 as g,a6 as p,dL as ae,dM as te,dN as ne}from"./index-BsTpXlvi.js";import{s as oe}from"./sub-3UcXQDsZ.js";function le(a){return!a||B(a)?null:encodeURIComponent(JSON.stringify(a))}const re=[{value:D.AbsAmount,label:"Abs Amount"},{value:D.Amount,label:"Amount"},{value:D.Date,label:"Date"}],ce=[{label:"All",value:A.All},{label:"Income",value:A.Income},{label:"Expense",value:A.Expense}];function ie({filter:a,setFilter:w,closeModal:d}){const{userContext:y}=i.useContext(q),o=J({defaultValues:{byOwners:y?.context.adminBusinessId?[y.context.adminBusinessId]:void 0,sortBy:{field:D.Date,asc:!1},toAnyDate:N(new Date,"yyyy-MM-dd"),fromAnyDate:N(oe(new Date,{years:1}),"yyyy-MM-dd"),...a}}),{control:r,handleSubmit:T,watch:C}=o,[b,F]=i.useState(a.sortBy?.asc??!1),[c,u]=i.useState(!!a.sortBy?.field),{selectableFinancialEntities:S,fetching:t}=X(),{selectableTags:v,fetching:I}=$(),E=C("sortBy.field");i.useEffect(()=>{E&&!c?u(!0):!E&&c&&u(!1)},[E,c]);const P=s=>{b!=null&&s.sortBy?.field&&(s.sortBy.asc=b),w(s),d()};function H(){w({}),F(!1),d()}return e.jsxs(e.Fragment,{children:[t?e.jsx("div",{children:"Loading..."}):e.jsx("div",{}),e.jsx(K,{...o,children:e.jsxs("form",{onSubmit:T(P),children:[e.jsxs(Y,{cols:2,children:[e.jsx(h,{name:"byOwners",control:r,defaultValue:a.byOwners,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Owners",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byBusinesses",control:r,defaultValue:a.byBusinesses,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:S,value:s.value??[],disabled:t,label:"Financial Entities",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"byTags",control:r,defaultValue:a.byTags,render:({field:s,fieldState:n})=>e.jsx(k,{...s,data:v,itemComponent:Z,value:s.value??[],disabled:I,label:"Tags",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,withinPortal:!0,filter:(l,f,M)=>M.label?.toLowerCase().includes(l.toLowerCase().trim())||M.description?.toLowerCase().includes(l.toLowerCase().trim())})}),e.jsx(h,{name:"fromAnyDate",control:r,defaultValue:a.fromAnyDate,rules:{pattern:{value:L,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"From Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"toAnyDate",control:r,defaultValue:a.toAnyDate,rules:{pattern:{value:L,message:"Date must be im format yyyy-mm-dd"}},render:({field:s,fieldState:n})=>e.jsx(O,{...s,onChange:l=>{const f=l?typeof l=="string"?l:N(l,"yyyy-MM-dd"):void 0;f!==s.value&&s.onChange(f)},value:s.value?new Date(s.value):void 0,error:n.error?.message,label:"To Date",popoverProps:{withinPortal:!0}})}),e.jsx(h,{name:"chargesType",control:r,defaultValue:a.chargesType,render:({field:s,fieldState:n})=>e.jsx(V,{...s,data:ce,value:s.value??A.All,disabled:t,label:"Charge Type",placeholder:"Filter income/expense",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsx(h,{name:"sortBy.field",control:r,defaultValue:a.sortBy?.field??D.Date,render:({field:s,fieldState:n})=>e.jsx(V,{...s,data:re,label:"Field to sort by",placeholder:"Scroll to see all options",maxDropdownHeight:160,searchable:!0,error:n.error?.message,rightSectionProps:{style:{width:"5rem"}},withinPortal:!0,rightSection:e.jsxs("div",{className:"flex flex-row items-center gap-1",children:[e.jsx(x,{defaultChecked:a.sortBy?.asc??!1,checked:b??!1,disabled:!c,onCheckedChange:F}),e.jsx("span",{className:"text-xs",children:b?"ASC":"DESC"})]})})}),e.jsx(h,{name:"accountantStatus",control:r,defaultValue:a.accountantStatus,render:({field:s,fieldState:n})=>e.jsx(k,{...s,value:s.value??[],data:ee,disabled:t,label:"Accountant Status",placeholder:"All",maxDropdownHeight:160,error:n.error?.message,withinPortal:!0})}),e.jsxs("div",{className:"flex flex-col gap-2 mt-4 rounded-lg border p-3 shadow-sm space-y-2",children:[e.jsx(se,{children:"Missing Information:"}),e.jsx(m,{control:o.control,name:"withoutInvoice",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Invoice"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutInvoice??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutReceipt",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Receipts"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutReceipt??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Documents"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutDocuments??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withOpenDocuments",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"With Open Documents"})}),e.jsx(p,{children:e.jsxs(ae,{children:[e.jsx(te,{children:e.jsx(x,{defaultChecked:a.withOpenDocuments??!1,onCheckedChange:s.onChange})}),e.jsx(ne,{children:e.jsx("p",{children:"Show only charges with documents that are currently open"})})]})})]})}),e.jsx(m,{control:o.control,name:"withoutTransactions",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without Transactions"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutTransactions??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"unbalanced",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Unbalanced businesses"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.unbalanced??!1,onCheckedChange:s.onChange})})]})}),e.jsx(m,{control:o.control,name:"withoutLedger",render:({field:s})=>e.jsxs(j,{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(g,{children:"Without ledger"})}),e.jsx(p,{children:e.jsx(x,{defaultChecked:a.withoutLedger??!1,onCheckedChange:s.onChange})})]})})]})]}),e.jsxs("div",{className:"flex justify-center mt-5 gap-3",children:[e.jsx("button",{type:"submit",disabled:t||I,className:"text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-indigo-600 rounded-sm text-lg",children:"Filter"}),e.jsx("button",{type:"button",className:"text-white bg-orange-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-orange-600 rounded-sm text-lg",onClick:H,children:"Clear"}),e.jsx("button",{type:"button",className:"text-white bg-rose-500 border-0 py-2 px-8 focus:outline-hidden hover:bg-rose-600 rounded-sm text-lg",onClick:d,children:"Cancel"})]})]})})]})}function he({filter:a={},setFilter:w,activePage:d,setPage:y,totalPages:o=1,initiallyOpened:r=!1}){const[T,C]=i.useState(r),[b,F]=i.useState(!B(a)),{get:c,set:u}=R();i.useEffect(()=>{const t=d>1?d.toFixed(0):null,v=c("page");t!==v&&u("page",t)},[d,c,u]),i.useEffect(()=>{const t=le(a),v=c("chargesFilters");t!==v&&(u("chargesFilters",t),u("page"),y(1))},[a,c,u,y]);const S=i.useCallback(t=>{W(t,a)||(w(t),F(!B(t)))},[a,w]);return e.jsxs("div",{className:"flex flex-row gap-5 items-center",children:[e.jsx(z,{opened:T,onClose:()=>C(!1),content:e.jsx(ie,{filter:a,setFilter:S,closeModal:()=>C(!1)}),modalSize:"xl"}),o>1&&e.jsx(U,{className:"flex-auto",value:d,onChange:y,total:o}),e.jsx(G,{inline:!0,size:16,disabled:!b,children:e.jsx(_,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>C(!0),children:e.jsx(Q,{className:"size-5"})})})]})}export{he as C,ce as c,le as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,F as E,u as N,a as P,j as e,T as b,B as w,P as z,b as T,c as W,L as O,C as k,e as B,f as R,g as V,E as A,I as Q,M as U,h as q}from"./index-BsTpXlvi.js";import{C as J}from"./charges-filters-Dc9JkkaM.js";import{M as $}from"./index-CWM7AEkA.js";import{P as G}from"./Progress-3b9RPwUr.js";import"./sub-3UcXQDsZ.js";import"./subMonths-BbuiFsxa.js";import"./Checkbox-DBiOK2wr.js";const se=()=>{const{setFiltersContext:m}=t.useContext(E),[o,x]=t.useState(void 0),[l,C]=t.useState(void 0),[c,p]=t.useState(void 0),[g,f]=t.useState(!1),[a,d]=t.useState([]),{get:F}=N(),h=F("chargesFilters"),I=t.useMemo(()=>{if(h)try{return JSON.parse(decodeURIComponent(h))}catch{return}},[h]),[n,j]=t.useState(I),S=t.useCallback((s,D)=>{a.map(u=>u.id).includes(s)?d(a.filter(u=>u.id!==s)):d([...a,{id:s,onChange:D}])},[a]),[{data:r,fetching:M},v]=P({query:q,variables:{filters:n},pause:!0});function y(){d([])}const i=t.useMemo(()=>r?.chargesWithLedgerChanges?.length?r.chargesWithLedgerChanges[r.chargesWithLedgerChanges.length-1].progress:0,[r?.chargesWithLedgerChanges]),L=t.useCallback(s=>{j(s)},[j]);return t.useEffect(()=>{n&&v()},[n,v]),t.useEffect(()=>{m(e.jsxs("div",{className:"flex flex-row gap-x-5 items-center",children:[e.jsx(G,{value:i,label:`${i?.toFixed(2)}%`,size:"xl",animate:i<100,className:"min-w-52"}),e.jsx(J,{filter:n,setFilter:L,activePage:1,setPage:()=>{},initiallyOpened:!0}),e.jsx(b,{label:"Expand all accounts",children:e.jsx(w,{variant:"outline",size:"icon",className:"size-7.5",onClick:()=>f(s=>!s),children:g?e.jsx(z,{className:"size-5"}):e.jsx(T,{className:"size-5"})})}),e.jsx($,{selected:a,resetMerge:y})]}))},[r,M,n,g,m,f,a,i,L]),e.jsxs(W,{title:"Charges Ledger Validation",description:"Manage charges",children:[M?e.jsx(O,{className:"h-10 w-10 animate-spin mr-2 self-center"}):e.jsxs(e.Fragment,{children:[e.jsx(k,{setEditChargeId:x,setInsertDocument:C,setMatchDocuments:p,toggleMergeCharge:S,mergeSelectedCharges:new Set(a.map(s=>s.id)),data:r?.chargesWithLedgerChanges.filter(s=>!!s.charge).map(s=>s.charge)??[],isAllOpened:g}),e.jsxs("div",{className:"flex flex-row justify-center my-2",children:[i>0&&i<100&&e.jsx(B,{}),i===100&&!r?.chargesWithLedgerChanges.filter(s=>!!s.charge).length&&e.jsx(R,{radius:"xl",size:"xl",color:"green",children:e.jsx(V,{})})]})]}),o&&e.jsx(A,{chargeId:o?.id,close:()=>x(void 0),onChange:o.onChange}),l&&e.jsx(Q,{chargeId:l.id,onChange:l.onChange,close:()=>C(void 0)}),c&&e.jsx(U,{chargeId:c.id,ownerId:c.ownerId,setMatchDocuments:()=>p(void 0)})]})};export{se as ChargesLedgerValidation};
|