@wisemen/wise-invoicing-web 0.1.1 → 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 (206) hide show
  1. package/dist/ApprovalReminderSettingsViewDataProvider-D-qXZrPT.js +151 -0
  2. package/dist/{BillingDocumentDetailViewDataProvider-f5goWm_i.js → BillingDocumentDetailViewDataProvider-DDdtlW-2.js} +1386 -1450
  3. package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
  4. package/dist/{BillingDocumentPdf-5vi2pgRM.js → BillingDocumentPdf-ehdFB6mr.js} +4 -4
  5. package/dist/{CreditNoteDetailViewDataProvider-Byd1QvfY.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/utils/html.util.d.ts +4 -0
  134. package/package.json +2 -1
  135. package/dist/AddOpenBoundaryIcon-9SqBHfoz.js +0 -25
  136. package/dist/AirlineIcon-Z6sH_StM.js +0 -26
  137. package/dist/AirplaneIcon-C-nSkD1w.js +0 -19
  138. package/dist/AirportIcon-m4itDKCV.js +0 -16
  139. package/dist/AlertTriangleIcon-DtYLCC-Y.js +0 -23
  140. package/dist/AllocationsIcon-hcg93Sll.js +0 -16
  141. package/dist/ArrowNarrowRightIcon-2-Sml68f.js +0 -23
  142. package/dist/AssetIcon-qOYs6Wna.js +0 -16
  143. package/dist/BarChartIcon-DDyzpV_3.js +0 -22
  144. package/dist/BellIcon-DF1OBFta.js +0 -21
  145. package/dist/BuildingIcon-CC5PMNeP.js +0 -22
  146. package/dist/ChargerIcon-aM_endLr.js +0 -16
  147. package/dist/ChevronDownIcon-4QiK-Z6-.js +0 -23
  148. package/dist/ChevronUpIcon-qBsjZ5Dz.js +0 -23
  149. package/dist/ClockIcon-BNiPCaiB.js +0 -23
  150. package/dist/ClockSnoozeIcon-BxGfwJB6.js +0 -23
  151. package/dist/CopyIcon-DH5ly0dZ.js +0 -19
  152. package/dist/DataProvider-Dj34ljUX.js +0 -75
  153. package/dist/DownloadCloudIcon-Cf8ftklG.js +0 -22
  154. package/dist/EditIcon-Dr7OHBBR.js +0 -21
  155. package/dist/EraserIcon-B1VJSvdI.js +0 -23
  156. package/dist/FileIcon-ssmQI5Yl.js +0 -23
  157. package/dist/FilterLinesIcon-C7YdyPBk.js +0 -23
  158. package/dist/GlobeIcon-BfRM6Ike.js +0 -22
  159. package/dist/HelpIcon-BrJ49P5y.js +0 -22
  160. package/dist/HourGlassIcon-D9rfU1Is.js +0 -22
  161. package/dist/InfoCircleIcon-Ee0SyiMc.js +0 -23
  162. package/dist/InvoiceDetailViewDataProvider-BU6jZfD7.js +0 -1670
  163. package/dist/InvoiceOverviewViewDataProvider-i8tXATJE.js +0 -1677
  164. package/dist/InvoicePublicPdfViewDataProvider-BJe-8hC5.js +0 -45
  165. package/dist/KeyboardIcon-T3o_g-1c.js +0 -22
  166. package/dist/LinkExternalIcon-BkHS4fCx.js +0 -22
  167. package/dist/LinkIcon-DuPwae98.js +0 -22
  168. package/dist/MarkerIcon-B1Jqenjb.js +0 -28
  169. package/dist/MobileBatteryIcon-GZ1SMRDV.js +0 -16
  170. package/dist/MonitorIcon-pbK22reU.js +0 -22
  171. package/dist/NotificationIcon-Ctv8vyWt.js +0 -19
  172. package/dist/ParkingIcon-DnUPW3pB.js +0 -24
  173. package/dist/PlanningIcon-CXvrskgj.js +0 -16
  174. package/dist/PreferenceIcon-BHS8uDyi.js +0 -22
  175. package/dist/ReceiptCheckIcon-QTestqCJ.js +0 -23
  176. package/dist/RefreshIcon-DShY-aoS.js +0 -22
  177. package/dist/RemoveOpenBoundaryIcon-CN8YWs6o.js +0 -28
  178. package/dist/RewindIcon-GWg2AQax.js +0 -22
  179. package/dist/SettingsIcon-CBLJ6B5u.js +0 -25
  180. package/dist/ShieldIcon-CVnrOcxl.js +0 -19
  181. package/dist/ShieldOffIcon-B9l0dDVb.js +0 -23
  182. package/dist/SignOutIcon-CmDkjJ5F.js +0 -21
  183. package/dist/SlashCircleIcon-jY5FBko5.js +0 -22
  184. package/dist/StandIcon-CoYnBLMn.js +0 -23
  185. package/dist/StarsIcon-D7ZlqOW7.js +0 -22
  186. package/dist/StopwatchIcon-BK0vh1lg.js +0 -22
  187. package/dist/TargetIcon-HMWj77-Q.js +0 -22
  188. package/dist/ThreeDotsIcon-BtFruOKz.js +0 -32
  189. package/dist/ToolIcon-DRfDb7fE.js +0 -22
  190. package/dist/TrashIcon-BwxBjHv5.js +0 -19
  191. package/dist/TurnaroundIcon-b1X61TwZ.js +0 -27
  192. package/dist/UploadCloudIcon-BF0equKg.js +0 -22
  193. package/dist/UserIcon-B0rCC6KE.js +0 -22
  194. package/dist/UsersIcon-cK5l_zKG.js +0 -22
  195. package/dist/VerifiedIcon-CELYlqcv.js +0 -22
  196. package/dist/WifiIcon--JPvMNEF.js +0 -23
  197. package/dist/WifiOffIcon-BS2KftcP.js +0 -23
  198. package/dist/ZapIcon-BHwcIQc0.js +0 -23
  199. package/dist/ZoomInIcon-Cu6r915V.js +0 -23
  200. package/dist/ZoomOutIcon-DwB4FRj-.js +0 -23
  201. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  202. package/dist/instant.transformer-KmBsH3E9.js +0 -18
  203. package/dist/invoice.service-Bb8VqQvc.js +0 -635
  204. package/dist/invoiceDeliveryStatus.util-BPkGCQM6.js +0 -331
  205. package/dist/reminderConfig.query-DsJNqqi7.js +0 -331
  206. package/dist/search.composable-BCtYqudV.js +0 -52
@@ -0,0 +1,2156 @@
1
+ import { t as e } from "./i18n.lib-Cvr8pcDw.js";
2
+ import { ct as t, t as n } from "./api.util-C_kMGlJN.js";
3
+ import { S as r, _ as i, c as a, d as o, g as s, r as c, s as l, v as u, y as d } from "./documentTitle.composable-DsBbzhXN.js";
4
+ import { r as f } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
+ import { n as p } from "./invoicingConfig.composable-rxjGK882.js";
6
+ import { t as m } from "./search.composable-CU9OpyUB.js";
7
+ import { a as h, i as g, n as _, o as v, t as y } from "./invoice.service-DEEA9mal.js";
8
+ import { n as b } from "./address.transformer-jGddczLV.js";
9
+ import { n as x, t as ee } from "./download.util-B5Q7KUC9.js";
10
+ import { $ as te, E as ne, F as re, H as ie, I as ae, K as oe, L as se, N as ce, T as le, X as ue, _ as de, at as fe, ct as S, f as pe, g as me, h as he, i as ge, j as _e, k as ve, l as ye, rt as be, t as C, y as w, z as xe } from "./dist-Cxdm09Lp.js";
11
+ import { n as T, t as Se } from "./dist-boJIIxnT.js";
12
+ import { t as E } from "./formango.util-D5c2ql--.js";
13
+ import { n as D, t as Ce } from "./invoiceApprovalStatus.util-3Zh10Pj8.js";
14
+ import { i as O, n as k, r as we } from "./CustomFieldValueText-CZQXGE5F.js";
15
+ import { n as Te, r as Ee, t as De } from "./InvoiceApprovalStatusBadge-U-dW2hR4.js";
16
+ import { i as Oe, n as ke, r as Ae, t as je } from "./invoiceDeliveryStatus.util-nCsqDypY.js";
17
+ import { t as Me } from "./issuerSettings.query-Dc5gsaEm.js";
18
+ import { C as Ne, S as Pe, _ as Fe, a as Ie, b as Le, c as Re, d as ze, f as Be, g as Ve, h as He, i as Ue, l as We, m as Ge, n as Ke, o as qe, p as Je, r as Ye, s as Xe, t as Ze, u as Qe, v as $e, x as et, y as tt } from "./BillingDocumentDetailViewDataProvider-DDdtlW-2.js";
19
+ import { r as nt } from "./InvoicingFileUploadProvider-D9Xk4rQM.js";
20
+ import { a as rt, i as it, n as at, r as ot, t as st } from "./InvoiceApproveDialog-2LXneG2r.js";
21
+ import { t as ct } from "./invoiceDetail.query-CRoH_SgM.js";
22
+ import lt, { z as A } from "zod";
23
+ import { useI18n as j } from "vue-i18n";
24
+ import { Fragment as ut, computed as M, createBlock as N, createCommentVNode as P, createElementBlock as F, createElementVNode as I, createSlots as dt, createTextVNode as ft, createVNode as L, defineComponent as R, mergeModels as pt, mergeProps as z, normalizeClass as mt, openBlock as B, ref as ht, renderList as gt, resolveDynamicComponent as _t, toDisplayString as V, unref as H, useModel as vt, watch as yt, withCtx as U } from "vue";
25
+ import { ApiErrorUtil as bt, useKeysetInfiniteQuery as xt, useMutation as W, useOffsetInfiniteQuery as St, useQuery as Ct } from "@wisemen/vue-core-api-utils";
26
+ import { RouterLink as wt, useRouter as Tt } from "vue-router";
27
+ import { Temporal as Et } from "temporal-polyfill";
28
+ import { UIAutocomplete as Dt, UIBadge as Ot, UIBadgeLabel as kt, UIBadgeSeparator as At, UIButton as jt, UICheckbox as Mt, UIClickableElement as Nt, UIColumnLayout as Pt, UIConfirmDialog as Ft, UIDateField as It, UIDetailList as Lt, UIDetailListGroup as Rt, UIDetailListGroupItem as G, UIDetailListGroupItemLabel as K, UIDetailListGroupItemValueText as q, UIDetailListGroupSeparator as zt, UIDialog as Bt, UIDialogBody as Vt, UIDialogFooter as J, UIDialogFooterCancel as Ht, UIDialogFooterSubmit as Ut, UIDialogHeader as Y, UIForm as Wt, UIFormDialog as Gt, UIFormFieldGrid as Kt, UIFormFieldGroup as qt, UIFormSubmitButton as Jt, UIIconButton as Yt, UINumberField as Xt, UIRowLayout as Zt, UISelect as Qt, UITable as $t, UITableCell as en, UITableCellInteractiveElement as tn, UIText as X, UITextField as nn, UITooltip as rn, UITooltipContent as an, createAutocompleteOptions as on, createComponent as Z, createSelectOptions as sn, defineTableColumns as cn, useOverlay as ln, useToast as Q } from "@wisemen/vue-core-design-system";
29
+ import { useForm as $ } from "formango";
30
+ //#region src/modules/invoice/use-cases/detail/components/InvoiceApprovalBanner.vue?vue&type=script&setup=true&lang.ts
31
+ var un = { class: "flex min-w-0 flex-1 flex-col gap-lg" }, dn = { class: "flex flex-col gap-xs pr-4xl" }, fn = {
32
+ key: 0,
33
+ class: "text-xs text-tertiary"
34
+ }, pn = {
35
+ key: 0,
36
+ class: "flex flex-wrap items-center gap-lg"
37
+ }, mn = {
38
+ key: 0,
39
+ class: "absolute top-(--spacing-sm) right-(--spacing-sm) flex items-center gap-xxs rounded-full bg-error-solid px-sm py-xxs"
40
+ }, hn = /* @__PURE__ */ R({
41
+ __name: "InvoiceApprovalBanner",
42
+ props: {
43
+ isOutOfSync: { type: Boolean },
44
+ approval: {},
45
+ proFormaFile: {},
46
+ rejection: {}
47
+ },
48
+ emits: [
49
+ "revertChanges",
50
+ "sendNewRequest",
51
+ "viewProForma"
52
+ ],
53
+ setup(e, { emit: t }) {
54
+ let n = e, r = t, i = j(), a = T(), o = M(() => n.approval?.sentAt ?? null), c = M(() => o.value !== null), l = M(() => n.approval?.status === s.REJECTED), u = M(() => o.value === null ? "" : a.toDate(o.value)), d = M(() => l.value ? "error" : n.isOutOfSync ? "warning" : "info"), f = M(() => n.isOutOfSync ? i.t("wise_invoicing.invoice.approval_banner.out_of_sync", { date: u.value }) : i.t("wise_invoicing.invoice.approval_banner.sent", { date: u.value })), p = M(() => {
55
+ if (n.isOutOfSync) return i.t("wise_invoicing.invoice.approval_banner.out_of_sync_supporting");
56
+ if (!l.value || n.rejection === null) return null;
57
+ let e = i.t(Ce.getRejectionReasonTranslationKey(n.rejection.reason));
58
+ return i.t("wise_invoicing.invoice.approval_banner.rejected_reason", { reason: n.rejection.remark === null ? e : `${e} — ${n.rejection.remark}` });
59
+ }), m = M(() => l.value || n.approval?.status !== s.REQUESTED ? null : n.approval.level), h = M(() => {
60
+ let e = m.value;
61
+ return e === null ? "" : i.t(Ce.getReminderLevelTranslationKey(e));
62
+ }), g = M(() => {
63
+ let e = n.approval?.reminderSentAt ?? null;
64
+ return m.value === null || e === null ? null : i.t("wise_invoicing.invoice.approval_banner.last_reminder_sent", { time: a.toRelativeTime(e) });
65
+ }), _ = M(() => ({
66
+ error: "border-error-subtle bg-error-primary",
67
+ info: "border-primary bg-primary-alt",
68
+ warning: "border-warning-300 bg-warning-primary"
69
+ })[d.value]), v = M(() => ({
70
+ error: "rounded-full bg-error-secondary",
71
+ info: "rounded-lg border border-primary bg-primary shadow-xs",
72
+ warning: "rounded-full bg-warning-secondary"
73
+ })[d.value]), y = M(() => ({
74
+ error: "text-error-primary",
75
+ info: "text-tertiary",
76
+ warning: "text-warning-primary"
77
+ })[d.value]), b = M(() => d.value === "info" ? S : ie), x = M(() => ({
78
+ error: "text-error-primary",
79
+ info: "text-brand-secondary",
80
+ warning: "text-tertiary"
81
+ })[d.value]);
82
+ return (e, t) => c.value ? (B(), F("div", {
83
+ key: 0,
84
+ class: mt([_.value, "relative flex items-start gap-xl rounded-xl border p-xl shadow-xs"])
85
+ }, [
86
+ I("span", { class: mt([v.value, "flex size-(--spacing-4xl) shrink-0 items-center justify-center"]) }, [(B(), N(_t(b.value), { class: mt([y.value, "size-(--spacing-xl)"]) }, null, 8, ["class"]))], 2),
87
+ I("div", un, [I("div", dn, [L(H(X), {
88
+ text: f.value,
89
+ class: "text-xs font-semibold text-secondary"
90
+ }, null, 8, ["text"]), p.value === null ? P("", !0) : (B(), F("p", fn, [ft(V(p.value) + " ", 1), n.proFormaFile !== null && n.isOutOfSync ? (B(), N(H(Nt), { key: 0 }, {
91
+ default: U(() => [I("button", {
92
+ class: mt([x.value, "underline-offset-2 hover:underline"]),
93
+ type: "button",
94
+ onClick: t[0] ||= (e) => r("viewProForma")
95
+ }, V(H(i).t("wise_invoicing.invoice.approval_banner.view_pro_forma")), 3)]),
96
+ _: 1
97
+ })) : P("", !0)]))]), n.isOutOfSync || n.proFormaFile !== null ? (B(), F("div", pn, [n.isOutOfSync ? (B(), F(ut, { key: 0 }, [L(H(Nt), null, {
98
+ default: U(() => [I("button", {
99
+ class: "text-xs font-semibold text-tertiary underline-offset-2 hover:underline",
100
+ type: "button",
101
+ onClick: t[1] ||= (e) => r("revertChanges")
102
+ }, V(H(i).t("wise_invoicing.invoice.approval_banner.revert_changes")), 1)]),
103
+ _: 1
104
+ }), L(H(Nt), null, {
105
+ default: U(() => [I("button", {
106
+ class: "text-xs font-semibold text-warning-primary underline-offset-2 hover:underline",
107
+ type: "button",
108
+ onClick: t[2] ||= (e) => r("sendNewRequest")
109
+ }, V(H(i).t("wise_invoicing.invoice.approval_banner.send_new_request")), 1)]),
110
+ _: 1
111
+ })], 64)) : n.proFormaFile === null ? P("", !0) : (B(), N(H(Nt), { key: 1 }, {
112
+ default: U(() => [I("button", {
113
+ class: mt([x.value, "text-xs font-semibold underline-offset-2 hover:underline"]),
114
+ type: "button",
115
+ onClick: t[3] ||= (e) => r("viewProForma")
116
+ }, V(H(i).t("wise_invoicing.invoice.approval_banner.view_pro_forma")), 3)]),
117
+ _: 1
118
+ }))])) : P("", !0)]),
119
+ l.value ? (B(), F("span", mn, [L(H(xe), { class: "size-(--spacing-lg) shrink-0 text-white" }), L(H(X), {
120
+ text: H(i).t("wise_invoicing.invoice.approval_status.rejected"),
121
+ class: "text-xs text-white"
122
+ }, null, 8, ["text"])])) : m.value !== null && g.value !== null ? (B(), N(H(rn), {
123
+ key: 1,
124
+ "popover-side-offset": 8,
125
+ class: "absolute top-(--spacing-sm) right-(--spacing-sm)",
126
+ "popover-align": "center",
127
+ "popover-side": "bottom"
128
+ }, {
129
+ trigger: U(() => [L(Te, {
130
+ icon: void 0,
131
+ label: h.value,
132
+ level: m.value,
133
+ size: "sm",
134
+ tone: "warning"
135
+ }, null, 8, ["label", "level"])]),
136
+ content: U(() => [L(H(an), null, {
137
+ default: U(() => [L(H(X), {
138
+ text: g.value,
139
+ class: "text-sm text-primary"
140
+ }, null, 8, ["text"])]),
141
+ _: 1
142
+ })]),
143
+ _: 1
144
+ })) : m.value === null ? P("", !0) : (B(), N(Te, {
145
+ key: 2,
146
+ icon: void 0,
147
+ label: h.value,
148
+ level: m.value,
149
+ class: "absolute top-(--spacing-sm) right-(--spacing-sm)",
150
+ size: "sm",
151
+ tone: "warning"
152
+ }, null, 8, ["label", "level"]))
153
+ ], 2)) : P("", !0);
154
+ }
155
+ });
156
+ //#endregion
157
+ //#region src/modules/invoice/api/mutations/invoiceUpdate.mutation.ts
158
+ function gn() {
159
+ return W({
160
+ queryFn: (e) => y.update(e.params.invoiceUuid, e.body),
161
+ queryKeysToInvalidate: {
162
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
163
+ invoiceIndex: {}
164
+ }
165
+ });
166
+ }
167
+ //#endregion
168
+ //#region src/modules/invoice/components/InvoiceDeliveryStatusBadge.vue
169
+ var _n = /* @__PURE__ */ R({
170
+ __name: "InvoiceDeliveryStatusBadge",
171
+ props: {
172
+ deliveryStatus: {},
173
+ size: { default: "sm" }
174
+ },
175
+ setup(e) {
176
+ let t = e, n = j(), r = M(() => je.getMetadata(t.deliveryStatus)), i = M(() => n.t(r.value.translationKey));
177
+ return (e, n) => (B(), N(H(Ot), {
178
+ label: i.value,
179
+ color: r.value.tone,
180
+ size: t.size,
181
+ variant: "translucent"
182
+ }, null, 8, [
183
+ "label",
184
+ "color",
185
+ "size"
186
+ ]));
187
+ }
188
+ }), vn = A.string().nullable(), yn = A.object({ subject: vn }), bn = /* @__PURE__ */ R({
189
+ __name: "InvoiceDetailHeaderSection",
190
+ props: {
191
+ isDisputed: { type: Boolean },
192
+ isPdfViewActive: { type: Boolean },
193
+ invoice: {},
194
+ menuGroups: {},
195
+ primaryButtons: {}
196
+ },
197
+ emits: ["togglePdfView"],
198
+ setup(e, { emit: t }) {
199
+ let n = e, r = t, a = j(), o = Q(), s = gn(), c = M(() => new Pe(n.invoice.status)), l = M(() => c.value.color), u = M(() => a.t(c.value.translationKey)), d = M(() => n.invoice.deliveryStatus !== i.UNSENT), f = M(() => je.isSent(n.invoice.deliveryStatus)), p = M(() => !k.isEditable(n.invoice.status)), m = $({
200
+ initialState: { subject: n.invoice.subject },
201
+ schema: yn,
202
+ onSubmit: async (e) => {
203
+ let t = await s.execute({
204
+ body: {
205
+ ..._.toForm(n.invoice),
206
+ subject: e.subject
207
+ },
208
+ params: { invoiceUuid: n.invoice.uuid }
209
+ });
210
+ t.isErr() && o.apiError(t.error);
211
+ }
212
+ }), h = m.register("subject");
213
+ return Ne({ form: m }), (e, t) => (B(), N(H(Wt), {
214
+ form: H(m),
215
+ "prompt-on-unsaved-changes": !1
216
+ }, {
217
+ default: U(() => [L($e, {
218
+ "fallback-title": H(a).t("wise_invoicing.invoice.detail.fallback_title"),
219
+ "is-disabled": p.value,
220
+ sequence: n.invoice.sequence,
221
+ "status-color": l.value,
222
+ "status-label": u.value,
223
+ icon: H(ie),
224
+ "subject-field": H(h),
225
+ "subject-placeholder": H(a).t("wise_invoicing.invoice.detail.header.subject_placeholder")
226
+ }, {
227
+ actions: U(() => [L(Fe, {
228
+ "is-pdf-view-active": n.isPdfViewActive,
229
+ "menu-groups": n.menuGroups,
230
+ "primary-buttons": n.primaryButtons,
231
+ onTogglePdfView: t[0] ||= (e) => r("togglePdfView")
232
+ }, null, 8, [
233
+ "is-pdf-view-active",
234
+ "menu-groups",
235
+ "primary-buttons"
236
+ ])]),
237
+ status: U(() => [L(H(Zt), {
238
+ gap: "xs",
239
+ class: "flex-wrap items-start"
240
+ }, {
241
+ default: U(() => [
242
+ L(Ae, { "lifecycle-status": n.invoice.lifecycleStatus }, null, 8, ["lifecycle-status"]),
243
+ L(ke, {
244
+ "is-sent": f.value,
245
+ "balance-due-amount": n.invoice.balanceDueAmount,
246
+ "gross-amount": n.invoice.grossAmount,
247
+ "paid-amount": n.invoice.paidAmount,
248
+ "settlement-status": n.invoice.settlementStatus,
249
+ "total-credited-amount": n.invoice.totalCreditedAmount
250
+ }, null, 8, [
251
+ "is-sent",
252
+ "balance-due-amount",
253
+ "gross-amount",
254
+ "paid-amount",
255
+ "settlement-status",
256
+ "total-credited-amount"
257
+ ]),
258
+ n.invoice.isOverdue ? (B(), N(tt, { key: 0 })) : P("", !0),
259
+ n.isDisputed ? (B(), N(Oe, { key: 1 })) : P("", !0),
260
+ d.value ? (B(), N(_n, {
261
+ key: 2,
262
+ "delivery-status": n.invoice.deliveryStatus
263
+ }, null, 8, ["delivery-status"])) : P("", !0),
264
+ L(De, {
265
+ approval: n.invoice.approval,
266
+ rejection: n.invoice.rejection,
267
+ "requires-prior-approval": n.invoice.requiresPriorApproval
268
+ }, null, 8, [
269
+ "approval",
270
+ "rejection",
271
+ "requires-prior-approval"
272
+ ])
273
+ ]),
274
+ _: 1
275
+ })]),
276
+ _: 1
277
+ }, 8, [
278
+ "fallback-title",
279
+ "is-disabled",
280
+ "sequence",
281
+ "status-color",
282
+ "status-label",
283
+ "icon",
284
+ "subject-field",
285
+ "subject-placeholder"
286
+ ])]),
287
+ _: 1
288
+ }, 8, ["form"]));
289
+ }
290
+ }), xn = { class: "grid w-full grid-cols-1 gap-md lg:grid-cols-3" }, Sn = /* @__PURE__ */ R({
291
+ __name: "InvoiceDetailLinkedCreditNotesSection",
292
+ props: { invoice: {} },
293
+ setup(e) {
294
+ let t = e, n = j(), r = f(), i = M(() => t.invoice.creditNotes.map((e) => {
295
+ let t = new Pe(e.status);
296
+ return {
297
+ uuid: e.uuid,
298
+ title: e.sequence === null ? n.t("wise_invoicing.invoice.detail.credit_notes.untitled") : n.t("wise_invoicing.invoice.detail.credit_notes.card_title", { sequence: e.sequence }),
299
+ amountLabel: r.formatMonetary(a(e)),
300
+ statusColor: t.color,
301
+ statusLabel: n.t(t.translationKey)
302
+ };
303
+ }));
304
+ function a(e) {
305
+ return {
306
+ ...e.grossAmount,
307
+ amount: e.grossAmount.amount > 0 ? -e.grossAmount.amount : e.grossAmount.amount
308
+ };
309
+ }
310
+ return (e, t) => i.value.length > 0 ? (B(), N(H(Pt), {
311
+ key: 0,
312
+ as: "section",
313
+ gap: "md",
314
+ class: "w-full"
315
+ }, {
316
+ default: U(() => [L(H(X), {
317
+ text: H(n).t("wise_invoicing.invoice.detail.credit_notes.title"),
318
+ as: "h2",
319
+ class: "text-sm font-semibold text-primary"
320
+ }, null, 8, ["text"]), I("div", xn, [(B(!0), F(ut, null, gt(i.value, (e) => (B(), N(H(wt), {
321
+ key: e.uuid,
322
+ to: {
323
+ name: "invoicing-credit-note-detail",
324
+ params: { creditNoteUuid: e.uuid }
325
+ },
326
+ class: "min-w-0 rounded-lg border border-secondary bg-primary p-lg transition-colors hover:bg-secondary"
327
+ }, {
328
+ default: U(() => [L(H(Zt), {
329
+ align: "center",
330
+ gap: "md",
331
+ class: "min-w-0"
332
+ }, {
333
+ default: U(() => [
334
+ L(H(X), {
335
+ text: e.title,
336
+ class: "min-w-0 flex-1 truncate text-xs font-semibold text-primary"
337
+ }, null, 8, ["text"]),
338
+ L(H(Ot), {
339
+ label: e.statusLabel,
340
+ color: e.statusColor,
341
+ size: "sm",
342
+ variant: "translucent"
343
+ }, null, 8, ["label", "color"]),
344
+ L(H(Ot), {
345
+ label: e.amountLabel,
346
+ variant: "translucent",
347
+ size: "sm"
348
+ }, null, 8, ["label"])
349
+ ]),
350
+ _: 2
351
+ }, 1024)]),
352
+ _: 2
353
+ }, 1032, ["to"]))), 128))])]),
354
+ _: 1
355
+ })) : P("", !0);
356
+ }
357
+ }), Cn = A.object({
358
+ deliveredOn: Se.nullable(),
359
+ dueOn: Se,
360
+ issuedOn: Se,
361
+ customFields: A.array(A.custom()),
362
+ externalRemarks: A.string().nullable(),
363
+ poNumber: A.string().nullable(),
364
+ preparedBy: A.object({
365
+ uuid: A.uuid(),
366
+ name: A.string()
367
+ }),
368
+ subject: A.string().nullable()
369
+ }).superRefine((t, n) => {
370
+ Temporal.PlainDate.compare(t.dueOn, t.issuedOn) < 0 && n.addIssue({
371
+ code: "custom",
372
+ message: e.global.t("invoicing.invoice.validation.due_date_after_issue_date"),
373
+ path: ["dueOn"]
374
+ });
375
+ }), wn = /* @__PURE__ */ R({
376
+ __name: "InvoiceDetailRemarksSection",
377
+ props: { invoice: {} },
378
+ setup(e) {
379
+ let t = e, n = j(), r = Q(), i = gn(), a = $({
380
+ initialState: M(() => _.toForm(t.invoice)),
381
+ schema: Cn,
382
+ onSubmit: async (e) => {
383
+ let n = await i.execute({
384
+ body: e,
385
+ params: { invoiceUuid: t.invoice.uuid }
386
+ });
387
+ n.isErr() && r.apiError(n.error);
388
+ }
389
+ }), o = a.register("externalRemarks"), s = M(() => !k.isEditable(t.invoice.status));
390
+ return Ne({ form: a }), (e, t) => (B(), N(H(Wt), {
391
+ form: H(a),
392
+ "prompt-on-unsaved-changes": !1
393
+ }, {
394
+ default: U(() => [L(Ve, {
395
+ "is-disabled": s.value,
396
+ placeholder: H(n).t("wise_invoicing.invoice.detail.remarks.placeholder"),
397
+ "remarks-field": H(o),
398
+ title: H(n).t("wise_invoicing.invoice.detail.remarks.title")
399
+ }, null, 8, [
400
+ "is-disabled",
401
+ "placeholder",
402
+ "remarks-field",
403
+ "title"
404
+ ])]),
405
+ _: 1
406
+ }, 8, ["form"]));
407
+ }
408
+ });
409
+ //#endregion
410
+ //#region src/modules/invoice/api/queries/invoiceActivityLogIndex.query.ts
411
+ function Tn(e) {
412
+ return xt("invoiceActivityLogIndex", {
413
+ params: { invoiceUuid: e },
414
+ queryFn: (t) => y.getActivityLogs(e.value, { pagination: t })
415
+ });
416
+ }
417
+ //#endregion
418
+ //#region src/modules/invoice/use-cases/detail/components/sidebar/InvoiceDetailSidebarActivityTab.vue
419
+ var En = /* @__PURE__ */ R({
420
+ __name: "InvoiceDetailSidebarActivityTab",
421
+ props: { invoice: {} },
422
+ setup(e) {
423
+ let t = e, n = j(), { hasNextPage: r, isFetchingNextPage: i, isLoading: a, fetchNextPage: o, result: s } = Tn(M(() => t.invoice.uuid)), l = M(() => s.value.unwrapOr({
424
+ data: [],
425
+ meta: { next: null }
426
+ }).data);
427
+ return (e, s) => (B(), N(He, {
428
+ "current-billing-document": {
429
+ role: H(c).INVOICE,
430
+ uuid: t.invoice.uuid
431
+ },
432
+ "empty-message": H(n).t("wise_invoicing.invoice.detail.sidebar.activity_empty"),
433
+ entries: l.value,
434
+ "fetch-next-page": H(o),
435
+ "has-next-page": H(r),
436
+ "is-fetching-next-page": H(i),
437
+ "is-loading": H(a)
438
+ }, null, 8, [
439
+ "current-billing-document",
440
+ "empty-message",
441
+ "entries",
442
+ "fetch-next-page",
443
+ "has-next-page",
444
+ "is-fetching-next-page",
445
+ "is-loading"
446
+ ]));
447
+ }
448
+ }), Dn = /* @__PURE__ */ R({
449
+ __name: "CustomFieldFieldset",
450
+ props: /*@__PURE__*/ pt({
451
+ isDisabled: { type: Boolean },
452
+ currency: {},
453
+ definitions: {},
454
+ precision: {},
455
+ size: {}
456
+ }, {
457
+ modelValue: { required: !0 },
458
+ modelModifiers: {}
459
+ }),
460
+ emits: ["update:modelValue"],
461
+ setup(e) {
462
+ let t = e, n = vt(e, "modelValue");
463
+ function r(e) {
464
+ return x.findByDefinition(n.value, e);
465
+ }
466
+ function i(e, t) {
467
+ n.value = x.upsert(n.value, e, t);
468
+ }
469
+ return (e, n) => t.definitions.length > 0 ? (B(), N(H(Pt), {
470
+ key: 0,
471
+ gap: t.size === "sm" ? "xs" : "md",
472
+ align: "stretch"
473
+ }, {
474
+ default: U(() => [(B(!0), F(ut, null, gt(t.definitions, (e) => (B(), N(We, {
475
+ key: e.uuid,
476
+ currency: t.currency,
477
+ definition: e,
478
+ "is-disabled": t.isDisabled,
479
+ "model-value": r(e.uuid),
480
+ precision: t.precision,
481
+ size: t.size,
482
+ "onUpdate:modelValue": (t) => i(e.uuid, t)
483
+ }, null, 8, [
484
+ "currency",
485
+ "definition",
486
+ "is-disabled",
487
+ "model-value",
488
+ "precision",
489
+ "size",
490
+ "onUpdate:modelValue"
491
+ ]))), 128))]),
492
+ _: 1
493
+ }, 8, ["gap"])) : P("", !0);
494
+ }
495
+ });
496
+ //#endregion
497
+ //#region src/modules/invoice/api/queries/invoiceCustomerDetail.query.ts
498
+ function On(e) {
499
+ return Ct("invoiceCustomerDetail", {
500
+ params: { customerUuid: e },
501
+ queryFn: () => Ee.getByUuid(e.value)
502
+ });
503
+ }
504
+ //#endregion
505
+ //#region src/modules/invoice/models/invoice/update/invoicePreparer.transformer.ts
506
+ var kn = class {
507
+ static fromDto(e) {
508
+ let t = `${e.firstName ?? ""} ${e.lastName ?? ""}`.trim();
509
+ return {
510
+ uuid: e.uuid,
511
+ name: t === "" ? e.email ?? e.uuid : t
512
+ };
513
+ }
514
+ }, An = class {
515
+ static toDto(e) {
516
+ return {
517
+ pagination: e.pagination,
518
+ search: v.toDto(e.search)
519
+ };
520
+ }
521
+ }, jn = class {
522
+ static async getAll(e) {
523
+ return (await n.fromPromise(t({ query: An.toDto(e) }))).map((e) => ({
524
+ data: e.data.items.map(kn.fromDto),
525
+ meta: e.data.meta
526
+ }));
527
+ }
528
+ };
529
+ //#endregion
530
+ //#region src/modules/invoice/api/queries/invoiceUserSearch.query.ts
531
+ function Mn(e) {
532
+ let t = M(() => ({ search: e.params.search?.value }));
533
+ return St("invoiceUserSearch", {
534
+ params: { queryParams: t },
535
+ queryFn: (t) => jn.getAll({
536
+ pagination: t,
537
+ search: e.params.search?.value ?? ""
538
+ })
539
+ });
540
+ }
541
+ //#endregion
542
+ //#region src/modules/invoice/components/form/InvoiceFormPreparedByField.vue
543
+ var Nn = /* @__PURE__ */ R({
544
+ __name: "InvoiceFormPreparedByField",
545
+ props: {
546
+ isLoading: { type: Boolean },
547
+ field: {},
548
+ users: {}
549
+ },
550
+ emits: ["nextPage", "updateSearch"],
551
+ setup(e, { emit: t }) {
552
+ let n = e, r = t, i = j(), a = M(() => on(n.users));
553
+ function o(e) {
554
+ return e.name;
555
+ }
556
+ function s(e) {
557
+ e !== null && (n.field.setValue(e), r("updateSearch", ""));
558
+ }
559
+ return (e, t) => (B(), N(H(Dt), z(H(E)(n.field), {
560
+ "display-fn": o,
561
+ "is-loading": n.isLoading,
562
+ "is-required": !0,
563
+ items: a.value,
564
+ label: H(i).t("wise_invoicing.invoice.detail.header.created_by"),
565
+ placeholder: H(i).t("component.autocomplete.search_placeholder"),
566
+ "search-mode": "remote",
567
+ onNextPage: t[0] ||= (e) => r("nextPage"),
568
+ "onUpdate:modelValue": s,
569
+ "onUpdate:search": t[1] ||= (e) => r("updateSearch", e)
570
+ }), null, 16, [
571
+ "is-loading",
572
+ "items",
573
+ "label",
574
+ "placeholder"
575
+ ]));
576
+ }
577
+ }), Pn = /* @__PURE__ */ R({
578
+ __name: "InvoiceUpdateDialog",
579
+ props: {
580
+ customFieldDefinitions: {},
581
+ invoice: {}
582
+ },
583
+ emits: ["close"],
584
+ setup(e, { emit: t }) {
585
+ let n = e, r = t, i = j(), a = Q(), o = gn(), s = Me(), c = p(), l = m({ debounceMs: 250 }), u = Mn({ params: { search: l.debouncedSearch } }), d = M(() => u.result.value.match({
586
+ err: () => [],
587
+ loading: () => [],
588
+ ok: (e) => e.data
589
+ })), f = On(M(() => n.invoice.customer.uuid)), h = M(() => {
590
+ let e = f.result.value;
591
+ if (e.isOk()) return e.getValue().defaultPaymentTermDays;
592
+ let t = s.result.value;
593
+ return t.isOk() ? t.getValue().defaultPaymentTermDays ?? 0 : 0;
594
+ }), g = $({
595
+ initialState: M(() => _.toForm(n.invoice)),
596
+ schema: Cn,
597
+ onSubmit: async (e) => {
598
+ let t = await o.execute({
599
+ body: e,
600
+ params: { invoiceUuid: n.invoice.uuid }
601
+ });
602
+ if (t.isErr()) {
603
+ a.apiError(t.error);
604
+ return;
605
+ }
606
+ r("close");
607
+ },
608
+ onSubmitError: () => {
609
+ a.unableToSave();
610
+ }
611
+ }), v = g.register("issuedOn"), y = g.register("dueOn"), b = g.register("deliveredOn"), x = g.register("poNumber"), ee = g.register("preparedBy"), te = g.register("subject"), ne = g.register("customFields"), re = M({
612
+ get: () => ne.modelValue.value ?? [],
613
+ set: (e) => {
614
+ ne.setValue(e);
615
+ }
616
+ });
617
+ function ie(e) {
618
+ e !== null && y.setValue(e.add({ days: h.value }));
619
+ }
620
+ function ae(e) {
621
+ l.updateSearch(e);
622
+ }
623
+ return (e, t) => (B(), N(H(Gt), {
624
+ form: H(g),
625
+ size: "sm",
626
+ onClose: t[1] ||= (e) => r("close")
627
+ }, {
628
+ default: U(() => [
629
+ L(H(Y), {
630
+ icon: H(be),
631
+ "is-description-hidden": !0,
632
+ title: H(i).t("wise_invoicing.invoice.detail.header.edit_info"),
633
+ description: ""
634
+ }, null, 8, ["icon", "title"]),
635
+ L(H(Vt), null, {
636
+ default: U(() => [L(H(qt), null, {
637
+ default: U(() => [L(H(Kt), {
638
+ lg: 2,
639
+ sm: 1
640
+ }, {
641
+ default: U(() => [
642
+ L(H(It), z(H(E)(H(v)), {
643
+ label: H(i).t("wise_invoicing.invoice.detail.header.invoice_date"),
644
+ "is-required": !0,
645
+ "onUpdate:modelValue": ie
646
+ }), null, 16, ["label"]),
647
+ L(H(It), z(H(E)(H(y)), {
648
+ label: H(i).t("wise_invoicing.invoice.detail.header.due_date"),
649
+ "is-required": !0,
650
+ "min-date": H(v).modelValue.value
651
+ }), null, 16, ["label", "min-date"]),
652
+ H(c).isDeliveryDateVisible.value ? (B(), N(H(It), z({ key: 0 }, H(E)(H(b)), { label: H(i).t("wise_invoicing.invoice.detail.header.delivery_date") }), null, 16, ["label"])) : P("", !0),
653
+ L(Nn, {
654
+ field: H(ee),
655
+ "is-loading": H(u).isLoading.value,
656
+ users: d.value,
657
+ onNextPage: H(u).fetchNextPage,
658
+ onUpdateSearch: ae
659
+ }, null, 8, [
660
+ "field",
661
+ "is-loading",
662
+ "users",
663
+ "onNextPage"
664
+ ]),
665
+ L(H(nn), z(H(E)(H(x)), { label: H(i).t("wise_invoicing.invoice.detail.header.po_number") }), null, 16, ["label"]),
666
+ L(H(nn), z(H(E)(H(te)), {
667
+ label: H(i).t("wise_invoicing.invoice.detail.header.subject"),
668
+ placeholder: H(i).t("wise_invoicing.invoice.detail.header.subject_placeholder")
669
+ }), null, 16, ["label", "placeholder"])
670
+ ]),
671
+ _: 1
672
+ }), L(Dn, {
673
+ modelValue: re.value,
674
+ "onUpdate:modelValue": t[0] ||= (e) => re.value = e,
675
+ currency: n.invoice.currency,
676
+ definitions: n.customFieldDefinitions,
677
+ "is-disabled": !0,
678
+ precision: n.invoice.grossAmount.precision,
679
+ class: "w-full"
680
+ }, null, 8, [
681
+ "modelValue",
682
+ "currency",
683
+ "definitions",
684
+ "precision"
685
+ ])]),
686
+ _: 1
687
+ })]),
688
+ _: 1
689
+ }),
690
+ L(H(J), null, {
691
+ right: U(() => [L(H(Ht), { label: "cancel" }), L(H(Ut), { label: H(i).t("wise_invoicing.invoice.detail.header.edit_info") }, null, 8, ["label"])]),
692
+ _: 1
693
+ })
694
+ ]),
695
+ _: 1
696
+ }, 8, ["form"]));
697
+ }
698
+ }), Fn = /* @__PURE__ */ R({
699
+ __name: "InvoiceDetailSidebarInfoTab",
700
+ props: {
701
+ customFieldDefinitions: {},
702
+ invoice: {}
703
+ },
704
+ setup(e) {
705
+ let t = e, n = j(), r = T(), i = p(), o = ln().create(Pn), s = M(() => k.isEditable(t.invoice.status)), c = M(() => we.filterByEntityType(t.customFieldDefinitions, a.INVOICE)), l = M(() => {
706
+ if (!t.invoice.isOverdue) return null;
707
+ let e = t.invoice.dueOn.toZonedDateTime(Et.Now.timeZoneId()).toInstant();
708
+ return r.toRelativeTime(e);
709
+ });
710
+ async function u() {
711
+ await o.open({
712
+ customFieldDefinitions: c.value,
713
+ invoice: t.invoice
714
+ });
715
+ }
716
+ function d(e) {
717
+ return e === null ? "-" : r.formatPlainDate(e);
718
+ }
719
+ return (e, r) => (B(), N(H(Lt), { class: "px-2xl py-xl" }, {
720
+ default: U(() => [
721
+ L(H(Rt), { label: H(n).t("wise_invoicing.invoice.detail.sidebar.general") }, dt({
722
+ default: U(() => [
723
+ L(H(G), null, {
724
+ default: U(() => [L(H(K), {
725
+ icon: H(he),
726
+ label: H(n).t("wise_invoicing.invoice.detail.header.invoice_id")
727
+ }, null, 8, ["icon", "label"]), L(H(q), { text: t.invoice.sequence ?? "-" }, null, 8, ["text"])]),
728
+ _: 1
729
+ }),
730
+ L(H(G), null, {
731
+ default: U(() => [L(H(K), {
732
+ icon: H(re),
733
+ label: H(n).t("wise_invoicing.invoice.detail.header.po_number")
734
+ }, null, 8, ["icon", "label"]), L(H(q), { text: t.invoice.poNumber ?? "-" }, null, 8, ["text"])]),
735
+ _: 1
736
+ }),
737
+ L(H(G), null, {
738
+ default: U(() => [L(H(K), {
739
+ icon: H(ye),
740
+ label: H(n).t("wise_invoicing.invoice.detail.header.issuer")
741
+ }, null, 8, ["icon", "label"]), L(H(q), { text: t.invoice.issuer.name ?? "-" }, null, 8, ["text"])]),
742
+ _: 1
743
+ }),
744
+ L(H(G), null, {
745
+ default: U(() => [L(H(K), {
746
+ icon: H(ie),
747
+ label: H(n).t("wise_invoicing.invoice.detail.header.invoice_date")
748
+ }, null, 8, ["icon", "label"]), L(H(q), { text: d(t.invoice.issueOn) }, null, 8, ["text"])]),
749
+ _: 1
750
+ }),
751
+ L(H(G), null, {
752
+ default: U(() => [L(H(K), {
753
+ icon: H(ue),
754
+ label: H(n).t("wise_invoicing.invoice.detail.header.due_date"),
755
+ variant: t.invoice.isOverdue ? "error" : "default"
756
+ }, null, 8, [
757
+ "icon",
758
+ "label",
759
+ "variant"
760
+ ]), L(H(Zt), { gap: "xs" }, {
761
+ default: U(() => [L(H(q), {
762
+ text: d(t.invoice.dueOn),
763
+ variant: t.invoice.isOverdue ? "error" : "default"
764
+ }, null, 8, ["text", "variant"]), l.value === null ? P("", !0) : (B(), N(H(Ot), {
765
+ key: 0,
766
+ label: l.value,
767
+ color: "error",
768
+ size: "sm",
769
+ variant: "translucent"
770
+ }, null, 8, ["label"]))]),
771
+ _: 1
772
+ })]),
773
+ _: 1
774
+ }),
775
+ H(i).isDeliveryDateVisible.value ? (B(), N(H(G), { key: 0 }, {
776
+ default: U(() => [L(H(K), {
777
+ icon: H(S),
778
+ label: H(n).t("wise_invoicing.invoice.detail.header.delivery_date")
779
+ }, null, 8, ["icon", "label"]), L(H(q), { text: d(t.invoice.deliveredOn) }, null, 8, ["text"])]),
780
+ _: 1
781
+ })) : P("", !0),
782
+ L(Ge, {
783
+ definitions: t.customFieldDefinitions,
784
+ values: t.invoice.customFields
785
+ }, null, 8, ["definitions", "values"])
786
+ ]),
787
+ _: 2
788
+ }, [s.value ? {
789
+ name: "actions",
790
+ fn: U(() => [L(H(Yt), {
791
+ icon: H(w),
792
+ label: H(n).t("wise_invoicing.invoice.detail.header.edit_info"),
793
+ variant: "tertiary",
794
+ onClick: u
795
+ }, null, 8, ["icon", "label"])]),
796
+ key: "0"
797
+ } : void 0]), 1032, ["label"]),
798
+ L(Je, { "original-invoice": t.invoice.originalInvoice }, null, 8, ["original-invoice"]),
799
+ L(H(zt)),
800
+ L(H(Rt), {
801
+ label: H(n).t("wise_invoicing.invoice.detail.header.bill_to"),
802
+ "collapse-options": {
803
+ isCollapsible: !0,
804
+ isOpenByDefault: !0,
805
+ badge: { label: t.invoice.customer.name ?? "-" }
806
+ }
807
+ }, {
808
+ default: U(() => [L(H(G), { orientation: "vertical" }, {
809
+ default: U(() => [L(H(X), {
810
+ text: t.invoice.customer.name ?? "-",
811
+ class: "text-xs font-medium"
812
+ }, null, 8, ["text"]), t.invoice.customer.address ? (B(), F(ut, { key: 0 }, [L(H(X), {
813
+ text: H(b).formatLines(t.invoice.customer.address)[0] ?? "",
814
+ class: "text-xs"
815
+ }, null, 8, ["text"]), t.invoice.customer.address ? (B(), N(H(X), {
816
+ key: 0,
817
+ text: H(b).formatLines(t.invoice.customer.address)[1] ?? "",
818
+ class: "text-xs"
819
+ }, null, 8, ["text"])) : P("", !0)], 64)) : P("", !0)]),
820
+ _: 1
821
+ })]),
822
+ _: 1
823
+ }, 8, ["label", "collapse-options"]),
824
+ L(H(zt)),
825
+ L(H(Rt), {
826
+ label: H(n).t("wise_invoicing.invoice.detail.header.bill_from"),
827
+ "collapse-options": {
828
+ isCollapsible: !0,
829
+ isOpenByDefault: !1,
830
+ badge: { label: t.invoice.issuer.email ?? "-" }
831
+ }
832
+ }, {
833
+ default: U(() => [L(H(G), { orientation: "vertical" }, {
834
+ default: U(() => [L(H(K), { label: t.invoice.issuer.email ?? "-" }, null, 8, ["label"]), t.invoice.issuer.address ? (B(), N(H(q), {
835
+ key: 0,
836
+ text: H(b).format(t.invoice.issuer.address)
837
+ }, null, 8, ["text"])) : P("", !0)]),
838
+ _: 1
839
+ })]),
840
+ _: 1
841
+ }, 8, ["label", "collapse-options"])
842
+ ]),
843
+ _: 1
844
+ }));
845
+ }
846
+ }), In = /* @__PURE__ */ R({
847
+ __name: "InvoiceDetailSidebar",
848
+ props: {
849
+ customFieldDefinitions: {},
850
+ invoice: {}
851
+ },
852
+ setup(e) {
853
+ let t = e, n = j(), r = T(), i = M(() => n.t("wise_invoicing.invoice.detail.sidebar.updated_on", { date: r.toDateTime(t.invoice.updatedAt) }));
854
+ return (e, n) => (B(), N(Be, {
855
+ "billing-document": t.invoice,
856
+ "updated-footer": i.value
857
+ }, {
858
+ activity: U(() => [L(En, { invoice: t.invoice }, null, 8, ["invoice"])]),
859
+ info: U(() => [L(Fn, {
860
+ "custom-field-definitions": t.customFieldDefinitions,
861
+ invoice: t.invoice
862
+ }, null, 8, ["custom-field-definitions", "invoice"])]),
863
+ _: 1
864
+ }, 8, ["billing-document", "updated-footer"]));
865
+ }
866
+ });
867
+ //#endregion
868
+ //#region src/modules/invoice/api/mutations/invoicePaymentDelete.mutation.ts
869
+ function Ln() {
870
+ return W({
871
+ queryFn: (e) => y.deletePayment(e.params.invoiceUuid, e.params.paymentUuid),
872
+ queryKeysToInvalidate: {
873
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
874
+ invoicePaymentIndex: { invoiceUuid: (e) => e.invoiceUuid }
875
+ }
876
+ });
877
+ }
878
+ //#endregion
879
+ //#region src/modules/invoice/api/queries/invoicePaymentIndex.query.ts
880
+ function Rn(e) {
881
+ return Ct("invoicePaymentIndex", {
882
+ params: { invoiceUuid: e },
883
+ queryFn: () => y.getPayments(e.value)
884
+ });
885
+ }
886
+ //#endregion
887
+ //#region src/modules/invoice/use-cases/detail/components/table/InvoiceDetailPaymentActionsCell.vue
888
+ var zn = /* @__PURE__ */ R({
889
+ __name: "InvoiceDetailPaymentActionsCell",
890
+ props: {
891
+ payment: {},
892
+ onDelete: { type: Function }
893
+ },
894
+ setup(e) {
895
+ let t = e, n = j();
896
+ return (e, i) => (B(), N(H(en), null, {
897
+ default: U(() => [L(H(tn), null, {
898
+ default: U(() => [t.payment.source === H(r).MANUAL ? (B(), N(H(Yt), {
899
+ key: 0,
900
+ label: H(n).t("wise_invoicing.invoice.detail.payments.delete.title"),
901
+ icon: H(ve),
902
+ size: "sm",
903
+ variant: "tertiary",
904
+ onClick: i[0] ||= (e) => t.onDelete(t.payment)
905
+ }, null, 8, ["label", "icon"])) : P("", !0)]),
906
+ _: 1
907
+ })]),
908
+ _: 1
909
+ }));
910
+ }
911
+ }), Bn = /* @__PURE__ */ R({
912
+ __name: "InvoiceDetailPaymentManualCell",
913
+ props: { payment: {} },
914
+ setup(e) {
915
+ let t = e;
916
+ return (e, n) => (B(), N(H(en), null, {
917
+ default: U(() => [t.payment.source === H(r).MANUAL ? (B(), N(H(ge), {
918
+ key: 0,
919
+ class: "size-4 text-brand-600"
920
+ })) : P("", !0)]),
921
+ _: 1
922
+ }));
923
+ }
924
+ }), Vn = /* @__PURE__ */ R({
925
+ __name: "InvoiceDetailPaymentsTableTextCell",
926
+ props: { text: {} },
927
+ setup(e) {
928
+ let t = e;
929
+ return (e, n) => (B(), N(H(en), null, {
930
+ default: U(() => [L(H(X), {
931
+ text: t.text ?? "-",
932
+ class: "text-sm/5 text-primary"
933
+ }, null, 8, ["text"])]),
934
+ _: 1
935
+ }));
936
+ }
937
+ });
938
+ //#endregion
939
+ //#region src/modules/invoice/use-cases/detail/composables/invoiceDetailPaymentsTableColumns.composable.ts
940
+ function Hn(e) {
941
+ let t = j(), n = T(), r = f();
942
+ return M(() => cn()([
943
+ {
944
+ headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.date"),
945
+ key: "date",
946
+ size: {
947
+ max: "12rem",
948
+ min: "12rem"
949
+ },
950
+ component: (e) => Z(Vn, { text: n.formatPlainDate(e.date) })
951
+ },
952
+ {
953
+ headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.reference"),
954
+ key: "reference",
955
+ size: {
956
+ max: "14rem",
957
+ min: "12rem"
958
+ },
959
+ component: (e) => Z(Vn, { text: e.paymentReference ?? "—" })
960
+ },
961
+ {
962
+ headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.remark"),
963
+ key: "remark",
964
+ size: {
965
+ max: "1fr",
966
+ min: "12rem"
967
+ },
968
+ component: (e) => Z(Vn, { text: e.remarks ?? "—" })
969
+ },
970
+ {
971
+ headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.manual"),
972
+ key: "manual",
973
+ size: {
974
+ max: "6rem",
975
+ min: "6rem"
976
+ },
977
+ component: (e) => Z(Bn, { payment: e })
978
+ },
979
+ {
980
+ headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.amount"),
981
+ key: "amount",
982
+ size: {
983
+ max: "10rem",
984
+ min: "10rem"
985
+ },
986
+ component: (e) => Z(Vn, { text: r.formatMonetary(e.amount) })
987
+ },
988
+ {
989
+ headerLabel: "",
990
+ key: "actions",
991
+ size: {
992
+ max: "5rem",
993
+ min: "5rem"
994
+ },
995
+ component: (t) => Z(zn, {
996
+ payment: t,
997
+ onDelete: e.onDelete
998
+ })
999
+ }
1000
+ ]));
1001
+ }
1002
+ //#endregion
1003
+ //#region src/modules/invoice/api/mutations/invoicePaymentCreate.mutation.ts
1004
+ function Un() {
1005
+ return W({
1006
+ queryFn: (e) => y.createPayment(e.params.invoiceUuid, e.body),
1007
+ queryKeysToInvalidate: {
1008
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1009
+ invoicePaymentIndex: { invoiceUuid: (e) => e.invoiceUuid }
1010
+ }
1011
+ });
1012
+ }
1013
+ //#endregion
1014
+ //#region src/modules/invoice/models/invoice/payment/invoicePaymentCreateForm.model.ts
1015
+ var Wn = A.object({
1016
+ amount: A.number().positive(),
1017
+ currency: A.enum(l),
1018
+ date: g,
1019
+ paymentReference: A.string().nullable(),
1020
+ precision: A.number().int().nonnegative(),
1021
+ remarks: A.string().nullable()
1022
+ }), Gn = { class: "pr-md text-xs text-secondary" }, Kn = /* @__PURE__ */ R({
1023
+ __name: "InvoicePaymentCreateDialog",
1024
+ props: { invoice: {} },
1025
+ emits: ["close"],
1026
+ setup(e, { emit: t }) {
1027
+ let n = e, r = t, i = j(), a = Q(), o = f(), s = Un(), c = M(() => o.getSymbol(n.invoice.grossAmount.currency)), l = $({
1028
+ initialState: {
1029
+ amount: null,
1030
+ currency: n.invoice.grossAmount.currency,
1031
+ date: h.getToday(),
1032
+ paymentReference: null,
1033
+ precision: n.invoice.grossAmount.precision,
1034
+ remarks: null
1035
+ },
1036
+ schema: Wn,
1037
+ onSubmit: async (e) => {
1038
+ let t = await s.execute({
1039
+ body: e,
1040
+ params: { invoiceUuid: n.invoice.uuid }
1041
+ });
1042
+ if (t.isErr()) {
1043
+ a.apiError(t.error);
1044
+ return;
1045
+ }
1046
+ a.show({ message: i.t("wise_invoicing.invoice.detail.payments.create.success") }), r("close");
1047
+ },
1048
+ onSubmitError: () => {
1049
+ a.unableToSave();
1050
+ }
1051
+ }), u = l.register("amount"), d = l.register("date"), p = l.register("paymentReference"), m = l.register("remarks");
1052
+ return (e, t) => (B(), N(H(Gt), {
1053
+ form: H(l),
1054
+ size: "sm",
1055
+ onClose: t[0] ||= (e) => r("close")
1056
+ }, {
1057
+ default: U(() => [
1058
+ L(H(Y), {
1059
+ title: H(i).t("wise_invoicing.invoice.detail.payments.create.title"),
1060
+ description: H(i).t("wise_invoicing.invoice.detail.payments.create.description"),
1061
+ icon: H(le)
1062
+ }, null, 8, [
1063
+ "title",
1064
+ "description",
1065
+ "icon"
1066
+ ]),
1067
+ L(H(Vt), null, {
1068
+ default: U(() => [L(H(qt), null, {
1069
+ default: U(() => [L(H(Kt), {
1070
+ lg: 2,
1071
+ sm: 1
1072
+ }, {
1073
+ default: U(() => [
1074
+ L(H(Xt), z(H(E)(H(u)), {
1075
+ "is-required": !0,
1076
+ label: H(i).t("wise_invoicing.invoice.detail.payments.create.fields.amount"),
1077
+ min: .01,
1078
+ step: .01
1079
+ }), {
1080
+ right: U(() => [I("span", Gn, V(c.value.symbol), 1)]),
1081
+ _: 1
1082
+ }, 16, ["label"]),
1083
+ L(H(It), z(H(E)(H(d)), {
1084
+ "is-required": !0,
1085
+ label: H(i).t("wise_invoicing.invoice.detail.payments.create.fields.date")
1086
+ }), null, 16, ["label"]),
1087
+ L(H(nn), z(H(E)(H(p)), { label: H(i).t("wise_invoicing.invoice.detail.payments.create.fields.reference") }), null, 16, ["label"]),
1088
+ L(H(nn), z(H(E)(H(m)), { label: H(i).t("wise_invoicing.invoice.detail.payments.create.fields.remarks") }), null, 16, ["label"])
1089
+ ]),
1090
+ _: 1
1091
+ })]),
1092
+ _: 1
1093
+ })]),
1094
+ _: 1
1095
+ }),
1096
+ L(H(J), null, {
1097
+ right: U(() => [L(H(Ht), { label: "cancel" }), L(H(Jt), { label: H(i).t("wise_invoicing.invoice.detail.payments.create.submit") }, null, 8, ["label"])]),
1098
+ _: 1
1099
+ })
1100
+ ]),
1101
+ _: 1
1102
+ }, 8, ["form"]));
1103
+ }
1104
+ }), qn = /* @__PURE__ */ R({
1105
+ __name: "InvoiceDetailPaymentsSection",
1106
+ props: { invoice: {} },
1107
+ setup(e) {
1108
+ let t = e, n = j(), r = f(), i = M(() => t.invoice.uuid), a = M(() => t.invoice.balanceDueAmount === null ? null : r.formatMonetary(t.invoice.balanceDueAmount)), { isLoading: o, result: s } = Rn(i), c = ln(), l = Q(), u = c.create(Kn), d = c.create(Ft), p = Ln(), m = M(() => s.value.match({
1109
+ err: () => [],
1110
+ loading: () => [],
1111
+ ok: (e) => e
1112
+ })), h = M(() => s.value.match({
1113
+ err: (e) => e,
1114
+ loading: () => null,
1115
+ ok: () => null
1116
+ })), g = M(() => !k.getMetadata(t.invoice.status).isTerminal);
1117
+ function _() {
1118
+ u.open({ invoice: t.invoice });
1119
+ }
1120
+ function v(e) {
1121
+ d.open({
1122
+ title: n.t("wise_invoicing.invoice.detail.payments.delete.title"),
1123
+ isDestructive: !0,
1124
+ confirmLabel: n.t("wise_invoicing.invoice.detail.payments.delete.submit"),
1125
+ description: n.t("wise_invoicing.invoice.detail.payments.delete.description"),
1126
+ onConfirm: async () => {
1127
+ let r = await p.execute({ params: {
1128
+ invoiceUuid: t.invoice.uuid,
1129
+ paymentUuid: e.uuid
1130
+ } });
1131
+ if (r.isErr()) {
1132
+ l.apiError(r.error);
1133
+ return;
1134
+ }
1135
+ l.show({ message: n.t("wise_invoicing.invoice.detail.payments.delete.success") }), d.close();
1136
+ }
1137
+ });
1138
+ }
1139
+ let y = Hn({ onDelete: v });
1140
+ return (e, t) => (B(), N(qe, null, {
1141
+ default: U(() => [L(H(Zt), {
1142
+ justify: "between",
1143
+ class: "w-full gap-lg border-b border-secondary px-lg py-md"
1144
+ }, {
1145
+ default: U(() => [L(H(Zt), { gap: "sm" }, {
1146
+ default: U(() => [L(H(X), {
1147
+ text: H(n).t("wise_invoicing.invoice.detail.payments.title"),
1148
+ as: "h2",
1149
+ class: "text-sm font-semibold text-primary"
1150
+ }, null, 8, ["text"]), a.value === null ? P("", !0) : (B(), N(H(Ot), {
1151
+ key: 0,
1152
+ color: "gray",
1153
+ size: "sm",
1154
+ variant: "outline"
1155
+ }, {
1156
+ default: U(() => [
1157
+ L(H(kt), { label: H(n).t("wise_invoicing.invoice.detail.payments.balance_due") }, null, 8, ["label"]),
1158
+ L(H(At)),
1159
+ L(H(kt), { label: a.value }, null, 8, ["label"])
1160
+ ]),
1161
+ _: 1
1162
+ }))]),
1163
+ _: 1
1164
+ }), g.value ? (B(), N(H(jt), {
1165
+ key: 0,
1166
+ label: H(n).t("wise_invoicing.invoice.detail.payments.add"),
1167
+ "icon-left": H(oe),
1168
+ size: "sm",
1169
+ onClick: _
1170
+ }, null, 8, ["label", "icon-left"])) : P("", !0)]),
1171
+ _: 1
1172
+ }), L(H($t), {
1173
+ "active-filter-count": 0,
1174
+ columns: H(y),
1175
+ data: m.value,
1176
+ error: h.value,
1177
+ "get-key": (e) => e.uuid,
1178
+ "has-active-search": !1,
1179
+ "header-actions": [],
1180
+ "is-fetching-next-page": !1,
1181
+ "is-loading": H(o)
1182
+ }, null, 8, [
1183
+ "columns",
1184
+ "data",
1185
+ "error",
1186
+ "get-key",
1187
+ "is-loading"
1188
+ ])]),
1189
+ _: 1
1190
+ }));
1191
+ }
1192
+ });
1193
+ //#endregion
1194
+ //#region src/modules/invoice/api/mutations/invoiceUpdateLines.mutation.ts
1195
+ function Jn() {
1196
+ return W({
1197
+ queryFn: (e) => y.updateLines(e.params.invoiceUuid, e.body),
1198
+ queryKeysToInvalidate: { invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid } }
1199
+ });
1200
+ }
1201
+ //#endregion
1202
+ //#region src/modules/invoice/api/mutations/invoiceApplyDiscount.mutation.ts
1203
+ function Yn() {
1204
+ return W({
1205
+ queryFn: (e) => y.applyDiscount(e.params.invoiceUuid, e.body),
1206
+ queryKeysToInvalidate: { invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid } }
1207
+ });
1208
+ }
1209
+ //#endregion
1210
+ //#region src/modules/invoice/models/invoice/update/invoiceApplyDiscountForm.model.ts
1211
+ var Xn = A.object({
1212
+ currency: A.enum(l),
1213
+ precision: A.number().int().nonnegative(),
1214
+ type: A.enum(o),
1215
+ value: A.number()
1216
+ }).refine((e) => e.type !== o.PERCENTAGE || e.value <= 100, { path: ["value"] }), Zn = { class: "pr-md text-xs text-secondary" }, Qn = /* @__PURE__ */ R({
1217
+ __name: "InvoiceApplyDiscountDialog",
1218
+ props: { invoice: {} },
1219
+ emits: ["close"],
1220
+ setup(e, { emit: t }) {
1221
+ let n = e, r = t, i = j(), a = Q(), s = f(), c = Yn(), l = M(() => sn([o.PERCENTAGE, o.AMOUNT])), u = $({
1222
+ initialState: {
1223
+ currency: n.invoice.grossAmount.currency,
1224
+ precision: n.invoice.grossAmount.precision,
1225
+ type: o.PERCENTAGE,
1226
+ value: null
1227
+ },
1228
+ schema: Xn,
1229
+ onSubmit: async (e) => {
1230
+ let t = await c.execute({
1231
+ body: e,
1232
+ params: { invoiceUuid: n.invoice.uuid }
1233
+ });
1234
+ if (t.isErr()) {
1235
+ a.apiError(t.error);
1236
+ return;
1237
+ }
1238
+ r("close");
1239
+ },
1240
+ onSubmitError: () => {
1241
+ a.unableToSave();
1242
+ }
1243
+ }), d = u.register("value"), p = u.register("type"), m = M(() => p.modelValue.value === o.PERCENTAGE), h = M(() => p.modelValue.value === o.AMOUNT), g = M(() => s.getSymbol(n.invoice.grossAmount.currency));
1244
+ function _(e) {
1245
+ return i.t(`wise_invoicing.invoice.detail.global_discount.type.${e}`);
1246
+ }
1247
+ return (e, t) => (B(), N(H(Gt), {
1248
+ form: H(u),
1249
+ size: "sm",
1250
+ onClose: t[0] ||= (e) => r("close")
1251
+ }, {
1252
+ default: U(() => [
1253
+ L(H(Y), {
1254
+ title: H(i).t("wise_invoicing.invoice.detail.line_items.global_discount"),
1255
+ description: H(i).t("wise_invoicing.invoice.detail.global_discount.description"),
1256
+ icon: H(C)
1257
+ }, null, 8, [
1258
+ "title",
1259
+ "description",
1260
+ "icon"
1261
+ ]),
1262
+ L(H(Vt), null, {
1263
+ default: U(() => [L(H(qt), null, {
1264
+ default: U(() => [L(H(Kt), {
1265
+ lg: 2,
1266
+ sm: 1
1267
+ }, {
1268
+ default: U(() => [
1269
+ L(H(Qt), z(H(E)(H(p)), {
1270
+ "display-fn": _,
1271
+ "is-required": !0,
1272
+ items: l.value,
1273
+ label: H(i).t("wise_invoicing.invoice.detail.global_discount.type.label")
1274
+ }), null, 16, ["items", "label"]),
1275
+ m.value ? (B(), N(H(Xt), z({ key: 0 }, H(E)(H(d)), {
1276
+ hint: H(i).t("wise_invoicing.invoice.detail.global_discount.amount.hint"),
1277
+ "is-required": !0,
1278
+ label: H(i).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
1279
+ max: 100,
1280
+ min: 0,
1281
+ step: .01
1282
+ }), {
1283
+ right: U(() => [...t[1] ||= [I("span", { class: "pr-md text-xs text-secondary" }, " % ", -1)]]),
1284
+ _: 1
1285
+ }, 16, ["hint", "label"])) : P("", !0),
1286
+ h.value ? (B(), N(H(Xt), z({ key: 1 }, H(E)(H(d)), {
1287
+ "is-required": !0,
1288
+ label: H(i).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
1289
+ min: .01,
1290
+ step: .01
1291
+ }), {
1292
+ right: U(() => [I("span", Zn, V(g.value.symbol), 1)]),
1293
+ _: 1
1294
+ }, 16, ["label"])) : P("", !0)
1295
+ ]),
1296
+ _: 1
1297
+ })]),
1298
+ _: 1
1299
+ })]),
1300
+ _: 1
1301
+ }),
1302
+ L(H(J), null, {
1303
+ right: U(() => [L(H(Ht), { label: "cancel" }), L(H(Ut), { label: H(i).t("wise_invoicing.invoice.detail.global_discount.confirm") }, null, 8, ["label"])]),
1304
+ _: 1
1305
+ })
1306
+ ]),
1307
+ _: 1
1308
+ }, 8, ["form"]));
1309
+ }
1310
+ }), $n = /* @__PURE__ */ R({
1311
+ __name: "InvoiceLineItemsTableSection",
1312
+ props: {
1313
+ customFieldDefinitions: {},
1314
+ invoice: {}
1315
+ },
1316
+ setup(e) {
1317
+ let t = e, n = M(() => t.invoice), r = p(), i = Jn(), a = M(() => k.isEditable(t.invoice.status)), o = Ue({
1318
+ isSaving: M(() => i.isLoading.value),
1319
+ billingDocument: () => n.value,
1320
+ canEdit: a,
1321
+ customFieldDefinitions: () => t.customFieldDefinitions,
1322
+ updateLines: (e) => i.execute({
1323
+ body: e,
1324
+ params: { invoiceUuid: t.invoice.uuid }
1325
+ })
1326
+ }), s = ln().create(Qn);
1327
+ function c() {
1328
+ s.open({ invoice: t.invoice });
1329
+ }
1330
+ return ze(o), (e, n) => (B(), N(qe, null, {
1331
+ default: U(() => [
1332
+ L(Xe, {
1333
+ "show-apply-discount": H(r).isGlobalDiscountEnabled.value,
1334
+ onApplyDiscount: c
1335
+ }, null, 8, ["show-apply-discount"]),
1336
+ L(Re),
1337
+ L(Ie, { "billing-document": t.invoice }, null, 8, ["billing-document"]),
1338
+ L(Qe)
1339
+ ]),
1340
+ _: 1
1341
+ }));
1342
+ }
1343
+ });
1344
+ //#endregion
1345
+ //#region src/modules/invoice/api/mutations/invoiceCreateCreditNote.mutation.ts
1346
+ function er() {
1347
+ return W({
1348
+ queryFn: (e) => y.createCreditNote(e.params.invoiceUuid),
1349
+ queryKeysToInvalidate: {
1350
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1351
+ invoiceIndex: {}
1352
+ }
1353
+ });
1354
+ }
1355
+ //#endregion
1356
+ //#region src/modules/invoice/api/mutations/invoiceDuplicate.mutation.ts
1357
+ function tr() {
1358
+ return W({
1359
+ queryFn: (e) => y.duplicate(e.params.invoiceUuid),
1360
+ queryKeysToInvalidate: { invoiceIndex: {} }
1361
+ });
1362
+ }
1363
+ //#endregion
1364
+ //#region src/modules/invoice/api/mutations/invoiceFinalize.mutation.ts
1365
+ function nr() {
1366
+ return W({
1367
+ queryFn: (e) => y.finalize(e.params.invoiceUuid),
1368
+ queryKeysToInvalidate: {
1369
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1370
+ invoiceIndex: {}
1371
+ }
1372
+ });
1373
+ }
1374
+ //#endregion
1375
+ //#region src/modules/invoice/api/mutations/invoiceMarkAsDraft.mutation.ts
1376
+ function rr() {
1377
+ return W({
1378
+ queryFn: (e) => y.markAsDraft(e.params.invoiceUuid),
1379
+ queryKeysToInvalidate: {
1380
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1381
+ invoiceIndex: {}
1382
+ }
1383
+ });
1384
+ }
1385
+ //#endregion
1386
+ //#region src/modules/invoice/api/mutations/invoiceMarkAsPaid.mutation.ts
1387
+ function ir() {
1388
+ return W({
1389
+ queryFn: (e) => y.markAsPaid(e.params.invoiceUuid),
1390
+ queryKeysToInvalidate: {
1391
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1392
+ invoiceIndex: {}
1393
+ }
1394
+ });
1395
+ }
1396
+ //#endregion
1397
+ //#region src/modules/invoice/api/mutations/invoiceMarkAsPriorApprovalRequired.mutation.ts
1398
+ function ar() {
1399
+ return W({
1400
+ queryFn: (e) => y.markAsPriorApprovalRequired(e.params.invoiceUuid),
1401
+ queryKeysToInvalidate: {
1402
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1403
+ invoiceIndex: {}
1404
+ }
1405
+ });
1406
+ }
1407
+ //#endregion
1408
+ //#region src/modules/invoice/api/mutations/invoiceMarkAsProtested.mutation.ts
1409
+ function or() {
1410
+ return W({
1411
+ queryFn: (e) => y.markAsProtested(e.params.invoiceUuid),
1412
+ queryKeysToInvalidate: {
1413
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1414
+ invoiceIndex: {}
1415
+ }
1416
+ });
1417
+ }
1418
+ //#endregion
1419
+ //#region src/modules/invoice/api/mutations/invoiceMarkAsReady.mutation.ts
1420
+ function sr() {
1421
+ return W({
1422
+ queryFn: (e) => y.markAsReady(e.params.invoiceUuid),
1423
+ queryKeysToInvalidate: {
1424
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1425
+ invoiceIndex: {}
1426
+ }
1427
+ });
1428
+ }
1429
+ //#endregion
1430
+ //#region src/modules/invoice/api/mutations/invoiceSend.mutation.ts
1431
+ function cr() {
1432
+ return W({
1433
+ queryFn: (e) => y.send(e.params.invoiceUuid),
1434
+ queryKeysToInvalidate: {
1435
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1436
+ invoiceIndex: {}
1437
+ }
1438
+ });
1439
+ }
1440
+ //#endregion
1441
+ //#region src/modules/invoice/api/mutations/invoiceWithdrawProtest.mutation.ts
1442
+ function lr() {
1443
+ return W({
1444
+ queryFn: (e) => y.withdrawProtest(e.params.invoiceUuid),
1445
+ queryKeysToInvalidate: {
1446
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1447
+ invoiceIndex: {}
1448
+ }
1449
+ });
1450
+ }
1451
+ //#endregion
1452
+ //#region src/modules/invoice/api/mutations/invoiceRestoreFromProForma.mutation.ts
1453
+ function ur() {
1454
+ return W({
1455
+ queryFn: (e) => y.restoreFromProForma(e.params.invoiceUuid),
1456
+ queryKeysToInvalidate: {
1457
+ invoiceApprovalIndex: {},
1458
+ invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
1459
+ invoiceIndex: {}
1460
+ }
1461
+ });
1462
+ }
1463
+ //#endregion
1464
+ //#region src/modules/invoice/use-cases/detail/dialogs/InvoiceApprovalRevertDialog.vue
1465
+ var dr = /* @__PURE__ */ R({
1466
+ __name: "InvoiceApprovalRevertDialog",
1467
+ props: {
1468
+ invoiceUuid: {},
1469
+ sentAt: {}
1470
+ },
1471
+ emits: ["close", "reverted"],
1472
+ setup(e, { emit: t }) {
1473
+ let n = e, r = t, i = j(), a = Q(), o = T(), s = ur(), c = M(() => n.sentAt === null ? "" : o.toDate(n.sentAt)), l = $({
1474
+ initialState: {},
1475
+ schema: A.object({}),
1476
+ onSubmit: async () => {
1477
+ let e = await s.execute({ params: { invoiceUuid: n.invoiceUuid } });
1478
+ if (e.isErr()) {
1479
+ a.apiError(e.error);
1480
+ return;
1481
+ }
1482
+ a.show({ message: i.t("wise_invoicing.invoice.approval_revert.success") }), r("reverted"), r("close");
1483
+ },
1484
+ onSubmitError: () => {
1485
+ a.unableToSave();
1486
+ }
1487
+ });
1488
+ return (e, t) => (B(), N(H(Gt), {
1489
+ form: H(l),
1490
+ size: "sm",
1491
+ onClose: t[0] ||= (e) => r("close")
1492
+ }, {
1493
+ default: U(() => [L(H(Y), {
1494
+ title: H(i).t("wise_invoicing.invoice.approval_revert.title"),
1495
+ description: H(i).t("wise_invoicing.invoice.approval_revert.description", { date: c.value }),
1496
+ icon: H(_e),
1497
+ "icon-variant": "warning"
1498
+ }, null, 8, [
1499
+ "title",
1500
+ "description",
1501
+ "icon"
1502
+ ]), L(H(J), null, {
1503
+ default: U(() => [L(H(Ht)), L(H(Ut), { label: H(i).t("wise_invoicing.invoice.approval_revert.submit") }, null, 8, ["label"])]),
1504
+ _: 1
1505
+ })]),
1506
+ _: 1
1507
+ }, 8, ["form"]));
1508
+ }
1509
+ });
1510
+ //#endregion
1511
+ //#region src/modules/invoice/api/mutations/invoiceDelete.mutation.ts
1512
+ function fr() {
1513
+ return W({
1514
+ queryFn: (e) => y.delete(e.params.invoiceUuid),
1515
+ queryKeysToInvalidate: { invoiceIndex: {} }
1516
+ });
1517
+ }
1518
+ //#endregion
1519
+ //#region src/modules/invoice/use-cases/detail/dialogs/InvoiceDeleteDialog.vue
1520
+ var pr = /* @__PURE__ */ R({
1521
+ __name: "InvoiceDeleteDialog",
1522
+ props: { invoice: {} },
1523
+ emits: ["close", "deleted"],
1524
+ setup(e, { emit: t }) {
1525
+ let n = e, r = t, i = j(), a = Tt(), o = Q(), s = fr(), c = $({
1526
+ schema: lt.object({}),
1527
+ onSubmit: async () => {
1528
+ let e = await s.execute({ params: { invoiceUuid: n.invoice.uuid } });
1529
+ if (e.isErr()) {
1530
+ o.apiError(e.error);
1531
+ return;
1532
+ }
1533
+ o.show({ message: i.t("wise_invoicing.invoice.delete.success_toast") }), r("deleted"), r("close"), await a.push({ name: "invoicing-invoice-overview" });
1534
+ }
1535
+ });
1536
+ return (e, t) => (B(), N(H(Gt), {
1537
+ form: H(c),
1538
+ size: "xs",
1539
+ onClose: t[0] ||= (e) => r("close")
1540
+ }, {
1541
+ default: U(() => [L(H(Y), {
1542
+ title: H(i).t("wise_invoicing.invoice.delete.title"),
1543
+ description: H(i).t("wise_invoicing.invoice.delete.description")
1544
+ }, null, 8, ["title", "description"]), L(H(J), null, {
1545
+ right: U(() => [L(H(Ht), { label: "cancel" }), L(H(Ut), {
1546
+ "is-destructive": !0,
1547
+ label: H(i).t("wise_invoicing.invoice.delete.submit_button")
1548
+ }, null, 8, ["label"])]),
1549
+ _: 1
1550
+ })]),
1551
+ _: 1
1552
+ }, 8, ["form"]));
1553
+ }
1554
+ }), mr = { class: "flex flex-col gap-lg px-2xl" }, hr = /* @__PURE__ */ R({
1555
+ __name: "InvoiceFinalizeOutOfSyncDialog",
1556
+ props: {
1557
+ sentAt: {},
1558
+ proFormaFile: {}
1559
+ },
1560
+ emits: [
1561
+ "close",
1562
+ "finalizeAnyway",
1563
+ "revertChanges",
1564
+ "sendNewRequest",
1565
+ "viewProForma"
1566
+ ],
1567
+ setup(e, { emit: t }) {
1568
+ let n = e, r = t, i = j(), a = T(), o = ht(!1), s = M(() => n.sentAt === null ? "" : a.toDate(n.sentAt));
1569
+ function c() {
1570
+ r("finalizeAnyway"), r("close");
1571
+ }
1572
+ function l() {
1573
+ r("revertChanges"), r("close");
1574
+ }
1575
+ function u() {
1576
+ r("sendNewRequest"), r("close");
1577
+ }
1578
+ return (e, t) => (B(), N(H(Bt), {
1579
+ size: "sm",
1580
+ onClose: t[2] ||= (e) => r("close")
1581
+ }, {
1582
+ default: U(() => [
1583
+ L(H(Y), {
1584
+ title: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.title"),
1585
+ description: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.description", { date: s.value }),
1586
+ icon: H(te),
1587
+ "icon-variant": "warning"
1588
+ }, null, 8, [
1589
+ "title",
1590
+ "description",
1591
+ "icon"
1592
+ ]),
1593
+ I("div", mr, [n.proFormaFile === null ? P("", !0) : (B(), N(H(Nt), {
1594
+ key: 0,
1595
+ class: "self-start"
1596
+ }, {
1597
+ default: U(() => [I("button", {
1598
+ class: "text-sm font-semibold text-brand-secondary underline-offset-2 hover:underline",
1599
+ type: "button",
1600
+ onClick: t[0] ||= (e) => r("viewProForma")
1601
+ }, V(H(i).t("wise_invoicing.invoice.approval_banner.view_pro_forma")), 1)]),
1602
+ _: 1
1603
+ })), L(H(Mt), {
1604
+ modelValue: o.value,
1605
+ "onUpdate:modelValue": t[1] ||= (e) => o.value = e,
1606
+ label: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.acknowledge")
1607
+ }, null, 8, ["modelValue", "label"])]),
1608
+ L(H(J), null, {
1609
+ left: U(() => [L(H(jt), {
1610
+ "icon-right": H(S),
1611
+ label: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.send_new_request"),
1612
+ variant: "tertiary",
1613
+ onClick: u
1614
+ }, null, 8, ["icon-right", "label"])]),
1615
+ right: U(() => [L(H(jt), {
1616
+ label: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.revert_changes"),
1617
+ variant: "secondary",
1618
+ onClick: l
1619
+ }, null, 8, ["label"]), L(H(jt), {
1620
+ "disabled-reason": o.value ? null : H(i).t("wise_invoicing.invoice.finalize_out_of_sync.acknowledge_required"),
1621
+ "is-destructive": !0,
1622
+ "is-disabled": !o.value,
1623
+ label: H(i).t("wise_invoicing.invoice.finalize_out_of_sync.finalize_anyway"),
1624
+ variant: "primary",
1625
+ onClick: c
1626
+ }, null, 8, [
1627
+ "disabled-reason",
1628
+ "is-disabled",
1629
+ "label"
1630
+ ])]),
1631
+ _: 1
1632
+ })
1633
+ ]),
1634
+ _: 1
1635
+ }));
1636
+ }
1637
+ }), gr = "customer_has_no_default_recipient", _r = /* @__PURE__ */ new Set([
1638
+ D.AWAITING_APPROVAL,
1639
+ D.EXPIRED,
1640
+ D.R1,
1641
+ D.R2
1642
+ ]);
1643
+ function vr(e) {
1644
+ let t = j(), n = Q(), r = Tt(), i = p(), a = ln(), o = a.create(pr), s = a.create(st), c = a.create(it), l = a.create(dr), f = a.create(rt), m = a.create(hr), h = a.create(Le), g = cr(), _ = er(), v = tr(), b = nr(), x = rr(), te = ir(), re = ar(), ie = or(), oe = sr(), le = ot(), he = at(), ye = lr(), { shouldSkipConfirmation: be } = et(), C = ht(null), w = M(() => k.getMetadata(e.value.status)), xe = M(() => C.value ?? e.value.isDisputed), T = M(() => e.value.status !== d.DRAFT && e.value.status !== d.READY), Se = M(() => e.value.lifecycleStatus === u.FINALIZED);
1645
+ function E(e) {
1646
+ return w.value.actions.includes(e);
1647
+ }
1648
+ let O = M(() => Ce.getDisplayStatus({
1649
+ approval: e.value.approval,
1650
+ requiresPriorApproval: e.value.requiresPriorApproval
1651
+ })), we = M(() => {
1652
+ let e = O.value;
1653
+ return e === null || e === D.APPROVED ? null : e;
1654
+ }), Te = M(() => we.value === null ? null : t.t("wise_invoicing.invoice.finalize.blocked_by_approval", { status: t.t(Ce.getMetadata(we.value).translationKey) })), Ee = M(() => w.value.isEditable && !e.value.requiresPriorApproval), De = M(() => w.value.isEditable && e.value.requiresPriorApproval && !e.value.hasApprovalHistory), Oe = M(() => w.value.isEditable && e.value.requiresPriorApproval && (O.value !== D.APPROVED || e.value.hasChangesSinceApprovalSent)), ke = M(() => Oe.value && E("finalize") && !e.value.hasApprovalHistory), Ae = M(() => e.value.status === d.READY && e.value.approvalUuid !== null && O.value !== D.APPROVED), je = M(() => e.value.status === d.READY && e.value.approvalUuid !== null && O.value !== D.REJECTED), Me = M(() => e.value.status === d.READY && e.value.approvalUuid !== null && _r.has(O.value)), Ne = M(() => O.value === D.APPROVED && e.value.hasChangesSinceApprovalSent);
1655
+ async function Pe() {
1656
+ e.value.approvalUuid !== null && await f.open({
1657
+ approvalUuid: e.value.approvalUuid,
1658
+ invoiceUuid: e.value.uuid
1659
+ });
1660
+ }
1661
+ async function Fe(t) {
1662
+ await l.open({
1663
+ invoiceUuid: e.value.uuid,
1664
+ sentAt: e.value.approval?.sentAt ?? null,
1665
+ onReverted: () => {
1666
+ t?.onReverted?.();
1667
+ }
1668
+ });
1669
+ }
1670
+ async function Ie() {
1671
+ let t = e.value.approvalProFormaFile;
1672
+ if (t === null) return;
1673
+ let n = await nt.getDownloadUrl(t.uuid);
1674
+ n !== null && window.open(n, "_blank", "noopener");
1675
+ }
1676
+ async function Re() {
1677
+ e.value.approvalUuid !== null && await s.open({
1678
+ approvalUuid: e.value.approvalUuid,
1679
+ invoiceUuid: e.value.uuid
1680
+ });
1681
+ }
1682
+ async function ze() {
1683
+ e.value.approvalUuid !== null && await c.open({
1684
+ approvalUuid: e.value.approvalUuid,
1685
+ invoiceUuid: e.value.uuid
1686
+ });
1687
+ }
1688
+ async function Be() {
1689
+ let r = await le.execute({ params: {
1690
+ invoiceUuid: e.value.uuid,
1691
+ hasActiveApproval: e.value.approval !== null
1692
+ } });
1693
+ if (r.isErr()) {
1694
+ let a = i.getCustomerDetailRoute(e.value.customer.uuid);
1695
+ if (bt.isExpectedApiError(r.error) && bt.getApiErrorCode(r.error) === gr) {
1696
+ n.show({
1697
+ link: a === null ? void 0 : {
1698
+ label: t.t("wise_invoicing.invoice.send_approval.view_customer_action"),
1699
+ to: a
1700
+ },
1701
+ message: t.t("wise_invoicing.invoice.send_approval.missing_recipient"),
1702
+ variant: "error"
1703
+ });
1704
+ return;
1705
+ }
1706
+ n.apiError(r.error);
1707
+ return;
1708
+ }
1709
+ n.show({ message: t.t("wise_invoicing.invoice.send_approval.success", {
1710
+ email: e.value.recipient?.email ?? e.value.customer.name ?? "",
1711
+ reference: e.value.sequence ?? e.value.subject ?? t.t("wise_invoicing.invoice.detail.fallback_title")
1712
+ }) });
1713
+ }
1714
+ async function Ve() {
1715
+ let r = await re.execute({ params: { invoiceUuid: e.value.uuid } });
1716
+ if (r.isErr()) {
1717
+ n.apiError(r.error);
1718
+ return;
1719
+ }
1720
+ n.show({ message: t.t("wise_invoicing.invoice.mark_as_needs_approval.success") });
1721
+ }
1722
+ async function He() {
1723
+ let r = await he.execute({ params: { invoiceUuid: e.value.uuid } });
1724
+ if (r.isErr()) {
1725
+ n.apiError(r.error);
1726
+ return;
1727
+ }
1728
+ n.show({ message: t.t("wise_invoicing.invoice.unmark_as_needs_approval.success") });
1729
+ }
1730
+ yt(() => e.value.isDisputed, (e) => {
1731
+ C.value === e && (C.value = null);
1732
+ });
1733
+ async function Ue() {
1734
+ let r = await b.execute({ params: { invoiceUuid: e.value.uuid } });
1735
+ return r.isErr() ? (n.apiError(r.error), !1) : (n.show({ message: t.t("wise_invoicing.invoice.finalize.success") }), !0);
1736
+ }
1737
+ async function We() {
1738
+ if (Ne.value) {
1739
+ await m.open({
1740
+ sentAt: e.value.approval?.sentAt ?? null,
1741
+ proFormaFile: e.value.approvalProFormaFile,
1742
+ onFinalizeAnyway: () => {
1743
+ Ue();
1744
+ },
1745
+ onRevertChanges: () => {
1746
+ Fe({ onReverted: () => {
1747
+ Ue();
1748
+ } });
1749
+ },
1750
+ onSendNewRequest: () => {
1751
+ Be();
1752
+ },
1753
+ onViewProForma: () => {
1754
+ Ie();
1755
+ }
1756
+ });
1757
+ return;
1758
+ }
1759
+ if (be.value) {
1760
+ await Ue();
1761
+ return;
1762
+ }
1763
+ await h.open({
1764
+ billingDocumentType: "invoice",
1765
+ onConfirm: Ue
1766
+ });
1767
+ }
1768
+ async function Ge() {
1769
+ let r = await oe.execute({ params: { invoiceUuid: e.value.uuid } });
1770
+ if (r.isErr()) {
1771
+ n.apiError(r.error);
1772
+ return;
1773
+ }
1774
+ n.show({ message: t.t("wise_invoicing.invoice.mark_as_ready.success") });
1775
+ }
1776
+ async function Ke() {
1777
+ let r = await x.execute({ params: { invoiceUuid: e.value.uuid } });
1778
+ if (r.isErr()) {
1779
+ n.apiError(r.error);
1780
+ return;
1781
+ }
1782
+ n.show({ message: t.t("wise_invoicing.invoice.mark_as_draft.success") });
1783
+ }
1784
+ async function qe() {
1785
+ let r = await te.execute({ params: { invoiceUuid: e.value.uuid } });
1786
+ if (r.isErr()) {
1787
+ n.apiError(r.error);
1788
+ return;
1789
+ }
1790
+ n.show({ message: t.t("wise_invoicing.invoice.mark_as_paid.success") });
1791
+ }
1792
+ async function Je() {
1793
+ C.value = !0;
1794
+ let r = await ie.execute({ params: { invoiceUuid: e.value.uuid } });
1795
+ if (r.isErr()) {
1796
+ C.value = null, n.apiError(r.error);
1797
+ return;
1798
+ }
1799
+ n.show({ message: t.t("wise_invoicing.invoice.mark_as_disputed.success") });
1800
+ }
1801
+ async function Ye() {
1802
+ C.value = !1;
1803
+ let r = await ye.execute({ params: { invoiceUuid: e.value.uuid } });
1804
+ if (r.isErr()) {
1805
+ C.value = null, n.apiError(r.error);
1806
+ return;
1807
+ }
1808
+ n.show({ message: t.t("wise_invoicing.invoice.withdraw_dispute.success") });
1809
+ }
1810
+ async function Xe() {
1811
+ let r = await g.execute({ params: { invoiceUuid: e.value.uuid } });
1812
+ if (r.isErr()) {
1813
+ n.apiError(r.error);
1814
+ return;
1815
+ }
1816
+ n.show({ message: t.t("wise_invoicing.invoice.send.success") });
1817
+ }
1818
+ async function Ze() {
1819
+ await o.open({ invoice: e.value });
1820
+ }
1821
+ async function Qe() {
1822
+ let r = await y.getByUuid(e.value.uuid);
1823
+ if (r.isErr()) {
1824
+ n.apiError(r.error);
1825
+ return;
1826
+ }
1827
+ let i = r.value.file;
1828
+ if (i === null) {
1829
+ n.show({ message: t.t("wise_invoicing.invoice.download_pdf.generation_in_progress") });
1830
+ return;
1831
+ }
1832
+ let a = await nt.getDownloadUrl(i.uuid);
1833
+ a !== null && ee.downloadUrl(a, i.name);
1834
+ }
1835
+ async function $e() {
1836
+ let i = await v.execute({ params: { invoiceUuid: e.value.uuid } });
1837
+ if (i.isErr()) {
1838
+ n.apiError(i.error);
1839
+ return;
1840
+ }
1841
+ n.show({
1842
+ button: {
1843
+ label: t.t("wise_invoicing.invoice.duplicate.view_action"),
1844
+ onClick: () => {
1845
+ r.push({
1846
+ name: "invoicing-invoice-detail",
1847
+ params: { invoiceUuid: i.value }
1848
+ });
1849
+ }
1850
+ },
1851
+ message: t.t("wise_invoicing.invoice.duplicate.success")
1852
+ });
1853
+ }
1854
+ async function tt() {
1855
+ let i = await _.execute({ params: { invoiceUuid: e.value.uuid } });
1856
+ if (i.isErr()) {
1857
+ n.apiError(i.error);
1858
+ return;
1859
+ }
1860
+ n.show({
1861
+ button: {
1862
+ label: t.t("wise_invoicing.credit_note.create.view_action"),
1863
+ onClick: () => {
1864
+ r.push({
1865
+ name: "invoicing-credit-note-detail",
1866
+ params: { creditNoteUuid: i.value }
1867
+ });
1868
+ }
1869
+ },
1870
+ message: t.t("wise_invoicing.credit_note.create.success")
1871
+ });
1872
+ }
1873
+ let ct = M(() => [
1874
+ {
1875
+ isLoading: g.isLoading.value,
1876
+ iconLeft: S,
1877
+ key: "send",
1878
+ label: t.t("wise_invoicing.invoice.detail.actions.send"),
1879
+ variant: "primary",
1880
+ visible: e.value.status === d.FINALIZED,
1881
+ onClick: Xe
1882
+ },
1883
+ {
1884
+ isLoading: oe.isLoading.value,
1885
+ iconRight: ge,
1886
+ key: "markAsReady",
1887
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_ready"),
1888
+ visible: E("markAsReady"),
1889
+ onClick: Ge
1890
+ },
1891
+ {
1892
+ isLoading: !1,
1893
+ iconLeft: fe,
1894
+ key: "markAsApproved",
1895
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_approved"),
1896
+ visible: Ae.value,
1897
+ onClick: Re
1898
+ },
1899
+ {
1900
+ isLoading: le.isLoading.value,
1901
+ iconLeft: S,
1902
+ key: "sendApprovalRequest",
1903
+ label: t.t("wise_invoicing.invoice.detail.actions.send_approval_request"),
1904
+ variant: "primary",
1905
+ visible: ke.value,
1906
+ onClick: Be
1907
+ },
1908
+ {
1909
+ isDisabled: we.value !== null,
1910
+ isLoading: b.isLoading.value,
1911
+ disabledReason: Te.value,
1912
+ iconLeft: ne,
1913
+ key: "finalize",
1914
+ label: t.t("wise_invoicing.invoice.detail.actions.finalize"),
1915
+ variant: we.value === null ? "primary" : "secondary",
1916
+ visible: E("finalize") && !ke.value,
1917
+ onClick: We
1918
+ }
1919
+ ].filter((e) => e.visible)), lt = M(() => {
1920
+ let n = [
1921
+ {
1922
+ icon: ue,
1923
+ key: "markAsProtested",
1924
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_disputed"),
1925
+ visible: Se.value && !xe.value,
1926
+ onSelect: Je
1927
+ },
1928
+ {
1929
+ icon: fe,
1930
+ key: "markAsPaid",
1931
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_paid"),
1932
+ visible: E("markAsPaid"),
1933
+ onSelect: qe
1934
+ },
1935
+ {
1936
+ icon: ge,
1937
+ key: "withdrawProtest",
1938
+ label: t.t("wise_invoicing.invoice.detail.actions.withdraw_dispute"),
1939
+ visible: Se.value && xe.value,
1940
+ onSelect: Ye
1941
+ }
1942
+ ], r = [
1943
+ d.FINALIZED,
1944
+ d.PAID,
1945
+ d.SENT,
1946
+ d.OVERDUE,
1947
+ d.PROTESTED
1948
+ ].includes(e.value.status), i = [
1949
+ {
1950
+ icon: de,
1951
+ key: "downloadPdf",
1952
+ label: t.t("wise_invoicing.common.download_pdf"),
1953
+ visible: T.value,
1954
+ onSelect: Qe
1955
+ },
1956
+ {
1957
+ icon: _e,
1958
+ key: "backToDraft",
1959
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_draft"),
1960
+ visible: E("markAsDraft"),
1961
+ onSelect: Ke
1962
+ },
1963
+ {
1964
+ icon: pe,
1965
+ key: "duplicate",
1966
+ label: t.t("wise_invoicing.invoice.detail.actions.duplicate"),
1967
+ visible: !0,
1968
+ onSelect: $e
1969
+ },
1970
+ {
1971
+ icon: ae,
1972
+ key: "rejectApproval",
1973
+ label: t.t("wise_invoicing.invoice.detail.actions.reject_approval"),
1974
+ visible: je.value,
1975
+ onSelect: ze
1976
+ },
1977
+ {
1978
+ icon: S,
1979
+ key: "sendApprovalRequest",
1980
+ label: t.t("wise_invoicing.invoice.detail.actions.send_approval_request"),
1981
+ visible: Oe.value && !ke.value,
1982
+ onSelect: Be
1983
+ },
1984
+ {
1985
+ icon: me,
1986
+ key: "markAsNeedsApproval",
1987
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_needs_approval"),
1988
+ visible: Ee.value,
1989
+ onSelect: Ve
1990
+ },
1991
+ {
1992
+ icon: _e,
1993
+ key: "unmarkAsNeedsApproval",
1994
+ label: t.t("wise_invoicing.invoice.detail.actions.unmark_as_needs_approval"),
1995
+ visible: De.value,
1996
+ onSelect: He
1997
+ }
1998
+ ], a = [
1999
+ {
2000
+ icon: ce,
2001
+ key: "archiveApproval",
2002
+ label: t.t("wise_invoicing.invoice.detail.actions.archive_approval"),
2003
+ visible: Me.value,
2004
+ onSelect: Pe
2005
+ },
2006
+ {
2007
+ icon: se,
2008
+ key: "createCreditNote",
2009
+ label: t.t("wise_invoicing.invoice.detail.header.cancel_with_credit_note"),
2010
+ visible: r,
2011
+ onSelect: tt
2012
+ },
2013
+ {
2014
+ icon: ve,
2015
+ key: "delete",
2016
+ label: t.t("wise_invoicing.invoice.detail.actions.delete"),
2017
+ visible: w.value.isEditable,
2018
+ onSelect: Ze
2019
+ }
2020
+ ];
2021
+ return [
2022
+ {
2023
+ items: n.filter((e) => e.visible),
2024
+ key: "lifecycle"
2025
+ },
2026
+ {
2027
+ items: i.filter((e) => e.visible),
2028
+ key: "secondary"
2029
+ },
2030
+ {
2031
+ items: a.filter((e) => e.visible),
2032
+ key: "destructive"
2033
+ }
2034
+ ].filter((e) => e.items.length > 0);
2035
+ });
2036
+ return {
2037
+ isActionMenuVisible: M(() => lt.value.length > 0),
2038
+ isDisputed: xe,
2039
+ menuGroups: lt,
2040
+ primaryButtons: ct,
2041
+ onRevertApprovalChanges: Fe,
2042
+ onSendApprovalRequest: Be,
2043
+ onViewProForma: Ie
2044
+ };
2045
+ }
2046
+ //#endregion
2047
+ //#region src/modules/invoice/use-cases/detail/views/InvoiceDetailView.vue
2048
+ var yr = /* @__PURE__ */ R({
2049
+ __name: "InvoiceDetailView",
2050
+ props: {
2051
+ customFieldDefinitions: {},
2052
+ invoice: {}
2053
+ },
2054
+ setup(e) {
2055
+ let t = e, n = j(), r = ht(!1), { isDisputed: i, menuGroups: a, primaryButtons: o, onRevertApprovalChanges: s, onSendApprovalRequest: c, onViewProForma: l } = vr(M(() => t.invoice)), u = M(() => [{
2056
+ label: n.t("wise_invoicing.invoice.overview.title"),
2057
+ to: { name: "invoicing-invoice-overview" }
2058
+ }, { label: t.invoice.sequence ?? t.invoice.subject ?? n.t("wise_invoicing.invoice.detail.fallback_title") }]);
2059
+ return (e, d) => (B(), N(Ye, {
2060
+ "billing-document": t.invoice,
2061
+ breadcrumbs: u.value,
2062
+ title: H(n).t("wise_invoicing.invoice.detail.fallback_title")
2063
+ }, {
2064
+ header: U(() => [L(bn, {
2065
+ invoice: t.invoice,
2066
+ "is-disputed": H(i),
2067
+ "menu-groups": H(a),
2068
+ "primary-buttons": H(o),
2069
+ "is-pdf-view-active": r.value,
2070
+ class: "w-full",
2071
+ onTogglePdfView: d[0] ||= (e) => r.value = !r.value
2072
+ }, null, 8, [
2073
+ "invoice",
2074
+ "is-disputed",
2075
+ "menu-groups",
2076
+ "primary-buttons",
2077
+ "is-pdf-view-active"
2078
+ ])]),
2079
+ default: U(() => [L(hn, {
2080
+ approval: t.invoice.approval,
2081
+ "is-out-of-sync": t.invoice.hasChangesSinceApprovalSent,
2082
+ "pro-forma-file": t.invoice.approvalProFormaFile,
2083
+ rejection: t.invoice.rejection,
2084
+ class: "w-full",
2085
+ onRevertChanges: H(s),
2086
+ onSendNewRequest: H(c),
2087
+ onViewProForma: H(l)
2088
+ }, null, 8, [
2089
+ "approval",
2090
+ "is-out-of-sync",
2091
+ "pro-forma-file",
2092
+ "rejection",
2093
+ "onRevertChanges",
2094
+ "onSendNewRequest",
2095
+ "onViewProForma"
2096
+ ]), r.value ? (B(), N(Ke, {
2097
+ key: 0,
2098
+ "billing-document": t.invoice,
2099
+ class: "w-full"
2100
+ }, null, 8, ["billing-document"])) : (B(), F(ut, { key: 1 }, [
2101
+ L($n, {
2102
+ "custom-field-definitions": t.customFieldDefinitions,
2103
+ invoice: t.invoice
2104
+ }, null, 8, ["custom-field-definitions", "invoice"]),
2105
+ H(k).isEditable(t.invoice.status) ? P("", !0) : (B(), N(qn, {
2106
+ key: 0,
2107
+ invoice: t.invoice,
2108
+ class: "w-full"
2109
+ }, null, 8, ["invoice"])),
2110
+ L(Sn, {
2111
+ invoice: t.invoice,
2112
+ class: "w-full"
2113
+ }, null, 8, ["invoice"]),
2114
+ L(wn, {
2115
+ invoice: t.invoice,
2116
+ class: "w-full"
2117
+ }, null, 8, ["invoice"])
2118
+ ], 64))]),
2119
+ sidebar: U(() => [L(In, {
2120
+ "custom-field-definitions": t.customFieldDefinitions,
2121
+ invoice: t.invoice
2122
+ }, null, 8, ["custom-field-definitions", "invoice"])]),
2123
+ _: 1
2124
+ }, 8, [
2125
+ "billing-document",
2126
+ "breadcrumbs",
2127
+ "title"
2128
+ ]));
2129
+ }
2130
+ }), br = /* @__PURE__ */ R({
2131
+ __name: "InvoiceDetailViewDataProvider",
2132
+ props: { invoiceUuid: {} },
2133
+ setup(e) {
2134
+ let t = e, n = j(), r = M(() => [{
2135
+ label: n.t("wise_invoicing.invoice.overview.title"),
2136
+ to: { name: "invoicing-invoice-overview" }
2137
+ }]), i = ct(M(() => t.invoiceUuid)), a = O();
2138
+ return (e, t) => (B(), N(Ze, {
2139
+ "custom-field-definitions-query": H(a),
2140
+ query: H(i),
2141
+ "loading-breadcrumbs": r.value
2142
+ }, {
2143
+ default: U(({ billingDocument: e, customFieldDefinitions: t }) => [L(yr, {
2144
+ "custom-field-definitions": t,
2145
+ invoice: e
2146
+ }, null, 8, ["custom-field-definitions", "invoice"])]),
2147
+ _: 1
2148
+ }, 8, [
2149
+ "custom-field-definitions-query",
2150
+ "query",
2151
+ "loading-breadcrumbs"
2152
+ ]));
2153
+ }
2154
+ });
2155
+ //#endregion
2156
+ export { br as default };