@wisemen/wise-invoicing-web 0.0.3 → 0.0.4
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.
- package/dist/{BillingDocumentDetailViewDataProvider-CwonTh2r.js → BillingDocumentDetailViewDataProvider-pePmiXWb.js} +332 -332
- package/dist/{BillingDocumentPdf-GWCCjE6F.js → BillingDocumentPdf-Dg5JlQE1.js} +8 -8
- package/dist/{CreditNoteDetailViewDataProvider-CaucKK9o.js → CreditNoteDetailViewDataProvider-C-A0jyVr.js} +5 -5
- package/dist/{CreditNotePdfViewDataProvider-CDkvm-3m.js → CreditNotePdfViewDataProvider-DNUvFVDj.js} +2 -2
- package/dist/{CustomFieldValueText-CC9spLWf.js → CustomFieldValueText-DDQq-975.js} +1 -1
- package/dist/{DunningCaseDetailViewDataProvider-1Ui9yqUb.js → DunningCaseDetailViewDataProvider-0WV-7-vg.js} +110 -113
- package/dist/DunningCaseOverviewView-CHdzfbhb.js +553 -0
- package/dist/{DunningCaseReminderPdfViewDataProvider-CVnr9ge6.js → DunningCaseReminderPdfViewDataProvider-DcM-7ECg.js} +4 -1
- package/dist/DunningCaseSendDialog-DBtwr2ue.js +350 -0
- package/dist/{InvoiceDetailViewDataProvider-DfRDFCEb.js → InvoiceDetailViewDataProvider-BDL9lAWe.js} +175 -174
- package/dist/{InvoiceOverviewViewDataProvider-CNK7H5r2.js → InvoiceOverviewViewDataProvider-B_jrcC_8.js} +54 -54
- package/dist/{InvoicePdfView-CrWU8Xa-.js → InvoicePdfView-Bygb-9z6.js} +2 -2
- package/dist/{InvoicePdfViewDataProvider-nHZoeRxn.js → InvoicePdfViewDataProvider-nBk3XNrE.js} +2 -2
- package/dist/{InvoicePublicPdfViewDataProvider-CXWSg2pq.js → InvoicePublicPdfViewDataProvider-DHJP_-7-.js} +2 -2
- package/dist/{IssuerSettingsViewDataProvider-DcA6rgOJ.js → IssuerSettingsViewDataProvider-Dk_Q6w6f.js} +2 -2
- package/dist/ReminderSettingsViewDataProvider-CDBjfU7R.js +668 -0
- package/dist/{billingDocumentDetail.transformer-tmy9Tf_b.js → billingDocumentDetail.transformer-zMTbka5p.js} +1 -1
- package/dist/composables/invoicingConfig.composable.d.ts +0 -2
- package/dist/{creditNoteDetail.query-BM2saU0n.js → creditNoteDetail.query-BZqgZRSu.js} +2 -2
- package/dist/{documentTitle.composable-D7XA-8iJ.js → documentTitle.composable-CeaFddr1.js} +28 -30
- package/dist/{invoicingConfig.composable-AjojW4qE.js → i18n.lib-DUbAMBRb.js} +8 -66
- package/dist/index.js +156 -157
- package/dist/{invoice.service-PsmVGGTR.js → invoice.service-ChHEtXBA.js} +13 -13
- package/dist/{invoiceDeliveryStatus.util-CL8K78pD.js → invoiceDeliveryStatus.util-BsA-MlA3.js} +27 -27
- package/dist/{invoiceDetail.query-D2eFdE0j.js → invoiceDetail.query-O_CGvdwg.js} +1 -1
- package/dist/invoicingConfig.composable-c6w_aMm1.js +60 -0
- package/dist/{issuerSettings.query-d5i7Wd7j.js → issuerSettings.query-RqtrZFaB.js} +1 -1
- package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.d.ts +0 -1
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue.d.ts +9 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendSummary.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendFeeRow.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceRow.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceSummary.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendRecipientAlert.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseReminderSubject.composable.d.ts +6 -0
- package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseSendRecipient.composable.d.ts +16 -0
- package/dist/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.d.ts +13 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderFeeNotice.vue.d.ts +3 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderPanel.vue.d.ts +12 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +26 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderTimeline.vue.d.ts +13 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplateTabs.vue.d.ts +20 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplatesPanel.vue.d.ts +24 -0
- package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +41 -0
- package/dist/{reminderConfig.query-C7I3M2pu.js → reminderConfig.query-DzTN2AvU.js} +87 -100
- package/package.json +1 -1
- package/dist/DunningCaseOverviewView-Bvwaj4_y.js +0 -507
- package/dist/PermissionGuard-DDw-lDGL.js +0 -301
- package/dist/ReminderSettingsViewDataProvider-C4qz2Rli.js +0 -502
- package/dist/composables/permission-guard/permissionGuard.composable.d.ts +0 -4
- package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.spec.d.ts +0 -1
- package/dist/ui/permission-guard/PermissionGuard.vue.d.ts +0 -22
|
@@ -0,0 +1,350 @@
|
|
|
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 };
|