@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
@@ -1,553 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { t } from "./documentTitle.composable-CeaFddr1.js";
3
- import { r as n } from "./useCurrencyFormat.composable-MtZaqKnO.js";
4
- import { f as r, i, n as a, o, p as s, r as c, s as l } from "./dist-DJ8yJcb9.js";
5
- import { n as u } from "./invoicingConfig.composable-c6w_aMm1.js";
6
- import { n as d, r as f } from "./reminderConfig.query-DzTN2AvU.js";
7
- import { $ as ee, A as te, P as ne, S as re, c as ie, et as ae, l as oe, nt as p, tt as se } from "./dist-DP8KNFVD.js";
8
- import { i as ce, o as le, r as ue, t as de } from "./DunningCaseSendDialog-DBtwr2ue.js";
9
- import { useRouter as fe } from "vue-router";
10
- import { z as m } from "zod";
11
- import { useI18n as h } from "vue-i18n";
12
- import { Fragment as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createVNode as S, defineComponent as C, nextTick as pe, normalizeClass as w, normalizeStyle as me, onMounted as T, openBlock as E, ref as D, renderList as O, toDisplayString as k, unref as A, watch as j, withCtx as M, withModifiers as he } from "vue";
13
- import { useMutation as N, useOffsetInfiniteQuery as P } from "@wisemen/vue-core-api-utils";
14
- import { Temporal as F } from "temporal-polyfill";
15
- import { UIBadge as ge, UIButton as I, UIDashboardPage as _e, UIDashboardPageContent as ve, UIDialogBody as ye, UIDialogFooter as be, UIDialogFooterCancel as L, UIDialogFooterPrimary as R, UIDialogHeader as xe, UIDropdownMenu as Se, UIDropdownMenuGroup as Ce, UIDropdownMenuItem as we, UIEmptyState as Te, UIFormDialog as z, UIIconButton as Ee, UITabs as De, UITabsItem as Oe, UITabsList as ke, useOverlay as Ae, useToast as B } from "@wisemen/vue-core-design-system";
16
- import { useForm as V } from "formango";
17
- //#region src/modules/dunning-case/api/queries/dunningCaseIndex.query.ts
18
- function H(e) {
19
- let t = _(() => ({
20
- customerUuid: e.params.customerUuid?.value,
21
- isOpen: e.params.isOpen?.value,
22
- dunningCaseUuids: e.params.dunningCaseUuids?.value,
23
- level: e.params.level?.value
24
- }));
25
- return P("dunningCaseIndex", {
26
- isEnabled: _(() => e.isEnabled?.value ?? !0),
27
- params: { queryParams: t },
28
- queryFn: (e) => f.getAll({
29
- ...t.value,
30
- pagination: e
31
- })
32
- });
33
- }
34
- //#endregion
35
- //#region src/modules/dunning-case/api/queries/dunningCaseCustomerIndex.query.ts
36
- function U(e) {
37
- let t = _(() => ({ search: e.params.search?.value }));
38
- return P("dunningCaseCustomerIndex", {
39
- params: { queryParams: t },
40
- queryFn: (e) => le.getAll(t.value.search, e)
41
- });
42
- }
43
- //#endregion
44
- //#region src/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewFilters.composable.ts
45
- function je() {
46
- let e = h(), t = s({ debounceMs: 250 }), n = U({ params: { search: t.debouncedSearch } }), a = _(() => n.result.value.isOk() ? n.result.value.getValue().data : []), o = i({
47
- actionGroup: { name: "dunning-cases" },
48
- filters: [r({
49
- defaultValue: {
50
- operator: c.INCLUDES,
51
- value: []
52
- },
53
- disableOperators: !0,
54
- displayFn: (e) => a.value.find((t) => t.uuid === e)?.name ?? e,
55
- key: "customerUuids",
56
- label: e.t("module.dunning_case.overview.filter_customer"),
57
- options: async (e) => o.values.value.customerUuids.value.length > 0 ? [] : (t.updateSearch(e), await pe(), a.value.map((e) => e.uuid))
58
- })]
59
- });
60
- return j(() => o.values.value.customerUuids, (e) => {
61
- (e.operator !== c.INCLUDES || e.value.length > 1) && (o.values.value.customerUuids = {
62
- operator: c.INCLUDES,
63
- value: e.value.slice(-1)
64
- });
65
- }, {
66
- deep: !0,
67
- immediate: !0
68
- }), {
69
- customerUuid: _(() => o.values.value.customerUuids.value[0]),
70
- filters: o
71
- };
72
- }
73
- //#endregion
74
- //#region src/modules/dunning-case/api/mutations/dunningCaseBulkSend.mutation.ts
75
- function W() {
76
- return N({
77
- queryFn: (e) => f.sendBulk(e.params.queryParams),
78
- queryKeysToInvalidate: {
79
- dunningCaseDetail: {},
80
- dunningCaseIndex: {}
81
- }
82
- });
83
- }
84
- //#endregion
85
- //#region src/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue
86
- var G = /* @__PURE__ */ C({
87
- __name: "DunningCaseBulkSendStat",
88
- props: {
89
- hasSeparator: { type: Boolean },
90
- label: {},
91
- tone: {},
92
- value: {}
93
- },
94
- setup(e) {
95
- let t = e;
96
- return (e, n) => (E(), b("div", { class: w([{ "border-r border-secondary": t.hasSeparator }, "p-lg"]) }, [x("p", { class: w([{
97
- "text-primary": t.tone === "default",
98
- "text-success-primary": t.tone === "success",
99
- "text-warning-primary": t.tone === "warning"
100
- }, "font-mono text-2xl font-semibold tabular-nums"]) }, k(t.value), 3), x("p", { class: w([{
101
- "text-secondary": t.tone === "default",
102
- "text-success-primary": t.tone === "success",
103
- "text-warning-primary": t.tone === "warning"
104
- }, "mt-xs text-xs font-medium uppercase"]) }, k(t.label), 3)], 2));
105
- }
106
- }), K = { class: "flex flex-col gap-md" }, Me = { class: "grid grid-cols-3 overflow-hidden rounded-md border border-secondary" }, q = { class: "rounded-md bg-success-primary px-lg py-md text-sm font-medium text-success-primary" }, Ne = {
107
- key: 0,
108
- class: "rounded-md border border-secondary px-lg py-md text-sm text-secondary"
109
- }, Pe = /* @__PURE__ */ C({
110
- __name: "DunningCaseBulkSendSummary",
111
- props: {
112
- processableCount: {},
113
- skippedCount: {},
114
- totalCount: {}
115
- },
116
- setup(e) {
117
- let t = e, n = h(), r = _(() => [
118
- {
119
- label: n.t("module.dunning_case.bulk_send.total"),
120
- tone: "default",
121
- value: t.totalCount
122
- },
123
- {
124
- label: n.t("module.dunning_case.bulk_send.ready"),
125
- tone: "success",
126
- value: t.processableCount
127
- },
128
- {
129
- label: n.t("module.dunning_case.bulk_send.skipped_label"),
130
- tone: "warning",
131
- value: t.skippedCount
132
- }
133
- ]);
134
- return (e, i) => (E(), b("div", K, [
135
- x("div", Me, [(E(!0), b(g, null, O(r.value, (e, t) => (E(), v(G, {
136
- key: e.label,
137
- "has-separator": t < r.value.length - 1,
138
- label: e.label,
139
- tone: e.tone,
140
- value: e.value
141
- }, null, 8, [
142
- "has-separator",
143
- "label",
144
- "tone",
145
- "value"
146
- ]))), 128))]),
147
- x("p", q, k(A(n).t("module.dunning_case.bulk_send.processable", { count: t.processableCount })), 1),
148
- t.skippedCount > 0 ? (E(), b("p", Ne, k(A(n).t("module.dunning_case.bulk_send.skipped", { count: t.skippedCount })), 1)) : y("", !0)
149
- ]));
150
- }
151
- }), J = {
152
- key: 0,
153
- class: "text-sm text-secondary"
154
- }, Fe = /* @__PURE__ */ C({
155
- __name: "DunningCaseBulkSendDialog",
156
- props: { onSent: { type: Function } },
157
- emits: ["close"],
158
- setup(e, { emit: t }) {
159
- let n = e, r = t, i = {}, a = h(), o = B(), s = W(), c = D(null), l = D(!0), u = _(() => c.value?.meta.processed ?? 0), d = V({
160
- schema: m.object({}),
161
- onSubmit: async () => {
162
- let e = await s.execute({ params: { queryParams: i } });
163
- if (e.isErr()) {
164
- o.apiError(e.error);
165
- return;
166
- }
167
- o.show({
168
- duration: Infinity,
169
- message: a.t("module.dunning_case.bulk_send.success", {
170
- count: e.value.meta.processed,
171
- processed: e.value.meta.processed,
172
- skipped: e.value.meta.skipped
173
- })
174
- }), n.onSent(), r("close");
175
- }
176
- });
177
- async function ee() {
178
- let e = await f.previewBulk(i);
179
- if (e.isErr()) {
180
- o.apiError(e.error), r("close");
181
- return;
182
- }
183
- c.value = e.value, l.value = !1;
184
- }
185
- return T(() => {
186
- ee();
187
- }), (e, t) => (E(), v(A(z), {
188
- form: A(d),
189
- size: "md",
190
- onClose: t[0] ||= (e) => r("close")
191
- }, {
192
- default: M(() => [
193
- S(A(xe), {
194
- title: l.value ? A(a).t("module.dunning_case.bulk_send.title") : A(a).t("module.dunning_case.bulk_send.confirm_question", { count: u.value }),
195
- description: A(a).t("module.dunning_case.bulk_send.description"),
196
- "has-separator": !1,
197
- icon: A(p)
198
- }, null, 8, [
199
- "title",
200
- "description",
201
- "icon"
202
- ]),
203
- S(A(ye), null, {
204
- default: M(() => [c.value === null ? (E(), b("p", J, k(A(a).t("module.dunning_case.bulk_send.loading")), 1)) : (E(), v(Pe, {
205
- key: 1,
206
- "processable-count": c.value.meta.processed,
207
- "skipped-count": c.value.meta.skipped,
208
- "total-count": c.value.meta.total
209
- }, null, 8, [
210
- "processable-count",
211
- "skipped-count",
212
- "total-count"
213
- ]))]),
214
- _: 1
215
- }),
216
- S(A(be), { "has-separator": !1 }, {
217
- right: M(() => [S(A(L)), S(A(R), {
218
- "icon-right": A(p),
219
- "is-disabled": l.value || u.value === 0,
220
- "is-loading": A(d).isSubmitting.value,
221
- label: A(a).t("module.dunning_case.bulk_send.confirm", { count: u.value }),
222
- onClick: A(d).submit
223
- }, null, 8, [
224
- "icon-right",
225
- "is-disabled",
226
- "is-loading",
227
- "label",
228
- "onClick"
229
- ])]),
230
- _: 1
231
- })
232
- ]),
233
- _: 1
234
- }, 8, ["form"]));
235
- }
236
- }), Ie = { class: "flex flex-col gap-3xl" }, Le = { class: "flex flex-col gap-lg border-b border-secondary pb-3xl lg:flex-row lg:items-start lg:justify-between" }, Re = { class: "text-lg font-semibold text-primary" }, ze = { class: "mt-xs text-sm text-secondary" }, Be = { class: "flex flex-wrap items-center gap-sm" }, Ve = {
237
- key: 0,
238
- class: "w-full"
239
- }, He = ["aria-label"], Ue = { class: "text-xs font-semibold text-secondary uppercase" }, We = { class: "mt-xl font-mono text-4xl font-semibold text-primary" }, Ge = { class: "mt-xs text-sm text-secondary" }, Ke = { class: "lg:col-span-2" }, qe = { class: "flex h-1.5 w-full overflow-hidden rounded-full bg-secondary" }, Je = { class: "mt-xl grid grid-cols-1 gap-md sm:grid-cols-3" }, Ye = { class: "flex min-w-0 items-center gap-sm" }, Xe = { class: "truncate text-sm text-secondary" }, Ze = { class: "shrink-0 font-mono text-sm font-semibold text-primary tabular-nums" }, Qe = { class: "overflow-hidden rounded-lg border border-secondary bg-primary shadow-sm" }, $e = { class: "flex flex-col gap-md border-b border-secondary p-sm md:flex-row md:items-center md:justify-between" }, et = { class: "flex flex-wrap items-center justify-end gap-sm" }, tt = { class: "flex flex-col gap-md border-b border-secondary p-sm sm:flex-row sm:items-center sm:justify-between" }, nt = {
240
- key: 0,
241
- class: "px-sm text-xs text-secondary"
242
- }, rt = { class: "flex justify-end" }, it = { class: "overflow-x-auto" }, at = { class: "w-full min-w-240 table-fixed border-collapse text-left" }, ot = { class: "border-b border-secondary bg-secondary" }, st = { class: "w-[28%] px-lg py-md text-xs font-medium text-secondary" }, ct = { class: "w-[18%] px-lg py-md text-xs font-medium text-secondary" }, lt = { class: "w-[24%] px-lg py-md text-xs font-medium text-secondary" }, ut = { class: "w-[18%] px-lg py-md text-right text-xs font-medium text-secondary" }, dt = { key: 0 }, ft = [
243
- "aria-label",
244
- "onClick",
245
- "onKeydown"
246
- ], pt = { class: "px-lg py-md" }, mt = { class: "flex min-w-0 items-center gap-sm" }, ht = ["onClick"], gt = { class: "px-lg py-md" }, _t = {
247
- key: 0,
248
- class: "flex min-w-0 flex-col items-start gap-xxs"
249
- }, vt = { class: "flex min-w-0 items-center gap-sm" }, yt = { class: "truncate text-xs text-primary" }, bt = { class: "px-lg py-md" }, xt = { class: "flex flex-col items-start gap-xxs" }, St = {
250
- key: 1,
251
- class: "font-mono text-xs text-secondary tabular-nums"
252
- }, Ct = { class: "px-lg py-md text-right font-mono text-sm font-medium text-primary tabular-nums" }, wt = { class: "px-lg py-md" }, Tt = {
253
- key: 0,
254
- class: "border-t border-secondary px-lg py-xl"
255
- }, Et = {
256
- key: 1,
257
- class: "p-xl text-center text-sm text-secondary"
258
- }, Dt = {
259
- key: 1,
260
- class: "flex justify-center"
261
- }, Ot = /*@__PURE__*/ C({
262
- __name: "DunningCaseOverviewView",
263
- setup(e) {
264
- let r = h(), i = Ae(), s = fe(), c = n(), f = t(), le = u(), m = D("all"), C = _(() => [
265
- {
266
- icon: ne,
267
- key: "all",
268
- label: r.t("module.dunning_case.overview.filter_all")
269
- },
270
- {
271
- icon: ie,
272
- key: "level-1",
273
- label: r.t("module.dunning_case.level.reminder", { level: 1 })
274
- },
275
- {
276
- icon: ie,
277
- key: "level-2",
278
- label: r.t("module.dunning_case.level.reminder", { level: 2 })
279
- },
280
- {
281
- icon: ie,
282
- key: "level-3",
283
- label: r.t("module.dunning_case.level.reminder", { level: 3 })
284
- }
285
- ]), pe = _(() => m.value === "all" ? null : Number(m.value.replace("level-", ""))), T = _(() => !0), j = D(!0), { customerUuid: N, filters: P } = je();
286
- a(P), f.set(() => r.t("module.dunning_case.title"));
287
- let { hasNextPage: ye, isFetching: be, isFetchingNextPage: L, isLoading: R, fetchNextPage: xe, result: z } = H({ params: {
288
- customerUuid: N,
289
- isOpen: T,
290
- level: _(() => pe.value ?? void 0)
291
- } }), B = _(() => be.value && !R.value && !L.value), V = H({ params: {
292
- customerUuid: N,
293
- isOpen: T,
294
- level: _(() => 1)
295
- } }), U = H({ params: {
296
- customerUuid: N,
297
- isOpen: T,
298
- level: _(() => 2)
299
- } }), W = H({ params: {
300
- customerUuid: N,
301
- isOpen: T,
302
- level: _(() => 3)
303
- } }), G = _(() => !B.value && z.value.isOk() ? z.value.getValue().data : []), K = _(() => [
304
- V,
305
- U,
306
- W
307
- ].map((e) => e.result.value.isOk() ? e.result.value.getValue().meta.total : null)), Me = _(() => [
308
- V,
309
- U,
310
- W
311
- ].some((e) => e.result.value.isErr())), q = _(() => K.value.every((e) => e !== null) ? K.value.reduce((e, t) => e + t, 0) : null), Ne = { left: {
312
- icon: te,
313
- type: "icon"
314
- } }, Pe = { left: {
315
- icon: oe,
316
- type: "icon"
317
- } };
318
- function J(e) {
319
- return e === 0 ? r.t("module.dunning_case.level.none") : r.t("module.dunning_case.level.reminder", { level: e });
320
- }
321
- function Ot(e) {
322
- let t = F.Now.plainDateISO().until(e, { largestUnit: "days" }).days;
323
- return t <= 0 ? r.t("module.dunning_case.overview.due_today") : r.t("module.dunning_case.overview.due_in_days", { count: t });
324
- }
325
- function Y(e) {
326
- if (e.level === null) return null;
327
- if (e.lastReminderSentAt === null) return r.t("module.dunning_case.overview.last_reminder_not_sent");
328
- let t = F.Now.instant().epochMilliseconds - e.lastReminderSentAt.epochMilliseconds, n = Math.max(0, Math.floor(t / 864e5));
329
- return r.t("module.dunning_case.overview.last_reminder_sent", {
330
- days: n,
331
- level: e.level
332
- });
333
- }
334
- function X(e) {
335
- return le.getCustomerDetailRoute(e.customer.uuid);
336
- }
337
- function Z(e) {
338
- return ue(e.latestCreatedReminder);
339
- }
340
- function Q(e) {
341
- return e.blockedReason !== null;
342
- }
343
- function kt(e) {
344
- return Q(e) || Z(e) === "failed" || Z(e) === "sending";
345
- }
346
- function At(e) {
347
- return Q(e) ? r.t("module.dunning_case.overview.blocked") : e.nextReminderOn === null ? r.t("module.dunning_case.overview.not_scheduled") : r.t("module.dunning_case.overview.send");
348
- }
349
- function jt(e) {
350
- return F.PlainDate.compare(e, F.Now.plainDateISO()) <= 0;
351
- }
352
- function Mt(e) {
353
- i.create(de, { props: { dunningCaseUuid: e.uuid } }).open();
354
- }
355
- function Nt() {
356
- i.create(Fe, { props: { onSent: () => {
357
- z.value;
358
- } } }).open();
359
- }
360
- function $(e) {
361
- s.push({
362
- name: "dunning-case-detail",
363
- params: { dunningCaseUuid: e.uuid }
364
- });
365
- }
366
- function Pt(e) {
367
- let t = X(e);
368
- t !== null && s.push(t);
369
- }
370
- function Ft(e, t) {
371
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), $(t));
372
- }
373
- return (e, t) => (E(), v(A(_e), { title: A(r).t("module.dunning_case.title") }, {
374
- default: M(() => [S(A(ve), null, {
375
- default: M(() => [x("div", Ie, [
376
- x("div", Le, [x("div", null, [x("h2", Re, k(A(r).t("module.dunning_case.title")), 1), x("p", ze, k(A(r).t("module.dunning_case.overview.description")), 1)]), x("div", Be, [S(A(I), {
377
- "icon-left": j.value ? A(ae) : A(te),
378
- label: A(r).t(j.value ? "module.dunning_case.overview.hide_metrics" : "module.dunning_case.overview.show_metrics"),
379
- variant: "secondary",
380
- onClick: t[0] ||= (e) => j.value = !j.value
381
- }, null, 8, ["icon-left", "label"]), S(A(I), {
382
- "icon-right": A(p),
383
- label: A(r).t("module.dunning_case.overview.send_all"),
384
- onClick: Nt
385
- }, null, 8, ["icon-right", "label"])])]),
386
- j.value ? (E(), b("div", Ve, [x("section", {
387
- "aria-label": A(r).t("module.dunning_case.overview.levels"),
388
- 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"
389
- }, [x("div", null, [
390
- x("p", Ue, k(A(r).t("module.dunning_case.overview.levels")), 1),
391
- x("p", We, k(q.value ?? "—"), 1),
392
- x("p", Ge, k(Me.value ? A(r).t("module.dunning_case.overview.metrics_unavailable") : q.value === null ? A(r).t("module.dunning_case.common.loading") : A(r).t("module.dunning_case.overview.case_count", { count: q.value })), 1)
393
- ]), x("div", Ke, [x("div", qe, [(E(!0), b(g, null, O(K.value, (e, t) => (E(), b("span", {
394
- key: t,
395
- class: w({
396
- "bg-brand-500": t === 0,
397
- "bg-error-solid": t === 2,
398
- "bg-warning-solid": t === 1
399
- }),
400
- style: me({ flexGrow: e ?? 0 })
401
- }, null, 6))), 128))]), x("div", Je, [(E(!0), b(g, null, O(K.value, (e, t) => (E(), b("div", {
402
- key: t,
403
- class: "flex items-center justify-between gap-xl"
404
- }, [x("div", Ye, [x("span", { class: w([{
405
- "bg-brand-500": t === 0,
406
- "bg-error-solid": t === 2,
407
- "bg-warning-solid": t === 1
408
- }, "size-2 shrink-0 rounded-full"]) }, null, 2), x("p", Xe, k(J(t + 1)), 1)]), x("p", Ze, k(e ?? "—"), 1)]))), 128))])])], 8, He)])) : y("", !0),
409
- x("div", Qe, [
410
- x("div", $e, [S(A(De), {
411
- modelValue: m.value,
412
- "onUpdate:modelValue": t[1] ||= (e) => m.value = e,
413
- "aria-label": A(r).t("module.dunning_case.overview.filter_label"),
414
- variant: "button-border"
415
- }, {
416
- default: M(() => [S(A(ke), null, {
417
- default: M(() => [(E(!0), b(g, null, O(C.value, (e) => (E(), v(A(Oe), {
418
- key: e.key,
419
- config: { left: {
420
- icon: e.icon,
421
- type: "icon"
422
- } },
423
- label: e.label,
424
- value: e.key
425
- }, null, 8, [
426
- "config",
427
- "label",
428
- "value"
429
- ]))), 128))]),
430
- _: 1
431
- })]),
432
- _: 1
433
- }, 8, ["modelValue", "aria-label"]), x("div", et, [S(A(I), {
434
- "icon-right": A(p),
435
- label: A(r).t("module.dunning_case.overview.send_all"),
436
- size: "sm",
437
- onClick: Nt
438
- }, null, 8, ["icon-right", "label"])])]),
439
- x("div", tt, [A(P).activeFilters.value.length === 0 ? (E(), b("p", nt, k(A(r).t("module.dunning_case.overview.no_active_filters")), 1)) : (E(), v(A(o), { key: 1 })), x("div", rt, [S(A(l))])]),
440
- x("div", it, [x("table", at, [x("thead", null, [x("tr", ot, [
441
- x("th", st, k(A(r).t("module.dunning_case.overview.table.customer")), 1),
442
- x("th", ct, k(A(r).t("module.dunning_case.overview.table.level")), 1),
443
- x("th", lt, k(A(r).t("module.dunning_case.overview.table.next_reminder")), 1),
444
- x("th", ut, k(A(r).t("module.dunning_case.overview.table.outstanding")), 1),
445
- t[3] ||= x("th", { class: "w-[12%] px-lg py-md" }, null, -1)
446
- ])]), G.value.length > 0 ? (E(), b("tbody", dt, [(E(!0), b(g, null, O(G.value, (e) => (E(), b("tr", {
447
- key: e.uuid,
448
- "aria-label": A(r).t("module.dunning_case.overview.view_case", { customer: e.customer.name }),
449
- class: "cursor-pointer border-b border-secondary hover:bg-secondary focus-visible:bg-secondary focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:outline-none focus-visible:ring-inset",
450
- tabindex: "0",
451
- onClick: (t) => $(e),
452
- onKeydown: (t) => Ft(t, e)
453
- }, [
454
- x("td", pt, [x("div", mt, [x("button", {
455
- class: "truncate text-sm font-medium text-primary hover:underline",
456
- type: "button",
457
- onClick: he((t) => $(e), ["stop"])
458
- }, k(e.customer.name), 9, ht)])]),
459
- x("td", gt, [e.level === null ? y("", !0) : (E(), b("div", _t, [x("div", vt, [S(d, {
460
- level: e.level,
461
- size: "sm"
462
- }, null, 8, ["level"]), x("span", yt, k(J(e.level)), 1)])]))]),
463
- x("td", bt, [x("div", xt, [
464
- e.nextReminderOn === null ? y("", !0) : (E(), v(A(ge), {
465
- key: 0,
466
- color: jt(e.nextReminderOn) ? "success" : "warning",
467
- label: Ot(e.nextReminderOn),
468
- size: "sm",
469
- variant: "translucent"
470
- }, null, 8, ["color", "label"])),
471
- S(ce, {
472
- "blocked-reason": e.blockedReason,
473
- status: Z(e)
474
- }, null, 8, ["blocked-reason", "status"]),
475
- !kt(e) && Y(e) !== null ? (E(), b("span", St, k(Y(e)), 1)) : y("", !0)
476
- ])]),
477
- x("td", Ct, k(A(c).formatMonetary(e.outstandingBalance)), 1),
478
- x("td", wt, [x("div", {
479
- class: "flex items-center justify-end gap-xs",
480
- onClick: t[2] ||= he(() => {}, ["stop"])
481
- }, [Q(e) && X(e) !== null ? (E(), v(A(I), {
482
- key: 0,
483
- "icon-right": A(re),
484
- label: A(r).t("module.dunning_case.overview.fix"),
485
- size: "sm",
486
- variant: "secondary",
487
- onClick: (t) => Pt(e)
488
- }, null, 8, [
489
- "icon-right",
490
- "label",
491
- "onClick"
492
- ])) : (E(), v(A(I), {
493
- key: 1,
494
- "icon-right": e.canSendReminder ? A(p) : void 0,
495
- "is-disabled": Q(e) || !e.canSendReminder,
496
- "is-loading": Z(e) === "sending",
497
- label: At(e),
498
- size: "sm",
499
- variant: "secondary",
500
- onClick: (t) => Mt(e)
501
- }, null, 8, [
502
- "icon-right",
503
- "is-disabled",
504
- "is-loading",
505
- "label",
506
- "onClick"
507
- ])), S(A(Se), { "popover-align": "end" }, {
508
- trigger: M(() => [S(A(Ee), {
509
- icon: A(se),
510
- label: A(r).t("shared.actions"),
511
- variant: "tertiary"
512
- }, null, 8, ["icon", "label"])]),
513
- content: M(() => [S(A(Ce), null, {
514
- default: M(() => [S(A(we), {
515
- config: Ne,
516
- label: A(r).t("module.dunning_case.overview.menu.view_case"),
517
- onSelect: (t) => $(e)
518
- }, null, 8, ["label", "onSelect"]), X(e) === null ? y("", !0) : (E(), v(A(we), {
519
- key: 0,
520
- config: Pe,
521
- label: A(r).t("module.dunning_case.overview.menu.view_customer"),
522
- onSelect: (t) => Pt(e)
523
- }, null, 8, ["label", "onSelect"]))]),
524
- _: 2
525
- }, 1024)]),
526
- _: 2
527
- }, 1024)])])
528
- ], 40, ft))), 128))])) : y("", !0)])]),
529
- !A(R) && !B.value && G.value.length === 0 ? (E(), b("div", Tt, [S(A(Te), {
530
- title: A(r).t("module.dunning_case.overview.empty_open"),
531
- icon: A(ee)
532
- }, null, 8, ["title", "icon"])])) : y("", !0),
533
- A(R) || B.value ? (E(), b("div", Et, k(A(r).t("module.dunning_case.common.loading")), 1)) : y("", !0)
534
- ]),
535
- A(ye) ? (E(), b("div", Dt, [S(A(I), {
536
- "is-loading": A(L),
537
- label: A(r).t("module.dunning_case.overview.load_more"),
538
- variant: "secondary",
539
- onClick: A(xe)
540
- }, null, 8, [
541
- "is-loading",
542
- "label",
543
- "onClick"
544
- ])])) : y("", !0)
545
- ])]),
546
- _: 1
547
- })]),
548
- _: 1
549
- }, 8, ["title"]));
550
- }
551
- }), Y = /* @__PURE__ */ e({ default: () => X }), X = Ot;
552
- //#endregion
553
- export { Y as n, H as r, X as t };