@wisemen/wise-invoicing-web 0.0.4 → 0.0.6

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 (91) hide show
  1. package/dist/{BillingDocumentDetailViewDataProvider-pePmiXWb.js → BillingDocumentDetailViewDataProvider-BGE-p_FL.js} +953 -863
  2. package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
  3. package/dist/{BillingDocumentPdf-Dg5JlQE1.js → BillingDocumentPdf-Ca81NkZq.js} +4 -4
  4. package/dist/{CreditNoteDetailViewDataProvider-C-A0jyVr.js → CreditNoteDetailViewDataProvider-b5dY_4mH.js} +181 -181
  5. package/dist/{CreditNotePdfViewDataProvider-DNUvFVDj.js → CreditNotePdfViewDataProvider-C2QqCdQ7.js} +3 -3
  6. package/dist/{CustomFieldValueText-DDQq-975.js → CustomFieldValueText-ne5yy02J.js} +2 -2
  7. package/dist/DataProvider-Dj34ljUX.js +75 -0
  8. package/dist/{DunningCaseDetailViewDataProvider-0WV-7-vg.js → DunningCaseDetailViewDataProvider-jsh-LlGx.js} +68 -59
  9. package/dist/DunningCaseOverviewView-WbXalMt6.js +747 -0
  10. package/dist/{DunningCaseReminderPdfViewDataProvider-DcM-7ECg.js → DunningCaseReminderPdfViewDataProvider-B3Y2aYFf.js} +1 -1
  11. package/dist/DunningCaseSendDialog-D7jAZ8yT.js +349 -0
  12. package/dist/{InvoiceDetailViewDataProvider-BDL9lAWe.js → InvoiceDetailViewDataProvider-BAVdcJay.js} +589 -498
  13. package/dist/{InvoiceOverviewViewDataProvider-B_jrcC_8.js → InvoiceOverviewViewDataProvider-BT9cuQXw.js} +546 -482
  14. package/dist/{InvoicePdfView-Bygb-9z6.js → InvoicePdfView-BpIaYdZX.js} +2 -2
  15. package/dist/{InvoicePdfViewDataProvider-nBk3XNrE.js → InvoicePdfViewDataProvider-DGCnmNE-.js} +3 -3
  16. package/dist/{InvoicePublicPdfViewDataProvider-DHJP_-7-.js → InvoicePublicPdfViewDataProvider-KV0_hKUI.js} +3 -3
  17. package/dist/{IssuerSettingsViewDataProvider-Dk_Q6w6f.js → IssuerSettingsViewDataProvider-Bs4rEES2.js} +4 -4
  18. package/dist/ReminderSettingsViewDataProvider-D4bRLLXx.js +711 -0
  19. package/dist/{api.util-Dm_TQedZ.js → api.util-BCSgCfpS.js} +528 -509
  20. package/dist/{billingDocumentDetail.transformer-zMTbka5p.js → billingDocumentDetail.transformer-DIKAl4_L.js} +58 -89
  21. package/dist/client/index.d.ts +1 -1
  22. package/dist/client/types.gen.d.ts +28 -5
  23. package/dist/client/zod.gen.d.ts +869 -623
  24. package/dist/{creditNoteDetail.query-BZqgZRSu.js → creditNoteDetail.query-DHP69UiB.js} +13 -13
  25. package/dist/{dist-DP8KNFVD.js → dist-D9lp7NDv.js} +20 -36
  26. package/dist/{dist-DJ8yJcb9.js → dist-PErDVE6-.js} +621 -671
  27. package/dist/{documentTitle.composable-CeaFddr1.js → documentTitle.composable-4ApFl9TZ.js} +10 -8
  28. package/dist/{i18n.lib-DUbAMBRb.js → i18n.lib-BGcQ_OBF.js} +50 -2
  29. package/dist/index.d.ts +51 -2
  30. package/dist/index.js +78 -78
  31. package/dist/{invoice.service-ChHEtXBA.js → invoice.service-DG5eacZC.js} +46 -46
  32. package/dist/{invoiceDeliveryStatus.util-BsA-MlA3.js → invoiceDeliveryStatus.util-CX-IdqAu.js} +28 -28
  33. package/dist/{invoiceDetail.query-O_CGvdwg.js → invoiceDetail.query-C_IMGjOX.js} +1 -1
  34. package/dist/{invoicingConfig.composable-c6w_aMm1.js → invoicingConfig.composable-Kad_HHx_.js} +2 -2
  35. package/dist/{issuerSettings.query-RqtrZFaB.js → issuerSettings.query-6wnSPphB.js} +2 -2
  36. package/dist/libs/i18n.lib.d.ts +50 -2
  37. package/dist/locales/en-US.json.d.ts +25 -1
  38. package/dist/locales/nl-BE.json.d.ts +25 -1
  39. package/dist/models/billing-document/billingDocumentLineItemGroupUpdateForm.model.d.ts +9 -3
  40. package/dist/modules/dunning-case/actions/dunningCase.actions.d.ts +12 -0
  41. package/dist/modules/dunning-case/actions/dunningCaseNavigateToCustomer.action.d.ts +1 -0
  42. package/dist/modules/dunning-case/actions/dunningCaseNavigateToDetail.action.d.ts +1 -0
  43. package/dist/modules/dunning-case/api/mutations/reminderConfigUpdate.mutation.d.ts +2 -0
  44. package/dist/modules/dunning-case/models/dunningCase.model.d.ts +12 -3
  45. package/dist/modules/dunning-case/models/reminderConfigForm.model.d.ts +3 -1
  46. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewActionsCell.vue.d.ts +13 -0
  47. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewCustomerCell.vue.d.ts +7 -0
  48. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewDaysOverdueCell.vue.d.ts +7 -0
  49. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewLastReminderCell.vue.d.ts +7 -0
  50. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewLevelCell.vue.d.ts +7 -0
  51. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewMetrics.vue.d.ts +8 -0
  52. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewOutstandingCell.vue.d.ts +7 -0
  53. package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewReminderCell.vue.d.ts +7 -0
  54. package/dist/modules/dunning-case/use-cases/overview/components/dunningCaseOverviewActionsCell.spec.d.ts +1 -0
  55. package/dist/modules/dunning-case/use-cases/overview/components/dunningCaseOverviewLastReminderCell.spec.d.ts +1 -0
  56. package/dist/modules/dunning-case/use-cases/overview/components/dunningCaseOverviewReminderCell.spec.d.ts +1 -0
  57. package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverview.composable.d.ts +24 -0
  58. package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewTableColumns.composable.d.ts +8 -0
  59. package/dist/modules/dunning-case/use-cases/send/dialogs/dunningCaseBulkSendDialog.spec.d.ts +1 -0
  60. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +3 -1
  61. package/dist/modules/dunning-case/use-cases/settings/components/reminderLadderFeeNotice.spec.d.ts +1 -0
  62. package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +3 -1
  63. package/dist/modules/invoice/api/invoiceIndexCache.util.d.ts +4 -4
  64. package/dist/modules/invoice/api/queries/invoiceUserSearch.query.d.ts +3 -0
  65. package/dist/modules/invoice/api/query-keys/invoice.queryKeys.d.ts +8 -0
  66. package/dist/modules/invoice/api/services/invoiceUser.service.d.ts +6 -0
  67. package/dist/modules/invoice/components/form/InvoiceFormPreparedByField.vue.d.ts +16 -0
  68. package/dist/modules/invoice/models/invoice/update/invoicePreparer.model.d.ts +4 -0
  69. package/dist/modules/invoice/models/invoice/update/invoicePreparer.transformer.d.ts +5 -0
  70. package/dist/modules/invoice/models/invoice/update/invoiceUserSearchQueryParams.model.d.ts +3 -0
  71. package/dist/modules/invoice/models/invoice/update/invoiceUserSearchQueryParams.transformer.d.ts +6 -0
  72. package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkActionDialog.vue.d.ts +1 -0
  73. package/dist/{plainDate.transformer-BxvJpJOv.js → plainDate.transformer-Dfe5r84P.js} +32 -1
  74. package/dist/{reminderConfig.query-DzTN2AvU.js → reminderConfig.query-hmDNKreg.js} +105 -91
  75. package/dist/search.composable-BCtYqudV.js +52 -0
  76. package/dist/style.css +1 -1
  77. package/dist/ui/billing-document/table/billingDocumentLineItemsTable.context.d.ts +6 -6
  78. package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsEditor.composable.d.ts +1 -1
  79. package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsRowMutations.composable.d.ts +2 -2
  80. package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsRowMutations.composable.spec.d.ts +1 -0
  81. package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsTableDrag.composable.d.ts +3 -1
  82. package/dist/ui/billing-document/table/field/BillingDocumentLineItemsTableField.vue.d.ts +2 -0
  83. package/dist/ui/billing-document/table/field/BillingDocumentLineItemsTableTextField.vue.d.ts +1 -0
  84. package/dist/ui/billing-document/table/utils/billingDocumentLineItemsEditor.util.d.ts +19 -0
  85. package/dist/ui/data-provider/DataProviderErrorState.vue.d.ts +7 -0
  86. package/dist/ui/data-provider/dataProviderErrorState.spec.d.ts +1 -0
  87. package/package.json +6 -1
  88. package/dist/DataProvider-CfHLB3rH.js +0 -48
  89. package/dist/DunningCaseOverviewView-CHdzfbhb.js +0 -553
  90. package/dist/DunningCaseSendDialog-DBtwr2ue.js +0 -350
  91. package/dist/ReminderSettingsViewDataProvider-CDBjfU7R.js +0 -668
@@ -0,0 +1,747 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { t } from "./documentTitle.composable-4ApFl9TZ.js";
3
+ import { r as n } from "./useCurrencyFormat.composable-MtZaqKnO.js";
4
+ import { t as r } from "./search.composable-BCtYqudV.js";
5
+ import { n as i } from "./invoicingConfig.composable-Kad_HHx_.js";
6
+ import { n as a, r as o } from "./reminderConfig.query-hmDNKreg.js";
7
+ import { $ as s, N as c, S as l, c as u, k as d, l as f, tt as p } from "./dist-D9lp7NDv.js";
8
+ import { i as m, o as h, r as g, t as _ } from "./DunningCaseSendDialog-D7jAZ8yT.js";
9
+ import { f as v, i as y, n as ee, o as te, r as b, s as ne } from "./dist-PErDVE6-.js";
10
+ import { createAction as x } from "@wisemen/vue-core-actions";
11
+ import { useRouter as S } from "vue-router";
12
+ import { z as C } from "zod";
13
+ import { useI18n as w } from "vue-i18n";
14
+ import { Fragment as T, computed as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createVNode as j, defineComponent as M, nextTick as re, normalizeClass as N, normalizeStyle as P, onMounted as F, openBlock as I, ref as L, renderList as R, toDisplayString as z, unref as B, watch as V, withCtx as H } from "vue";
15
+ import { useMutation as U, useOffsetInfiniteQuery as W } from "@wisemen/vue-core-api-utils";
16
+ import { Temporal as G } from "temporal-polyfill";
17
+ import { UIBadge as ie, UIButton as K, UIDashboardPage as ae, UIDialogBody as q, UIDialogFooter as J, UIDialogFooterCancel as Y, UIDialogFooterPrimary as X, UIDialogHeader as oe, UIFormDialog as se, UITable as ce, UITableCell as Z, UITableCellInteractiveElement as le, UITabs as ue, UITabsItem as de, UITabsList as fe, createComponent as Q, defineTableColumns as pe, useOverlay as me, useToast as he } from "@wisemen/vue-core-design-system";
18
+ import { useForm as ge } from "formango";
19
+ //#region src/modules/dunning-case/api/queries/dunningCaseIndex.query.ts
20
+ function $(e) {
21
+ let t = E(() => ({
22
+ customerUuid: e.params.customerUuid?.value,
23
+ isOpen: e.params.isOpen?.value,
24
+ dunningCaseUuids: e.params.dunningCaseUuids?.value,
25
+ level: e.params.level?.value
26
+ }));
27
+ return W("dunningCaseIndex", {
28
+ isEnabled: E(() => e.isEnabled?.value ?? !0),
29
+ params: { queryParams: t },
30
+ queryFn: (e) => o.getAll({
31
+ ...t.value,
32
+ pagination: e
33
+ })
34
+ });
35
+ }
36
+ //#endregion
37
+ //#region src/modules/dunning-case/actions/dunningCaseNavigateToCustomer.action.ts
38
+ function _e() {
39
+ let e = w(), t = S(), n = i();
40
+ return x({
41
+ id: "dunning-case-navigate-to-customer",
42
+ isApplicable: (e) => {
43
+ let t = e.targetedModelOfType("DunningCase");
44
+ return t !== null && n.getCustomerDetailRoute(t.customer.uuid) !== null;
45
+ },
46
+ name: () => e.t("module.dunning_case.overview.menu.view_customer"),
47
+ execute: (e) => {
48
+ let r = e.targetedModelOfTypeOrThrow("DunningCase"), i = n.getCustomerDetailRoute(r.customer.uuid);
49
+ i !== null && t.push(i);
50
+ },
51
+ icon: () => f
52
+ });
53
+ }
54
+ //#endregion
55
+ //#region src/modules/dunning-case/actions/dunningCaseNavigateToDetail.action.ts
56
+ function ve() {
57
+ let e = w(), t = S();
58
+ return x({
59
+ id: "dunning-case-navigate-to-detail",
60
+ isApplicable: (e) => e.hasTargetedModelsOfType("DunningCase"),
61
+ name: () => e.t("module.dunning_case.overview.menu.view_case"),
62
+ execute: (e) => {
63
+ let n = e.targetedModelOfTypeOrThrow("DunningCase");
64
+ t.push({
65
+ name: "dunning-case-detail",
66
+ params: { dunningCaseUuid: n.uuid }
67
+ });
68
+ },
69
+ icon: () => d
70
+ });
71
+ }
72
+ //#endregion
73
+ //#region src/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewMetrics.vue?vue&type=script&setup=true&lang.ts
74
+ var ye = ["aria-label"], be = { class: "text-xs font-semibold text-secondary uppercase" }, xe = { class: "mt-xl font-mono text-4xl font-semibold text-primary" }, Se = { class: "mt-xs text-sm text-secondary" }, Ce = { class: "lg:col-span-2" }, we = { class: "flex h-1.5 w-full overflow-hidden rounded-full bg-secondary" }, Te = { class: "mt-xl grid grid-cols-1 gap-md sm:grid-cols-3" }, Ee = { class: "flex min-w-0 items-center gap-sm" }, De = { class: "truncate text-sm text-secondary" }, Oe = { class: "shrink-0 font-mono text-sm font-semibold text-primary tabular-nums" }, ke = /* @__PURE__ */ M({
75
+ __name: "DunningCaseOverviewMetrics",
76
+ props: {
77
+ hasLevelCountError: { type: Boolean },
78
+ levelCounts: {},
79
+ levelCountTotal: {}
80
+ },
81
+ setup(e) {
82
+ let t = e, n = w(), r = E(() => t.hasLevelCountError ? n.t("module.dunning_case.overview.metrics_unavailable") : t.levelCountTotal === null ? n.t("module.dunning_case.common.loading") : n.t("module.dunning_case.overview.case_count", { count: t.levelCountTotal }));
83
+ function i(e) {
84
+ return e === 0 ? n.t("module.dunning_case.level.none") : n.t("module.dunning_case.level.reminder", { level: e });
85
+ }
86
+ return (t, a) => (I(), k("section", {
87
+ "aria-label": B(n).t("module.dunning_case.overview.levels"),
88
+ class: "grid min-w-0 grid-cols-1 gap-2xl rounded-lg border border-secondary bg-primary p-2xl shadow-sm lg:grid-cols-3 lg:items-center"
89
+ }, [A("div", null, [
90
+ A("p", be, z(B(n).t("module.dunning_case.overview.levels")), 1),
91
+ A("p", xe, z(e.levelCountTotal ?? "—"), 1),
92
+ A("p", Se, z(r.value), 1)
93
+ ]), A("div", Ce, [A("div", we, [(I(!0), k(T, null, R(e.levelCounts, (e, t) => (I(), k("span", {
94
+ key: t,
95
+ class: N({
96
+ "bg-brand-500": t === 0,
97
+ "bg-error-solid": t === 2,
98
+ "bg-warning-solid": t === 1
99
+ }),
100
+ style: P({ flexGrow: e ?? 0 })
101
+ }, null, 6))), 128))]), A("div", Te, [(I(!0), k(T, null, R(e.levelCounts, (e, t) => (I(), k("div", {
102
+ key: t,
103
+ class: "flex items-center justify-between gap-xl"
104
+ }, [A("div", Ee, [A("span", { class: N([{
105
+ "bg-brand-500": t === 0,
106
+ "bg-error-solid": t === 2,
107
+ "bg-warning-solid": t === 1
108
+ }, "size-2 shrink-0 rounded-full"]) }, null, 2), A("p", De, z(i(t + 1)), 1)]), A("p", Oe, z(e ?? "—"), 1)]))), 128))])])], 8, ye));
109
+ }
110
+ });
111
+ //#endregion
112
+ //#region src/modules/dunning-case/use-cases/overview/composables/dunningCaseOverview.composable.ts
113
+ function Ae(e) {
114
+ let t = E(() => !0), { isFetchingNextPage: n, isLoading: r, fetchNextPage: i, result: a } = $({ params: {
115
+ customerUuid: e.customerUuid,
116
+ isOpen: t,
117
+ level: E(() => e.activeLevel.value ?? void 0)
118
+ } }), o = E(() => a.value.isOk() ? a.value.getValue().data : []), s = E(() => a.value.isErr() ? a.value.getError() : null), c = $({ params: {
119
+ customerUuid: e.customerUuid,
120
+ isOpen: t,
121
+ level: E(() => 1)
122
+ } }), l = $({ params: {
123
+ customerUuid: e.customerUuid,
124
+ isOpen: t,
125
+ level: E(() => 2)
126
+ } }), u = $({ params: {
127
+ customerUuid: e.customerUuid,
128
+ isOpen: t,
129
+ level: E(() => 3)
130
+ } }), d = E(() => [
131
+ c,
132
+ l,
133
+ u
134
+ ].map((e) => e.result.value.isOk() ? e.result.value.getValue().meta.total : null));
135
+ return {
136
+ hasLevelCountError: E(() => [
137
+ c,
138
+ l,
139
+ u
140
+ ].some((e) => e.result.value.isErr())),
141
+ isFetchingNextPage: n,
142
+ isLoading: r,
143
+ data: o,
144
+ error: s,
145
+ fetchNextPage: i,
146
+ levelCounts: d,
147
+ levelCountTotal: E(() => d.value.every((e) => e !== null) ? d.value.reduce((e, t) => e + t, 0) : null),
148
+ result: a
149
+ };
150
+ }
151
+ //#endregion
152
+ //#region src/modules/dunning-case/api/queries/dunningCaseCustomerIndex.query.ts
153
+ function je(e) {
154
+ let t = E(() => ({ search: e.params.search?.value }));
155
+ return W("dunningCaseCustomerIndex", {
156
+ params: { queryParams: t },
157
+ queryFn: (e) => h.getAll(t.value.search, e)
158
+ });
159
+ }
160
+ //#endregion
161
+ //#region src/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewFilters.composable.ts
162
+ function Me() {
163
+ let e = w(), t = r({ debounceMs: 250 }), n = je({ params: { search: t.debouncedSearch } }), i = E(() => n.result.value.isOk() ? n.result.value.getValue().data : []), a = y({
164
+ actionGroup: { name: "dunning-cases" },
165
+ filters: [v({
166
+ defaultValue: {
167
+ operator: b.INCLUDES,
168
+ value: []
169
+ },
170
+ disableOperators: !0,
171
+ displayFn: (e) => i.value.find((t) => t.uuid === e)?.name ?? e,
172
+ key: "customerUuids",
173
+ label: e.t("module.dunning_case.overview.filter_customer"),
174
+ options: async (e) => a.values.value.customerUuids.value.length > 0 ? [] : (t.updateSearch(e), await re(), i.value.map((e) => e.uuid))
175
+ })]
176
+ });
177
+ return V(() => a.values.value.customerUuids, (e) => {
178
+ (e.operator !== b.INCLUDES || e.value.length > 1) && (a.values.value.customerUuids = {
179
+ operator: b.INCLUDES,
180
+ value: e.value.slice(-1)
181
+ });
182
+ }, {
183
+ deep: !0,
184
+ immediate: !0
185
+ }), {
186
+ customerUuid: E(() => a.values.value.customerUuids.value[0]),
187
+ filters: a
188
+ };
189
+ }
190
+ //#endregion
191
+ //#region src/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewActionsCell.vue?vue&type=script&setup=true&lang.ts
192
+ var Ne = { class: "flex w-full items-center justify-end gap-xs" }, Pe = /* @__PURE__ */ M({
193
+ __name: "DunningCaseOverviewActionsCell",
194
+ props: { item: {} },
195
+ emits: ["send", "viewCustomer"],
196
+ setup(e, { emit: t }) {
197
+ let n = e, r = t, a = w(), o = i(), s = E(() => o.getCustomerDetailRoute(n.item.customer.uuid)), c = E(() => n.item.blockedReason !== null), u = E(() => g(n.item.latestCreatedReminder)), d = E(() => c.value ? a.t("module.dunning_case.overview.blocked") : n.item.nextReminderOn === null ? a.t("module.dunning_case.overview.not_scheduled") : a.t("module.dunning_case.overview.send"));
198
+ return (t, n) => (I(), D(B(Z), null, {
199
+ default: H(() => [j(B(le), { class: "w-full" }, {
200
+ default: H(() => [A("div", Ne, [c.value && s.value !== null ? (I(), D(B(K), {
201
+ key: 0,
202
+ "icon-right": B(l),
203
+ label: B(a).t("module.dunning_case.overview.fix"),
204
+ size: "sm",
205
+ variant: "secondary",
206
+ onClick: n[0] ||= (e) => r("viewCustomer")
207
+ }, null, 8, ["icon-right", "label"])) : (I(), D(B(K), {
208
+ key: 1,
209
+ "icon-right": e.item.canSendReminder ? B(p) : void 0,
210
+ "is-disabled": c.value || !e.item.canSendReminder,
211
+ "is-loading": u.value === "sending",
212
+ label: d.value,
213
+ size: "sm",
214
+ variant: "secondary",
215
+ onClick: n[1] ||= (e) => r("send")
216
+ }, null, 8, [
217
+ "icon-right",
218
+ "is-disabled",
219
+ "is-loading",
220
+ "label"
221
+ ]))])]),
222
+ _: 1
223
+ })]),
224
+ _: 1
225
+ }));
226
+ }
227
+ }), Fe = { class: "truncate text-sm font-medium text-primary" }, Ie = /* @__PURE__ */ M({
228
+ __name: "DunningCaseOverviewCustomerCell",
229
+ props: { item: {} },
230
+ setup(e) {
231
+ return (t, n) => (I(), D(B(Z), null, {
232
+ default: H(() => [A("span", Fe, z(e.item.customer.name), 1)]),
233
+ _: 1
234
+ }));
235
+ }
236
+ }), Le = /* @__PURE__ */ M({
237
+ __name: "DunningCaseOverviewDaysOverdueCell",
238
+ props: { item: {} },
239
+ setup(e) {
240
+ return (t, n) => (I(), D(B(Z), null, {
241
+ default: H(() => [A("span", { class: N([{
242
+ "text-error-primary": e.item.level === 3,
243
+ "text-primary": e.item.level !== 3
244
+ }, "w-full text-right font-mono text-sm tabular-nums"]) }, z(e.item.daysOverdue), 3)]),
245
+ _: 1
246
+ }));
247
+ }
248
+ }), Re = {
249
+ key: 0,
250
+ class: "font-mono text-xs text-secondary tabular-nums"
251
+ }, ze = /* @__PURE__ */ M({
252
+ __name: "DunningCaseOverviewLastReminderCell",
253
+ props: { item: {} },
254
+ setup(e) {
255
+ let t = e, n = w(), r = E(() => {
256
+ if (t.item.level === null) return null;
257
+ if (t.item.lastReminderSentAt === null) return n.t("module.dunning_case.overview.last_reminder_not_sent");
258
+ let e = G.Now.instant().epochMilliseconds - t.item.lastReminderSentAt.epochMilliseconds, r = Math.floor(e / 36e5);
259
+ return r < 1 ? n.t("module.dunning_case.overview.last_reminder_sent_just_now", { level: t.item.level }) : r < 24 ? n.t("module.dunning_case.overview.last_reminder_sent_hours", {
260
+ hours: r,
261
+ level: t.item.level
262
+ }) : n.t("module.dunning_case.overview.last_reminder_sent", {
263
+ days: Math.floor(r / 24),
264
+ level: t.item.level
265
+ });
266
+ });
267
+ return (e, t) => (I(), D(B(Z), null, {
268
+ default: H(() => [r.value === null ? O("", !0) : (I(), k("span", Re, z(r.value), 1))]),
269
+ _: 1
270
+ }));
271
+ }
272
+ }), Be = {
273
+ key: 0,
274
+ class: "flex min-w-0 items-center gap-sm"
275
+ }, Ve = { class: "truncate text-xs text-primary" }, He = /* @__PURE__ */ M({
276
+ __name: "DunningCaseOverviewLevelCell",
277
+ props: { item: {} },
278
+ setup(e) {
279
+ let t = w();
280
+ function n(e) {
281
+ return e === 0 ? t.t("module.dunning_case.level.none") : t.t("module.dunning_case.level.reminder", { level: e });
282
+ }
283
+ return (t, r) => (I(), D(B(Z), null, {
284
+ default: H(() => [e.item.level === null ? O("", !0) : (I(), k("div", Be, [j(a, {
285
+ level: e.item.level,
286
+ size: "sm"
287
+ }, null, 8, ["level"]), A("span", Ve, z(n(e.item.level)), 1)]))]),
288
+ _: 1
289
+ }));
290
+ }
291
+ }), Ue = { class: "w-full text-right font-mono text-sm font-medium text-primary tabular-nums" }, We = /* @__PURE__ */ M({
292
+ __name: "DunningCaseOverviewOutstandingCell",
293
+ props: { item: {} },
294
+ setup(e) {
295
+ let t = n();
296
+ return (n, r) => (I(), D(B(Z), null, {
297
+ default: H(() => [A("span", Ue, z(B(t).formatMonetary(e.item.outstandingBalance)), 1)]),
298
+ _: 1
299
+ }));
300
+ }
301
+ }), Ge = { class: "flex flex-col items-start gap-xxs" }, Ke = /* @__PURE__ */ M({
302
+ __name: "DunningCaseOverviewReminderCell",
303
+ props: { item: {} },
304
+ setup(e) {
305
+ let t = e, n = w(), r = E(() => g(t.item.latestCreatedReminder));
306
+ function i(e) {
307
+ let t = G.Now.plainDateISO().until(e, { largestUnit: "days" }).days;
308
+ return t <= 0 ? n.t("module.dunning_case.overview.due_today") : n.t("module.dunning_case.overview.due_in_days", { count: t });
309
+ }
310
+ function a(e) {
311
+ return G.PlainDate.compare(e, G.Now.plainDateISO()) <= 0;
312
+ }
313
+ return (t, n) => (I(), D(B(Z), null, {
314
+ default: H(() => [A("div", Ge, [e.item.nextReminderOn === null ? O("", !0) : (I(), D(B(ie), {
315
+ key: 0,
316
+ color: a(e.item.nextReminderOn) ? "success" : "warning",
317
+ label: i(e.item.nextReminderOn),
318
+ size: "sm",
319
+ variant: "translucent"
320
+ }, null, 8, ["color", "label"])), j(m, {
321
+ "blocked-reason": e.item.blockedReason,
322
+ status: r.value
323
+ }, null, 8, ["blocked-reason", "status"])])]),
324
+ _: 1
325
+ }));
326
+ }
327
+ });
328
+ //#endregion
329
+ //#region src/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewTableColumns.composable.ts
330
+ function qe(e) {
331
+ let t = w();
332
+ return E(() => pe()([
333
+ {
334
+ headerLabel: t.t("module.dunning_case.overview.table.customer"),
335
+ key: "customer",
336
+ size: {
337
+ max: "1fr",
338
+ min: "12rem"
339
+ },
340
+ component: (e) => Q(Ie, { item: e })
341
+ },
342
+ {
343
+ headerLabel: t.t("module.dunning_case.overview.table.level"),
344
+ key: "level",
345
+ size: {
346
+ max: "10rem",
347
+ min: "8rem"
348
+ },
349
+ component: (e) => Q(He, { item: e })
350
+ },
351
+ {
352
+ headerLabel: t.t("module.dunning_case.overview.table.days_overdue"),
353
+ key: "daysOverdue",
354
+ size: {
355
+ max: "9rem",
356
+ min: "7rem"
357
+ },
358
+ component: (e) => Q(Le, { item: e })
359
+ },
360
+ {
361
+ headerLabel: t.t("module.dunning_case.overview.table.next_reminder"),
362
+ key: "nextReminder",
363
+ size: {
364
+ max: "14rem",
365
+ min: "10rem"
366
+ },
367
+ component: (e) => Q(Ke, { item: e })
368
+ },
369
+ {
370
+ headerLabel: t.t("module.dunning_case.overview.table.last_reminder"),
371
+ key: "lastReminder",
372
+ size: {
373
+ max: "12rem",
374
+ min: "9rem"
375
+ },
376
+ component: (e) => Q(ze, { item: e })
377
+ },
378
+ {
379
+ headerLabel: t.t("module.dunning_case.overview.table.outstanding"),
380
+ key: "outstanding",
381
+ size: {
382
+ max: "10rem",
383
+ min: "8rem"
384
+ },
385
+ component: (e) => Q(We, { item: e })
386
+ },
387
+ {
388
+ headerLabel: "",
389
+ key: "actions",
390
+ size: {
391
+ max: "11rem",
392
+ min: "9rem"
393
+ },
394
+ component: (t) => Q(Pe, {
395
+ item: t,
396
+ onSend: () => e.onSend(t),
397
+ onViewCustomer: () => e.onViewCustomer(t)
398
+ })
399
+ }
400
+ ]));
401
+ }
402
+ //#endregion
403
+ //#region src/modules/dunning-case/api/mutations/dunningCaseBulkSend.mutation.ts
404
+ function Je() {
405
+ return U({
406
+ queryFn: (e) => o.sendBulk(e.params.queryParams),
407
+ queryKeysToInvalidate: {
408
+ dunningCaseDetail: {},
409
+ dunningCaseIndex: {}
410
+ }
411
+ });
412
+ }
413
+ //#endregion
414
+ //#region src/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue
415
+ var Ye = /* @__PURE__ */ M({
416
+ __name: "DunningCaseBulkSendStat",
417
+ props: {
418
+ hasSeparator: { type: Boolean },
419
+ label: {},
420
+ tone: {},
421
+ value: {}
422
+ },
423
+ setup(e) {
424
+ let t = e;
425
+ return (e, n) => (I(), k("div", { class: N([{ "border-r border-secondary": t.hasSeparator }, "p-lg"]) }, [A("p", { class: N([{
426
+ "text-primary": t.tone === "default",
427
+ "text-success-primary": t.tone === "success",
428
+ "text-warning-primary": t.tone === "warning"
429
+ }, "font-mono text-2xl font-semibold tabular-nums"]) }, z(t.value), 3), A("p", { class: N([{
430
+ "text-secondary": t.tone === "default",
431
+ "text-success-primary": t.tone === "success",
432
+ "text-warning-primary": t.tone === "warning"
433
+ }, "mt-xs text-xs font-medium uppercase"]) }, z(t.label), 3)], 2));
434
+ }
435
+ }), Xe = { class: "flex flex-col gap-md" }, Ze = { class: "grid grid-cols-3 overflow-hidden rounded-md border border-secondary" }, Qe = { class: "rounded-md bg-success-primary px-lg py-md text-sm font-medium text-success-primary" }, $e = {
436
+ key: 0,
437
+ class: "rounded-md border border-secondary px-lg py-md text-sm text-secondary"
438
+ }, et = /* @__PURE__ */ M({
439
+ __name: "DunningCaseBulkSendSummary",
440
+ props: {
441
+ processableCount: {},
442
+ skippedCount: {},
443
+ totalCount: {}
444
+ },
445
+ setup(e) {
446
+ let t = e, n = w(), r = E(() => [
447
+ {
448
+ label: n.t("module.dunning_case.bulk_send.total"),
449
+ tone: "default",
450
+ value: t.totalCount
451
+ },
452
+ {
453
+ label: n.t("module.dunning_case.bulk_send.ready"),
454
+ tone: "success",
455
+ value: t.processableCount
456
+ },
457
+ {
458
+ label: n.t("module.dunning_case.bulk_send.skipped_label"),
459
+ tone: "warning",
460
+ value: t.skippedCount
461
+ }
462
+ ]);
463
+ return (e, i) => (I(), k("div", Xe, [
464
+ A("div", Ze, [(I(!0), k(T, null, R(r.value, (e, t) => (I(), D(Ye, {
465
+ key: e.label,
466
+ "has-separator": t < r.value.length - 1,
467
+ label: e.label,
468
+ tone: e.tone,
469
+ value: e.value
470
+ }, null, 8, [
471
+ "has-separator",
472
+ "label",
473
+ "tone",
474
+ "value"
475
+ ]))), 128))]),
476
+ A("p", Qe, z(B(n).t("module.dunning_case.bulk_send.processable", { count: t.processableCount })), 1),
477
+ t.skippedCount > 0 ? (I(), k("p", $e, z(B(n).t("module.dunning_case.bulk_send.skipped", { count: t.skippedCount })), 1)) : O("", !0)
478
+ ]));
479
+ }
480
+ }), tt = {
481
+ key: 0,
482
+ class: "text-sm text-secondary"
483
+ }, nt = /* @__PURE__ */ M({
484
+ __name: "DunningCaseBulkSendDialog",
485
+ props: { onSent: { type: Function } },
486
+ emits: ["close"],
487
+ setup(e, { emit: t }) {
488
+ let n = e, r = t, i = {}, a = {
489
+ customer_has_no_default_recipient: "module.dunning_case.bulk_send.skip_reason.customer_has_no_default_recipient",
490
+ dunning_case_not_found: "module.dunning_case.bulk_send.skip_reason.dunning_case_not_found",
491
+ dunning_case_reminder_config_not_found: "module.dunning_case.bulk_send.skip_reason.dunning_case_reminder_config_not_found",
492
+ dunning_case_reminder_not_due: "module.dunning_case.bulk_send.skip_reason.dunning_case_reminder_not_due",
493
+ dunning_case_reminder_pending: "module.dunning_case.bulk_send.skip_reason.dunning_case_reminder_pending"
494
+ };
495
+ function s(e) {
496
+ return Object.hasOwn(a, e);
497
+ }
498
+ let c = w(), l = he(), u = Je(), d = L(null), f = L(!0), m = E(() => d.value?.meta.processed ?? 0);
499
+ function h(e) {
500
+ let t = e.errors.at(0)?.errors.at(0)?.code;
501
+ return t !== void 0 && s(t) ? c.t(a[t]) : c.t("module.dunning_case.bulk_send.skip_reason.unknown");
502
+ }
503
+ function g(e) {
504
+ let t = /* @__PURE__ */ new Map();
505
+ for (let n of e) {
506
+ let e = h(n);
507
+ t.set(e, (t.get(e) ?? 0) + 1);
508
+ }
509
+ return Array.from(t, ([e, t]) => c.t("module.dunning_case.bulk_send.skip_reason_count", {
510
+ count: t,
511
+ reason: e
512
+ })).join(", ");
513
+ }
514
+ let _ = ge({
515
+ schema: C.object({}),
516
+ onSubmit: async () => {
517
+ let e = await u.execute({ params: { queryParams: i } });
518
+ if (e.isErr()) {
519
+ l.apiError(e.error);
520
+ return;
521
+ }
522
+ let t = g(e.value.skipped);
523
+ l.show({
524
+ duration: Infinity,
525
+ message: t === "" ? c.t("module.dunning_case.bulk_send.success", {
526
+ count: e.value.meta.processed,
527
+ processed: e.value.meta.processed,
528
+ skipped: e.value.meta.skipped
529
+ }) : c.t("module.dunning_case.bulk_send.success_with_reasons", {
530
+ count: e.value.meta.processed,
531
+ processed: e.value.meta.processed,
532
+ skipped: e.value.meta.skipped,
533
+ summary: t
534
+ })
535
+ }), n.onSent(), r("close");
536
+ }
537
+ });
538
+ async function v() {
539
+ let e = await o.previewBulk(i);
540
+ if (e.isErr()) {
541
+ l.apiError(e.error), r("close");
542
+ return;
543
+ }
544
+ d.value = e.value, f.value = !1;
545
+ }
546
+ return F(() => {
547
+ v();
548
+ }), (e, t) => (I(), D(B(se), {
549
+ form: B(_),
550
+ size: "md",
551
+ onClose: t[0] ||= (e) => r("close")
552
+ }, {
553
+ default: H(() => [
554
+ j(B(oe), {
555
+ title: f.value ? B(c).t("module.dunning_case.bulk_send.title") : B(c).t("module.dunning_case.bulk_send.confirm_question", { count: m.value }),
556
+ description: B(c).t("module.dunning_case.bulk_send.description"),
557
+ "has-separator": !1,
558
+ icon: B(p)
559
+ }, null, 8, [
560
+ "title",
561
+ "description",
562
+ "icon"
563
+ ]),
564
+ j(B(q), null, {
565
+ default: H(() => [d.value === null ? (I(), k("p", tt, z(B(c).t("module.dunning_case.bulk_send.loading")), 1)) : (I(), D(et, {
566
+ key: 1,
567
+ "processable-count": d.value.meta.processed,
568
+ "skipped-count": d.value.meta.skipped,
569
+ "total-count": d.value.meta.total
570
+ }, null, 8, [
571
+ "processable-count",
572
+ "skipped-count",
573
+ "total-count"
574
+ ]))]),
575
+ _: 1
576
+ }),
577
+ j(B(J), { "has-separator": !1 }, {
578
+ right: H(() => [j(B(Y)), j(B(X), {
579
+ "icon-right": B(p),
580
+ "is-disabled": f.value || m.value === 0,
581
+ "is-loading": B(_).isSubmitting.value,
582
+ label: B(c).t("module.dunning_case.bulk_send.confirm", { count: m.value }),
583
+ onClick: B(_).submit
584
+ }, null, 8, [
585
+ "icon-right",
586
+ "is-disabled",
587
+ "is-loading",
588
+ "label",
589
+ "onClick"
590
+ ])]),
591
+ _: 1
592
+ })
593
+ ]),
594
+ _: 1
595
+ }, 8, ["form"]));
596
+ }
597
+ }), rt = { class: "flex min-h-0 flex-1 flex-col gap-xl px-3xl py-xl" }, it = { class: "flex shrink-0 flex-col gap-lg md:flex-row md:items-center md:justify-between" }, at = { class: "text-lg font-semibold text-primary" }, ot = { class: "mt-xs text-sm text-secondary" }, st = { class: "flex items-center gap-sm" }, ct = {
598
+ key: 0,
599
+ class: "shrink-0"
600
+ }, lt = { class: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-secondary bg-primary shadow-sm" }, ut = { class: "flex flex-col gap-md border-b border-secondary p-sm md:flex-row md:items-center md:justify-between" }, dt = { class: "flex items-center justify-between gap-md border-b border-secondary p-sm" }, ft = {
601
+ key: 0,
602
+ class: "px-sm text-xs text-secondary"
603
+ }, pt = { class: "relative flex min-h-0 flex-1 flex-col" }, mt = /*@__PURE__*/ M({
604
+ __name: "DunningCaseOverviewView",
605
+ setup(e) {
606
+ let n = w(), r = me(), a = S(), o = t(), l = i(), f = L("all"), m = E(() => [
607
+ {
608
+ icon: c,
609
+ key: "all",
610
+ label: n.t("module.dunning_case.overview.filter_all")
611
+ },
612
+ {
613
+ icon: u,
614
+ key: "level-1",
615
+ label: n.t("module.dunning_case.level.reminder", { level: 1 })
616
+ },
617
+ {
618
+ icon: u,
619
+ key: "level-2",
620
+ label: n.t("module.dunning_case.level.reminder", { level: 2 })
621
+ },
622
+ {
623
+ icon: u,
624
+ key: "level-3",
625
+ label: n.t("module.dunning_case.level.reminder", { level: 3 })
626
+ }
627
+ ]), h = E(() => f.value === "all" ? null : Number(f.value.replace("level-", ""))), g = L(!0), { customerUuid: v, filters: y } = Me();
628
+ ee(y), o.set(() => n.t("module.dunning_case.title"));
629
+ let { hasLevelCountError: b, isFetchingNextPage: x, isLoading: C, data: M, error: re, fetchNextPage: N, levelCounts: P, levelCountTotal: F, result: V } = Ae({
630
+ customerUuid: v,
631
+ activeLevel: h
632
+ }), U = E(() => y.activeFilters.value.length);
633
+ function W(e) {
634
+ r.create(_, { props: { dunningCaseUuid: e.uuid } }).open();
635
+ }
636
+ function G() {
637
+ r.create(nt, { props: { onSent: () => {
638
+ V.value;
639
+ } } }).open();
640
+ }
641
+ function ie(e) {
642
+ let t = l.getCustomerDetailRoute(e.customer.uuid);
643
+ t !== null && a.push(t);
644
+ }
645
+ function q(e) {
646
+ return {
647
+ name: "dunning-case-detail",
648
+ params: { dunningCaseUuid: e.uuid }
649
+ };
650
+ }
651
+ let J = ve(), Y = _e(), X = qe({
652
+ onSend: W,
653
+ onViewCustomer: ie
654
+ });
655
+ return (e, t) => (I(), D(B(ae), {
656
+ title: B(n).t("module.dunning_case.title"),
657
+ "is-title-hidden": !0
658
+ }, {
659
+ default: H(() => [A("div", rt, [
660
+ A("div", it, [A("div", null, [A("h2", at, z(B(n).t("module.dunning_case.title")), 1), A("p", ot, z(B(n).t("module.dunning_case.overview.description")), 1)]), A("div", st, [j(B(K), {
661
+ "icon-left": g.value ? B(s) : B(d),
662
+ label: B(n).t(g.value ? "module.dunning_case.overview.hide_metrics" : "module.dunning_case.overview.show_metrics"),
663
+ variant: "secondary",
664
+ onClick: t[0] ||= (e) => g.value = !g.value
665
+ }, null, 8, ["icon-left", "label"]), j(B(K), {
666
+ "icon-right": B(p),
667
+ label: B(n).t("module.dunning_case.overview.send_all"),
668
+ onClick: G
669
+ }, null, 8, ["icon-right", "label"])])]),
670
+ g.value ? (I(), k("div", ct, [j(ke, {
671
+ "has-level-count-error": B(b),
672
+ "level-counts": B(P),
673
+ "level-count-total": B(F)
674
+ }, null, 8, [
675
+ "has-level-count-error",
676
+ "level-counts",
677
+ "level-count-total"
678
+ ])])) : O("", !0),
679
+ A("div", lt, [
680
+ A("div", ut, [j(B(ue), {
681
+ modelValue: f.value,
682
+ "onUpdate:modelValue": t[1] ||= (e) => f.value = e,
683
+ "aria-label": B(n).t("module.dunning_case.overview.filter_label"),
684
+ variant: "button-border"
685
+ }, {
686
+ default: H(() => [j(B(fe), null, {
687
+ default: H(() => [(I(!0), k(T, null, R(m.value, (e) => (I(), D(B(de), {
688
+ key: e.key,
689
+ config: { left: {
690
+ icon: e.icon,
691
+ type: "icon"
692
+ } },
693
+ label: e.label,
694
+ value: e.key
695
+ }, null, 8, [
696
+ "config",
697
+ "label",
698
+ "value"
699
+ ]))), 128))]),
700
+ _: 1
701
+ })]),
702
+ _: 1
703
+ }, 8, ["modelValue", "aria-label"]), j(B(K), {
704
+ "icon-right": B(p),
705
+ label: B(n).t("module.dunning_case.overview.send_all"),
706
+ size: "sm",
707
+ onClick: G
708
+ }, null, 8, ["icon-right", "label"])]),
709
+ A("div", dt, [U.value === 0 ? (I(), k("p", ft, z(B(n).t("module.dunning_case.overview.no_active_filters")), 1)) : (I(), D(B(te), { key: 1 })), j(B(ne))]),
710
+ A("div", pt, [j(B(ce), {
711
+ "active-filter-count": U.value,
712
+ columns: B(X),
713
+ data: B(M),
714
+ error: B(re),
715
+ "get-key": (e) => e.uuid,
716
+ actions: [B(J), B(Y)],
717
+ "get-action-model": (e) => ({
718
+ key: e.uuid,
719
+ modelName: "DunningCase",
720
+ ...e
721
+ }),
722
+ "get-link": q,
723
+ "is-fetching-next-page": B(x),
724
+ "is-loading": B(C),
725
+ variant: "full-page",
726
+ onClearFilters: t[2] ||= (e) => B(y).clearAll(),
727
+ onNextPage: B(N)
728
+ }, null, 8, [
729
+ "active-filter-count",
730
+ "columns",
731
+ "data",
732
+ "error",
733
+ "get-key",
734
+ "actions",
735
+ "get-action-model",
736
+ "is-fetching-next-page",
737
+ "is-loading",
738
+ "onNextPage"
739
+ ])])
740
+ ])
741
+ ])]),
742
+ _: 1
743
+ }, 8, ["title"]));
744
+ }
745
+ }), ht = /* @__PURE__ */ e({ default: () => gt }), gt = mt;
746
+ //#endregion
747
+ export { ht as n, $ as r, gt as t };