@wisemen/wise-invoicing-web 0.1.0 → 0.2.0

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.
Files changed (207) hide show
  1. package/dist/ApprovalReminderSettingsViewDataProvider-D-qXZrPT.js +151 -0
  2. package/dist/{BillingDocumentDetailViewDataProvider-BemnzVNY.js → BillingDocumentDetailViewDataProvider-DDdtlW-2.js} +1417 -1459
  3. package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
  4. package/dist/{BillingDocumentPdf-5vi2pgRM.js → BillingDocumentPdf-ehdFB6mr.js} +4 -4
  5. package/dist/{CreditNoteDetailViewDataProvider-BuY9ELoK.js → CreditNoteDetailViewDataProvider-11a-JO3H.js} +201 -201
  6. package/dist/{CreditNotePdfViewDataProvider-DI4eQkpM.js → CreditNotePdfViewDataProvider-bfeaya3P.js} +3 -3
  7. package/dist/{CustomFieldValueText-BGbQwhON.js → CustomFieldValueText-CZQXGE5F.js} +81 -81
  8. package/dist/DataProvider-C3uEds9v.js +75 -0
  9. package/dist/{DunningCaseDetailViewDataProvider-DKuuysqS.js → DunningCaseDetailViewDataProvider-DC-ziMoO.js} +35 -35
  10. package/dist/{DunningCaseOverviewView-aWttPLrC.js → DunningCaseOverviewView-y_bCmi5j.js} +180 -180
  11. package/dist/{DunningCaseReminderPdfViewDataProvider-I0I_WQQB.js → DunningCaseReminderPdfViewDataProvider-DNODfED_.js} +22 -23
  12. package/dist/{DunningCaseSendDialog-DyvA5R1p.js → DunningCaseSendDialog-BPXcqit5.js} +82 -82
  13. package/dist/InvoiceApprovalOverviewView-DZ14mi4L.js +870 -0
  14. package/dist/InvoiceApprovalStatusBadge-U-dW2hR4.js +161 -0
  15. package/dist/InvoiceApproveDialog-2LXneG2r.js +308 -0
  16. package/dist/InvoiceDetailViewDataProvider-BYeaaQzL.js +2156 -0
  17. package/dist/InvoiceOverviewBulkSendApprovalDialog-99dfuN4i.js +318 -0
  18. package/dist/InvoiceOverviewViewDataProvider-CZIQeftL.js +1620 -0
  19. package/dist/{InvoicePdfView-C-7m2g3b.js → InvoicePdfView-BJRTg_TH.js} +2 -2
  20. package/dist/{InvoicePdfViewDataProvider-BPiK110e.js → InvoicePdfViewDataProvider-CwI_uGm3.js} +4 -4
  21. package/dist/InvoicePublicPdfViewDataProvider-uZUfsr5K.js +45 -0
  22. package/dist/InvoicingFileUploadProvider-D9Xk4rQM.js +94 -0
  23. package/dist/{IssuerSettingsViewDataProvider-COqHGUE6.js → IssuerSettingsViewDataProvider-CGRa8F-2.js} +4 -4
  24. package/dist/{ReminderSettingsViewDataProvider-Dys4bUU7.js → ReminderSettingsViewDataProvider-1ucp3z2T.js} +58 -58
  25. package/dist/{api.util-BCSgCfpS.js → api.util-C_kMGlJN.js} +1456 -846
  26. package/dist/{billingDocumentDetail.transformer-BBn9R_cx.js → billingDocumentDetail.transformer-Da6_-Hv9.js} +58 -59
  27. package/dist/client/index.d.ts +2 -2
  28. package/dist/client/sdk.gen.d.ts +18 -1
  29. package/dist/client/types.gen.d.ts +1059 -106
  30. package/dist/client/zod.gen.d.ts +32759 -16136
  31. package/dist/{creditNoteDetail.query-BcPsB96h.js → creditNoteDetail.query-DLR7L0Ep.js} +30 -30
  32. package/dist/{dist-BBjpqvUl.js → dist-CoztMdYH.js} +614 -614
  33. package/dist/{dist-D9lp7NDv.js → dist-Cxdm09Lp.js} +210 -98
  34. package/dist/{documentTitle.composable-4ApFl9TZ.js → documentTitle.composable-DsBbzhXN.js} +23 -15
  35. package/dist/{customFieldValue.util-BwsX8exl.js → download.util-B5Q7KUC9.js} +6 -6
  36. package/dist/{i18n.lib-C6eb-F-e.js → i18n.lib-Cvr8pcDw.js} +272 -8
  37. package/dist/index.d.ts +297 -31
  38. package/dist/index.js +344 -324
  39. package/dist/invoice.service-DEEA9mal.js +745 -0
  40. package/dist/invoiceApproval.service-DvL3LliM.js +72 -0
  41. package/dist/invoiceApprovalStatus.util-3Zh10Pj8.js +79 -0
  42. package/dist/invoiceDeliveryStatus.util-nCsqDypY.js +211 -0
  43. package/dist/{invoiceDetail.query-Cek8nyaw.js → invoiceDetail.query-CRoH_SgM.js} +1 -1
  44. package/dist/{invoicingConfig.composable-DTmad1fe.js → invoicingConfig.composable-rxjGK882.js} +2 -2
  45. package/dist/{issuerSettings.query-Bvz-Oj5D.js → issuerSettings.query-Dc5gsaEm.js} +5 -5
  46. package/dist/libs/i18n.lib.d.ts +270 -6
  47. package/dist/locales/en-US.json.d.ts +136 -4
  48. package/dist/locales/nl-BE.json.d.ts +136 -4
  49. package/dist/modules/dunning-case/models/dunningCase.transformer.d.ts +0 -1
  50. package/dist/modules/invoice/api/mutations/invoiceApproveApproval.mutation.d.ts +16 -0
  51. package/dist/modules/invoice/api/mutations/invoiceArchiveApproval.mutation.d.ts +6 -0
  52. package/dist/modules/invoice/api/mutations/invoiceBulkSendApproval.mutation.d.ts +5 -0
  53. package/dist/modules/invoice/api/mutations/invoiceMarkAsPriorApprovalRequired.mutation.d.ts +4 -0
  54. package/dist/modules/invoice/api/mutations/invoiceRejectApproval.mutation.d.ts +9 -0
  55. package/dist/modules/invoice/api/mutations/invoiceRestoreFromProForma.mutation.d.ts +4 -0
  56. package/dist/modules/invoice/api/mutations/invoiceSendApproval.mutation.d.ts +5 -0
  57. package/dist/modules/invoice/api/mutations/invoiceUnmarkAsPriorApprovalRequired.mutation.d.ts +4 -0
  58. package/dist/modules/invoice/api/services/invoice.service.d.ts +14 -1
  59. package/dist/modules/invoice/components/InvoiceApprovalOutOfSyncIndicator.vue.d.ts +3 -0
  60. package/dist/{ui/DisplayState.vue.d.ts → modules/invoice/components/InvoiceApprovalStatusBadge.vue.d.ts} +7 -10
  61. package/dist/modules/invoice/components/InvoiceApprovalStatusChip.vue.d.ts +16 -0
  62. package/dist/modules/invoice/models/invoice/approval/invoiceApprovalTransformers.spec.d.ts +1 -0
  63. package/dist/modules/invoice/models/invoice/approval/invoiceApprovalUuid.model.d.ts +3 -0
  64. package/dist/modules/invoice/models/invoice/approval/invoiceApprove.transformer.d.ts +5 -0
  65. package/dist/modules/invoice/models/invoice/approval/invoiceApproveForm.model.d.ts +13 -0
  66. package/dist/modules/invoice/models/invoice/approval/invoiceReject.transformer.d.ts +5 -0
  67. package/dist/modules/invoice/models/invoice/approval/invoiceRejectForm.model.d.ts +7 -0
  68. package/dist/modules/invoice/models/invoice/approval/invoiceRejectForm.model.spec.d.ts +1 -0
  69. package/dist/modules/invoice/models/invoice/detail/invoiceDetail.model.d.ts +13 -1
  70. package/dist/modules/invoice/models/invoice/detail/invoiceDetail.transformer.d.ts +1 -0
  71. package/dist/modules/invoice/models/invoice/index/invoiceIndex.model.d.ts +4 -0
  72. package/dist/modules/invoice/models/invoice/index/invoiceIndexQueryParams.model.d.ts +3 -0
  73. package/dist/modules/invoice/models/invoice/invoiceApproval.transformer.d.ts +7 -0
  74. package/dist/modules/invoice/models/invoice/invoiceApprovalStatus.model.d.ts +34 -0
  75. package/dist/modules/invoice/models/invoice/invoiceApprovalStatus.util.d.ts +10 -0
  76. package/dist/modules/invoice/models/invoice/invoiceApprovalStatus.util.spec.d.ts +1 -0
  77. package/dist/modules/invoice/use-cases/detail/components/InvoiceApprovalBanner.vue.d.ts +19 -0
  78. package/dist/modules/invoice/use-cases/detail/components/InvoiceDetailHeaderSection.vue.d.ts +4 -0
  79. package/dist/modules/invoice/use-cases/detail/composables/invoiceDetailHeaderActions.composable.d.ts +5 -0
  80. package/dist/modules/invoice/use-cases/detail/composables/invoiceDetailPaymentsTableColumns.composable.d.ts +1 -1
  81. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApprovalArchiveDialog.vue.d.ts +13 -0
  82. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApprovalRevertDialog.vue.d.ts +15 -0
  83. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApproveDialog.vue.d.ts +13 -0
  84. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceFinalizeOutOfSyncDialog.vue.d.ts +21 -0
  85. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceRejectDialog.vue.d.ts +13 -0
  86. package/dist/modules/invoice/use-cases/overview/components/InvoiceOverviewBulkActionBar.vue.d.ts +3 -0
  87. package/dist/modules/invoice/use-cases/overview/components/InvoiceOverviewTableApprovalCell.vue.d.ts +9 -0
  88. package/dist/modules/invoice/use-cases/overview/composables/invoiceOverviewDataTableFilters.composable.d.ts +3 -0
  89. package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkActionDialog.vue.d.ts +1 -0
  90. package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkSendApprovalDialog.vue.d.ts +12 -0
  91. package/dist/modules/invoice/use-cases/overview/utils/invoiceOverviewBulkActionFeedback.util.d.ts +2 -0
  92. package/dist/modules/invoice/use-cases/overview/views/InvoiceOverviewView.vue.d.ts +0 -5
  93. package/dist/modules/invoice-approval/actions/invoiceApproval.actions.d.ts +5 -0
  94. package/dist/modules/invoice-approval/actions/invoiceApprovalArchive.action.d.ts +1 -0
  95. package/dist/modules/invoice-approval/actions/invoiceApprovalMarkAsApproved.action.d.ts +1 -0
  96. package/dist/modules/invoice-approval/actions/invoiceApprovalReject.action.d.ts +1 -0
  97. package/dist/modules/invoice-approval/actions/invoiceApprovalSendRequest.action.d.ts +1 -0
  98. package/dist/modules/invoice-approval/actions/invoiceApprovalUnmarkAsNeedsApproval.action.d.ts +1 -0
  99. package/dist/modules/invoice-approval/api/mutations/approvalReminderConfigUpdate.mutation.d.ts +8 -0
  100. package/dist/modules/invoice-approval/api/queries/approvalReminderConfig.query.d.ts +1 -0
  101. package/dist/modules/invoice-approval/api/queries/invoiceApprovalIndex.query.d.ts +3 -0
  102. package/dist/modules/invoice-approval/api/query-keys/invoiceApproval.queryKeys.d.ts +15 -0
  103. package/dist/modules/invoice-approval/api/services/invoiceApproval.service.d.ts +10 -0
  104. package/dist/modules/invoice-approval/components/InvoiceApprovalReminderLevelIndicator.vue.d.ts +7 -0
  105. package/dist/modules/invoice-approval/models/approvalReminderConfig.transformer.d.ts +6 -0
  106. package/dist/modules/invoice-approval/models/approvalReminderConfigForm.model.d.ts +11 -0
  107. package/dist/modules/invoice-approval/models/approvalReminderConfigForm.spec.d.ts +1 -0
  108. package/dist/modules/invoice-approval/models/invoiceApprovalIndex.model.d.ts +21 -0
  109. package/dist/modules/invoice-approval/models/invoiceApprovalIndex.transformer.d.ts +5 -0
  110. package/dist/modules/invoice-approval/models/invoiceApprovalIndexQueryParams.model.d.ts +9 -0
  111. package/dist/modules/invoice-approval/models/invoiceApprovalIndexQueryParams.transformer.d.ts +6 -0
  112. package/dist/modules/invoice-approval/routes/invoiceApproval.routes.d.ts +24 -0
  113. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewActionsCell.vue.d.ts +7 -0
  114. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewAmountCell.vue.d.ts +7 -0
  115. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewInvoiceCell.vue.d.ts +7 -0
  116. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewMetrics.vue.d.ts +18 -0
  117. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewNextReminderCell.vue.d.ts +7 -0
  118. package/dist/modules/invoice-approval/use-cases/overview/components/InvoiceApprovalOverviewStatusCell.vue.d.ts +7 -0
  119. package/dist/modules/invoice-approval/use-cases/overview/composables/invoiceApprovalOverview.composable.d.ts +42 -0
  120. package/dist/modules/invoice-approval/use-cases/overview/composables/invoiceApprovalOverviewFilters.composable.d.ts +10 -0
  121. package/dist/modules/invoice-approval/use-cases/overview/composables/invoiceApprovalOverviewTableColumns.composable.d.ts +3 -0
  122. package/dist/modules/invoice-approval/use-cases/overview/views/InvoiceApprovalOverviewView.vue.d.ts +3 -0
  123. package/dist/modules/invoice-approval/use-cases/settings/views/ApprovalReminderSettingsView.vue.d.ts +7 -0
  124. package/dist/modules/invoice-approval/use-cases/settings/views/ApprovalReminderSettingsViewDataProvider.vue.d.ts +3 -0
  125. package/dist/modules/settings/routes/settings.routes.d.ts +7 -0
  126. package/dist/{plainDate.transformer-BxvJpJOv.js → plainDate.transformer-Bhiz9jW7.js} +17 -4
  127. package/dist/reminderConfig.query-snaHQmrY.js +309 -0
  128. package/dist/routes/invoicingRoutes.composable.d.ts +14 -6
  129. package/dist/search.composable-CU9OpyUB.js +52 -0
  130. package/dist/{src-BFgnUugN.js → src-DUSgQTKr.js} +45 -45
  131. package/dist/style.css +1 -1
  132. package/dist/types/queryKey.type.d.ts +3 -2
  133. package/dist/ui/billing-document/table/utils/billingDocumentLineItemsEditor.util.d.ts +15 -0
  134. package/dist/utils/html.util.d.ts +4 -0
  135. package/package.json +2 -1
  136. package/dist/AddOpenBoundaryIcon-9SqBHfoz.js +0 -25
  137. package/dist/AirlineIcon-Z6sH_StM.js +0 -26
  138. package/dist/AirplaneIcon-C-nSkD1w.js +0 -19
  139. package/dist/AirportIcon-m4itDKCV.js +0 -16
  140. package/dist/AlertTriangleIcon-DtYLCC-Y.js +0 -23
  141. package/dist/AllocationsIcon-hcg93Sll.js +0 -16
  142. package/dist/ArrowNarrowRightIcon-2-Sml68f.js +0 -23
  143. package/dist/AssetIcon-qOYs6Wna.js +0 -16
  144. package/dist/BarChartIcon-DDyzpV_3.js +0 -22
  145. package/dist/BellIcon-DF1OBFta.js +0 -21
  146. package/dist/BuildingIcon-CC5PMNeP.js +0 -22
  147. package/dist/ChargerIcon-aM_endLr.js +0 -16
  148. package/dist/ChevronDownIcon-4QiK-Z6-.js +0 -23
  149. package/dist/ChevronUpIcon-qBsjZ5Dz.js +0 -23
  150. package/dist/ClockIcon-BNiPCaiB.js +0 -23
  151. package/dist/ClockSnoozeIcon-BxGfwJB6.js +0 -23
  152. package/dist/CopyIcon-DH5ly0dZ.js +0 -19
  153. package/dist/DataProvider-Dj34ljUX.js +0 -75
  154. package/dist/DownloadCloudIcon-Cf8ftklG.js +0 -22
  155. package/dist/EditIcon-Dr7OHBBR.js +0 -21
  156. package/dist/EraserIcon-B1VJSvdI.js +0 -23
  157. package/dist/FileIcon-ssmQI5Yl.js +0 -23
  158. package/dist/FilterLinesIcon-C7YdyPBk.js +0 -23
  159. package/dist/GlobeIcon-BfRM6Ike.js +0 -22
  160. package/dist/HelpIcon-BrJ49P5y.js +0 -22
  161. package/dist/HourGlassIcon-D9rfU1Is.js +0 -22
  162. package/dist/InfoCircleIcon-Ee0SyiMc.js +0 -23
  163. package/dist/InvoiceDetailViewDataProvider-D6E7YVV1.js +0 -1670
  164. package/dist/InvoiceOverviewViewDataProvider-i8tXATJE.js +0 -1677
  165. package/dist/InvoicePublicPdfViewDataProvider-BJe-8hC5.js +0 -45
  166. package/dist/KeyboardIcon-T3o_g-1c.js +0 -22
  167. package/dist/LinkExternalIcon-BkHS4fCx.js +0 -22
  168. package/dist/LinkIcon-DuPwae98.js +0 -22
  169. package/dist/MarkerIcon-B1Jqenjb.js +0 -28
  170. package/dist/MobileBatteryIcon-GZ1SMRDV.js +0 -16
  171. package/dist/MonitorIcon-pbK22reU.js +0 -22
  172. package/dist/NotificationIcon-Ctv8vyWt.js +0 -19
  173. package/dist/ParkingIcon-DnUPW3pB.js +0 -24
  174. package/dist/PlanningIcon-CXvrskgj.js +0 -16
  175. package/dist/PreferenceIcon-BHS8uDyi.js +0 -22
  176. package/dist/ReceiptCheckIcon-QTestqCJ.js +0 -23
  177. package/dist/RefreshIcon-DShY-aoS.js +0 -22
  178. package/dist/RemoveOpenBoundaryIcon-CN8YWs6o.js +0 -28
  179. package/dist/RewindIcon-GWg2AQax.js +0 -22
  180. package/dist/SettingsIcon-CBLJ6B5u.js +0 -25
  181. package/dist/ShieldIcon-CVnrOcxl.js +0 -19
  182. package/dist/ShieldOffIcon-B9l0dDVb.js +0 -23
  183. package/dist/SignOutIcon-CmDkjJ5F.js +0 -21
  184. package/dist/SlashCircleIcon-jY5FBko5.js +0 -22
  185. package/dist/StandIcon-CoYnBLMn.js +0 -23
  186. package/dist/StarsIcon-D7ZlqOW7.js +0 -22
  187. package/dist/StopwatchIcon-BK0vh1lg.js +0 -22
  188. package/dist/TargetIcon-HMWj77-Q.js +0 -22
  189. package/dist/ThreeDotsIcon-BtFruOKz.js +0 -32
  190. package/dist/ToolIcon-DRfDb7fE.js +0 -22
  191. package/dist/TrashIcon-BwxBjHv5.js +0 -19
  192. package/dist/TurnaroundIcon-b1X61TwZ.js +0 -27
  193. package/dist/UploadCloudIcon-BF0equKg.js +0 -22
  194. package/dist/UserIcon-B0rCC6KE.js +0 -22
  195. package/dist/UsersIcon-cK5l_zKG.js +0 -22
  196. package/dist/VerifiedIcon-CELYlqcv.js +0 -22
  197. package/dist/WifiIcon--JPvMNEF.js +0 -23
  198. package/dist/WifiOffIcon-BS2KftcP.js +0 -23
  199. package/dist/ZapIcon-BHwcIQc0.js +0 -23
  200. package/dist/ZoomInIcon-Cu6r915V.js +0 -23
  201. package/dist/ZoomOutIcon-DwB4FRj-.js +0 -23
  202. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  203. package/dist/instant.transformer-KmBsH3E9.js +0 -18
  204. package/dist/invoice.service-Bb8VqQvc.js +0 -635
  205. package/dist/invoiceDeliveryStatus.util-BPkGCQM6.js +0 -331
  206. package/dist/reminderConfig.query-DsJNqqi7.js +0 -331
  207. package/dist/search.composable-BCtYqudV.js +0 -52
@@ -1,1677 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import "./api.util-BCSgCfpS.js";
3
- import { a as t, b as n, c as r, g as i, h as a, m as o, o as s, p as c, s as l, t as u, w as d } from "./documentTitle.composable-4ApFl9TZ.js";
4
- import { n as f, r as p, t as m } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
- import { t as h } from "./search.composable-BCtYqudV.js";
6
- import { t as g } from "./src-BFgnUugN.js";
7
- import { t as _ } from "./invoice.service-Bb8VqQvc.js";
8
- import { t as v } from "./plainDate.transformer-BxvJpJOv.js";
9
- import { t as y } from "./instant.transformer-KmBsH3E9.js";
10
- import { G as b, H as x, I as S, L as ee, tt as te, w as C } from "./dist-D9lp7NDv.js";
11
- import { n as w } from "./dist-boJIIxnT.js";
12
- import { a as ne, c as re, d as ie, f as T, i as ae, l as E, n as oe, o as se, r as D, s as ce, t as le, u as ue } from "./dist-BBjpqvUl.js";
13
- import { i as de, n as O, r as fe, t as pe } from "./CustomFieldValueText-BGbQwhON.js";
14
- import { t as me } from "./customerUuid.model-GUFYq3O2.js";
15
- import { t as he } from "./DataProvider-Dj34ljUX.js";
16
- import { t as ge } from "./formango.util-D5c2ql--.js";
17
- import { c as _e, l as ve, n as ye, o as be, s as xe, t as Se, u as Ce } from "./invoiceDeliveryStatus.util-BPkGCQM6.js";
18
- import { t as we } from "./issuerSettings.query-Bvz-Oj5D.js";
19
- import { t as Te } from "./dashboard-BaWGNEek.js";
20
- import { RouterLink as Ee, useRouter as De } from "vue-router";
21
- import { z as k } from "zod";
22
- import { useI18n as A } from "vue-i18n";
23
- import { Fragment as Oe, computed as j, createBlock as M, createCommentVNode as N, createElementBlock as P, createElementVNode as F, createTextVNode as ke, createVNode as I, defineComponent as L, isRef as Ae, mergeModels as je, mergeProps as Me, normalizeClass as Ne, onMounted as Pe, openBlock as R, ref as z, renderList as Fe, renderSlot as Ie, toDisplayString as B, unref as V, useModel as Le, watch as Re, withCtx as H } from "vue";
24
- import { QueryClient as ze, getTanstackQueryClient as Be, useMutation as U, useOffsetInfiniteQuery as Ve } from "@wisemen/vue-core-api-utils";
25
- import { useLocalStorage as He, watchDebounced as Ue } from "@vueuse/core";
26
- import { Temporal as We } from "temporal-polyfill";
27
- import { UIAutocomplete as Ge, UIBadge as Ke, UIButton as W, UICheckbox as qe, UIColumnLayout as G, UIDashboardPage as Je, UIDashboardPageActions as Ye, UIDateRangePicker as Xe, UIDialog as Ze, UIDialogBody as Qe, UIDialogFooter as $e, UIDialogFooterCancel as et, UIDialogFooterPrimary as tt, UIDialogFooterSubmit as nt, UIDialogHeader as rt, UIFormDialog as it, UIPopover as at, UIRowLayout as K, UITable as ot, UITableCell as q, UITableCellInteractiveElement as st, UITableCellText as ct, UITabs as lt, UITabsItem as ut, UITabsList as dt, UIText as ft, UITextField as pt, createAutocompleteOptions as mt, createComponent as J, defineTableColumns as ht, useOverlay as gt, useTableCustomizeColumns as _t, useToast as Y } from "@wisemen/vue-core-design-system";
28
- import { useForm as vt } from "formango";
29
- import { useRouteQuery as yt } from "@vueuse/router";
30
- //#region src/modules/invoice/api/queries/invoiceIndex.query.ts
31
- function bt(e) {
32
- let t = j(() => ({
33
- filters: e?.params?.filters?.value,
34
- search: e?.params?.search?.value,
35
- sort: e?.params?.sort?.value ?? []
36
- }));
37
- return Ve("invoiceIndex", {
38
- params: { queryParams: t },
39
- queryFn: (t) => _.getAll({
40
- filters: e?.params?.filters?.value,
41
- pagination: t,
42
- search: e?.params?.search?.value,
43
- sort: e?.params?.sort?.value ?? []
44
- })
45
- });
46
- }
47
- //#endregion
48
- //#region src/modules/invoice/api/mutations/invoiceCreate.mutation.ts
49
- function xt() {
50
- return U({
51
- queryFn: (e) => _.create(e.body),
52
- queryKeysToInvalidate: { invoiceIndex: {} }
53
- });
54
- }
55
- //#endregion
56
- //#region src/modules/invoice/api/queries/invoiceCustomerSearch.query.ts
57
- function St(e) {
58
- let t = j(() => ({ search: e.params.search?.value }));
59
- return Ve("invoiceCustomerSearch", {
60
- params: { queryParams: t },
61
- queryFn: (t) => Ce.getAll({
62
- pagination: t,
63
- search: e.params.search?.value ?? ""
64
- })
65
- });
66
- }
67
- //#endregion
68
- //#region src/modules/invoice/components/form/InvoiceFormCustomerField.vue
69
- var Ct = /* @__PURE__ */ L({
70
- __name: "InvoiceFormCustomerField",
71
- props: {
72
- isLoading: { type: Boolean },
73
- customers: {},
74
- field: {}
75
- },
76
- emits: ["nextPage", "updateSearch"],
77
- setup(e, { emit: t }) {
78
- let n = e, i = t, a = A(), o = j(() => mt(n.customers));
79
- function s(e) {
80
- return e.name;
81
- }
82
- function c(e) {
83
- switch (e) {
84
- case r.BUSINESS: return a.t("wise_invoicing.customer.type.business");
85
- case r.INDIVIDUAL: return a.t("wise_invoicing.customer.type.individual");
86
- }
87
- return "-";
88
- }
89
- function l(e) {
90
- return { description: {
91
- layout: "block",
92
- value: c(e.type)
93
- } };
94
- }
95
- function u(e) {
96
- i("updateSearch", e);
97
- }
98
- function d(e) {
99
- n.field.setValue(e), e !== null && i("updateSearch", "");
100
- }
101
- return (e, t) => (R(), M(V(Ge), Me(V(ge)(n.field), {
102
- "display-fn": s,
103
- "get-item-config": l,
104
- "is-loading": n.isLoading,
105
- "is-required": !0,
106
- items: o.value,
107
- label: V(a).t("wise_invoicing.invoice.create.fields.customer"),
108
- placeholder: V(a).t("component.autocomplete.search_placeholder"),
109
- "search-mode": "remote",
110
- onNextPage: t[0] ||= (e) => i("nextPage"),
111
- "onUpdate:modelValue": d,
112
- "onUpdate:search": u
113
- }), null, 16, [
114
- "is-loading",
115
- "items",
116
- "label",
117
- "placeholder"
118
- ]));
119
- }
120
- }), wt = k.enum(r), Tt = k.object({
121
- uuid: me,
122
- name: k.string().min(1),
123
- type: wt
124
- }), Et = k.object({ customer: Tt }), Dt = /* @__PURE__ */ L({
125
- __name: "InvoiceCreateDialog",
126
- emits: ["close"],
127
- setup(e, { emit: t }) {
128
- let n = t, r = A(), i = Y(), a = De(), o = xt(), s = h({ debounceMs: 250 }), c = St({ params: { search: s.debouncedSearch } }), l = j(() => c.result.value.match({
129
- err: () => [],
130
- loading: () => [],
131
- ok: (e) => e.data
132
- })), u = vt({
133
- initialState: { customer: null },
134
- schema: Et,
135
- onSubmit: async (e) => {
136
- let t = await o.execute({ body: e });
137
- if (t.isErr()) {
138
- i.apiError(t.error);
139
- return;
140
- }
141
- n("close"), await a.push({
142
- name: "invoicing-invoice-detail",
143
- params: { invoiceUuid: t.value }
144
- });
145
- }
146
- }), d = u.register("customer");
147
- function f(e) {
148
- s.updateSearch(e);
149
- }
150
- return (e, t) => (R(), M(V(it), {
151
- form: V(u),
152
- size: "xs",
153
- onClose: t[0] ||= (e) => n("close")
154
- }, {
155
- default: H(() => [
156
- I(V(rt), {
157
- title: V(r).t("wise_invoicing.invoice.create.modal_title"),
158
- description: V(r).t("wise_invoicing.invoice.create.modal_description"),
159
- icon: V(S),
160
- "is-description-visible": !0
161
- }, null, 8, [
162
- "title",
163
- "description",
164
- "icon"
165
- ]),
166
- I(V(Qe), null, {
167
- default: H(() => [I(Ct, {
168
- customers: l.value,
169
- field: V(d),
170
- "is-loading": V(c).isLoading.value,
171
- onNextPage: V(c).fetchNextPage,
172
- onUpdateSearch: f
173
- }, null, 8, [
174
- "customers",
175
- "field",
176
- "is-loading",
177
- "onNextPage"
178
- ])]),
179
- _: 1
180
- }),
181
- I(V($e), null, {
182
- right: H(() => [I(V(et), { label: "cancel" }), I(V(nt), { label: V(r).t("wise_invoicing.invoice.create.confirm") }, null, 8, ["label"])]),
183
- _: 1
184
- })
185
- ]),
186
- _: 1
187
- }, 8, ["form"]));
188
- }
189
- }), Ot = {
190
- key: 0,
191
- class: "pointer-events-none fixed inset-x-0 bottom-4 z-20 flex justify-center px-lg"
192
- }, kt = { class: "text-sm text-secondary" }, At = /* @__PURE__ */ L({
193
- __name: "InvoiceOverviewBulkActionBar",
194
- props: {
195
- canFinalize: { type: Boolean },
196
- canMarkAsReady: { type: Boolean },
197
- canSelectAll: { type: Boolean },
198
- canSend: { type: Boolean },
199
- selectedCount: {}
200
- },
201
- emits: [
202
- "cancel",
203
- "finalize",
204
- "markAsReady",
205
- "selectAll",
206
- "send"
207
- ],
208
- setup(e, { emit: t }) {
209
- let n = e, r = t, i = A();
210
- return (e, t) => n.selectedCount > 0 ? (R(), P("div", Ot, [I(V(K), { class: "pointer-events-auto rounded-xl border border-secondary bg-primary px-lg py-sm shadow-lg" }, {
211
- default: H(() => [
212
- F("span", kt, B(V(i).t("wise_invoicing.invoice.overview.bulk.selected_documents", { count: n.selectedCount })), 1),
213
- n.canMarkAsReady ? (R(), M(V(W), {
214
- key: 0,
215
- label: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.action"),
216
- onClick: t[0] ||= (e) => r("markAsReady")
217
- }, null, 8, ["label"])) : N("", !0),
218
- n.canFinalize ? (R(), M(V(W), {
219
- key: 1,
220
- label: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.action"),
221
- onClick: t[1] ||= (e) => r("finalize")
222
- }, null, 8, ["label"])) : N("", !0),
223
- n.canSend ? (R(), M(V(W), {
224
- key: 2,
225
- label: V(i).t("wise_invoicing.invoice.overview.bulk.send.action"),
226
- onClick: t[2] ||= (e) => r("send")
227
- }, null, 8, ["label"])) : N("", !0),
228
- n.canSelectAll ? (R(), M(V(W), {
229
- key: 3,
230
- label: V(i).t("wise_invoicing.invoice.overview.bulk.select_all"),
231
- variant: "secondary",
232
- onClick: t[3] ||= (e) => r("selectAll")
233
- }, null, 8, ["label"])) : N("", !0),
234
- I(V(W), {
235
- label: V(i).t("wise_invoicing.invoice.overview.bulk.cancel"),
236
- variant: "tertiary",
237
- onClick: t[4] ||= (e) => r("cancel")
238
- }, null, 8, ["label"])
239
- ]),
240
- _: 1
241
- })])) : N("", !0);
242
- }
243
- });
244
- //#endregion
245
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewBulkSendEligibility.composable.ts
246
- function jt(e) {
247
- let t = z(null), n = j(() => e.selectedInvoices().filter((e) => e.status === a.FINALIZED).map((e) => e.uuid)), r = j(() => n.value.toSorted().join(","));
248
- return Ue(r, async (e) => {
249
- let i = n.value;
250
- if (i.length === 0) {
251
- t.value = null;
252
- return;
253
- }
254
- let a = await _.previewBulkSend(i);
255
- r.value === e && (t.value = a.isErr() ? i.length : a.value.meta.processed);
256
- }, { debounce: 300 }), { canSend: j(() => n.value.length > 0 && (t.value ?? 0) > 0) };
257
- }
258
- //#endregion
259
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewCustomFieldFilter.util.ts
260
- function X(e) {
261
- return Array.isArray(e) && e.every((e) => typeof e == "string");
262
- }
263
- function Mt(e, t) {
264
- try {
265
- switch (e) {
266
- case l.DATE: return v.toDto(v.fromDto(t));
267
- case l.TIMESTAMP: return y.toDto(y.fromDto(t));
268
- default: return t;
269
- }
270
- } catch {
271
- return null;
272
- }
273
- }
274
- var Z = class {
275
- static getFreeformOptions(e, t) {
276
- let n = t.trim();
277
- if (n.length === 0) return [];
278
- let r = Mt(e.type, n);
279
- return r === null ? [] : [r];
280
- }
281
- static getKey(e) {
282
- return `custom-field-${e.uuid}`;
283
- }
284
- static getMajorUnitRule(e, t, n) {
285
- let r = this.getRuleNumber(e, t);
286
- return r === void 0 || n === void 0 ? void 0 : m(r, n);
287
- }
288
- static getMonetaryCurrency(e, n) {
289
- let r = e.rules?.currencies;
290
- if (!Array.isArray(r)) return n;
291
- let i = new Set(Object.values(t)), a = r.filter((e) => typeof e == "string" && i.has(e));
292
- return a.includes(n) ? n : a[0] ?? n;
293
- }
294
- static getRuleNumber(e, t) {
295
- let n = e.rules?.[t];
296
- return typeof n == "number" ? n : void 0;
297
- }
298
- static toFilters(e, t, n) {
299
- switch (e.type) {
300
- case l.BOOLEAN: return typeof t == "boolean" ? [{
301
- definitionUuid: e.uuid,
302
- type: l.BOOLEAN,
303
- value: t
304
- }] : [];
305
- case l.MONETARY: {
306
- let r = this.getRuleNumber(e, "precision"), i = this.getMonetaryCurrency(e, n);
307
- return typeof t == "number" && r !== void 0 ? [{
308
- definitionUuid: e.uuid,
309
- type: l.MONETARY,
310
- value: {
311
- amount: f(t, r),
312
- currency: i,
313
- precision: r
314
- }
315
- }] : [];
316
- }
317
- case l.NUMBER: return typeof t == "number" ? [{
318
- definitionUuid: e.uuid,
319
- type: l.NUMBER,
320
- value: t
321
- }] : [];
322
- case l.MULTI_SELECT: return X(t) && t.length > 0 ? [{
323
- definitionUuid: e.uuid,
324
- type: l.MULTI_SELECT,
325
- value: t
326
- }] : [];
327
- case l.TEXT_ARRAY: return X(t) && t.length > 0 ? [{
328
- definitionUuid: e.uuid,
329
- type: l.TEXT_ARRAY,
330
- value: t
331
- }] : [];
332
- case l.DATE: return X(t) ? t.map((t) => ({
333
- definitionUuid: e.uuid,
334
- type: l.DATE,
335
- value: t
336
- })) : [];
337
- case l.SINGLE_SELECT: return X(t) ? t.map((t) => ({
338
- definitionUuid: e.uuid,
339
- type: l.SINGLE_SELECT,
340
- value: t
341
- })) : [];
342
- case l.TEXT: return X(t) ? t.map((t) => ({
343
- definitionUuid: e.uuid,
344
- type: l.TEXT,
345
- value: t
346
- })) : [];
347
- case l.TIMESTAMP: return X(t) ? t.map((t) => ({
348
- definitionUuid: e.uuid,
349
- type: l.TIMESTAMP,
350
- value: t
351
- })) : [];
352
- default: throw TypeError("Unsupported custom field definition type");
353
- }
354
- }
355
- };
356
- //#endregion
357
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewDataTableFilters.composable.ts
358
- function Nt(e) {
359
- let t = A(), n = h({ debounceMs: 250 }), r = St({ params: { search: n.debouncedSearch } }), i = j(() => r.result.value.match({
360
- err: () => [],
361
- loading: () => [],
362
- ok: (e) => e.data
363
- })), a = e.customFieldDefinitions.map((n) => {
364
- let r = Z.getKey(n), i = O.getLabel(n, t.locale.value);
365
- switch (n.type) {
366
- case l.BOOLEAN: return re({
367
- entityLabel: i,
368
- key: r,
369
- label: i
370
- });
371
- case l.MONETARY: {
372
- let t = Z.getRuleNumber(n, "precision"), a = Z.getMonetaryCurrency(n, e.currency);
373
- return ie({
374
- customUnit: a,
375
- defaultValue: {
376
- operator: ue.EQUALS,
377
- value: null
378
- },
379
- disableOperators: !0,
380
- key: r,
381
- label: i,
382
- max: Z.getMajorUnitRule(n, "max", t),
383
- min: Z.getMajorUnitRule(n, "min", t),
384
- step: t === void 0 ? void 0 : 1 / 10 ** t
385
- });
386
- }
387
- case l.NUMBER: return ie({
388
- defaultValue: {
389
- operator: ue.EQUALS,
390
- value: null
391
- },
392
- disableOperators: !0,
393
- key: r,
394
- label: i,
395
- max: Z.getRuleNumber(n, "max"),
396
- min: Z.getRuleNumber(n, "min")
397
- });
398
- case l.MULTI_SELECT:
399
- case l.SINGLE_SELECT: return ne({
400
- defaultValue: {
401
- operator: D.INCLUDES,
402
- value: []
403
- },
404
- disableOperators: !0,
405
- displayFn: (e) => O.getChoiceLabel(n, e, t.locale.value),
406
- key: r,
407
- label: i,
408
- options: () => n.choices.map((e) => e.value)
409
- });
410
- case l.DATE:
411
- case l.TEXT:
412
- case l.TEXT_ARRAY:
413
- case l.TIMESTAMP: return T({
414
- defaultValue: {
415
- operator: D.INCLUDES,
416
- value: []
417
- },
418
- disableOperators: !0,
419
- displayFn: (e) => e,
420
- key: r,
421
- label: i,
422
- options: (e) => Promise.resolve(Z.getFreeformOptions(n, e))
423
- });
424
- default: throw TypeError("Unsupported custom field definition type");
425
- }
426
- }), s = ae({
427
- actionGroup: { name: "invoices" },
428
- filters: [
429
- T({
430
- defaultValue: {
431
- operator: D.INCLUDES,
432
- value: []
433
- },
434
- disableOperators: !0,
435
- displayFn: (e) => i.value.find((t) => t.uuid === e)?.name ?? e,
436
- key: "customerUuids",
437
- label: t.t("wise_invoicing.invoice.overview.filters.customer"),
438
- options: async (e) => (n.updateSearch(e), await new Promise((e) => setTimeout(e, 0)), i.value.map((e) => e.uuid))
439
- }),
440
- E({
441
- defaultValue: {
442
- operator: le.IS_BETWEEN,
443
- value: {
444
- from: null,
445
- until: null
446
- }
447
- },
448
- disableOperators: !0,
449
- key: "dueOnRange",
450
- label: t.t("wise_invoicing.invoice.overview.filters.due_on")
451
- }),
452
- ne({
453
- defaultValue: {
454
- operator: D.INCLUDES,
455
- value: []
456
- },
457
- disableOperators: !0,
458
- displayFn: (e) => t.t(de.getLifecycleMetadata(e).translationKey),
459
- key: "lifecycleStatuses",
460
- label: t.t("wise_invoicing.invoice.overview.filters.lifecycle"),
461
- options: () => Object.values(o)
462
- }),
463
- ...a
464
- ]
465
- }), c = j(() => {
466
- let e = s.values.value.customerUuids.value;
467
- return e?.length ? e : null;
468
- }), u = j(() => {
469
- let e = s.values.value.dueOnRange.value;
470
- return e.from === null || e.until === null ? null : e;
471
- });
472
- return {
473
- customerUuids: c,
474
- customFields: j(() => {
475
- let t = s.values.value;
476
- return e.customFieldDefinitions.flatMap((n) => {
477
- let r = t[Z.getKey(n)], i = typeof r == "object" && r && "value" in r ? r.value : r;
478
- return Z.toFilters(n, i, e.currency);
479
- });
480
- }),
481
- dueOnRange: u,
482
- filters: s,
483
- lifecycleStatuses: j(() => {
484
- let e = s.values.value.lifecycleStatuses.value;
485
- return e?.length ? e : null;
486
- })
487
- };
488
- }
489
- //#endregion
490
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewFilters.composable.ts
491
- var Pt = {
492
- awaiting_payment: {
493
- settlementStatuses: [n.UNPAID, n.PARTIALLY_PAID],
494
- statuses: [a.SENT]
495
- },
496
- credited: { settlementStatuses: [n.CREDITED] },
497
- overdue: { isOverdue: !0 },
498
- paid: { settlementStatuses: [n.PAID, n.OVERPAID] },
499
- settled: { settlementStatuses: [n.SETTLED] }
500
- };
501
- function Ft() {
502
- let e = A();
503
- return {
504
- getFilters: (e) => e === "all" ? {} : Pt[e],
505
- tabs: j(() => [
506
- {
507
- key: "all",
508
- label: e.t("wise_invoicing.invoice.overview.tabs.all")
509
- },
510
- {
511
- key: "awaiting_payment",
512
- label: e.t("wise_invoicing.invoice.overview.tabs.awaiting_payment")
513
- },
514
- {
515
- key: "paid",
516
- label: e.t("wise_invoicing.invoice.overview.tabs.paid")
517
- },
518
- {
519
- key: "overdue",
520
- label: e.t("wise_invoicing.invoice.overview.tabs.overdue")
521
- },
522
- {
523
- key: "credited",
524
- label: e.t("wise_invoicing.invoice.overview.tabs.credited")
525
- },
526
- {
527
- key: "settled",
528
- label: e.t("wise_invoicing.invoice.overview.tabs.settled")
529
- }
530
- ])
531
- };
532
- }
533
- //#endregion
534
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewSelection.composable.ts
535
- function It(e) {
536
- let t = z([]), n = j(() => {
537
- let n = new Set(t.value);
538
- return e.rows().filter((e) => n.has(e.uuid));
539
- }), r = j(() => {
540
- let t = e.rows();
541
- return t.length > 0 && n.value.length === t.length;
542
- }), i = j(() => e.rows().length > 0 && !r.value), a = j(() => n.value.length);
543
- function o(e) {
544
- return t.value.includes(e);
545
- }
546
- function s() {
547
- let n = new Set(e.rows().map((e) => e.uuid));
548
- t.value = t.value.filter((e) => n.has(e));
549
- }
550
- function c(e) {
551
- if (o(e)) {
552
- t.value = t.value.filter((t) => t !== e);
553
- return;
554
- }
555
- t.value = [...t.value, e];
556
- }
557
- function l() {
558
- t.value = e.rows().map((e) => e.uuid);
559
- }
560
- function u() {
561
- t.value = [];
562
- }
563
- return {
564
- isSelected: o,
565
- allSelected: r,
566
- canSelectAll: i,
567
- clearSelection: u,
568
- selectAll: l,
569
- selectedCount: a,
570
- selectedIds: t,
571
- selectedInvoices: n,
572
- syncSelection: s,
573
- toggleRow: c
574
- };
575
- }
576
- //#endregion
577
- //#region src/modules/invoice/use-cases/overview/components/InvoiceOverviewTableAmountCell.vue?vue&type=script&setup=true&lang.ts
578
- var Lt = { class: "font-medium text-secondary" }, Rt = ["title"], zt = /* @__PURE__ */ L({
579
- __name: "InvoiceOverviewTableAmountCell",
580
- props: { value: {} },
581
- setup(e) {
582
- let t = e, n = A(), r = p(), i = j(() => r.formatMonetary(t.value.total)), a = j(() => {
583
- let e = ve.getSubtextParts({
584
- balanceDueAmount: t.value.balanceDueAmount,
585
- grossAmount: t.value.grossAmount,
586
- paidAmount: t.value.paidAmount,
587
- settlementStatus: t.value.settlementStatus,
588
- totalCreditedAmount: t.value.totalCreditedAmount
589
- });
590
- return e == null ? null : e.paidAmount !== null && e.overpaidAmount !== null ? n.t("wise_invoicing.invoice.status_subtext.paid_overpaid", {
591
- overpaidAmount: r.formatMonetary(e.overpaidAmount),
592
- paidAmount: r.formatMonetary(e.paidAmount)
593
- }) : e.paidAmount !== null && e.creditedAmount !== null ? n.t("wise_invoicing.invoice.status_subtext.paid_credited", {
594
- creditedAmount: r.formatMonetary(e.creditedAmount),
595
- paidAmount: r.formatMonetary(e.paidAmount)
596
- }) : e.paidAmount === null ? e.creditedAmount === null ? null : n.t("wise_invoicing.invoice.status_subtext.credited", { creditedAmount: r.formatMonetary(e.creditedAmount) }) : n.t("wise_invoicing.invoice.status_subtext.paid", { paidAmount: r.formatMonetary(e.paidAmount) });
597
- });
598
- return (e, t) => (R(), M(V(q), null, {
599
- default: H(() => [I(V(G), {
600
- gap: "xxs",
601
- class: "text-sm/tight"
602
- }, {
603
- default: H(() => [F("span", Lt, B(i.value), 1), a.value === null ? N("", !0) : (R(), P("span", {
604
- key: 0,
605
- title: a.value,
606
- class: "truncate text-xs text-secondary"
607
- }, B(a.value), 9, Rt))]),
608
- _: 1
609
- })]),
610
- _: 1
611
- }));
612
- }
613
- }), Bt = /* @__PURE__ */ L({
614
- __name: "InvoiceOverviewTableCustomFieldCell",
615
- props: {
616
- definition: {},
617
- value: {}
618
- },
619
- setup(e) {
620
- return (t, n) => (R(), M(V(q), null, {
621
- default: H(() => [e.value === void 0 ? (R(), M(V(ft), {
622
- key: 1,
623
- text: "-",
624
- class: "text-sm/5 text-primary"
625
- })) : (R(), M(pe, {
626
- key: 0,
627
- definition: e.definition,
628
- value: e.value,
629
- size: "md"
630
- }, null, 8, ["definition", "value"]))]),
631
- _: 1
632
- }));
633
- }
634
- }), Vt = /* @__PURE__ */ L({
635
- __name: "InvoiceOverviewTableDueDateCell",
636
- props: {
637
- isOverdue: { type: Boolean },
638
- value: {}
639
- },
640
- setup(e) {
641
- let t = e, n = w(), r = j(() => t.value === null ? "-" : n.formatPlainDate(t.value)), i = j(() => {
642
- if (!t.isOverdue || t.value === null) return null;
643
- let e = t.value.toZonedDateTime(We.Now.timeZoneId()).toInstant();
644
- return n.toRelativeTime(e);
645
- });
646
- return (e, n) => (R(), M(V(q), null, {
647
- default: H(() => [I(V(K), { gap: "sm" }, {
648
- default: H(() => [I(V(ft), {
649
- class: Ne([{
650
- "text-error-primary": t.isOverdue,
651
- "text-primary": !t.isOverdue
652
- }, "text-sm"]),
653
- text: r.value
654
- }, null, 8, ["class", "text"]), i.value === null ? N("", !0) : (R(), M(V(Ke), {
655
- key: 0,
656
- label: i.value,
657
- color: "error",
658
- size: "sm",
659
- variant: "translucent"
660
- }, null, 8, ["label"]))]),
661
- _: 1
662
- })]),
663
- _: 1
664
- }));
665
- }
666
- }), Ht = /* @__PURE__ */ L({
667
- __name: "InvoiceOverviewTableIssuedDateCell",
668
- props: { value: {} },
669
- setup(e) {
670
- let t = e, n = w(), r = j(() => t.value === null ? "-" : n.formatPlainDate(t.value));
671
- return (e, t) => (R(), M(V(q), null, {
672
- default: H(() => [I(V(ft), {
673
- text: r.value,
674
- class: "text-sm/5 text-primary"
675
- }, null, 8, ["text"])]),
676
- _: 1
677
- }));
678
- }
679
- }), Ut = /* @__PURE__ */ L({
680
- __name: "InvoiceOverviewTableLifecycleCell",
681
- props: {
682
- isDisputed: { type: Boolean },
683
- lifecycleStatus: {}
684
- },
685
- setup(e) {
686
- let t = e;
687
- return (e, n) => (R(), M(V(q), null, {
688
- default: H(() => [I(V(K), { gap: "xs" }, {
689
- default: H(() => [I(xe, { "lifecycle-status": t.lifecycleStatus }, null, 8, ["lifecycle-status"]), t.isDisputed ? (R(), M(_e, { key: 0 })) : N("", !0)]),
690
- _: 1
691
- })]),
692
- _: 1
693
- }));
694
- }
695
- }), Wt = { class: "flex flex-col leading-tight" }, Gt = ["title"], Kt = ["title"], qt = /* @__PURE__ */ L({
696
- __name: "InvoiceOverviewTableNameCell",
697
- props: {
698
- customerName: {},
699
- subject: {},
700
- type: {}
701
- },
702
- setup(e) {
703
- let t = e, n = A();
704
- return (e, r) => (R(), M(V(q), null, {
705
- default: H(() => [F("div", Wt, [I(V(K), null, {
706
- default: H(() => [F("span", {
707
- title: t.customerName,
708
- class: "truncate text-sm/4 font-medium text-primary"
709
- }, B(t.customerName), 9, Gt), t.type === V(i).CREDIT_NOTE ? (R(), M(V(b), {
710
- key: 0,
711
- "aria-label": V(n).t("wise_invoicing.invoice.type.credit_note"),
712
- class: "size-3 shrink-0 text-warning-primary",
713
- role: "img"
714
- }, null, 8, ["aria-label"])) : N("", !0)]),
715
- _: 1
716
- }), F("span", {
717
- title: t.subject ?? void 0,
718
- class: "truncate text-xs/4 text-secondary"
719
- }, B(t.subject ?? "-"), 9, Kt)])]),
720
- _: 1
721
- }));
722
- }
723
- }), Jt = /* @__PURE__ */ L({
724
- __name: "InvoiceOverviewTableSelectionCell",
725
- props: { isSelected: { type: Boolean } },
726
- emits: ["toggle"],
727
- setup(e, { emit: t }) {
728
- let n = e, r = t, i = A();
729
- return (e, t) => (R(), M(V(q), null, {
730
- default: H(() => [I(V(st), null, {
731
- default: H(() => [I(V(qe), {
732
- label: V(i).t("wise_invoicing.invoice.overview.bulk.select_document"),
733
- "model-value": n.isSelected,
734
- "is-label-hidden": !0,
735
- class: "mx-auto",
736
- "onUpdate:modelValue": t[0] ||= (e) => r("toggle")
737
- }, null, 8, ["label", "model-value"])]),
738
- _: 1
739
- })]),
740
- _: 1
741
- }));
742
- }
743
- }), Yt = /* @__PURE__ */ L({
744
- __name: "InvoiceOverviewTableSentCell",
745
- props: { deliveryStatus: {} },
746
- setup(e) {
747
- let t = e, n = j(() => [c.SENT, c.VIEWED].includes(t.deliveryStatus));
748
- return (e, t) => (R(), M(V(q), null, {
749
- default: H(() => [n.value ? (R(), M(V(be), {
750
- key: 0,
751
- class: "size-4 text-brand-600"
752
- })) : N("", !0)]),
753
- _: 1
754
- }));
755
- }
756
- }), Xt = /* @__PURE__ */ L({
757
- __name: "InvoiceOverviewTableSequenceCell",
758
- props: { sequence: {} },
759
- setup(e) {
760
- return (t, n) => (R(), M(V(q), null, {
761
- default: H(() => [I(V(ct), { text: e.sequence ?? "-" }, null, 8, ["text"])]),
762
- _: 1
763
- }));
764
- }
765
- }), Zt = /* @__PURE__ */ L({
766
- __name: "InvoiceOverviewTableStatusCell",
767
- props: { value: {} },
768
- setup(e) {
769
- let t = e, n = j(() => t.value.type === i.CREDIT_NOTE), r = j(() => Se.isSent(t.value.deliveryStatus));
770
- return (e, i) => (R(), M(V(q), null, {
771
- default: H(() => [n.value ? N("", !0) : (R(), M(ye, {
772
- key: 0,
773
- "is-sent": r.value,
774
- "balance-due-amount": t.value.balanceDueAmount,
775
- "gross-amount": t.value.grossAmount,
776
- "paid-amount": t.value.paidAmount,
777
- "settlement-status": t.value.settlementStatus,
778
- "show-subtext": !1,
779
- "total-credited-amount": t.value.totalCreditedAmount
780
- }, null, 8, [
781
- "is-sent",
782
- "balance-due-amount",
783
- "gross-amount",
784
- "paid-amount",
785
- "settlement-status",
786
- "total-credited-amount"
787
- ]))]),
788
- _: 1
789
- }));
790
- }
791
- });
792
- //#endregion
793
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewTableColumns.composable.ts
794
- function Qt(e) {
795
- let t = A();
796
- return j(() => {
797
- let n = e?.selection, r = e?.customFieldDefinitions?.().map((e) => ({
798
- headerLabel: O.getLabel(e, t.locale.value),
799
- key: Z.getKey(e),
800
- size: {
801
- max: "1fr",
802
- min: "10rem"
803
- },
804
- component: (t) => J(Bt, {
805
- definition: e,
806
- value: t.customFields.find((t) => t.definitionUuid === e.uuid)
807
- })
808
- })) ?? [], i = n === void 0 ? [] : [{
809
- headerLabel: "",
810
- key: "selection",
811
- size: {
812
- max: "2.5rem",
813
- min: "2.5rem"
814
- },
815
- component: (e) => J(Jt, {
816
- isSelected: n.isSelected(e.uuid),
817
- onToggle: () => n.toggleRow(e.uuid)
818
- })
819
- }];
820
- return ht()([
821
- ...i,
822
- {
823
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.recipient"),
824
- key: d.CUSTOMER,
825
- size: {
826
- max: "16rem",
827
- min: "16rem"
828
- },
829
- component: (e) => J(qt, {
830
- customerName: e.customerName,
831
- subject: e.subject,
832
- type: e.type
833
- })
834
- },
835
- {
836
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.id"),
837
- key: d.SEQUENCE,
838
- size: {
839
- max: "9rem",
840
- min: "9rem"
841
- },
842
- component: (e) => J(Xt, { sequence: e.sequence })
843
- },
844
- {
845
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.lifecycle"),
846
- key: "lifecycleStatus",
847
- size: {
848
- max: "12rem",
849
- min: "8rem"
850
- },
851
- component: (e) => J(Ut, {
852
- isDisputed: e.isDisputed,
853
- lifecycleStatus: e.lifecycleStatus
854
- })
855
- },
856
- {
857
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.invoice_date"),
858
- key: d.ISSUED_ON,
859
- size: {
860
- max: "8rem",
861
- min: "8rem"
862
- },
863
- component: (e) => J(Ht, { value: e.issuedOn })
864
- },
865
- {
866
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.sent"),
867
- key: "deliveryStatus",
868
- size: {
869
- max: "8rem",
870
- min: "8rem"
871
- },
872
- component: (e) => J(Yt, { deliveryStatus: e.deliveryStatus })
873
- },
874
- {
875
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.settlement"),
876
- key: "status",
877
- size: {
878
- max: "10rem",
879
- min: "10rem"
880
- },
881
- component: (e) => J(Zt, { value: e })
882
- },
883
- {
884
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.due_date"),
885
- key: "dueOn",
886
- size: {
887
- max: "14rem",
888
- min: "12rem"
889
- },
890
- component: (e) => J(Vt, {
891
- isOverdue: e.isOverdue,
892
- value: e.dueOn
893
- })
894
- },
895
- {
896
- headerLabel: t.t("wise_invoicing.invoice.overview.columns.amount_excl_vat"),
897
- key: d.NET_AMOUNT,
898
- size: {
899
- max: "1fr",
900
- min: "10rem"
901
- },
902
- component: (e) => J(zt, { value: e })
903
- },
904
- ...r
905
- ]);
906
- });
907
- }
908
- //#endregion
909
- //#region src/modules/invoice/api/invoiceIndexCache.util.ts
910
- var $t = 3e5, Q = /* @__PURE__ */ new Map(), en = null, tn = null;
911
- function nn(e) {
912
- return typeof e == "object" && !!e && "pages" in e && Array.isArray(e.pages);
913
- }
914
- function rn(e) {
915
- return nn(e) ? e.pages.flatMap((e) => e.isOk() ? e.getValue().data : []) : [];
916
- }
917
- function an(e) {
918
- return Object.keys(e);
919
- }
920
- function on(e, t) {
921
- let n = an(t.patch);
922
- return n.every((n) => e[n] === t.patch[n]) ? !0 : n.some((n) => n in t.serverValues && e[n] !== t.serverValues[n]);
923
- }
924
- function sn() {
925
- return Be().getQueryCache().findAll({ predicate: (e) => e.queryKey[0] === "invoiceIndex" }).flatMap((e) => rn(e.state.data));
926
- }
927
- function cn(e, t) {
928
- return e === void 0 ? {} : Object.fromEntries(an(t).map((t) => [t, e[t]]));
929
- }
930
- function ln() {
931
- new ze(Be()).update("invoiceIndex", {
932
- by: (e) => Q.has(e.uuid),
933
- value: (e) => ({
934
- ...e,
935
- ...Q.get(e.uuid)?.patch
936
- })
937
- });
938
- }
939
- function un(e) {
940
- let t = Date.now() - $t;
941
- for (let [e, n] of Q) n.patchedAt <= t && Q.delete(e);
942
- for (let t of e) {
943
- let e = Q.get(t.uuid);
944
- e !== void 0 && on(t, e) && Q.delete(t.uuid);
945
- }
946
- }
947
- function dn() {
948
- tn?.(), tn = null, en = null;
949
- }
950
- function fn(e) {
951
- if (e.type !== "updated" || e.action.type !== "success" || e.action.manual === !0 || e.query.queryKey[0] !== "invoiceIndex") return;
952
- let t = e.query.state.data;
953
- if (un(rn(t)), Q.size === 0) {
954
- dn();
955
- return;
956
- }
957
- ln();
958
- }
959
- function pn() {
960
- let e = Be().getQueryCache();
961
- en !== e && (dn(), en = e, tn = e.subscribe(fn));
962
- }
963
- var mn = class {
964
- static reflectBulkAction(e, t) {
965
- if (e.length === 0) return;
966
- let n = Date.now(), r = new Map(sn().map((e) => [e.uuid, e]));
967
- for (let i of e) {
968
- let e = Q.get(i);
969
- Q.set(i, {
970
- patchedAt: n,
971
- patch: {
972
- ...e?.patch,
973
- ...t
974
- },
975
- serverValues: {
976
- ...cn(r.get(i), t),
977
- ...e?.serverValues
978
- }
979
- });
980
- }
981
- ln(), pn();
982
- }
983
- };
984
- //#endregion
985
- //#region src/modules/invoice/api/mutations/invoiceBulkFinalize.mutation.ts
986
- function hn() {
987
- return U({
988
- queryFn: (e) => _.bulkFinalize(e.params.invoiceUuids),
989
- queryKeysToInvalidate: { invoiceDetail: {} }
990
- });
991
- }
992
- //#endregion
993
- //#region src/modules/invoice/use-cases/overview/utils/invoiceOverviewBulkActionFeedback.util.ts
994
- var $ = class {
995
- static createEmptyPreview() {
996
- return {
997
- skipped: [],
998
- meta: {
999
- processed: 0,
1000
- skipped: 0,
1001
- total: 0
1002
- }
1003
- };
1004
- }
1005
- static createSkippedToast(e) {
1006
- let t = [], n = {};
1007
- for (let [r, i] of e.invoices.entries()) {
1008
- let e = `invoice${r}`;
1009
- t.push(`{${e}}`), n[e] = {
1010
- label: this.getInvoiceLabel(i),
1011
- to: this.getInvoiceDetailLink(i)
1012
- };
1013
- }
1014
- let r = t.join(", ");
1015
- return {
1016
- id: e.id,
1017
- duration: Infinity,
1018
- interactableModels: n,
1019
- message: r === "" ? e.message : `${e.message} ${r}`,
1020
- variant: "error"
1021
- };
1022
- }
1023
- static getInvoiceDetailLink(e) {
1024
- return e.type === i.CREDIT_NOTE ? {
1025
- name: "invoicing-credit-note-detail",
1026
- params: { creditNoteUuid: e.uuid }
1027
- } : {
1028
- name: "invoicing-invoice-detail",
1029
- params: { invoiceUuid: e.uuid }
1030
- };
1031
- }
1032
- static getInvoiceLabel(e) {
1033
- return e.sequence ?? e.subject ?? e.customerName;
1034
- }
1035
- static getUnskippedInvoiceUuids(e, t) {
1036
- let n = new Set(t.map((e) => e.uuid));
1037
- return e.filter((e) => !n.has(e.uuid)).map((e) => e.uuid);
1038
- }
1039
- }, gn = {
1040
- key: 0,
1041
- class: "text-sm text-error-primary"
1042
- }, _n = {
1043
- key: 1,
1044
- class: "text-sm text-secondary"
1045
- }, vn = {
1046
- key: 0,
1047
- class: "text-sm text-primary"
1048
- }, yn = {
1049
- key: 1,
1050
- class: "text-sm text-secondary"
1051
- }, bn = { class: "text-sm text-secondary" }, xn = /* @__PURE__ */ L({
1052
- __name: "InvoiceOverviewBulkActionDialog",
1053
- props: {
1054
- title: {},
1055
- isPreviewLoading: { type: Boolean },
1056
- isSubmitting: { type: Boolean },
1057
- confirmLabel: {},
1058
- description: {},
1059
- icon: {},
1060
- loadingLabel: {},
1061
- noneProcessableLabel: {},
1062
- previewErrorLabel: {},
1063
- processableCount: {},
1064
- processableLabel: {},
1065
- skippedInvoices: {},
1066
- skippedPreviewLabel: {}
1067
- },
1068
- emits: ["close", "confirm"],
1069
- setup(e, { emit: t }) {
1070
- let n = e, r = t;
1071
- return (e, t) => (R(), M(V(Ze), {
1072
- size: "sm",
1073
- onClose: t[1] ||= (e) => r("close")
1074
- }, {
1075
- default: H(() => [
1076
- I(V(rt), {
1077
- title: n.title,
1078
- description: n.description,
1079
- icon: n.icon,
1080
- "is-description-visible": !0
1081
- }, null, 8, [
1082
- "title",
1083
- "description",
1084
- "icon"
1085
- ]),
1086
- I(V(Qe), null, {
1087
- default: H(() => [I(V(G), null, {
1088
- default: H(() => [n.previewErrorLabel === null ? n.isPreviewLoading ? (R(), P("p", _n, B(n.loadingLabel), 1)) : (R(), P(Oe, { key: 2 }, [n.processableCount > 0 ? (R(), P("p", vn, B(n.processableLabel), 1)) : (R(), P("p", yn, B(n.noneProcessableLabel), 1)), n.skippedInvoices.length > 0 ? (R(), M(V(G), {
1089
- key: 2,
1090
- gap: "sm",
1091
- class: "rounded-lg border border-secondary bg-secondary p-md"
1092
- }, {
1093
- default: H(() => [F("p", bn, B(n.skippedPreviewLabel), 1), I(V(G), { gap: "xs" }, {
1094
- default: H(() => [(R(!0), P(Oe, null, Fe(n.skippedInvoices, (e) => (R(), M(V(Ee), {
1095
- key: e.uuid,
1096
- to: V($).getInvoiceDetailLink(e),
1097
- class: "text-sm text-brand-primary hover:underline"
1098
- }, {
1099
- default: H(() => [ke(B(V($).getInvoiceLabel(e)), 1)]),
1100
- _: 2
1101
- }, 1032, ["to"]))), 128))]),
1102
- _: 1
1103
- })]),
1104
- _: 1
1105
- })) : N("", !0)], 64)) : (R(), P("p", gn, B(n.previewErrorLabel), 1))]),
1106
- _: 1
1107
- })]),
1108
- _: 1
1109
- }),
1110
- I(V($e), null, {
1111
- right: H(() => [I(V(et)), I(V(tt), {
1112
- "is-disabled": n.isPreviewLoading || n.processableCount === 0,
1113
- "is-loading": n.isSubmitting,
1114
- label: n.confirmLabel,
1115
- onClick: t[0] ||= (e) => r("confirm")
1116
- }, null, 8, [
1117
- "is-disabled",
1118
- "is-loading",
1119
- "label"
1120
- ])]),
1121
- _: 1
1122
- })
1123
- ]),
1124
- _: 1
1125
- }));
1126
- }
1127
- }), Sn = /* @__PURE__ */ L({
1128
- __name: "InvoiceOverviewBulkFinalizeDialog",
1129
- props: {
1130
- invoices: {},
1131
- onFinalized: { type: Function }
1132
- },
1133
- emits: ["close"],
1134
- setup(e, { emit: t }) {
1135
- let n = e, r = t, i = A(), s = Y(), c = hn(), l = z(!0), u = z(!1), d = z(null), f = z(null), p = j(() => n.invoices.filter((e) => e.status === a.READY)), m = j(() => p.value.map((e) => e.uuid)), h = j(() => d.value?.meta.processed ?? 0), g = j(() => $.getUnskippedInvoiceUuids(p.value, d.value?.skipped ?? [])), v = j(() => {
1136
- let e = new Set(g.value);
1137
- return n.invoices.filter((t) => !e.has(t.uuid));
1138
- }), y = j(() => v.value.length), b = j(() => d.value === null ? n.invoices.length : h.value);
1139
- async function x() {
1140
- let e = g.value;
1141
- if (e.length === 0 || u.value) return;
1142
- u.value = !0;
1143
- let t = await c.execute({ params: { invoiceUuids: e } });
1144
- if (u.value = !1, t.isErr()) {
1145
- s.apiError(t.error);
1146
- return;
1147
- }
1148
- let l = new Set(t.value.skipped.map((e) => e.uuid)), f = e.filter((e) => !l.has(e));
1149
- d.value = t.value, f.length > 0 && mn.reflectBulkAction(f, {
1150
- lifecycleStatus: o.FINALIZED,
1151
- status: a.FINALIZED
1152
- }), t.value.meta.processed > 0 && s.show({ message: i.t("wise_invoicing.invoice.overview.bulk.finalize.success", { count: t.value.meta.processed }) }), y.value > 0 && s.show($.createSkippedToast({
1153
- id: "invoice-overview-bulk-finalize-skipped",
1154
- invoices: v.value,
1155
- message: i.t("wise_invoicing.invoice.overview.bulk.finalize.skipped", { count: y.value })
1156
- })), t.value.meta.processed !== 0 && (n.onFinalized(), r("close"));
1157
- }
1158
- async function S() {
1159
- if (l.value = !0, m.value.length === 0) {
1160
- d.value = $.createEmptyPreview(), l.value = !1;
1161
- return;
1162
- }
1163
- let e = await _.previewBulkFinalize(m.value);
1164
- if (e.isErr()) {
1165
- f.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), l.value = !1;
1166
- return;
1167
- }
1168
- d.value = e.value, l.value = !1;
1169
- }
1170
- return Pe(() => {
1171
- S();
1172
- }), (e, t) => (R(), M(xn, {
1173
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.confirm"),
1174
- description: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.description"),
1175
- icon: V(C),
1176
- "is-preview-loading": l.value,
1177
- "is-submitting": u.value,
1178
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.loading"),
1179
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.none_processable"),
1180
- "preview-error-label": f.value,
1181
- "processable-count": h.value,
1182
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.processable", { count: h.value }),
1183
- "skipped-invoices": v.value,
1184
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.skipped_preview", { count: y.value }),
1185
- title: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.title", { count: b.value }),
1186
- onClose: t[0] ||= (e) => r("close"),
1187
- onConfirm: x
1188
- }, null, 8, [
1189
- "confirm-label",
1190
- "description",
1191
- "icon",
1192
- "is-preview-loading",
1193
- "is-submitting",
1194
- "loading-label",
1195
- "none-processable-label",
1196
- "preview-error-label",
1197
- "processable-count",
1198
- "processable-label",
1199
- "skipped-invoices",
1200
- "skipped-preview-label",
1201
- "title"
1202
- ]));
1203
- }
1204
- });
1205
- //#endregion
1206
- //#region src/modules/invoice/api/mutations/invoiceBulkMarkAsReady.mutation.ts
1207
- function Cn() {
1208
- return U({
1209
- queryFn: (e) => _.bulkMarkAsReady(e.params.invoiceUuids),
1210
- queryKeysToInvalidate: { invoiceDetail: {} }
1211
- });
1212
- }
1213
- //#endregion
1214
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkMarkAsReadyDialog.vue
1215
- var wn = /* @__PURE__ */ L({
1216
- __name: "InvoiceOverviewBulkMarkAsReadyDialog",
1217
- props: {
1218
- invoices: {},
1219
- onMarkedAsReady: { type: Function }
1220
- },
1221
- emits: ["close"],
1222
- setup(e, { emit: t }) {
1223
- let n = e, r = t, i = A(), s = Y(), c = Cn(), l = z(!0), u = z(!1), d = z(null), f = z(null), p = j(() => n.invoices.filter((e) => e.status === a.DRAFT)), m = j(() => p.value.map((e) => e.uuid)), h = j(() => d.value?.meta.processed ?? 0), g = j(() => $.getUnskippedInvoiceUuids(p.value, d.value?.skipped ?? [])), v = j(() => {
1224
- let e = new Set(g.value);
1225
- return n.invoices.filter((t) => !e.has(t.uuid));
1226
- }), y = j(() => v.value.length), b = j(() => d.value === null ? n.invoices.length : h.value);
1227
- async function x() {
1228
- let e = g.value;
1229
- if (e.length === 0 || u.value) return;
1230
- u.value = !0;
1231
- let t = await c.execute({ params: { invoiceUuids: e } });
1232
- if (u.value = !1, t.isErr()) {
1233
- s.apiError(t.error);
1234
- return;
1235
- }
1236
- let l = new Set(t.value.skipped.map((e) => e.uuid)), f = e.filter((e) => !l.has(e));
1237
- d.value = t.value, f.length > 0 && mn.reflectBulkAction(f, {
1238
- lifecycleStatus: o.READY,
1239
- status: a.READY
1240
- }), t.value.meta.processed > 0 && s.show({ message: i.t("wise_invoicing.invoice.overview.bulk.mark_as_ready.success", { count: t.value.meta.processed }) }), y.value > 0 && s.show($.createSkippedToast({
1241
- id: "invoice-overview-bulk-mark-as-ready-skipped",
1242
- invoices: v.value,
1243
- message: i.t("wise_invoicing.invoice.overview.bulk.mark_as_ready.skipped", { count: y.value })
1244
- })), t.value.meta.processed !== 0 && (n.onMarkedAsReady(), r("close"));
1245
- }
1246
- async function ee() {
1247
- if (l.value = !0, m.value.length === 0) {
1248
- d.value = $.createEmptyPreview(), l.value = !1;
1249
- return;
1250
- }
1251
- let e = await _.previewBulkMarkAsReady(m.value);
1252
- if (e.isErr()) {
1253
- f.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), l.value = !1;
1254
- return;
1255
- }
1256
- d.value = e.value, l.value = !1;
1257
- }
1258
- return Pe(() => {
1259
- ee();
1260
- }), (e, t) => (R(), M(xn, {
1261
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.confirm"),
1262
- description: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.description"),
1263
- icon: V(S),
1264
- "is-preview-loading": l.value,
1265
- "is-submitting": u.value,
1266
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.loading"),
1267
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.none_processable"),
1268
- "preview-error-label": f.value,
1269
- "processable-count": h.value,
1270
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.processable", { count: h.value }),
1271
- "skipped-invoices": v.value,
1272
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.skipped_preview", { count: y.value }),
1273
- title: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.title", { count: b.value }),
1274
- onClose: t[0] ||= (e) => r("close"),
1275
- onConfirm: x
1276
- }, null, 8, [
1277
- "confirm-label",
1278
- "description",
1279
- "icon",
1280
- "is-preview-loading",
1281
- "is-submitting",
1282
- "loading-label",
1283
- "none-processable-label",
1284
- "preview-error-label",
1285
- "processable-count",
1286
- "processable-label",
1287
- "skipped-invoices",
1288
- "skipped-preview-label",
1289
- "title"
1290
- ]));
1291
- }
1292
- });
1293
- //#endregion
1294
- //#region src/modules/invoice/api/mutations/invoiceBulkSend.mutation.ts
1295
- function Tn() {
1296
- return U({
1297
- queryFn: (e) => _.bulkSend(e.params.invoiceUuids),
1298
- queryKeysToInvalidate: { invoiceDetail: {} }
1299
- });
1300
- }
1301
- //#endregion
1302
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkSendDialog.vue
1303
- var En = /* @__PURE__ */ L({
1304
- __name: "InvoiceOverviewBulkSendDialog",
1305
- props: {
1306
- invoices: {},
1307
- onSent: { type: Function }
1308
- },
1309
- emits: ["close"],
1310
- setup(e, { emit: t }) {
1311
- let n = e, r = t, i = A(), o = Y(), s = Tn(), l = z(!0), u = z(!1), d = z(null), f = z(null), p = j(() => n.invoices.filter((e) => e.status === a.FINALIZED)), m = j(() => p.value.map((e) => e.uuid)), h = j(() => d.value?.meta.processed ?? 0), g = j(() => $.getUnskippedInvoiceUuids(p.value, d.value?.skipped ?? [])), v = j(() => {
1312
- let e = new Set(g.value);
1313
- return n.invoices.filter((t) => !e.has(t.uuid));
1314
- }), y = j(() => v.value.length), b = j(() => d.value === null ? n.invoices.length : h.value);
1315
- async function x() {
1316
- let e = g.value;
1317
- if (e.length === 0 || u.value) return;
1318
- u.value = !0;
1319
- let t = await s.execute({ params: { invoiceUuids: e } });
1320
- if (u.value = !1, t.isErr()) {
1321
- o.apiError(t.error);
1322
- return;
1323
- }
1324
- let a = new Set(t.value.skipped.map((e) => e.uuid)), l = e.filter((e) => !a.has(e));
1325
- d.value = t.value, l.length > 0 && mn.reflectBulkAction(l, { deliveryStatus: c.PROCESSING }), t.value.meta.processed > 0 && o.show({ message: i.t("wise_invoicing.invoice.overview.bulk.send.success", { count: t.value.meta.processed }) }), y.value > 0 && o.show($.createSkippedToast({
1326
- id: "invoice-overview-bulk-send-skipped",
1327
- invoices: v.value,
1328
- message: i.t("wise_invoicing.invoice.overview.bulk.send.skipped", { count: y.value })
1329
- })), t.value.meta.processed !== 0 && (n.onSent(), r("close"));
1330
- }
1331
- async function S() {
1332
- if (l.value = !0, m.value.length === 0) {
1333
- d.value = $.createEmptyPreview(), l.value = !1;
1334
- return;
1335
- }
1336
- let e = await _.previewBulkSend(m.value);
1337
- if (e.isErr()) {
1338
- f.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), l.value = !1;
1339
- return;
1340
- }
1341
- d.value = e.value, l.value = !1;
1342
- }
1343
- return Pe(() => {
1344
- S();
1345
- }), (e, t) => (R(), M(xn, {
1346
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.confirm"),
1347
- description: V(i).t("wise_invoicing.invoice.overview.bulk.send.description"),
1348
- icon: V(te),
1349
- "is-preview-loading": l.value,
1350
- "is-submitting": u.value,
1351
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.loading"),
1352
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.none_processable"),
1353
- "preview-error-label": f.value,
1354
- "processable-count": h.value,
1355
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.processable", { count: h.value }),
1356
- "skipped-invoices": v.value,
1357
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.skipped_preview", { count: y.value }),
1358
- title: V(i).t("wise_invoicing.invoice.overview.bulk.send.title", { count: b.value }),
1359
- onClose: t[0] ||= (e) => r("close"),
1360
- onConfirm: x
1361
- }, null, 8, [
1362
- "confirm-label",
1363
- "description",
1364
- "icon",
1365
- "is-preview-loading",
1366
- "is-submitting",
1367
- "loading-label",
1368
- "none-processable-label",
1369
- "preview-error-label",
1370
- "processable-count",
1371
- "processable-label",
1372
- "skipped-invoices",
1373
- "skipped-preview-label",
1374
- "title"
1375
- ]));
1376
- }
1377
- }), Dn = /* @__PURE__ */ L({
1378
- __name: "DateRangeFilterButton",
1379
- props: /*@__PURE__*/ je({ ariaLabel: {} }, {
1380
- modelValue: { default: null },
1381
- modelModifiers: {}
1382
- }),
1383
- emits: ["update:modelValue"],
1384
- setup(e) {
1385
- let t = e, n = Le(e, "modelValue"), r = A(), i = z(!1), a = z({
1386
- from: null,
1387
- until: null
1388
- });
1389
- Re(i, (e) => {
1390
- e && (a.value = {
1391
- from: n.value?.from ?? null,
1392
- until: n.value?.until ?? null
1393
- });
1394
- });
1395
- let o = w(), s = j(() => n.value === null ? r.t("component.date_range_filter_button.select_dates") : n.value.from !== null && n.value.until !== null && n.value.from.equals(n.value.until) ? o.formatPlainDate(n.value.from) : `${n.value.from === null ? "-" : o.formatPlainDate(n.value.from)} - ${n.value.until === null ? "-" : o.formatPlainDate(n.value.until)}`);
1396
- function c() {
1397
- n.value = a.value.from !== null || a.value.until !== null ? { ...a.value } : null, i.value = !1;
1398
- }
1399
- function l() {
1400
- i.value = !1;
1401
- }
1402
- function u() {
1403
- n.value = null, i.value = !1;
1404
- }
1405
- return (e, n) => (R(), M(V(at), {
1406
- "is-open": i.value,
1407
- "onUpdate:isOpen": n[1] ||= (e) => i.value = e,
1408
- "popover-side": "bottom",
1409
- "popover-align": "end"
1410
- }, {
1411
- trigger: H(() => [I(V(W), {
1412
- "aria-label": t.ariaLabel,
1413
- label: s.value,
1414
- "icon-right": V(x),
1415
- variant: "secondary"
1416
- }, null, 8, [
1417
- "aria-label",
1418
- "label",
1419
- "icon-right"
1420
- ])]),
1421
- content: H(() => [I(V(Xe), {
1422
- modelValue: a.value,
1423
- "onUpdate:modelValue": n[0] ||= (e) => a.value = e,
1424
- class: "p-lg"
1425
- }, null, 8, ["modelValue"]), I(V(K), {
1426
- justify: "end",
1427
- gap: "sm",
1428
- class: "border-t border-secondary p-md"
1429
- }, {
1430
- default: H(() => [
1431
- I(V(W), {
1432
- label: V(r).t("shared.cancel"),
1433
- variant: "tertiary",
1434
- onClick: l
1435
- }, null, 8, ["label"]),
1436
- I(V(W), {
1437
- label: V(r).t("shared.clear"),
1438
- variant: "tertiary",
1439
- onClick: u
1440
- }, null, 8, ["label"]),
1441
- I(V(W), {
1442
- label: V(r).t("component.filters_date_range_dialog.apply"),
1443
- variant: "primary",
1444
- onClick: c
1445
- }, null, 8, ["label"])
1446
- ]),
1447
- _: 1
1448
- })]),
1449
- _: 1
1450
- }, 8, ["is-open"]));
1451
- }
1452
- }), On = { class: "relative flex min-h-0 flex-1 flex-col" }, kn = /* @__PURE__ */ L({
1453
- __name: "InvoiceOverviewView",
1454
- props: {
1455
- currency: {},
1456
- customFieldDefinitions: {},
1457
- onCreateInvoice: { type: Function }
1458
- },
1459
- setup(e) {
1460
- let t = e, n = A(), r = u(), o = gt(), s = o.create(Dt), c = o.create(Sn), l = o.create(wn), f = o.create(En), p = h({ debounceMs: 300 }), m = yt("tab", "all"), _ = g({
1461
- initialValues: [{
1462
- direction: "desc",
1463
- key: d.ISSUED_ON
1464
- }],
1465
- keys: [
1466
- d.CUSTOMER,
1467
- d.SEQUENCE,
1468
- d.ISSUED_ON,
1469
- d.NET_AMOUNT
1470
- ]
1471
- }), v = Ft(), { customerUuids: y, customFields: b, dueOnRange: x, filters: S, lifecycleStatuses: te } = Nt({
1472
- currency: t.currency,
1473
- customFieldDefinitions: t.customFieldDefinitions
1474
- });
1475
- oe(S);
1476
- let C = z(null), w = j(() => v.getFilters(m.value)), { isFetchingNextPage: ne, isLoading: re, fetchNextPage: ie, result: T } = bt({ params: {
1477
- filters: j(() => ({
1478
- issuedOnRange: C.value,
1479
- customerUuids: y.value,
1480
- customFields: b.value,
1481
- dueOnRange: x.value,
1482
- lifecycleStatuses: te.value,
1483
- ...w.value
1484
- })),
1485
- search: p.debouncedSearch,
1486
- sort: _.values
1487
- } });
1488
- r.set(() => n.t("wise_invoicing.invoice.overview.title"));
1489
- let ae = { name: () => n.t("wise_invoicing.invoice.overview.title") }, E = j(() => T.value.isOk() ? T.value.getValue().data : []), D = It({ rows: () => E.value }), le = Qt({
1490
- customFieldDefinitions: () => t.customFieldDefinitions,
1491
- selection: {
1492
- isSelected: D.isSelected,
1493
- toggleRow: D.toggleRow
1494
- }
1495
- }), { customizedColumns: ue, customizeTableAction: de } = _t({
1496
- actionGroup: ae,
1497
- availableColumns: le,
1498
- initialState: He("invoice-overview-columns", []).value
1499
- }), O = j(() => T.value.isErr() ? T.value.getError() : null), fe = j(() => S.activeFilters.value.length), pe = j(() => (p.debouncedSearch.value?.trim().length ?? 0) > 0), me = j(() => D.selectedInvoices.value.some((e) => e.status === a.READY)), he = j(() => D.selectedInvoices.value.some((e) => e.status === a.DRAFT)), { canSend: ge } = jt({ selectedInvoices: () => D.selectedInvoices.value });
1500
- Re(E, () => {
1501
- D.syncSelection();
1502
- });
1503
- function _e() {
1504
- if (t.onCreateInvoice !== void 0) {
1505
- t.onCreateInvoice();
1506
- return;
1507
- }
1508
- s.open();
1509
- }
1510
- async function ve() {
1511
- await l.open({
1512
- invoices: D.selectedInvoices.value,
1513
- onMarkedAsReady: () => {
1514
- D.clearSelection();
1515
- }
1516
- });
1517
- }
1518
- async function ye() {
1519
- await c.open({
1520
- invoices: D.selectedInvoices.value,
1521
- onFinalized: () => {
1522
- D.clearSelection();
1523
- }
1524
- });
1525
- }
1526
- async function be() {
1527
- await f.open({
1528
- invoices: D.selectedInvoices.value,
1529
- onSent: () => {
1530
- D.clearSelection();
1531
- }
1532
- });
1533
- }
1534
- function xe(e) {
1535
- return e.type === i.CREDIT_NOTE ? {
1536
- name: "invoicing-credit-note-detail",
1537
- params: { creditNoteUuid: e.uuid }
1538
- } : {
1539
- name: "invoicing-invoice-detail",
1540
- params: { invoiceUuid: e.uuid }
1541
- };
1542
- }
1543
- return (e, t) => (R(), M(V(Je), { title: V(n).t("wise_invoicing.invoice.overview.title") }, {
1544
- "page-actions-left": H(() => [I(V(lt), {
1545
- modelValue: V(m),
1546
- "onUpdate:modelValue": t[0] ||= (e) => Ae(m) ? m.value = e : null,
1547
- variant: "button-border"
1548
- }, {
1549
- default: H(() => [I(V(dt), null, {
1550
- default: H(() => [(R(!0), P(Oe, null, Fe(V(v).tabs.value, (e) => (R(), M(V(ut), {
1551
- key: e.key,
1552
- value: e.key,
1553
- label: e.label
1554
- }, null, 8, ["value", "label"]))), 128))]),
1555
- _: 1
1556
- })]),
1557
- _: 1
1558
- }, 8, ["modelValue"])]),
1559
- "page-actions-right": H(() => [I(V(K), {
1560
- justify: "between",
1561
- class: "items-stretch"
1562
- }, {
1563
- default: H(() => [I(Dn, {
1564
- modelValue: C.value,
1565
- "onUpdate:modelValue": t[1] ||= (e) => C.value = e,
1566
- "aria-label": V(n).t("wise_invoicing.invoice.overview.filters.issued_on")
1567
- }, null, 8, ["modelValue", "aria-label"]), I(V(K), { justify: "end" }, {
1568
- default: H(() => [
1569
- I(V(pt), {
1570
- modelValue: V(p).search.value,
1571
- "onUpdate:modelValue": t[2] ||= (e) => V(p).search.value = e,
1572
- label: null,
1573
- "icon-left": V(ee),
1574
- placeholder: V(n).t("wise_invoicing.common.search"),
1575
- size: "sm",
1576
- type: "search"
1577
- }, null, 8, [
1578
- "modelValue",
1579
- "icon-left",
1580
- "placeholder"
1581
- ]),
1582
- Ie(e.$slots, "actions"),
1583
- I(V(W), {
1584
- label: V(n).t("wise_invoicing.invoice.create.title"),
1585
- onClick: _e
1586
- }, null, 8, ["label"])
1587
- ]),
1588
- _: 3
1589
- })]),
1590
- _: 3
1591
- })]),
1592
- default: H(() => [I(V(Ye), null, {
1593
- default: H(() => [I(V(K), { justify: "between" }, {
1594
- default: H(() => [I(V(se)), I(V(ce))]),
1595
- _: 1
1596
- })]),
1597
- _: 1
1598
- }), F("div", On, [I(V(ot), {
1599
- columns: V(ue),
1600
- data: E.value,
1601
- "is-loading": V(re),
1602
- "is-fetching-next-page": V(ne),
1603
- error: O.value,
1604
- "has-active-search": pe.value,
1605
- "active-filter-count": fe.value,
1606
- "get-key": (e) => e.uuid,
1607
- "header-actions": [V(de)],
1608
- "get-link": xe,
1609
- "get-action-model": (e) => ({
1610
- modelName: "Invoice",
1611
- key: e.uuid,
1612
- ...e
1613
- }),
1614
- onNextPage: V(ie),
1615
- onClearSearch: t[3] ||= (e) => V(p).clear(),
1616
- onClearFilters: t[4] ||= (e) => V(S).clearAll()
1617
- }, null, 8, [
1618
- "columns",
1619
- "data",
1620
- "is-loading",
1621
- "is-fetching-next-page",
1622
- "error",
1623
- "has-active-search",
1624
- "active-filter-count",
1625
- "get-key",
1626
- "header-actions",
1627
- "get-action-model",
1628
- "onNextPage"
1629
- ]), I(At, {
1630
- "can-finalize": me.value,
1631
- "can-select-all": V(D).canSelectAll.value,
1632
- "can-mark-as-ready": he.value,
1633
- "can-send": V(ge),
1634
- "selected-count": V(D).selectedCount.value,
1635
- onCancel: t[5] ||= (e) => V(D).clearSelection(),
1636
- onFinalize: t[6] ||= (e) => ye(),
1637
- onMarkAsReady: t[7] ||= (e) => ve(),
1638
- onSelectAll: t[8] ||= (e) => V(D).selectAll(),
1639
- onSend: t[9] ||= (e) => be()
1640
- }, null, 8, [
1641
- "can-finalize",
1642
- "can-select-all",
1643
- "can-mark-as-ready",
1644
- "can-send",
1645
- "selected-count"
1646
- ])])]),
1647
- _: 3
1648
- }, 8, ["title"]));
1649
- }
1650
- }), An = /*@__PURE__*/ L({
1651
- __name: "InvoiceOverviewViewDataProvider",
1652
- props: { onCreateInvoice: { type: Function } },
1653
- setup(e) {
1654
- let t = fe(j(() => ({ entityTypes: [s.INVOICE] }))), n = we();
1655
- return (r, i) => (R(), M(he, { queries: {
1656
- customFieldDefinitions: V(t),
1657
- issuerSettings: V(n)
1658
- } }, {
1659
- default: H(({ data: t }) => [I(kn, {
1660
- currency: t.issuerSettings.currency,
1661
- "custom-field-definitions": t.customFieldDefinitions,
1662
- "on-create-invoice": e.onCreateInvoice
1663
- }, {
1664
- actions: H(() => [Ie(r.$slots, "actions")]),
1665
- _: 3
1666
- }, 8, [
1667
- "currency",
1668
- "custom-field-definitions",
1669
- "on-create-invoice"
1670
- ])]),
1671
- loading: H(() => [I(V(Te).PageLoadingState, { breadcrumbs: [] })]),
1672
- _: 3
1673
- }, 8, ["queries"]));
1674
- }
1675
- }), jn = /* @__PURE__ */ e({ default: () => Mn }), Mn = An;
1676
- //#endregion
1677
- export { jn as n, bt as r, Mn as t };