@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,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { K as t, t as n } from "./api.util-Dm_TQedZ.js";
2
+ import { K as t, t as n } from "./api.util-BCSgCfpS.js";
3
3
  import { n as r } from "./src-BFgnUugN.js";
4
4
  import { useI18n as i } from "vue-i18n";
5
5
  import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, onUnmounted as ee, openBlock as p, renderList as m, toDisplayString as h, unref as g } from "vue";
@@ -0,0 +1,349 @@
1
+ import { R as e, t, z as n } from "./api.util-BCSgCfpS.js";
2
+ import { r } from "./useCurrencyFormat.composable-MtZaqKnO.js";
3
+ import { n as i } from "./invoicingConfig.composable-Kad_HHx_.js";
4
+ import { n as a, r as o, t as s } from "./reminderConfig.query-hmDNKreg.js";
5
+ import { K as c, d as l, tt as u } from "./dist-D9lp7NDv.js";
6
+ import { t as d } from "./customerUuid.model-GUFYq3O2.js";
7
+ import { useRouter as f } from "vue-router";
8
+ import { z as p } from "zod";
9
+ import { useI18n as m } from "vue-i18n";
10
+ 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, openBlock as T, ref as E, renderList as D, toDisplayString as O, unref as k, watch as A, withCtx as j } from "vue";
11
+ import { useMutation as ee, useQuery as M } from "@wisemen/vue-core-api-utils";
12
+ import { Temporal as N } from "temporal-polyfill";
13
+ import { err as te, ok as ne } from "neverthrow";
14
+ import { UIBadge as P, UIColumnLayout as F, UIDialogBody as I, UIDialogFooter as L, UIDialogFooterCancel as R, UIDialogFooterPrimary as z, UIDialogHeader as B, UIFormDialog as V, useToast as H } from "@wisemen/vue-core-design-system";
15
+ import { useForm as U } from "formango";
16
+ //#region src/modules/dunning-case/api/services/dunningCaseCustomer.service.ts
17
+ var W = class {
18
+ static async getAll(n, r) {
19
+ return (await t.fromPromise(e({ query: {
20
+ pagination: r,
21
+ search: n
22
+ } }))).map((e) => ({
23
+ data: e.data.items.map((e) => ({
24
+ uuid: e.uuid,
25
+ name: e.name
26
+ })),
27
+ meta: e.data.meta
28
+ }));
29
+ }
30
+ static async getRecipients(e) {
31
+ let r = [], i = 0, a = 0;
32
+ do {
33
+ let o = await t.fromPromise(n({
34
+ query: { pagination: {
35
+ limit: 100,
36
+ offset: i
37
+ } },
38
+ path: { uuid: e }
39
+ }));
40
+ if (o.isErr()) return te(o.error);
41
+ if (r.push(...o.value.data.items.map((e) => ({
42
+ isDefault: e.isDefault,
43
+ email: e.email
44
+ }))), a = o.value.data.meta.total, i += o.value.data.items.length, o.value.data.items.length === 0) break;
45
+ } while (i < a);
46
+ return ne(r);
47
+ }
48
+ static async getUuidByExternalId(n) {
49
+ return (await t.fromPromise(e({ query: {
50
+ filter: { externalId: n },
51
+ pagination: {
52
+ limit: 1,
53
+ offset: 0
54
+ }
55
+ } }))).map((e) => e.data.items[0]?.uuid ?? null);
56
+ }
57
+ }, G = 3e4;
58
+ function K(e) {
59
+ return M("dunningCaseDetail", {
60
+ staleTime: G,
61
+ params: { dunningCaseUuid: e },
62
+ queryFn: () => o.getByUuid(e.value)
63
+ });
64
+ }
65
+ //#endregion
66
+ //#region src/modules/dunning-case/components/DunningCaseReminderStatusIndicator.vue
67
+ var q = /* @__PURE__ */ C({
68
+ __name: "DunningCaseReminderStatusIndicator",
69
+ props: {
70
+ blockedReason: {},
71
+ status: {}
72
+ },
73
+ setup(e) {
74
+ let t = e, n = m(), r = {
75
+ icon: c,
76
+ type: "icon"
77
+ };
78
+ return (e, i) => t.blockedReason === null ? t.status === "failed" ? (T(), _(k(P), {
79
+ key: 1,
80
+ label: k(n).t("module.dunning_case.reminder_status.failed"),
81
+ left: r,
82
+ color: "warning",
83
+ size: "sm",
84
+ variant: "translucent"
85
+ }, null, 8, ["label"])) : v("", !0) : (T(), _(k(P), {
86
+ key: 0,
87
+ label: k(n).t(`module.dunning_case.blocked_reason.${t.blockedReason}`),
88
+ left: r,
89
+ color: "error",
90
+ size: "sm",
91
+ variant: "translucent"
92
+ }, null, 8, ["label"]));
93
+ }
94
+ });
95
+ p.uuid().brand("DunningCaseUuid");
96
+ function J(e) {
97
+ return e === null ? "none" : e.hasErrors ? "failed" : e.sentAt === null ? "sending" : "sent";
98
+ }
99
+ function Y(e, t) {
100
+ return [
101
+ 0,
102
+ 1,
103
+ 2,
104
+ 3
105
+ ].map((n) => e.filter((e) => !e.isDisputed && e.level === n).reduce((e, t) => ({
106
+ ...e,
107
+ amount: e.amount + t.balanceDueAmount.amount
108
+ }), {
109
+ ...t,
110
+ amount: 0
111
+ }));
112
+ }
113
+ //#endregion
114
+ //#region src/modules/dunning-case/api/mutations/dunningCaseSend.mutation.ts
115
+ function X() {
116
+ return ee({
117
+ queryFn: (e) => o.send(e.params.dunningCaseUuid),
118
+ queryKeysToInvalidate: {
119
+ dunningCaseDetail: { dunningCaseUuid: (e) => e.dunningCaseUuid },
120
+ dunningCaseIndex: {}
121
+ }
122
+ });
123
+ }
124
+ //#endregion
125
+ //#region src/modules/dunning-case/use-cases/send/components/DunningCaseSendFeeRow.vue?vue&type=script&setup=true&lang.ts
126
+ var Z = { class: "flex items-center justify-between gap-lg px-lg py-xs" }, re = { class: "text-xs text-secondary" }, ie = { class: "font-mono text-xs font-medium text-primary tabular-nums" }, ae = /* @__PURE__ */ C({
127
+ __name: "DunningCaseSendFeeRow",
128
+ props: {
129
+ fee: {},
130
+ level: {}
131
+ },
132
+ setup(e) {
133
+ let t = e, n = m(), i = r();
134
+ return (e, r) => (T(), y("dl", Z, [b("dt", re, O(k(n).t("module.dunning_case.detail.reminder_fee")) + " · " + O(k(n).t("module.dunning_case.level.reminder", { level: t.level })), 1), b("dd", ie, O(k(i).formatMonetary(t.fee)), 1)]));
135
+ }
136
+ });
137
+ //#endregion
138
+ //#region src/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.ts
139
+ function Q(e) {
140
+ return N.PlainDate.compare(e.dueOn, N.Now.plainDateISO()) >= 0;
141
+ }
142
+ function oe(e) {
143
+ return !e.isDisputed && !Q(e);
144
+ }
145
+ function se(e) {
146
+ return e.filter(oe);
147
+ }
148
+ function ce(e, t) {
149
+ let n = e.map((e) => ({
150
+ invoice: e,
151
+ type: "invoice"
152
+ }));
153
+ if (!t) return n;
154
+ let r = e.findIndex((e) => !e.isDisputed && Q(e));
155
+ return n.splice(r === -1 ? n.length : r, 0, { type: "fee" }), n;
156
+ }
157
+ //#endregion
158
+ //#region src/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceRow.vue?vue&type=script&setup=true&lang.ts
159
+ var le = { class: "min-w-0" }, ue = { class: "flex min-w-0 items-center gap-sm" }, de = { class: "font-mono text-sm font-medium text-primary" }, fe = {
160
+ key: 0,
161
+ class: "truncate text-xs text-error-primary"
162
+ }, pe = {
163
+ key: 1,
164
+ class: "truncate text-xs text-secondary"
165
+ }, me = {
166
+ key: 2,
167
+ class: "flex shrink-0 gap-xxs"
168
+ }, he = { class: "font-mono text-xs font-medium text-primary tabular-nums" }, ge = /* @__PURE__ */ C({
169
+ __name: "DunningCaseSendInvoiceRow",
170
+ props: {
171
+ hasSeparator: { type: Boolean },
172
+ invoice: {}
173
+ },
174
+ setup(e) {
175
+ let t = e, n = m(), i = r();
176
+ return (e, r) => (T(), y("div", { class: w([{ "border-t border-secondary": t.hasSeparator }, "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-lg px-lg py-xs"]) }, [b("div", le, [b("div", ue, [b("p", de, O(t.invoice.sequence), 1), t.invoice.isDisputed ? (T(), y("span", fe, " · " + O(k(n).t("module.dunning_case.detail.protested")), 1)) : k(Q)(t.invoice) ? (T(), y("span", pe, " (" + O(k(n).t("module.dunning_case.send.not_yet_due")) + ") ", 1)) : (T(), y("span", me, [S(a, {
177
+ level: t.invoice.level,
178
+ size: "sm"
179
+ }, null, 8, ["level"])]))])]), b("p", he, O(t.invoice.isDisputed ? "—" : k(i).formatMonetary(t.invoice.balanceDueAmount)), 1)], 2));
180
+ }
181
+ }), _e = { class: "w-full overflow-hidden rounded-md border border-secondary bg-primary shadow-xs" }, ve = { class: "flex items-start justify-between gap-lg border-b border-secondary px-lg py-md" }, ye = { class: "min-w-0" }, be = { class: "text-sm font-semibold text-primary" }, xe = { class: "shrink-0" }, Se = { class: "max-h-72 overflow-y-auto border-b border-secondary" }, Ce = { class: "flex items-center justify-between gap-xl bg-secondary px-lg py-md" }, we = { class: "text-sm font-medium text-primary" }, Te = { class: "font-mono text-xl font-semibold text-primary tabular-nums" }, Ee = /* @__PURE__ */ C({
182
+ __name: "DunningCaseSendInvoiceSummary",
183
+ props: {
184
+ dunningCase: {},
185
+ subject: {}
186
+ },
187
+ setup(e) {
188
+ let t = e, n = m(), i = r(), a = g(() => ce(t.dunningCase.invoices, t.dunningCase.totalFee.amount > 0)), o = g(() => t.dunningCase.level === 0 ? n.t("module.dunning_case.level.none") : n.t("module.dunning_case.level.reminder", { level: t.dunningCase.level }));
189
+ return (e, r) => (T(), y("section", _e, [
190
+ b("div", ve, [b("div", ye, [b("p", be, O(t.subject ?? k(n).t("module.dunning_case.detail.invoices")), 1)]), b("span", xe, [S(k(P), {
191
+ label: o.value,
192
+ color: "gray",
193
+ size: "sm",
194
+ variant: "translucent"
195
+ }, null, 8, ["label"])])]),
196
+ b("div", Se, [(T(!0), y(h, null, D(a.value, (e, n) => (T(), y(h, { key: e.type === "fee" ? "fee" : e.invoice.uuid }, [e.type === "fee" ? (T(), _(ae, {
197
+ key: 0,
198
+ fee: t.dunningCase.totalFee,
199
+ level: t.dunningCase.level
200
+ }, null, 8, ["fee", "level"])) : (T(), _(ge, {
201
+ key: 1,
202
+ "has-separator": a.value[n - 1]?.type === "fee",
203
+ invoice: e.invoice
204
+ }, null, 8, ["has-separator", "invoice"]))], 64))), 128))]),
205
+ b("dl", Ce, [b("dt", we, O(k(n).t("module.dunning_case.send.outstanding_balance")), 1), b("dd", Te, O(k(i).formatMonetary(t.dunningCase.outstandingBalance)), 1)])
206
+ ]));
207
+ }
208
+ }), De = { class: "rounded-md border border-secondary bg-secondary p-md" }, $ = { class: "text-sm text-error-primary" }, Oe = /* @__PURE__ */ C({
209
+ __name: "DunningCaseSendRecipientAlert",
210
+ props: { customerDetailRoute: {} },
211
+ setup(e) {
212
+ let t = e, n = m(), r = f();
213
+ function i() {
214
+ t.customerDetailRoute !== null && r.push(t.customerDetailRoute);
215
+ }
216
+ return (e, r) => (T(), y("div", De, [b("p", $, [x(O(k(n).t("module.dunning_case.send.no_default_recipient_description")) + " ", 1), t.customerDetailRoute === null ? v("", !0) : (T(), y("button", {
217
+ key: 0,
218
+ class: "font-medium underline hover:no-underline",
219
+ type: "button",
220
+ onClick: i
221
+ }, O(k(n).t("module.dunning_case.send.open_customer")), 1))])]));
222
+ }
223
+ });
224
+ //#endregion
225
+ //#region src/modules/dunning-case/use-cases/send/composables/dunningCaseReminderSubject.composable.ts
226
+ function ke(e) {
227
+ return e === "fr-BE" || e === "nl-BE" ? e : "en-US";
228
+ }
229
+ function Ae(e) {
230
+ let t = m(), n = s();
231
+ return g(() => {
232
+ let r = e.value;
233
+ return r === null || !n.result.value.isOk() ? null : n.result.value.getValue().find((e) => e.sequence === r)?.template[ke(t.locale.value)].subject || null;
234
+ });
235
+ }
236
+ //#endregion
237
+ //#region src/modules/dunning-case/use-cases/send/composables/dunningCaseSendRecipient.composable.ts
238
+ function je(e) {
239
+ let t = E(void 0), n = E(!0);
240
+ return A(e, async (e) => {
241
+ if (t.value = void 0, n.value = !0, e === null) return;
242
+ let r = await W.getRecipients(d.parse(e));
243
+ if (r.isErr()) {
244
+ n.value = !1;
245
+ return;
246
+ }
247
+ t.value = r.value.find((e) => e.isDefault)?.email ?? null, n.value = !1;
248
+ }, { immediate: !0 }), {
249
+ isMissing: g(() => t.value === null),
250
+ isPending: n,
251
+ defaultEmail: t
252
+ };
253
+ }
254
+ //#endregion
255
+ //#region src/modules/dunning-case/use-cases/send/dialogs/DunningCaseSendDialog.vue?vue&type=script&setup=true&lang.ts
256
+ var Me = {
257
+ key: 0,
258
+ class: "text-sm text-secondary"
259
+ }, Ne = { class: "flex w-full items-start gap-md rounded-md bg-secondary px-lg py-md text-secondary" }, Pe = { class: "text-xs/relaxed" }, Fe = /* @__PURE__ */ C({
260
+ __name: "DunningCaseSendDialog",
261
+ props: {
262
+ dunningCaseUuid: {},
263
+ onSent: { type: Function }
264
+ },
265
+ emits: ["close"],
266
+ setup(e, { emit: t }) {
267
+ let n = e, r = t, a = m(), o = H(), s = i(), c = X(), d = K(g(() => n.dunningCaseUuid)), f = g(() => d.result.value.isOk() ? d.result.value.getValue() : null), x = je(g(() => f.value?.customer.uuid ?? null)), C = Ae(g(() => f.value?.level ?? null)), w = g(() => {
268
+ let e = f.value?.customer.uuid;
269
+ return e === void 0 ? null : s.getCustomerDetailRoute(e);
270
+ }), E = g(() => f.value === null ? 0 : se(f.value.invoices).length), D = g(() => typeof x.defaultEmail.value == "string" ? a.t("module.dunning_case.send.grouped_to", { email: x.defaultEmail.value }) : x.isMissing.value ? a.t("module.dunning_case.send.no_default_recipient") : a.t("module.dunning_case.send.description")), A = U({
271
+ schema: p.object({}),
272
+ onSubmit: async () => {
273
+ if (x.isMissing.value) {
274
+ o.show({ message: a.t("module.dunning_case.send.no_default_recipient_blocked") });
275
+ return;
276
+ }
277
+ let e = await c.execute({ params: { dunningCaseUuid: n.dunningCaseUuid } });
278
+ if (e.isErr()) {
279
+ o.apiError(e.error);
280
+ return;
281
+ }
282
+ o.show({
283
+ duration: Infinity,
284
+ message: a.t("module.dunning_case.send.success", { customer: f.value?.customer.name ?? "" })
285
+ }), n.onSent?.(), r("close");
286
+ }
287
+ });
288
+ return (e, t) => (T(), _(k(V), {
289
+ form: k(A),
290
+ size: "lg",
291
+ onClose: t[0] ||= (e) => r("close")
292
+ }, {
293
+ default: j(() => [
294
+ S(k(B), {
295
+ title: k(a).t("module.dunning_case.send.title", {
296
+ customer: f.value?.customer.name ?? "",
297
+ level: f.value?.level ?? ""
298
+ }),
299
+ description: D.value,
300
+ "has-separator": !1,
301
+ icon: k(u)
302
+ }, null, 8, [
303
+ "title",
304
+ "description",
305
+ "icon"
306
+ ]),
307
+ S(k(I), null, {
308
+ default: j(() => [S(k(F), { gap: "lg" }, {
309
+ default: j(() => [k(d).isLoading.value ? (T(), y("p", Me, O(k(a).t("module.dunning_case.common.loading")), 1)) : f.value === null ? v("", !0) : (T(), y(h, { key: 1 }, [
310
+ k(x).isMissing.value ? (T(), _(Oe, {
311
+ key: 0,
312
+ "customer-detail-route": w.value
313
+ }, null, 8, ["customer-detail-route"])) : v("", !0),
314
+ S(Ee, {
315
+ "dunning-case": f.value,
316
+ subject: k(C)
317
+ }, null, 8, ["dunning-case", "subject"]),
318
+ b("div", Ne, [S(k(l), { class: "mt-xxs size-(--spacing-xl) shrink-0" }), b("p", Pe, O(k(a).t("module.dunning_case.send.impact", {
319
+ count: E.value,
320
+ level: f.value.level
321
+ })), 1)])
322
+ ], 64))]),
323
+ _: 1
324
+ })]),
325
+ _: 1
326
+ }),
327
+ S(k(L), { "has-separator": !1 }, {
328
+ right: j(() => [S(k(R)), S(k(z), {
329
+ "icon-right": k(u),
330
+ "is-disabled": f.value === null || k(x).isPending.value || k(x).isMissing.value,
331
+ "is-loading": k(A).isSubmitting.value,
332
+ label: k(a).t("module.dunning_case.send.send_now"),
333
+ onClick: k(A).submit
334
+ }, null, 8, [
335
+ "icon-right",
336
+ "is-disabled",
337
+ "is-loading",
338
+ "label",
339
+ "onClick"
340
+ ])]),
341
+ _: 1
342
+ })
343
+ ]),
344
+ _: 1
345
+ }, 8, ["form"]));
346
+ }
347
+ });
348
+ //#endregion
349
+ export { K as a, q as i, Y as n, W as o, J as r, Fe as t };