@wisemen/wise-invoicing-web 0.2.0 → 0.3.1

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 (118) hide show
  1. package/dist/{ApprovalReminderSettingsViewDataProvider-D-qXZrPT.js → ApprovalReminderSettingsViewDataProvider-DwtfyQpx.js} +4 -4
  2. package/dist/{BillingDocumentDetailViewDataProvider-DDdtlW-2.js → BillingDocumentDetailViewDataProvider-Dub07ybW.js} +1373 -1217
  3. package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
  4. package/dist/{BillingDocumentPdf-ehdFB6mr.js → BillingDocumentPdf-DgtUB45R.js} +20 -13
  5. package/dist/{CreditNoteDetailViewDataProvider-11a-JO3H.js → CreditNoteDetailViewDataProvider-BxNfC6yO.js} +90 -90
  6. package/dist/{CreditNotePdfViewDataProvider-bfeaya3P.js → CreditNotePdfViewDataProvider-D0j8qqK-.js} +2 -2
  7. package/dist/{CustomFieldValueText-CZQXGE5F.js → CustomFieldValueText-Cuhs9sRn.js} +26 -26
  8. package/dist/DunningCaseDetailViewDataProvider-ou1FfNWQ.js +439 -0
  9. package/dist/{DunningCaseOverviewView-y_bCmi5j.js → DunningCaseOverviewView--zaPD0-c.js} +255 -203
  10. package/dist/{DunningCaseReminderPdfViewDataProvider-DNODfED_.js → DunningCaseReminderPdfViewDataProvider-BpUDbbSH.js} +5 -4
  11. package/dist/{DunningCaseSendDialog-BPXcqit5.js → DunningCaseSendDialog-Co4oLFtZ.js} +83 -72
  12. package/dist/InvoiceApprovalOutOfSyncIndicator-H6H7kjAE.js +45 -0
  13. package/dist/InvoiceApprovalOverviewView-Bw-6rkon.js +814 -0
  14. package/dist/InvoiceApprovalStatusBadge-IyzJ--TJ.js +127 -0
  15. package/dist/InvoiceApproveDialogDataProvider-8G-11W1e.js +377 -0
  16. package/dist/{InvoiceDetailViewDataProvider-BYeaaQzL.js → InvoiceDetailViewDataProvider-B9gul2ei.js} +750 -692
  17. package/dist/InvoiceOverviewViewDataProvider-5KgIdhfL.js +1892 -0
  18. package/dist/{InvoicePdfView-BJRTg_TH.js → InvoicePdfView-5sJ-u_gT.js} +10 -4
  19. package/dist/{InvoicePdfViewDataProvider-CwI_uGm3.js → InvoicePdfViewDataProvider-BLVXDPv6.js} +3 -3
  20. package/dist/{InvoicePublicPdfViewDataProvider-uZUfsr5K.js → InvoicePublicPdfViewDataProvider-CnhYazmB.js} +3 -3
  21. package/dist/InvoicePublicProFormaPdfViewDataProvider-CcvGISK6.js +47 -0
  22. package/dist/{InvoicingFileUploadProvider-D9Xk4rQM.js → InvoicingFileUploadProvider-Kcq7kSSt.js} +2 -2
  23. package/dist/{IssuerSettingsViewDataProvider-CGRa8F-2.js → IssuerSettingsViewDataProvider-BuSIVnIl.js} +3 -3
  24. package/dist/{ReminderSettingsViewDataProvider-1ucp3z2T.js → ReminderSettingsViewDataProvider-CH7gSXnj.js} +100 -102
  25. package/dist/{api.util-C_kMGlJN.js → api.util-CkIRZS3h.js} +985 -930
  26. package/dist/{billingDocumentDetail.transformer-Da6_-Hv9.js → billingDocumentDetail.transformer-Bfd8geNo.js} +5 -7
  27. package/dist/client/index.d.ts +2 -2
  28. package/dist/client/sdk.gen.d.ts +2 -1
  29. package/dist/client/types.gen.d.ts +114 -31
  30. package/dist/client/zod.gen.d.ts +343 -78
  31. package/dist/composables/sending-refetch/sendingRefetch.composable.d.ts +7 -0
  32. package/dist/composables/sending-refetch/sendingRefetch.composable.spec.d.ts +1 -0
  33. package/dist/{creditNoteDetail.query-DLR7L0Ep.js → creditNoteDetail.query-tLnfqsEB.js} +27 -27
  34. package/dist/customerUuid.model-ClN4Vi9n.js +18 -0
  35. package/dist/{dist-Cxdm09Lp.js → dist-BQbaoN5W.js} +144 -96
  36. package/dist/{dist-CoztMdYH.js → dist-CGZBUnWK.js} +62 -62
  37. package/dist/{dist-boJIIxnT.js → dist-Cdbpkd3Y.js} +1 -1
  38. package/dist/{documentTitle.composable-DsBbzhXN.js → documentTitle.composable-CRJjS6p-.js} +19 -17
  39. package/dist/{i18n.lib-Cvr8pcDw.js → i18n.lib--mzprLMR.js} +88 -54
  40. package/dist/index.d.ts +56 -22
  41. package/dist/index.js +193 -201
  42. package/dist/{invoice.service-DEEA9mal.js → invoice.service-B1w16_Md.js} +184 -172
  43. package/dist/{invoiceApproval.service-DvL3LliM.js → invoiceApproval.service-BHAJmFkU.js} +8 -8
  44. package/dist/{invoiceApprovalStatus.util-3Zh10Pj8.js → invoiceApprovalStatus.util-DohOKR4q.js} +42 -38
  45. package/dist/invoiceCustomer.service-DpVfpQUD.js +39 -0
  46. package/dist/{invoiceDetail.query-CRoH_SgM.js → invoiceDetail.query-CfyNSXLS.js} +1 -1
  47. package/dist/{invoiceDeliveryStatus.util-nCsqDypY.js → invoiceIndexCache.util-BDLs7W9m.js} +128 -51
  48. package/dist/{invoicingConfig.composable-rxjGK882.js → invoicingConfig.composable-COn1rKRf.js} +2 -2
  49. package/dist/{issuerSettings.query-Dc5gsaEm.js → issuerSettings.query-CDFk2GiP.js} +3 -2
  50. package/dist/libs/i18n.lib.d.ts +56 -22
  51. package/dist/locales/en-US.json.d.ts +44 -27
  52. package/dist/locales/nl-BE.json.d.ts +44 -27
  53. package/dist/models/billing-document/activity-log/billingDocumentActivityLog.model.d.ts +8 -1
  54. package/dist/models/billing-document/activity-log/billingDocumentActivityLog.util.d.ts +12 -0
  55. package/dist/models/billing-document/activity-log/billingDocumentActivityLog.util.spec.d.ts +1 -0
  56. package/dist/models/billing-document/billingDocumentDetail.model.d.ts +2 -6
  57. package/dist/modules/dunning-case/api/mutations/dunningCaseReminderRetry.mutation.d.ts +4 -0
  58. package/dist/modules/dunning-case/api/services/dunningCase.service.d.ts +2 -1
  59. package/dist/modules/dunning-case/models/dunningCase.model.d.ts +5 -0
  60. package/dist/modules/dunning-case/models/dunningCaseReminderPdf.model.d.ts +0 -4
  61. package/dist/modules/dunning-case/models/dunningCaseReminderPdf.transformer.d.ts +0 -1
  62. package/dist/modules/dunning-case/test/builders/dunningCaseReminderPdfDto.builder.d.ts +1 -0
  63. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewActionsCell.vue.d.ts +2 -0
  64. package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverview.composable.d.ts +2 -2
  65. package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverview.composable.spec.d.ts +1 -0
  66. package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewTableColumns.composable.d.ts +1 -0
  67. package/dist/modules/dunning-case/use-cases/pdf/components/DunningCaseReminderPdfTable.vue.d.ts +0 -4
  68. package/dist/modules/dunning-case/use-cases/send/dialogs/DunningCaseBulkSendDialog.vue.d.ts +2 -1
  69. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +4 -4
  70. package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +2 -2
  71. package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.spec.d.ts +1 -0
  72. package/dist/modules/invoice/api/mutations/invoiceRejectApproval.mutation.d.ts +8 -0
  73. package/dist/modules/invoice/api/queries/invoicePublicProFormaDetail.query.d.ts +2 -0
  74. package/dist/modules/invoice/api/query-keys/invoice.queryKeys.d.ts +6 -0
  75. package/dist/modules/invoice/api/services/invoice.service.d.ts +1 -0
  76. package/dist/modules/invoice/models/invoice/approval/invoiceApproveForm.model.d.ts +4 -2
  77. package/dist/modules/invoice/models/invoice/approval/invoiceApproveForm.model.spec.d.ts +1 -0
  78. package/dist/modules/invoice/models/invoice/approval/invoiceRejectForm.model.d.ts +8 -0
  79. package/dist/modules/invoice/models/invoice/detail/invoiceDetail.model.d.ts +1 -0
  80. package/dist/modules/invoice/models/invoice/index/invoiceIndexQueryParams.model.d.ts +2 -3
  81. package/dist/modules/invoice/models/invoice/invoiceApprovalStatus.model.d.ts +2 -9
  82. package/dist/modules/invoice/models/invoice/invoiceApprovalStatus.util.d.ts +4 -2
  83. package/dist/modules/invoice/models/invoice/payment/invoicePaymentCreate.transformer.spec.d.ts +1 -0
  84. package/dist/modules/invoice/models/invoice/pdf/invoicePdfDetail.transformer.d.ts +2 -1
  85. package/dist/modules/invoice/routes/invoice.routes.d.ts +4 -0
  86. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApproveDialog.vue.d.ts +1 -0
  87. package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApproveDialogDataProvider.vue.d.ts +13 -0
  88. package/dist/modules/invoice/use-cases/detail/dialogs/InvoicePaymentDeleteDialog.vue.d.ts +13 -0
  89. package/dist/modules/invoice/use-cases/overview/composables/invoiceOverviewDataTableFilters.composable.d.ts +2 -3
  90. package/dist/modules/invoice/use-cases/overview/composables/invoiceOverviewSelection.composable.d.ts +11 -9
  91. package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkActionDialog.vue.d.ts +2 -2
  92. package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkSendApprovalDialog.vue.d.ts +3 -1
  93. package/dist/modules/invoice/use-cases/overview/utils/invoiceOverviewBulkActionFeedback.util.d.ts +7 -4
  94. package/dist/modules/invoice/use-cases/overview/utils/invoiceOverviewBulkActionFeedback.util.spec.d.ts +1 -0
  95. package/dist/modules/invoice/use-cases/pdf/components/BillingDocumentPdf.vue.d.ts +1 -0
  96. package/dist/modules/invoice/use-cases/pdf/components/InvoicePdfWatermark.vue.d.ts +4 -1
  97. package/dist/modules/invoice/use-cases/pdf/views/InvoicePdfView.vue.d.ts +1 -0
  98. package/dist/modules/invoice/use-cases/pdf/views/InvoicePublicProFormaPdfViewDataProvider.vue.d.ts +3 -0
  99. package/dist/modules/invoice-approval/actions/invoiceApprovalSendRequest.action.d.ts +2 -0
  100. package/dist/modules/invoice-approval/actions/invoiceApprovalSendRequest.spec.d.ts +1 -0
  101. package/dist/modules/invoice-approval/models/invoiceApprovalIndex.transformer.spec.d.ts +1 -0
  102. package/dist/modules/invoice-approval/models/invoiceApprovalIndexQueryParams.transformer.spec.d.ts +1 -0
  103. package/dist/modules/invoice-approval/use-cases/overview/composables/invoiceApprovalOverview.composable.d.ts +5 -6
  104. package/dist/modules/invoice-approval/use-cases/overview/composables/invoiceApprovalOverviewFilters.composable.d.ts +0 -5
  105. package/dist/modules/settings/models/issuer-settings/issuerSettings.model.d.ts +1 -0
  106. package/dist/{reminderConfig.query-snaHQmrY.js → reminderConfig.query-DSO0ekC_.js} +112 -105
  107. package/dist/routes/invoicingPublicRoutes.composable.d.ts +4 -0
  108. package/dist/style.css +1 -1
  109. package/dist/ui/billing-document/sidebar/BillingDocumentDetailSidebarActivityApprovalDetails.vue.d.ts +7 -0
  110. package/package.json +3 -3
  111. package/dist/DunningCaseDetailViewDataProvider-DC-ziMoO.js +0 -409
  112. package/dist/InvoiceApprovalOverviewView-DZ14mi4L.js +0 -870
  113. package/dist/InvoiceApprovalStatusBadge-U-dW2hR4.js +0 -161
  114. package/dist/InvoiceApproveDialog-2LXneG2r.js +0 -308
  115. package/dist/InvoiceOverviewBulkSendApprovalDialog-99dfuN4i.js +0 -318
  116. package/dist/InvoiceOverviewViewDataProvider-CZIQeftL.js +0 -1620
  117. package/dist/customerUuid.model-GUFYq3O2.js +0 -5
  118. package/dist/modules/invoice-approval/actions/invoiceApprovalUnmarkAsNeedsApproval.action.d.ts +0 -1
@@ -0,0 +1,439 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import "./api.util-CkIRZS3h.js";
3
+ import { T as t, t as n } from "./documentTitle.composable-CRJjS6p-.js";
4
+ import { r } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
+ import { n as i } from "./invoicingConfig.composable-COn1rKRf.js";
6
+ import { n as a } from "./reminderConfig.query-DSO0ekC_.js";
7
+ import { K as ee, Z as o, ct as s, dt as c, nt as te, w as l } from "./dist-BQbaoN5W.js";
8
+ import { a as u, i as ne, n as re, o as d, r as ie, t as ae } from "./DunningCaseSendDialog-Co4oLFtZ.js";
9
+ import { n as f } from "./customerUuid.model-ClN4Vi9n.js";
10
+ import { n as oe } from "./dist-Cdbpkd3Y.js";
11
+ import { t as p } from "./DataProvider-C3uEds9v.js";
12
+ import { useI18n as m } from "vue-i18n";
13
+ import { Fragment as h, computed as g, createBlock as _, createCommentVNode as v, createElementBlock as y, createElementVNode as b, createTextVNode as x, createVNode as S, defineComponent as C, normalizeClass as w, normalizeStyle as se, openBlock as T, ref as E, renderList as D, toDisplayString as O, unref as k, withCtx as A } from "vue";
14
+ import { RouterLink as ce, useRouter as le } from "vue-router";
15
+ import { Temporal as j } from "temporal-polyfill";
16
+ import { UIBadge as M, UIButton as N, UIDashboardPage as ue, UIDashboardPageContent as de, UIDashboardPageLoadingState as P, UITabs as fe, UITabsItem as F, UITabsList as pe, UITooltip as me, UITooltipContent as he, useOverlay as ge, useToast as _e } from "@wisemen/vue-core-design-system";
17
+ import { useViewModels as ve } from "@wisemen/vue-core-actions";
18
+ //#region src/modules/dunning-case/use-cases/detail/views/DunningCaseDetailView.vue?vue&type=script&setup=true&lang.ts
19
+ var ye = { class: "flex flex-col gap-4xl" }, be = { class: "flex flex-col gap-lg lg:flex-row lg:items-start lg:justify-between" }, xe = { class: "flex flex-wrap items-center gap-sm" }, Se = { class: "text-lg font-semibold text-primary" }, Ce = { key: 1 }, we = { class: "inline-flex items-center gap-xs rounded-sm border border-secondary px-sm py-px text-xs text-primary" }, Te = {
20
+ key: 0,
21
+ class: "mt-xs text-xs text-secondary"
22
+ }, Ee = { class: "mt-xxs text-xs text-secondary" }, De = { class: "grid grid-cols-1 gap-3xl md:grid-cols-2 xl:grid-cols-[minmax(20rem,1.45fr)_minmax(10rem,0.7fr)_repeat(2,minmax(8rem,0.8fr))]" }, Oe = { class: "min-w-0 xl:col-start-1 xl:row-start-1 2xl:col-start-1 2xl:row-start-1" }, ke = { class: "text-xs font-medium text-secondary" }, Ae = { class: "mt-xs font-mono text-4xl font-semibold text-primary tabular-nums xl:text-5xl" }, je = { class: "mt-xs text-xs text-secondary" }, Me = {
23
+ key: 0,
24
+ class: "mt-xxs text-xs text-secondary"
25
+ }, Ne = { class: "mt-xl flex h-(--spacing-md) overflow-hidden rounded-full bg-tertiary" }, Pe = { class: "flex flex-col justify-end gap-md xl:col-start-2 xl:row-start-1 xl:pb-xs" }, Fe = ["aria-label"], Ie = { class: "flex min-w-0 items-center gap-sm" }, Le = { class: "truncate text-xs text-secondary" }, Re = { class: "shrink-0 font-mono text-xs font-medium text-primary" }, ze = { class: "flex min-w-0 items-center gap-md xl:col-start-3 xl:row-start-1" }, Be = { class: "flex size-(--spacing-5xl) shrink-0 items-center justify-center rounded-full bg-brand-100" }, Ve = { class: "min-w-0" }, He = { class: "text-xs text-secondary" }, Ue = { class: "mt-xs font-mono text-xl font-semibold whitespace-nowrap text-primary xl:text-2xl" }, We = { class: "flex min-w-0 items-center gap-md xl:col-start-4 xl:row-start-1" }, Ge = { class: "flex size-(--spacing-5xl) shrink-0 items-center justify-center rounded-full bg-brand-100" }, Ke = { class: "text-xs text-secondary" }, qe = { class: "mt-xs font-mono text-2xl font-semibold text-primary" }, Je = {
26
+ key: 0,
27
+ class: "mt-xs text-xs text-secondary"
28
+ }, Ye = { class: "grid gap-3xl xl:grid-cols-[minmax(0,2fr)_25.5rem]" }, Xe = { class: "min-w-0" }, Ze = { class: "overflow-hidden rounded-md border border-secondary bg-primary shadow-sm" }, Qe = { class: "border-b border-secondary px-xl pt-lg" }, $e = { class: "overflow-x-auto" }, et = {
29
+ key: 0,
30
+ class: "w-full min-w-200 table-fixed border-collapse text-left"
31
+ }, tt = { class: "border-b border-secondary bg-secondary" }, nt = { class: "w-[20%] px-xl py-md text-xs font-medium text-secondary" }, rt = { class: "w-[26%] px-xl py-md text-xs font-medium text-secondary" }, it = { class: "w-[14%] px-xl py-md text-xs font-medium text-secondary" }, at = { class: "w-[20%] px-xl py-md text-xs font-medium text-secondary" }, ot = { class: "w-[20%] px-xl py-md text-right text-xs font-medium text-secondary" }, st = { class: "flex items-start gap-md" }, ct = [
32
+ "aria-expanded",
33
+ "aria-label",
34
+ "onClick"
35
+ ], lt = {
36
+ key: 1,
37
+ class: "size-(--spacing-xl) shrink-0"
38
+ }, ut = { class: "min-w-0" }, dt = {
39
+ key: 0,
40
+ class: "mt-xxs truncate text-xs text-secondary"
41
+ }, ft = { class: "px-xl py-md font-mono text-xs" }, pt = { class: "px-xl py-md" }, mt = {
42
+ key: 1,
43
+ class: "flex items-center gap-xs text-xs text-primary"
44
+ }, ht = { class: "px-xl py-md" }, gt = { class: "flex flex-col items-start gap-xs" }, _t = {
45
+ key: 0,
46
+ class: "text-xs text-secondary"
47
+ }, vt = { class: "px-xl py-md text-right font-mono text-xs text-secondary tabular-nums" }, yt = { class: "font-medium" }, bt = {
48
+ key: 0,
49
+ class: "mt-xxs text-tertiary"
50
+ }, xt = ["aria-hidden"], St = {
51
+ class: "p-none",
52
+ colspan: "5"
53
+ }, Ct = { class: "overflow-hidden" }, wt = { class: "relative flex flex-col items-start gap-xs px-5xl py-md text-xs before:absolute before:inset-y-0 before:left-0 before:w-(--spacing-xxs) before:bg-brand-500" }, Tt = {
54
+ key: 1,
55
+ class: "flex flex-col items-center justify-center gap-md px-xl py-2xl"
56
+ }, Et = { class: "flex size-(--spacing-3xl) items-center justify-center rounded-md border border-secondary" }, Dt = { class: "text-sm font-semibold text-secondary" }, Ot = {
57
+ key: 0,
58
+ class: "ml-auto flex w-full max-w-140 flex-col px-xl"
59
+ }, kt = { class: "flex items-center justify-between gap-3xl border-b border-secondary py-lg text-sm text-primary" }, At = { class: "shrink-0 font-mono text-2xl font-semibold tabular-nums" }, jt = { class: "flex items-center justify-between gap-3xl py-lg text-sm text-primary" }, Mt = { class: "shrink-0 font-mono text-sm font-medium tabular-nums" }, Nt = { class: "h-full rounded-md border border-secondary bg-primary p-xl shadow-sm" }, Pt = { class: "text-xl font-semibold text-primary" }, Ft = { class: "mt-2xl flex flex-col" }, It = { class: "flex w-(--spacing-3xl) shrink-0 flex-col items-center" }, Lt = {
60
+ key: 0,
61
+ class: "min-h-(--spacing-xl) w-px flex-1 bg-tertiary"
62
+ }, Rt = { class: "text-sm font-semibold text-primary" }, zt = { class: "mt-xxs text-sm text-secondary" }, I = /* @__PURE__ */ C({
63
+ __name: "DunningCaseDetailView",
64
+ props: { dunningCase: {} },
65
+ setup(e) {
66
+ let d = e, f = m(), p = ge(), C = _e(), P = r(), I = oe(), Bt = n(), L = i(), R = le(), z = ie(), B = E("overdue");
67
+ function V(e) {
68
+ return e.payments.length > 0 || e.creditNotes.length > 0;
69
+ }
70
+ let H = E(d.dunningCase.invoices.find(V)?.uuid ?? null);
71
+ Bt.set(() => d.dunningCase.customer.name), ve(g(() => [{
72
+ key: d.dunningCase.uuid,
73
+ modelName: "DunningCase",
74
+ ...d.dunningCase
75
+ }]));
76
+ let U = g(() => {
77
+ let e = d.dunningCase.invoices.flatMap((e) => [...e.payments.map((t) => ({
78
+ sortDate: t.date.toString(),
79
+ amount: t.amount,
80
+ date: t.date,
81
+ invoiceSequence: e.sequence,
82
+ key: t.uuid,
83
+ settlementStatus: e.settlementStatus,
84
+ type: "payment"
85
+ })), ...e.creditNotes.map((e) => ({
86
+ sortDate: e.finalizedOn.toString(),
87
+ amount: e.grossAmount,
88
+ date: e.finalizedOn,
89
+ key: e.uuid,
90
+ sequence: e.sequence,
91
+ type: "credit-note"
92
+ }))]);
93
+ return d.dunningCase.nextReminderOn !== null && j.PlainDate.compare(d.dunningCase.nextReminderOn, j.Now.plainDateISO()) <= 0 && e.push({
94
+ sortDate: j.Now.plainDateISO().toString(),
95
+ date: d.dunningCase.nextReminderOn,
96
+ key: `due-${d.dunningCase.nextReminderOn.toString()}`,
97
+ type: "reminder-due"
98
+ }), d.dunningCase.lastReminderSentAt !== null && e.push({
99
+ sortDate: d.dunningCase.lastReminderSentAt.toString(),
100
+ date: d.dunningCase.lastReminderSentAt,
101
+ key: `reminder-${d.dunningCase.lastReminderSentAt.toString()}`,
102
+ type: "reminder-sent"
103
+ }), d.dunningCase.closedAt !== null && e.push({
104
+ sortDate: d.dunningCase.closedAt.toString(),
105
+ date: d.dunningCase.closedAt,
106
+ key: `closed-${d.dunningCase.closedAt.toString()}`,
107
+ type: "case-closed"
108
+ }), e.toSorted((e, t) => t.sortDate.localeCompare(e.sortDate));
109
+ }), W = g(() => d.dunningCase.invoices.filter((e) => j.PlainDate.compare(e.dueOn, j.Now.plainDateISO()) < 0).toSorted((e, t) => j.PlainDate.compare(e.dueOn, t.dueOn))), Vt = g(() => d.dunningCase.invoices.filter((e) => j.PlainDate.compare(e.dueOn, j.Now.plainDateISO()) >= 0).toSorted((e, t) => j.PlainDate.compare(e.dueOn, t.dueOn))), G = g(() => B.value === "overdue" ? W.value : Vt.value), K = g(() => d.dunningCase.invoices.filter((e) => e.isDisputed).length), q = g(() => u(d.dunningCase.latestCreatedReminder)), J = g(() => W.value.filter((e) => !e.isDisputed)), Y = g(() => J.value.reduce((e, t) => ({
110
+ ...e,
111
+ amount: e.amount + t.balanceDueAmount.amount
112
+ }), {
113
+ ...d.dunningCase.outstandingBalance,
114
+ amount: 0
115
+ })), X = g(() => ne(J.value, d.dunningCase.outstandingBalance)), Ht = g(() => X.value.map((e, t) => ({
116
+ amount: e,
117
+ level: t
118
+ })));
119
+ function Ut(e) {
120
+ return Y.value.amount === 0 ? 0 : e / Y.value.amount * 100;
121
+ }
122
+ let Z = g(() => L.getCustomerDetailRoute(d.dunningCase.customer.uuid)), Wt = g(() => [{
123
+ label: f.t("module.dunning_case.title"),
124
+ to: { name: "dunning-case-overview" }
125
+ }, { label: d.dunningCase.customer.name }]);
126
+ function Gt() {
127
+ Z.value !== null && R.push(Z.value);
128
+ }
129
+ function Q(e) {
130
+ return e === 0 ? f.t("module.dunning_case.detail.overdue") : Zt(e);
131
+ }
132
+ function Kt(e, t) {
133
+ return f.t("module.dunning_case.detail.outstanding_split_tooltip", {
134
+ amount: P.formatMonetary(t),
135
+ label: Q(e)
136
+ });
137
+ }
138
+ function qt(e) {
139
+ return e.type === "credit-note" || e.type === "payment" || e.type === "reminder-due" ? I.formatPlainDate(e.date) : I.toDateTime(e.date);
140
+ }
141
+ function Jt(e) {
142
+ switch (e.type) {
143
+ case "case-closed": return f.t("module.dunning_case.detail.case_closed");
144
+ case "credit-note": return f.t("module.dunning_case.detail.credit_note_activity", {
145
+ amount: P.formatMonetary(e.amount),
146
+ sequence: e.sequence
147
+ });
148
+ case "payment": return f.t("module.dunning_case.detail.payment_activity", {
149
+ amount: P.formatMonetary(e.amount),
150
+ invoice: e.invoiceSequence
151
+ });
152
+ case "reminder-due": return f.t("module.dunning_case.detail.reminder_due", { level: d.dunningCase.level });
153
+ case "reminder-sent": return f.t("module.dunning_case.detail.reminder_sent");
154
+ }
155
+ }
156
+ function Yt(e) {
157
+ if (e.type === "reminder-due") return f.t("module.dunning_case.detail.today");
158
+ let n = qt(e);
159
+ return e.type === "payment" && e.settlementStatus === t.PARTIALLY_PAID ? f.t("module.dunning_case.detail.payment_partially_paid", { date: n }) : n;
160
+ }
161
+ function $(e) {
162
+ return e.dueOn.until(j.Now.plainDateISO(), { largestUnit: "days" }).days;
163
+ }
164
+ function Xt(e) {
165
+ let t = $(e);
166
+ return t > 0 ? f.t("module.dunning_case.detail.days_ago", { count: t }) : t === 0 ? f.t("module.dunning_case.overview.due_today") : f.t("module.dunning_case.overview.due_in_days", { count: Math.abs(t) });
167
+ }
168
+ function Zt(e) {
169
+ return e === 0 ? f.t("module.dunning_case.level.none") : f.t("module.dunning_case.level.reminder", { level: e });
170
+ }
171
+ function Qt(e) {
172
+ switch (e) {
173
+ case t.PARTIALLY_PAID: return "warning";
174
+ case t.CREDITED:
175
+ case t.OVERPAID:
176
+ case t.PAID:
177
+ case t.SETTLED: return "success";
178
+ case t.UNPAID: return "error";
179
+ }
180
+ }
181
+ function $t() {
182
+ p.create(ae, { props: { dunningCaseUuid: d.dunningCase.uuid } }).open();
183
+ }
184
+ async function en() {
185
+ if (d.dunningCase.latestCreatedReminder === null) return;
186
+ let e = await z.execute({ params: { dunningCaseReminderUuid: d.dunningCase.latestCreatedReminder.uuid } });
187
+ if (e.isErr()) {
188
+ C.apiError(e.error);
189
+ return;
190
+ }
191
+ C.show({
192
+ duration: Infinity,
193
+ message: f.t("module.dunning_case.retry.success", { customer: d.dunningCase.customer.name })
194
+ });
195
+ }
196
+ function tn(e) {
197
+ H.value = H.value === e ? null : e;
198
+ }
199
+ return (e, t) => (T(), _(k(ue), {
200
+ breadcrumbs: Wt.value,
201
+ title: d.dunningCase.customer.name
202
+ }, {
203
+ default: A(() => [S(k(de), null, {
204
+ default: A(() => [b("div", ye, [
205
+ b("div", be, [b("div", null, [
206
+ b("div", xe, [
207
+ b("h2", Se, [Z.value === null ? (T(), y("span", Ce, O(d.dunningCase.customer.name), 1)) : (T(), y("button", {
208
+ key: 0,
209
+ class: "hover:underline",
210
+ type: "button",
211
+ onClick: Gt
212
+ }, O(d.dunningCase.customer.name), 1))]),
213
+ b("span", we, [S(a, { level: d.dunningCase.level }, null, 8, ["level"]), x(" " + O(Zt(d.dunningCase.level)), 1)]),
214
+ S(re, {
215
+ "blocked-reason": null,
216
+ status: q.value
217
+ }, null, 8, ["status"])
218
+ ]),
219
+ d.dunningCase.customer.vatNumber || d.dunningCase.customer.email ? (T(), y("p", Te, O([d.dunningCase.customer.vatNumber, d.dunningCase.customer.email].filter(Boolean).join(" · ")), 1)) : v("", !0),
220
+ b("p", Ee, O(k(f).t("module.dunning_case.detail.last_synced", { date: k(I).toDateTime(d.dunningCase.updatedAt) })), 1)
221
+ ]), d.dunningCase.canSendReminder || q.value === "sending" ? (T(), _(k(N), {
222
+ key: 0,
223
+ "icon-right": k(c),
224
+ "is-loading": q.value === "sending",
225
+ label: k(f).t("module.dunning_case.detail.send"),
226
+ class: "w-fit self-start lg:ml-auto",
227
+ size: "sm",
228
+ onClick: $t
229
+ }, null, 8, [
230
+ "icon-right",
231
+ "is-loading",
232
+ "label"
233
+ ])) : d.dunningCase.canRetryReminder ? (T(), _(k(N), {
234
+ key: 1,
235
+ "icon-right": k(c),
236
+ "is-loading": k(z).result.value.isLoading(),
237
+ label: k(f).t("module.dunning_case.detail.retry"),
238
+ class: "w-fit self-start lg:ml-auto",
239
+ size: "sm",
240
+ onClick: en
241
+ }, null, 8, [
242
+ "icon-right",
243
+ "is-loading",
244
+ "label"
245
+ ])) : v("", !0)]),
246
+ b("div", De, [
247
+ b("div", Oe, [
248
+ b("p", ke, O(k(f).t("module.dunning_case.detail.outstanding")), 1),
249
+ b("p", Ae, O(k(P).formatMonetary(d.dunningCase.outstandingBalance)), 1),
250
+ b("p", je, O(k(f).t("module.dunning_case.detail.collected_summary", {
251
+ billed: k(P).formatMonetary(d.dunningCase.totalInvoiced),
252
+ collected: k(P).formatMonetary(d.dunningCase.totalPaid)
253
+ })), 1),
254
+ d.dunningCase.totalCredited.amount > 0 ? (T(), y("p", Me, O(k(f).t("module.dunning_case.detail.credited_summary", { credited: k(P).formatMonetary(d.dunningCase.totalCredited) })), 1)) : v("", !0),
255
+ b("div", Ne, [(T(!0), y(h, null, D(X.value, (e, t) => (T(), y("span", {
256
+ key: t,
257
+ class: w([{
258
+ "bg-quaternary": t === 0,
259
+ "bg-brand-500": t === 1,
260
+ "bg-error-solid": t === 3,
261
+ "bg-warning-solid": t === 2
262
+ }, "h-full"]),
263
+ style: se({ width: `${Ut(e.amount)}%` })
264
+ }, null, 6))), 128))])
265
+ ]),
266
+ b("div", Pe, [(T(!0), y(h, null, D(Ht.value, (e) => (T(), _(k(me), {
267
+ key: e.level,
268
+ "popover-side-offset": 8,
269
+ "popover-align": "start",
270
+ "popover-side": "top"
271
+ }, {
272
+ trigger: A(() => [b("button", {
273
+ "aria-label": Kt(e.level, e.amount),
274
+ class: "flex min-w-0 items-center justify-between gap-lg rounded-sm border-none bg-transparent p-none text-left hover:bg-secondary focus-visible:outline-2 focus-visible:outline-brand-500 xl:flex-row xl:items-center xl:gap-lg",
275
+ type: "button"
276
+ }, [b("span", Ie, [b("span", { class: w([{
277
+ "bg-quaternary": e.level === 0,
278
+ "bg-brand-500": e.level === 1,
279
+ "bg-error-solid": e.level === 3,
280
+ "bg-warning-solid": e.level === 2
281
+ }, "size-(--spacing-sm) shrink-0 rounded-full"]) }, null, 2), b("span", Le, O(Q(e.level)), 1)]), b("span", Re, O(k(P).formatMonetary(e.amount)), 1)], 8, Fe)]),
282
+ content: A(() => [S(k(he), { class: "max-w-80! text-sm!" }, {
283
+ default: A(() => [x(O(Kt(e.level, e.amount)), 1)]),
284
+ _: 2
285
+ }, 1024)]),
286
+ _: 2
287
+ }, 1024))), 128))]),
288
+ b("div", ze, [b("span", Be, [S(k(l), { class: "size-(--spacing-xl) text-brand-700" })]), b("div", Ve, [b("p", He, O(k(f).t("module.dunning_case.detail.next_reminder")), 1), b("p", Ue, O(d.dunningCase.nextReminderOn === null ? k(f).t("module.dunning_case.overview.not_scheduled") : k(I).formatPlainDate(d.dunningCase.nextReminderOn)), 1)])]),
289
+ b("div", We, [b("span", Ge, [S(k(o), { class: "size-(--spacing-xl) text-brand-700" })]), b("div", null, [
290
+ b("p", Ke, O(k(f).t("module.dunning_case.detail.invoices")), 1),
291
+ b("p", qe, O(d.dunningCase.invoices.length), 1),
292
+ K.value > 0 ? (T(), y("p", Je, O(k(f).t("module.dunning_case.detail.protested_count", { count: K.value })), 1)) : v("", !0)
293
+ ])])
294
+ ]),
295
+ b("div", Ye, [b("main", Xe, [b("div", Ze, [
296
+ b("div", Qe, [S(k(fe), {
297
+ modelValue: B.value,
298
+ "onUpdate:modelValue": t[0] ||= (e) => B.value = e,
299
+ "aria-label": k(f).t("module.dunning_case.detail.invoice_tabs"),
300
+ variant: "underline"
301
+ }, {
302
+ default: A(() => [S(k(pe), null, {
303
+ default: A(() => [S(k(F), {
304
+ label: k(f).t("module.dunning_case.detail.overdue_invoices"),
305
+ value: "overdue"
306
+ }, null, 8, ["label"]), S(k(F), {
307
+ label: k(f).t("module.dunning_case.detail.outstanding_invoices"),
308
+ value: "outstanding"
309
+ }, null, 8, ["label"])]),
310
+ _: 1
311
+ })]),
312
+ _: 1
313
+ }, 8, ["modelValue", "aria-label"])]),
314
+ b("div", $e, [G.value.length > 0 ? (T(), y("table", et, [b("thead", null, [b("tr", tt, [
315
+ b("th", nt, O(k(f).t("module.dunning_case.detail.table.invoice")), 1),
316
+ b("th", rt, O(k(f).t("module.dunning_case.detail.table.due_date")), 1),
317
+ b("th", it, O(k(f).t("module.dunning_case.detail.table.level")), 1),
318
+ b("th", at, O(k(f).t("module.dunning_case.detail.table.status")), 1),
319
+ b("th", ot, O(k(f).t("module.dunning_case.detail.table.remaining")), 1)
320
+ ])]), b("tbody", null, [(T(!0), y(h, null, D(G.value, (e) => (T(), y(h, { key: e.uuid }, [b("tr", { class: w([{ "opacity-60": e.isDisputed }, "border-b border-secondary"]) }, [
321
+ b("td", { class: w([{
322
+ "before:opacity-0": H.value !== e.uuid,
323
+ "before:opacity-100": H.value === e.uuid
324
+ }, "relative px-xl py-md before:absolute before:inset-y-0 before:left-0 before:w-(--spacing-xxs) before:bg-brand-500"]) }, [b("div", st, [V(e) ? (T(), y("button", {
325
+ key: 0,
326
+ "aria-expanded": H.value === e.uuid,
327
+ "aria-label": k(f).t(H.value === e.uuid ? "module.dunning_case.detail.collapse_updates" : "module.dunning_case.detail.expand_updates", { invoice: e.sequence }),
328
+ class: "mt-xxs flex size-(--spacing-xl) shrink-0 items-center justify-center text-secondary hover:text-primary",
329
+ type: "button",
330
+ onClick: (t) => tn(e.uuid)
331
+ }, [S(k(ee), { class: w([{ "rotate-180": H.value === e.uuid }, "size-(--spacing-xl) transition-transform duration-200 ease-out motion-reduce:transition-none"]) }, null, 8, ["class"])], 8, ct)) : (T(), y("span", lt)), b("div", ut, [S(k(ce), {
332
+ to: {
333
+ name: "invoicing-invoice-detail",
334
+ params: { invoiceUuid: e.uuid }
335
+ },
336
+ class: "font-mono text-xs font-medium text-primary hover:underline"
337
+ }, {
338
+ default: A(() => [x(O(e.sequence), 1)]),
339
+ _: 2
340
+ }, 1032, ["to"]), e.subject === null ? v("", !0) : (T(), y("p", dt, O(e.subject), 1))])])], 2),
341
+ b("td", ft, [b("span", { class: w([e.isDisputed ? "text-secondary" : $(e) > 0 ? "text-error-primary" : "text-primary", "inline-flex items-center gap-xs whitespace-nowrap"]) }, [x(O(k(I).formatPlainDate(e.dueOn)) + " ", 1), b("span", { class: w([!e.isDisputed && $(e) > 0 ? "\n border-error bg-error-primary\n text-error-primary\n " : "border-secondary bg-secondary text-secondary", "rounded-sm border px-sm py-px font-sans text-xs"]) }, O(Xt(e)), 3)], 2)]),
342
+ b("td", pt, [e.isDisputed ? (T(), _(k(M), {
343
+ key: 0,
344
+ label: k(f).t("module.dunning_case.detail.protested"),
345
+ color: "error",
346
+ size: "sm",
347
+ variant: "translucent"
348
+ }, null, 8, ["label"])) : B.value === "overdue" ? (T(), y("span", mt, [S(a, {
349
+ level: e.level,
350
+ size: "sm"
351
+ }, null, 8, ["level"]), x(" " + O(e.level === 0 ? "–" : e.level), 1)])) : v("", !0)]),
352
+ b("td", ht, [b("div", gt, [e.isDisputed ? (T(), y("p", _t, O(k(f).t("module.dunning_case.detail.excluded")), 1)) : B.value === "outstanding" ? (T(), _(k(M), {
353
+ key: 1,
354
+ label: k(f).t("module.dunning_case.detail.not_yet_due"),
355
+ color: "gray",
356
+ size: "sm",
357
+ variant: "translucent"
358
+ }, null, 8, ["label"])) : (T(), _(k(M), {
359
+ key: 2,
360
+ label: k(f).t(`module.dunning_case.settlement_status.${e.settlementStatus}`),
361
+ color: Qt(e.settlementStatus),
362
+ size: "sm",
363
+ variant: "translucent"
364
+ }, null, 8, ["label", "color"]))])]),
365
+ b("td", vt, [b("p", yt, O(k(P).formatMonetary(e.balanceDueAmount)), 1), e.balanceDueAmount.amount === e.grossAmount.amount ? v("", !0) : (T(), y("p", bt, " /" + O(k(P).formatMonetary(e.grossAmount)), 1))])
366
+ ], 2), V(e) ? (T(), y("tr", {
367
+ key: `${e.uuid}-updates`,
368
+ class: w({ "border-b border-secondary": H.value === e.uuid }),
369
+ "aria-hidden": H.value !== e.uuid
370
+ }, [b("td", St, [b("div", { class: w([H.value === e.uuid ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0", "grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none"]) }, [b("div", Ct, [b("div", wt, [(T(!0), y(h, null, D(e.payments, (e) => (T(), y("span", {
371
+ key: e.uuid,
372
+ class: "inline-flex items-center gap-sm rounded-sm bg-success-primary px-md py-sm text-success-primary"
373
+ }, [t[1] ||= b("span", { class: "size-(--spacing-sm) shrink-0 rounded-full bg-success-solid" }, null, -1), x(" " + O(k(f).t("module.dunning_case.detail.payment_line", {
374
+ amount: k(P).formatMonetary(e.amount),
375
+ date: k(I).formatPlainDate(e.date)
376
+ })), 1)]))), 128)), (T(!0), y(h, null, D(e.creditNotes, (e) => (T(), y("span", {
377
+ key: e.uuid,
378
+ class: "inline-flex items-center gap-sm rounded-sm bg-secondary px-md py-sm text-secondary"
379
+ }, [t[2] ||= b("span", { class: "size-(--spacing-sm) shrink-0 rounded-full bg-quaternary" }, null, -1), x(" " + O(k(f).t("module.dunning_case.detail.credit_note_line", {
380
+ amount: k(P).formatMonetary(e.grossAmount),
381
+ date: k(I).formatPlainDate(e.finalizedOn),
382
+ sequence: e.sequence
383
+ })), 1)]))), 128))])])], 2)])], 10, xt)) : v("", !0)], 64))), 128))])])) : (T(), y("div", Tt, [b("span", Et, [S(k(s), { class: "size-(--spacing-xl) text-primary" })]), b("p", Dt, O(k(f).t(B.value === "overdue" ? "module.dunning_case.detail.empty_overdue" : "module.dunning_case.detail.empty_outstanding")), 1)]))]),
384
+ B.value === "overdue" ? (T(), y("div", Ot, [b("div", kt, [b("span", null, O(k(f).t("module.dunning_case.detail.total_outstanding")), 1), b("span", At, O(k(P).formatMonetary(Y.value)), 1)]), b("div", jt, [b("span", null, O(d.dunningCase.level === 0 ? k(f).t("module.dunning_case.detail.reminder_fee") : k(f).t("module.dunning_case.detail.fee", { level: d.dunningCase.level })), 1), b("span", Mt, O(k(P).formatMonetary(d.dunningCase.totalFee)), 1)])])) : v("", !0)
385
+ ])]), b("aside", Nt, [b("h2", Pt, O(k(f).t("module.dunning_case.detail.activity")), 1), b("ol", Ft, [(T(!0), y(h, null, D(U.value, (e, t) => (T(), y("li", {
386
+ key: e.key,
387
+ class: "flex gap-md"
388
+ }, [b("div", It, [b("span", { class: w([{
389
+ "bg-brand-100": e.type === "reminder-sent",
390
+ "bg-error-secondary": e.type === "reminder-due",
391
+ "bg-success-secondary": e.type === "payment" || e.type === "case-closed",
392
+ "bg-tertiary": e.type === "credit-note"
393
+ }, "flex size-(--spacing-3xl) shrink-0 items-center justify-center rounded-full"]) }, [e.type === "reminder-due" ? (T(), _(k(l), {
394
+ key: 0,
395
+ class: "size-(--spacing-lg) text-error-primary"
396
+ })) : e.type === "payment" ? (T(), _(k(te), {
397
+ key: 1,
398
+ class: "size-(--spacing-lg) text-success-primary"
399
+ })) : e.type === "credit-note" ? (T(), _(k(o), {
400
+ key: 2,
401
+ class: "size-(--spacing-lg) text-secondary"
402
+ })) : e.type === "reminder-sent" ? (T(), _(k(c), {
403
+ key: 3,
404
+ class: "size-(--spacing-lg) text-brand-tertiary"
405
+ })) : e.type === "case-closed" ? (T(), _(k(s), {
406
+ key: 4,
407
+ class: "size-(--spacing-lg) text-success-primary"
408
+ })) : v("", !0)], 2), t < U.value.length - 1 ? (T(), y("span", Lt)) : v("", !0)]), b("div", { class: w([{ "pb-xl": t < U.value.length - 1 }, "pt-xs"]) }, [b("p", Rt, O(Jt(e)), 1), b("p", zt, O(Yt(e)), 1)], 2)]))), 128))])])])
409
+ ])]),
410
+ _: 1
411
+ })]),
412
+ _: 1
413
+ }, 8, ["breadcrumbs", "title"]));
414
+ }
415
+ }), Bt = /*@__PURE__*/ C({
416
+ __name: "DunningCaseDetailViewDataProvider",
417
+ props: { dunningCaseUuid: {} },
418
+ setup(e) {
419
+ let t = e, n = m(), r = d(g(() => t.dunningCaseUuid));
420
+ f({
421
+ refetch: r.refetch,
422
+ sendingUuids: () => r.result.value.isOk() && u(r.result.value.getValue().latestCreatedReminder) === "sending" ? [t.dunningCaseUuid] : []
423
+ });
424
+ let i = g(() => [{
425
+ label: n.t("module.dunning_case.title"),
426
+ to: { name: "dunning-case-overview" }
427
+ }, {
428
+ isLoading: !0,
429
+ label: ""
430
+ }]);
431
+ return (e, t) => (T(), _(p, { queries: { dunningCase: k(r) } }, {
432
+ default: A(({ data: e }) => [S(I, { "dunning-case": e.dunningCase }, null, 8, ["dunning-case"])]),
433
+ loading: A(() => [S(k(P), { breadcrumbs: i.value }, null, 8, ["breadcrumbs"])]),
434
+ _: 1
435
+ }, 8, ["queries"]));
436
+ }
437
+ }), L = /* @__PURE__ */ e({ default: () => R }), R = Bt;
438
+ //#endregion
439
+ export { L as n, R as t };