@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.
Files changed (52) hide show
  1. package/dist/{BillingDocumentDetailViewDataProvider-CwonTh2r.js → BillingDocumentDetailViewDataProvider-pePmiXWb.js} +332 -332
  2. package/dist/{BillingDocumentPdf-GWCCjE6F.js → BillingDocumentPdf-Dg5JlQE1.js} +8 -8
  3. package/dist/{CreditNoteDetailViewDataProvider-CaucKK9o.js → CreditNoteDetailViewDataProvider-C-A0jyVr.js} +5 -5
  4. package/dist/{CreditNotePdfViewDataProvider-CDkvm-3m.js → CreditNotePdfViewDataProvider-DNUvFVDj.js} +2 -2
  5. package/dist/{CustomFieldValueText-CC9spLWf.js → CustomFieldValueText-DDQq-975.js} +1 -1
  6. package/dist/{DunningCaseDetailViewDataProvider-1Ui9yqUb.js → DunningCaseDetailViewDataProvider-0WV-7-vg.js} +110 -113
  7. package/dist/DunningCaseOverviewView-CHdzfbhb.js +553 -0
  8. package/dist/{DunningCaseReminderPdfViewDataProvider-CVnr9ge6.js → DunningCaseReminderPdfViewDataProvider-DcM-7ECg.js} +4 -1
  9. package/dist/DunningCaseSendDialog-DBtwr2ue.js +350 -0
  10. package/dist/{InvoiceDetailViewDataProvider-DfRDFCEb.js → InvoiceDetailViewDataProvider-BDL9lAWe.js} +175 -174
  11. package/dist/{InvoiceOverviewViewDataProvider-CNK7H5r2.js → InvoiceOverviewViewDataProvider-B_jrcC_8.js} +54 -54
  12. package/dist/{InvoicePdfView-CrWU8Xa-.js → InvoicePdfView-Bygb-9z6.js} +2 -2
  13. package/dist/{InvoicePdfViewDataProvider-nHZoeRxn.js → InvoicePdfViewDataProvider-nBk3XNrE.js} +2 -2
  14. package/dist/{InvoicePublicPdfViewDataProvider-CXWSg2pq.js → InvoicePublicPdfViewDataProvider-DHJP_-7-.js} +2 -2
  15. package/dist/{IssuerSettingsViewDataProvider-DcA6rgOJ.js → IssuerSettingsViewDataProvider-Dk_Q6w6f.js} +2 -2
  16. package/dist/ReminderSettingsViewDataProvider-CDBjfU7R.js +668 -0
  17. package/dist/{billingDocumentDetail.transformer-tmy9Tf_b.js → billingDocumentDetail.transformer-zMTbka5p.js} +1 -1
  18. package/dist/composables/invoicingConfig.composable.d.ts +0 -2
  19. package/dist/{creditNoteDetail.query-BM2saU0n.js → creditNoteDetail.query-BZqgZRSu.js} +2 -2
  20. package/dist/{documentTitle.composable-D7XA-8iJ.js → documentTitle.composable-CeaFddr1.js} +28 -30
  21. package/dist/{invoicingConfig.composable-AjojW4qE.js → i18n.lib-DUbAMBRb.js} +8 -66
  22. package/dist/index.js +156 -157
  23. package/dist/{invoice.service-PsmVGGTR.js → invoice.service-ChHEtXBA.js} +13 -13
  24. package/dist/{invoiceDeliveryStatus.util-CL8K78pD.js → invoiceDeliveryStatus.util-BsA-MlA3.js} +27 -27
  25. package/dist/{invoiceDetail.query-D2eFdE0j.js → invoiceDetail.query-O_CGvdwg.js} +1 -1
  26. package/dist/invoicingConfig.composable-c6w_aMm1.js +60 -0
  27. package/dist/{issuerSettings.query-d5i7Wd7j.js → issuerSettings.query-RqtrZFaB.js} +1 -1
  28. package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.d.ts +0 -1
  29. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue.d.ts +9 -0
  30. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendSummary.vue.d.ts +8 -0
  31. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendFeeRow.vue.d.ts +8 -0
  32. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceRow.vue.d.ts +8 -0
  33. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceSummary.vue.d.ts +8 -0
  34. package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendRecipientAlert.vue.d.ts +7 -0
  35. package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseReminderSubject.composable.d.ts +6 -0
  36. package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseSendRecipient.composable.d.ts +16 -0
  37. package/dist/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.d.ts +13 -0
  38. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderFeeNotice.vue.d.ts +3 -0
  39. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderPanel.vue.d.ts +12 -0
  40. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +26 -0
  41. package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderTimeline.vue.d.ts +13 -0
  42. package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplateTabs.vue.d.ts +20 -0
  43. package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplatesPanel.vue.d.ts +24 -0
  44. package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +41 -0
  45. package/dist/{reminderConfig.query-C7I3M2pu.js → reminderConfig.query-DzTN2AvU.js} +87 -100
  46. package/package.json +1 -1
  47. package/dist/DunningCaseOverviewView-Bvwaj4_y.js +0 -507
  48. package/dist/PermissionGuard-DDw-lDGL.js +0 -301
  49. package/dist/ReminderSettingsViewDataProvider-C4qz2Rli.js +0 -502
  50. package/dist/composables/permission-guard/permissionGuard.composable.d.ts +0 -4
  51. package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.spec.d.ts +0 -1
  52. package/dist/ui/permission-guard/PermissionGuard.vue.d.ts +0 -22
@@ -0,0 +1,668 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { t } from "./i18n.lib-DUbAMBRb.js";
3
+ import "./api.util-Dm_TQedZ.js";
4
+ import { a as n, t as r, v as i } from "./documentTitle.composable-CeaFddr1.js";
5
+ import { i as a, n as o, r as s, t as c } from "./reminderConfig.query-DzTN2AvU.js";
6
+ import { t as l } from "./DataProvider-CfHLB3rH.js";
7
+ import { t as u } from "./formango.util-D5c2ql--.js";
8
+ import { z as d } from "zod";
9
+ import { useI18n as f } from "vue-i18n";
10
+ import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, mergeModels as S, mergeProps as C, nextTick as w, normalizeClass as T, normalizeStyle as E, openBlock as D, ref as O, renderList as k, toDisplayString as A, unref as j, useModel as M, watch as ee, withCtx as N, withKeys as P, withModifiers as F } from "vue";
11
+ import { useMutation as I } from "@wisemen/vue-core-api-utils";
12
+ import { UIButton as te, UIDashboardPage as ne, UIDashboardPageContent as re, UIDashboardPageLoadingState as L, UIForm as ie, UINumberField as R, UISelect as ae, UITabs as z, UITabsItem as B, UITabsList as V, UITextField as oe, UITextareaField as se, UITooltip as H, UITooltipContent as U, createSelectOptions as W, useToast as G } from "@wisemen/vue-core-design-system";
13
+ import { useForm as K } from "formango";
14
+ //#region src/modules/dunning-case/api/mutations/reminderConfigUpdate.mutation.ts
15
+ function ce() {
16
+ return I({
17
+ queryFn: (e) => s.updateReminderConfigs(e.body),
18
+ queryKeysToInvalidate: { reminderConfig: {} }
19
+ });
20
+ }
21
+ //#endregion
22
+ //#region src/modules/dunning-case/models/reminderConfigForm.model.ts
23
+ function q(e) {
24
+ return e.trim().length > 0;
25
+ }
26
+ var J = d.object({
27
+ body: d.string().refine(q, t.global.t("module.dunning_case.settings.validation.required")),
28
+ subject: d.string().refine(q, t.global.t("module.dunning_case.settings.validation.required"))
29
+ }), le = d.object({
30
+ feeAmount: d.number().min(0),
31
+ feeCurrency: d.enum(n),
32
+ feePrecision: d.number().int().min(0),
33
+ offsetDays: d.number().int().min(1),
34
+ schedule: d.enum(i),
35
+ sequence: d.number().int().min(1).max(3),
36
+ template: d.object({
37
+ "en-US": J,
38
+ "fr-BE": J,
39
+ "nl-BE": J
40
+ })
41
+ }), ue = d.object({ reminders: d.array(le).length(3) }).superRefine((e, n) => {
42
+ e.reminders[0]?.schedule !== i.AFTER_DUE_DATE && n.addIssue({
43
+ code: "custom",
44
+ message: t.global.t("module.dunning_case.settings.validation.level_one_due_date"),
45
+ path: [
46
+ "reminders",
47
+ 0,
48
+ "schedule"
49
+ ]
50
+ });
51
+ let r = 0;
52
+ for (let [a, o] of e.reminders.entries()) {
53
+ let e = o.schedule === i.AFTER_DUE_DATE ? o.offsetDays : r + o.offsetDays;
54
+ a > 0 && e <= r && n.addIssue({
55
+ code: "custom",
56
+ message: t.global.t("module.dunning_case.settings.validation.chronological"),
57
+ path: [
58
+ "reminders",
59
+ a,
60
+ "offsetDays"
61
+ ]
62
+ }), r = e;
63
+ }
64
+ });
65
+ function de(e) {
66
+ return !q(e.subject ?? "") || !q(e.body ?? "");
67
+ }
68
+ //#endregion
69
+ //#region src/modules/dunning-case/use-cases/settings/components/ReminderLadderFeeNotice.vue?vue&type=script&setup=true&lang.ts
70
+ var fe = { class: "mt-3xl flex max-w-260 flex-col gap-md" }, pe = { class: "rounded-md border border-warning-500 bg-warning-primary px-lg py-md text-sm text-warning-primary" }, me = { class: "font-semibold" }, he = { class: "rounded-md border border-secondary bg-primary px-lg py-md" }, ge = { class: "cursor-pointer text-sm font-medium text-primary" }, _e = { class: "mt-md text-sm text-secondary" }, ve = /* @__PURE__ */ x({
71
+ __name: "ReminderLadderFeeNotice",
72
+ setup(e) {
73
+ let t = f();
74
+ return (e, n) => (D(), _("div", fe, [v("p", pe, [v("strong", me, A(j(t).t("module.dunning_case.settings.ladder.fee_notice_title")), 1), y(" " + A(j(t).t("module.dunning_case.settings.ladder.fee_notice")), 1)]), v("details", he, [v("summary", ge, A(j(t).t("module.dunning_case.settings.ladder.fee_law_title")), 1), v("p", _e, A(j(t).t("module.dunning_case.settings.ladder.fee_law_description")), 1)])]));
75
+ }
76
+ }), ye = { class: "grid grid-cols-[7.5rem_minmax(0,1fr)] items-start gap-x-lg gap-y-xl border-b border-secondary py-2xl last:border-b-0 sm:grid-cols-[7.5rem_13.5rem_11.25rem_7.5rem] sm:gap-3xl sm:py-3xl" }, be = { class: "flex flex-col items-start gap-xs" }, xe = { class: "text-xs text-primary" }, Se = { class: "col-start-2 flex flex-col gap-xs sm:col-auto" }, Ce = { class: "text-xs font-medium text-secondary sm:hidden" }, we = { class: "col-start-2 flex flex-col items-start gap-xs sm:col-auto" }, Te = { class: "text-xs font-medium text-secondary sm:hidden" }, Ee = { class: "text-xs whitespace-nowrap text-secondary" }, De = { class: "col-start-2 flex flex-col gap-xs sm:col-auto" }, Oe = { class: "text-xs font-medium text-secondary sm:hidden" }, ke = /* @__PURE__ */ x({
77
+ __name: "ReminderLadderRow",
78
+ props: {
79
+ absoluteDay: {},
80
+ canUpdate: { type: Boolean },
81
+ feeCurrency: {},
82
+ feeField: {},
83
+ level: {},
84
+ offsetField: {},
85
+ scheduleField: {},
86
+ scheduleItems: {}
87
+ },
88
+ emits: [
89
+ "commitOffset",
90
+ "updateOffset",
91
+ "updateOffsetFromInput",
92
+ "updateSchedule"
93
+ ],
94
+ setup(e, { emit: t }) {
95
+ let n = e, r = t, a = f(), s = m(() => !n.canUpdate || n.level === 1), c = m(() => {
96
+ if (n.feeCurrency !== void 0) return {
97
+ currency: n.feeCurrency,
98
+ minimumFractionDigits: 0,
99
+ style: "currency"
100
+ };
101
+ });
102
+ function l(e) {
103
+ return a.t(e === i.AFTER_DUE_DATE ? "module.dunning_case.settings.ladder.after_due_date" : "module.dunning_case.settings.ladder.after_previous");
104
+ }
105
+ return (e, t) => (D(), _("div", ye, [
106
+ v("div", be, [v("span", xe, A(j(a).t("module.dunning_case.level.reminder", { level: n.level })), 1), b(o, {
107
+ level: n.level,
108
+ size: "md"
109
+ }, null, 8, ["level"])]),
110
+ v("div", Se, [v("span", Ce, A(j(a).t("module.dunning_case.settings.ladder.trigger")), 1), b(j(ae), C(j(u)(n.scheduleField), {
111
+ "aria-label": j(a).t("module.dunning_case.settings.ladder.trigger"),
112
+ "display-fn": l,
113
+ "is-disabled": s.value,
114
+ items: n.scheduleItems,
115
+ label: null,
116
+ size: "sm",
117
+ "onUpdate:modelValue": t[0] ||= (e) => r("updateSchedule", e)
118
+ }), null, 16, [
119
+ "aria-label",
120
+ "is-disabled",
121
+ "items"
122
+ ])]),
123
+ v("div", we, [v("span", Te, A(j(a).t("module.dunning_case.settings.ladder.offset")), 1), v("div", {
124
+ class: "flex flex-col items-start gap-xs sm:flex-row sm:items-center",
125
+ onFocusoutCapture: t[2] ||= (e) => r("commitOffset", e),
126
+ onInputCapture: t[3] ||= (e) => r("updateOffsetFromInput", e)
127
+ }, [b(j(R), C(j(u)(n.offsetField), {
128
+ "aria-label": j(a).t("module.dunning_case.settings.ladder.offset"),
129
+ "is-disabled": !n.canUpdate,
130
+ label: null,
131
+ min: 1,
132
+ "show-controls": !0,
133
+ step: 1,
134
+ class: "w-30",
135
+ size: "sm",
136
+ "onUpdate:modelValue": t[1] ||= (e) => r("updateOffset", e)
137
+ }), null, 16, ["aria-label", "is-disabled"]), v("span", Ee, A(j(a).t("module.dunning_case.settings.ladder.day_hint", { day: n.absoluteDay })), 1)], 32)]),
138
+ v("div", De, [v("span", Oe, A(j(a).t("module.dunning_case.settings.ladder.fee")), 1), b(j(R), C(j(u)(n.feeField), {
139
+ "aria-label": j(a).t("module.dunning_case.settings.ladder.fee"),
140
+ "format-options": c.value,
141
+ "is-disabled": !n.canUpdate,
142
+ label: null,
143
+ min: 0,
144
+ step: .01,
145
+ size: "sm"
146
+ }), null, 16, [
147
+ "aria-label",
148
+ "format-options",
149
+ "is-disabled"
150
+ ])])
151
+ ]));
152
+ }
153
+ }), Ae = { class: "relative mt-2xl pb-lg" }, je = { class: "w-full" }, Me = { class: "flex justify-between text-xs font-medium text-secondary" }, Ne = { class: "mt-md block font-mono text-xs text-secondary tabular-nums" }, Pe = [
154
+ "aria-label",
155
+ "aria-valuemax",
156
+ "aria-valuemin",
157
+ "aria-valuenow",
158
+ "disabled",
159
+ "onKeydown",
160
+ "onPointercancel",
161
+ "onPointerdown",
162
+ "onPointermove",
163
+ "onPointerup"
164
+ ], Fe = 4, Ie = /* @__PURE__ */ x({
165
+ __name: "ReminderLadderTimeline",
166
+ props: {
167
+ canUpdate: { type: Boolean },
168
+ markers: {},
169
+ timelineDays: {}
170
+ },
171
+ emits: ["moveTo"],
172
+ setup(e, { emit: t }) {
173
+ let n = e, r = t, i = [
174
+ "bg-brand-500",
175
+ "bg-warning-solid",
176
+ "bg-error-solid"
177
+ ], a = f(), o = O(null), s = O(null), c = m(() => Array.from({ length: 5 }, (e, t) => Math.round(t * (n.timelineDays / Fe))));
178
+ function l(e) {
179
+ return Math.min(100, e / n.timelineDays * 100);
180
+ }
181
+ function u(e) {
182
+ return i[e] ?? i[0];
183
+ }
184
+ function d(e, t) {
185
+ r("moveTo", e, (n.markers[e]?.absoluteDay ?? 0) + t);
186
+ }
187
+ function h(e, t) {
188
+ if (o.value === null) return;
189
+ let i = o.value.getBoundingClientRect(), a = Math.min(1, Math.max(0, (t.clientX - i.left) / i.width));
190
+ r("moveTo", e, Math.round(a * n.timelineDays));
191
+ }
192
+ function g(e, t) {
193
+ n.canUpdate && (s.value = e, t.currentTarget.setPointerCapture(t.pointerId), h(e, t));
194
+ }
195
+ function x(e, t) {
196
+ s.value === e && h(e, t);
197
+ }
198
+ function S(e, t) {
199
+ s.value === e && (s.value = null, t.currentTarget.releasePointerCapture(t.pointerId));
200
+ }
201
+ return (e, t) => (D(), _("div", Ae, [v("div", je, [v("div", Me, [v("span", null, A(j(a).t("module.dunning_case.settings.ladder.due_date")), 1), v("span", null, A(j(a).t("module.dunning_case.settings.ladder.timeline_end", { days: n.timelineDays })), 1)]), v("div", {
202
+ ref_key: "timelineTrack",
203
+ ref: o,
204
+ class: "relative mt-lg h-(--spacing-8xl)"
205
+ }, [
206
+ t[1] ||= v("div", { class: "absolute inset-x-0 top-(--spacing-lg) h-(--spacing-md) rounded-full bg-tertiary" }, null, -1),
207
+ v("div", {
208
+ style: E({ width: `${l(n.markers[n.markers.length - 1]?.absoluteDay ?? 0)}%` }),
209
+ class: "absolute top-(--spacing-lg) left-0 h-(--spacing-md) rounded-full bg-brand-100"
210
+ }, null, 4),
211
+ (D(!0), _(p, null, k(c.value, (e) => (D(), _("div", {
212
+ key: e,
213
+ class: T([{
214
+ "-translate-x-1/2": e > 0 && e < n.timelineDays,
215
+ "-translate-x-full": e === n.timelineDays
216
+ }, "absolute top-0"]),
217
+ style: E({ left: `${e / n.timelineDays * 100}%` })
218
+ }, [t[0] ||= v("span", { class: "block h-(--spacing-4xl) w-px bg-secondary" }, null, -1), v("span", Ne, A(j(a).t("module.dunning_case.settings.ladder.day_short", { day: e })), 1)], 6))), 128)),
219
+ (D(!0), _(p, null, k(n.markers, (e, t) => (D(), _("div", {
220
+ key: e.sequence,
221
+ style: E({ left: `${l(e.absoluteDay)}%` }),
222
+ class: "absolute top-0 z-10 -translate-x-1/2"
223
+ }, [b(j(H), {
224
+ "popover-side-offset": 8,
225
+ "popover-align": "center",
226
+ "popover-side": "top"
227
+ }, {
228
+ trigger: N(() => [v("button", {
229
+ class: T([u(t), "flex size-(--spacing-4xl) touch-none items-center justify-center rounded-full border-2 border-primary text-sm font-semibold text-white shadow-sm enabled:cursor-ew-resize"]),
230
+ "aria-label": j(a).t("module.dunning_case.settings.ladder.marker_label", {
231
+ day: e.absoluteDay,
232
+ level: t + 1
233
+ }),
234
+ "aria-valuemax": n.timelineDays,
235
+ "aria-valuemin": e.minimumDay,
236
+ "aria-valuenow": e.absoluteDay,
237
+ disabled: !n.canUpdate,
238
+ role: "slider",
239
+ type: "button",
240
+ onKeydown: [P(F((e) => d(t, -1), ["prevent"]), ["left"]), P(F((e) => d(t, 1), ["prevent"]), ["right"])],
241
+ onPointercancel: (e) => S(t, e),
242
+ onPointerdown: (e) => g(t, e),
243
+ onPointermove: (e) => x(t, e),
244
+ onPointerup: (e) => S(t, e)
245
+ }, A(e.sequence), 43, Pe)]),
246
+ content: N(() => [b(j(U), { class: "rounded-md! bg-primary-solid! px-lg! py-md! text-sm font-semibold! whitespace-nowrap! text-white!" }, {
247
+ default: N(() => [y(A(j(a).t("module.dunning_case.settings.ladder.day", { day: e.absoluteDay })), 1)]),
248
+ _: 2
249
+ }, 1024)]),
250
+ _: 2
251
+ }, 1024)], 4))), 128))
252
+ ], 512)])]));
253
+ }
254
+ }), Le = { class: "mt-3xl" }, Re = { class: "text-sm text-secondary" }, ze = { class: "mt-3xl max-w-260" }, Be = { class: "grid grid-cols-[7.5rem_minmax(0,1fr)] gap-lg text-xs font-medium text-secondary sm:grid-cols-[7.5rem_13.5rem_11.25rem_7.5rem] sm:gap-3xl" }, Ve = { class: "hidden sm:inline" }, He = { class: "hidden sm:inline" }, Ue = { class: "hidden sm:inline" }, We = /* @__PURE__ */ x({
255
+ __name: "ReminderLadderPanel",
256
+ props: {
257
+ canUpdate: { type: Boolean },
258
+ fields: {},
259
+ ladder: {},
260
+ scheduleItems: {}
261
+ },
262
+ setup(e) {
263
+ let t = e, n = f();
264
+ return (e, r) => (D(), _("div", Le, [
265
+ v("p", Re, A(j(n).t("module.dunning_case.settings.ladder.description")), 1),
266
+ b(Ie, {
267
+ "can-update": t.canUpdate,
268
+ markers: t.ladder.markers.value,
269
+ "timeline-days": t.ladder.timelineDays.value,
270
+ onMoveTo: t.ladder.setAbsoluteDay
271
+ }, null, 8, [
272
+ "can-update",
273
+ "markers",
274
+ "timeline-days",
275
+ "onMoveTo"
276
+ ]),
277
+ v("div", ze, [v("div", Be, [
278
+ v("span", null, A(j(n).t("module.dunning_case.settings.ladder.level")), 1),
279
+ v("span", Ve, A(j(n).t("module.dunning_case.settings.ladder.trigger")), 1),
280
+ v("span", He, A(j(n).t("module.dunning_case.settings.ladder.offset")), 1),
281
+ v("span", Ue, A(j(n).t("module.dunning_case.settings.ladder.fee")), 1)
282
+ ]), (D(!0), _(p, null, k(t.fields, (e, n) => (D(), h(ke, {
283
+ key: n,
284
+ "absolute-day": t.ladder.getAbsoluteDay(n),
285
+ "can-update": t.canUpdate,
286
+ "fee-currency": t.ladder.items.value[n]?.feeCurrency,
287
+ "fee-field": e.feeAmount,
288
+ level: n + 1,
289
+ "offset-field": e.offsetDays,
290
+ "schedule-field": e.schedule,
291
+ "schedule-items": t.scheduleItems,
292
+ onCommitOffset: (e) => t.ladder.commitOffset(n, e),
293
+ onUpdateOffset: (e) => t.ladder.updateOffset(n, e),
294
+ onUpdateOffsetFromInput: (e) => t.ladder.updateOffsetFromInput(n, e),
295
+ onUpdateSchedule: (e) => t.ladder.updateSchedule(n, e)
296
+ }, null, 8, [
297
+ "absolute-day",
298
+ "can-update",
299
+ "fee-currency",
300
+ "fee-field",
301
+ "level",
302
+ "offset-field",
303
+ "schedule-field",
304
+ "schedule-items",
305
+ "onCommitOffset",
306
+ "onUpdateOffset",
307
+ "onUpdateOffsetFromInput",
308
+ "onUpdateSchedule"
309
+ ]))), 128))]),
310
+ b(ve)
311
+ ]));
312
+ }
313
+ }), Ge = { class: "flex flex-wrap items-center gap-xl" }, Ke = { class: "text-xs text-secondary" }, Y = /* @__PURE__ */ x({
314
+ __name: "ReminderTemplateTabs",
315
+ props: /*@__PURE__*/ S({
316
+ caption: {},
317
+ items: {}
318
+ }, {
319
+ modelValue: { required: !0 },
320
+ modelModifiers: {}
321
+ }),
322
+ emits: ["update:modelValue"],
323
+ setup(e) {
324
+ let t = e, n = M(e, "modelValue"), r = f();
325
+ function i(e) {
326
+ return e.hasMissingContent ? `${e.label}, ${r.t("module.dunning_case.settings.templates.missing")}` : e.label;
327
+ }
328
+ return (e, r) => (D(), _("div", Ge, [v("p", Ke, A(t.caption), 1), b(j(z), {
329
+ modelValue: n.value,
330
+ "onUpdate:modelValue": r[0] ||= (e) => n.value = e,
331
+ "aria-label": t.caption,
332
+ variant: "button-brand"
333
+ }, {
334
+ default: N(() => [b(j(V), null, {
335
+ default: N(() => [(D(!0), _(p, null, k(t.items, (e) => (D(), h(j(B), {
336
+ key: e.value,
337
+ "aria-label": i(e),
338
+ config: e.hasMissingContent ? { indicator: {
339
+ type: "dot",
340
+ color: "error"
341
+ } } : null,
342
+ label: e.label,
343
+ value: e.value
344
+ }, null, 8, [
345
+ "aria-label",
346
+ "config",
347
+ "label",
348
+ "value"
349
+ ]))), 128))]),
350
+ _: 1
351
+ })]),
352
+ _: 1
353
+ }, 8, ["modelValue", "aria-label"])]));
354
+ }
355
+ }), qe = { class: "mt-5xl" }, Je = { class: "flex flex-col gap-xl sm:flex-row sm:items-center sm:justify-between" }, Ye = { class: "mt-xl overflow-hidden rounded-md border border-secondary bg-primary" }, Xe = { class: "border-b border-secondary px-3xl py-lg" }, Ze = { class: "text-sm font-medium text-primary" }, X = {
356
+ key: 0,
357
+ class: "flex flex-col gap-md p-3xl"
358
+ }, Qe = /* @__PURE__ */ x({
359
+ __name: "ReminderTemplatesPanel",
360
+ props: /*@__PURE__*/ S({
361
+ bodyField: {},
362
+ canUpdate: { type: Boolean },
363
+ cardTitle: {},
364
+ levelItems: {},
365
+ localeItems: {},
366
+ subjectField: {}
367
+ }, {
368
+ activeLevel: { required: !0 },
369
+ activeLevelModifiers: {},
370
+ activeLocale: { required: !0 },
371
+ activeLocaleModifiers: {}
372
+ }),
373
+ emits: ["update:activeLevel", "update:activeLocale"],
374
+ setup(e) {
375
+ let t = e, n = M(e, "activeLevel"), r = M(e, "activeLocale"), i = f();
376
+ return (e, a) => (D(), _("div", qe, [v("div", Je, [b(Y, {
377
+ modelValue: n.value,
378
+ "onUpdate:modelValue": a[0] ||= (e) => n.value = e,
379
+ caption: j(i).t("module.dunning_case.settings.templates.selector"),
380
+ items: t.levelItems
381
+ }, null, 8, [
382
+ "modelValue",
383
+ "caption",
384
+ "items"
385
+ ]), b(Y, {
386
+ modelValue: r.value,
387
+ "onUpdate:modelValue": a[1] ||= (e) => r.value = e,
388
+ caption: j(i).t("module.dunning_case.settings.templates.language"),
389
+ items: t.localeItems
390
+ }, null, 8, [
391
+ "modelValue",
392
+ "caption",
393
+ "items"
394
+ ])]), v("div", Ye, [v("div", Xe, [v("h2", Ze, A(t.cardTitle), 1)]), t.subjectField !== void 0 && t.bodyField !== void 0 ? (D(), _("div", X, [b(j(oe), C(j(u)(t.subjectField), {
395
+ "is-disabled": !t.canUpdate,
396
+ "is-required": !0,
397
+ label: j(i).t("module.dunning_case.settings.templates.subject"),
398
+ size: "sm"
399
+ }), null, 16, ["is-disabled", "label"]), b(j(se), C(j(u)(t.bodyField), {
400
+ "is-disabled": !t.canUpdate,
401
+ "is-required": !0,
402
+ label: j(i).t("module.dunning_case.settings.templates.content"),
403
+ "min-height": "var(--spacing-11xl)",
404
+ resize: "auto-vertical",
405
+ size: "sm"
406
+ }), null, 16, ["is-disabled", "label"])])) : g("", !0)])]));
407
+ }
408
+ }), Z = class {
409
+ static commitReminder(e, t, n) {
410
+ if (t === void 0) return e.slice();
411
+ let r = e.slice();
412
+ return r[n] = { ...t }, r;
413
+ }
414
+ static getAbsoluteDay(e, t) {
415
+ let n = 0;
416
+ for (let r of t.slice(0, e + 1)) r.schedule === i.AFTER_DUE_DATE ? n = r.offsetDays : n += r.offsetDays;
417
+ return n;
418
+ }
419
+ }, $e = 60, Q = 15;
420
+ function et(e) {
421
+ let t = O([]);
422
+ function n(e) {
423
+ return Z.getAbsoluteDay(e, t.value);
424
+ }
425
+ let r = m(() => {
426
+ let t = e.items.value.length - 1, r = t < 0 ? 0 : n(t), i = Math.ceil(r / Q) * Q;
427
+ return Math.max($e, i);
428
+ }), a = m(() => e.items.value.map((e, t) => ({
429
+ absoluteDay: n(t),
430
+ minimumDay: t === 0 ? 1 : n(t - 1) + 1,
431
+ sequence: e.sequence
432
+ })));
433
+ function o() {
434
+ t.value = e.items.value.map((e) => ({
435
+ offsetDays: e.offsetDays,
436
+ schedule: e.schedule
437
+ }));
438
+ }
439
+ function s(n, r) {
440
+ let i = e.items.value[n];
441
+ i !== void 0 && (t.value = Z.commitReminder(t.value, {
442
+ offsetDays: r ?? i.offsetDays,
443
+ schedule: i.schedule
444
+ }, n));
445
+ }
446
+ function c(t, n) {
447
+ let r = n?.target, i;
448
+ if (r instanceof HTMLInputElement) {
449
+ let n = Number(r.value);
450
+ Number.isFinite(n) && (i = n, e.fields[t]?.offsetDays["onUpdate:modelValue"](n));
451
+ }
452
+ e.fields[t]?.offsetDays.onBlur(), w(() => s(t, i));
453
+ }
454
+ function l(t, n) {
455
+ let r = n.target;
456
+ if (!(r instanceof HTMLInputElement)) return;
457
+ let i = Number(r.value);
458
+ Number.isFinite(i) && e.fields[t]?.offsetDays["onUpdate:modelValue"](i);
459
+ }
460
+ function u(t, n) {
461
+ e.fields[t]?.offsetDays["onUpdate:modelValue"](n), s(t, n ?? void 0);
462
+ }
463
+ function d(t, n) {
464
+ e.fields[t]?.schedule["onUpdate:modelValue"](n), s(t);
465
+ }
466
+ function f(t, a) {
467
+ let o = e.items.value[t], c = e.fields[t]?.offsetDays;
468
+ if (o === void 0 || c === void 0 || !e.canUpdate.value) return;
469
+ let l = t === 0 ? 0 : n(t - 1), u = o.schedule === i.AFTER_DUE_DATE ? 1 : l + 1, d = Math.min(r.value, Math.max(u, a)), f = o.schedule === i.AFTER_DUE_DATE ? d : d - l;
470
+ c.setValue(f), s(t);
471
+ }
472
+ return {
473
+ commitOffset: c,
474
+ getAbsoluteDay: n,
475
+ items: e.items,
476
+ markers: a,
477
+ reset: o,
478
+ setAbsoluteDay: f,
479
+ timelineDays: r,
480
+ updateOffset: u,
481
+ updateOffsetFromInput: l,
482
+ updateSchedule: d
483
+ };
484
+ }
485
+ //#endregion
486
+ //#region src/modules/dunning-case/use-cases/settings/views/ReminderSettingsView.vue?vue&type=script&setup=true&lang.ts
487
+ var tt = { class: "mx-auto w-full max-w-340" }, nt = { class: "flex flex-col gap-lg sm:flex-row sm:items-start sm:justify-between" }, rt = { class: "text-md font-semibold text-primary" }, it = { class: "mt-xs text-sm text-secondary" }, at = /* @__PURE__ */ x({
488
+ __name: "ReminderSettingsView",
489
+ props: { reminderConfigs: {} },
490
+ setup(e) {
491
+ let t = e, n = [
492
+ 0,
493
+ 1,
494
+ 2
495
+ ], o = [
496
+ "en-US",
497
+ "nl-BE",
498
+ "fr-BE"
499
+ ], s = [i.AFTER_DUE_DATE, i.AFTER_LAST_REMINDER], c = f(), l = G(), u = r(), d = ce(), p = O("ladder"), _ = O(0), y = O("en-US");
500
+ u.set(() => c.t("module.dunning_case.settings.title"));
501
+ let x = K({
502
+ initialState: m(() => a.reminderConfigsToForm(t.reminderConfigs)),
503
+ schema: ue,
504
+ onSubmit: async (e) => {
505
+ let t = await d.execute({ body: e });
506
+ if (t.isErr()) {
507
+ l.apiError(t.error);
508
+ return;
509
+ }
510
+ l.show({ message: c.t("module.dunning_case.settings.saved") });
511
+ },
512
+ onSubmitError: () => {
513
+ l.unableToSave();
514
+ }
515
+ }), S = x.registerArray("reminders"), C = n.map((e) => {
516
+ let t = S.register(`${e}`), n = t.register("template");
517
+ return {
518
+ feeAmount: t.register("feeAmount"),
519
+ locales: {
520
+ "en-US": {
521
+ body: n.register("en-US").register("body"),
522
+ subject: n.register("en-US").register("subject")
523
+ },
524
+ "fr-BE": {
525
+ body: n.register("fr-BE").register("body"),
526
+ subject: n.register("fr-BE").register("subject")
527
+ },
528
+ "nl-BE": {
529
+ body: n.register("nl-BE").register("body"),
530
+ subject: n.register("nl-BE").register("subject")
531
+ }
532
+ },
533
+ offsetDays: t.register("offsetDays"),
534
+ schedule: t.register("schedule")
535
+ };
536
+ }), w = O(!0), T = m(() => W(s)), E = et({
537
+ canUpdate: w,
538
+ fields: C,
539
+ items: m(() => (x.state.value.reminders ?? []).map((e, t) => ({
540
+ feeCurrency: e?.feeCurrency,
541
+ offsetDays: e?.offsetDays ?? 0,
542
+ schedule: e?.schedule ?? i.AFTER_DUE_DATE,
543
+ sequence: e?.sequence ?? t + 1
544
+ })))
545
+ }), k = m({
546
+ get: () => String(_.value),
547
+ set: (e) => {
548
+ let t = Number(e);
549
+ Number.isInteger(t) && t >= 0 && t < C.length && (_.value = t);
550
+ }
551
+ }), M = m({
552
+ get: () => y.value,
553
+ set: (e) => {
554
+ let t = o.find((t) => t === e);
555
+ t !== void 0 && (y.value = t);
556
+ }
557
+ });
558
+ function P(e, t) {
559
+ let n = x.state.value.reminders?.[e]?.template?.[t];
560
+ return n === void 0 || de(n);
561
+ }
562
+ let F = m(() => C[_.value]?.locales[y.value]), I = m(() => C.map((e, t) => ({
563
+ hasMissingContent: P(t, y.value),
564
+ label: c.t("module.dunning_case.level.reminder", { level: t + 1 }),
565
+ value: String(t)
566
+ }))), L = m(() => o.map((e) => ({
567
+ hasMissingContent: P(_.value, e),
568
+ label: c.t(`module.dunning_case.settings.locale.${e}`),
569
+ value: e
570
+ }))), R = m(() => c.t("module.dunning_case.settings.templates.card_title", {
571
+ language: c.t(`module.dunning_case.settings.locale_name.${y.value}`),
572
+ level: _.value + 1
573
+ }));
574
+ return ee(() => t.reminderConfigs, E.reset, { immediate: !0 }), (e, t) => (D(), h(j(ne), {
575
+ title: j(c).t("module.dunning_case.settings.title"),
576
+ subtitle: j(c).t("module.dunning_case.settings.subtitle")
577
+ }, {
578
+ default: N(() => [b(j(re), null, {
579
+ default: N(() => [b(j(ie), {
580
+ form: j(x),
581
+ "prompt-on-unsaved-changes": !0
582
+ }, {
583
+ default: N(() => [v("div", tt, [
584
+ v("div", nt, [v("div", null, [v("h2", rt, A(j(c).t("module.dunning_case.settings.title")), 1), v("p", it, A(j(c).t("module.dunning_case.settings.subtitle")), 1)]), w.value ? (D(), h(j(te), {
585
+ key: 0,
586
+ "is-disabled": !j(x).isDirty.value || !j(x).isValid.value,
587
+ "is-loading": j(x).isSubmitting.value,
588
+ label: j(c).t("shared.save_changes"),
589
+ onClick: j(x).submit
590
+ }, null, 8, [
591
+ "is-disabled",
592
+ "is-loading",
593
+ "label",
594
+ "onClick"
595
+ ])) : g("", !0)]),
596
+ b(j(z), {
597
+ modelValue: p.value,
598
+ "onUpdate:modelValue": t[0] ||= (e) => p.value = e,
599
+ "aria-label": j(c).t("module.dunning_case.settings.navigation"),
600
+ class: "mt-xl",
601
+ variant: "button-border"
602
+ }, {
603
+ default: N(() => [b(j(V), null, {
604
+ default: N(() => [b(j(B), {
605
+ label: j(c).t("module.dunning_case.settings.ladder.tab"),
606
+ value: "ladder"
607
+ }, null, 8, ["label"]), b(j(B), {
608
+ label: j(c).t("module.dunning_case.settings.templates.tab"),
609
+ value: "templates"
610
+ }, null, 8, ["label"])]),
611
+ _: 1
612
+ })]),
613
+ _: 1
614
+ }, 8, ["modelValue", "aria-label"]),
615
+ p.value === "ladder" ? (D(), h(We, {
616
+ key: 0,
617
+ "can-update": w.value,
618
+ fields: j(C),
619
+ ladder: j(E),
620
+ "schedule-items": T.value
621
+ }, null, 8, [
622
+ "can-update",
623
+ "fields",
624
+ "ladder",
625
+ "schedule-items"
626
+ ])) : (D(), h(Qe, {
627
+ key: 1,
628
+ "active-level": k.value,
629
+ "onUpdate:activeLevel": t[1] ||= (e) => k.value = e,
630
+ "active-locale": M.value,
631
+ "onUpdate:activeLocale": t[2] ||= (e) => M.value = e,
632
+ "body-field": F.value?.body,
633
+ "can-update": w.value,
634
+ "card-title": R.value,
635
+ "level-items": I.value,
636
+ "locale-items": L.value,
637
+ "subject-field": F.value?.subject
638
+ }, null, 8, [
639
+ "active-level",
640
+ "active-locale",
641
+ "body-field",
642
+ "can-update",
643
+ "card-title",
644
+ "level-items",
645
+ "locale-items",
646
+ "subject-field"
647
+ ]))
648
+ ])]),
649
+ _: 1
650
+ }, 8, ["form"])]),
651
+ _: 1
652
+ })]),
653
+ _: 1
654
+ }, 8, ["title", "subtitle"]));
655
+ }
656
+ }), ot = /*@__PURE__*/ x({
657
+ __name: "ReminderSettingsViewDataProvider",
658
+ setup(e) {
659
+ let t = c();
660
+ return (e, n) => (D(), h(l, { queries: { reminderConfigs: j(t) } }, {
661
+ default: N(({ data: e }) => [b(at, { "reminder-configs": e.reminderConfigs }, null, 8, ["reminder-configs"])]),
662
+ loading: N(() => [b(j(L), { breadcrumbs: [] })]),
663
+ _: 1
664
+ }, 8, ["queries"]));
665
+ }
666
+ }), st = /* @__PURE__ */ e({ default: () => $ }), $ = ot;
667
+ //#endregion
668
+ export { st as n, $ as t };
@@ -1,5 +1,5 @@
1
1
  import "./api.util-Dm_TQedZ.js";
2
- import { l as e, s as t } from "./documentTitle.composable-D7XA-8iJ.js";
2
+ import { l as e, s as t } from "./documentTitle.composable-CeaFddr1.js";
3
3
  import { n, t as r } from "./plainDate.transformer-BxvJpJOv.js";
4
4
  import { n as i, t as a } from "./address.transformer-B8C0pwT1.js";
5
5
  import { Temporal as o } from "temporal-polyfill";
@@ -6,7 +6,6 @@ export interface InvoicingConfig {
6
6
  isLineDiscountEnabled?: boolean;
7
7
  }
8
8
  export interface InvoicingInitProps {
9
- hasPermission?: (permission: string) => boolean;
10
9
  apiInvoicingBaseUrl: string;
11
10
  config?: InvoicingConfig;
12
11
  environment?: string;
@@ -16,7 +15,6 @@ export interface InvoicingInitProps {
16
15
  }
17
16
  export declare function initInvoicingConfig(props: InvoicingInitProps): Promise<void>;
18
17
  export declare function useInvoicingConfig(): {
19
- hasPermission: (permission: string) => boolean;
20
18
  isDeliveryDateVisible: import('vue').ComputedRef<boolean>;
21
19
  isGlobalDiscountEnabled: import('vue').ComputedRef<boolean>;
22
20
  isInitialized: import('vue').ComputedRef<boolean>;