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