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