@wisemen/wise-invoicing-web 0.20.0 → 1.0.0
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/ApprovalReminderSettingsViewDataProvider-DyrHExKn.js +962 -0
- package/dist/{BillingDocumentDetailViewDataProvider-jpp-QwPi.js → BillingDocumentDetailViewDataProvider-kFzqhrxW.js} +1563 -1550
- package/dist/{BillingDocumentPdf-Zw3GXZVE.js → BillingDocumentPdf-Dp6HSypy.js} +5 -5
- package/dist/{DunningCaseSendDialog-CA-nzjzV.js → DunningCaseSendDialog-1S6OD9wd.js} +36 -36
- package/dist/{InvoiceApprovalOutOfSyncIndicator-Dnw03isr.js → InvoiceApprovalOutOfSyncIndicator-DaM5hQVT.js} +16 -13
- package/dist/{InvoiceApprovalOverviewView-CoJXggOy.js → InvoiceApprovalOverviewView-DM_LiO19.js} +210 -210
- package/dist/{InvoiceApprovalStatusBadge-BWx3Fhuy.js → InvoiceApprovalStatusBadge-mbYHYU3x.js} +6 -6
- package/dist/{InvoicePdfView-Bv5aMLh6.js → InvoicePdfView-YbDJpTIA.js} +2 -2
- package/dist/{InvoicePublicProFormaPdfViewDataProvider-Ca7-AmAH.js → InvoicePublicProFormaPdfViewDataProvider-BgAhcvB6.js} +3 -3
- package/dist/InvoiceRejectDialogDataProvider-yegAlkDB.js +410 -0
- package/dist/{InvoiceStatusBadge-uXAh9ypU.js → InvoiceStatusBadge-Bo5PDjEy.js} +3 -3
- package/dist/{InvoicingFileUploadProvider-C3cyIUhL.js → InvoicingFileUploadProvider-DVh22OUB.js} +2 -2
- package/dist/{IssuerSettingsViewDataProvider-C-CRF9sK.js → IssuerSettingsViewDataProvider-BgSFemZr.js} +4 -4
- package/dist/{PeppolSettingsViewDataProvider-COQEInsh.js → PeppolSettingsViewDataProvider-_Bx0xx9e.js} +3 -3
- package/dist/ReminderTemplatesPanel-DxmfU2xK.js +103 -0
- package/dist/{api.util-DSerLsgA.js → api.util-lGbimoKL.js} +575 -446
- package/dist/{billingDocumentDetail.transformer-ClWwi8h4.js → billingDocumentDetail.transformer-C5-zjIhL.js} +13 -4
- package/dist/client/index.d.ts +2 -2
- package/dist/client/sdk.gen.d.ts +8 -3
- package/dist/client/types.gen.d.ts +316 -49
- package/dist/client/zod.gen.d.ts +1465 -71
- package/dist/{creditNoteDetail.query-q1b6nzu0.js → creditNoteDetail.query-CqJeWeRV.js} +23 -23
- package/dist/{customFieldDefinitionIndex.query-DQxer9Je.js → customFieldDefinitionIndex.query-Co7hoMow.js} +65 -56
- package/dist/{deliveryReason.util-BlxvUaz0.js → deliveryReason.util-ny1rA7Sm.js} +6 -6
- package/dist/{dist-47-1LAzT.js → dist-CrNFh-CR.js} +59 -59
- package/dist/{dist-B33lNwLw.js → dist-DmVrfBOT.js} +149 -79
- package/dist/{documentTitle.composable-D5uPh3uG.js → documentTitle.composable-aTEYXgaZ.js} +1 -1
- package/dist/html.util-vG4ow95N.js +52 -0
- package/dist/{i18n.lib-DB15VQsH.js → i18n.lib-B1H9r0km.js} +196 -26
- package/dist/index.d.ts +182 -12
- package/dist/index.js +1638 -1479
- package/dist/{invoice.service-BKgP2p8z.js → invoice.service-D9ubyWPb.js} +245 -203
- package/dist/invoiceApproval.service-BtDIOHIo.js +182 -0
- package/dist/{invoiceApprovalStatus.util-D17DWEh1.js → invoiceApprovalStatus.util-Bqq_bILG.js} +2 -2
- package/dist/{invoiceCustomer.service-CLYUR6vc.js → invoiceCustomer.service-D0AtVrLg.js} +6 -6
- package/dist/{invoiceDetail.query-CzyZqT82.js → invoiceDetail.query-BNL6MkvC.js} +1 -1
- package/dist/{invoicingConfig.composable-CzgTMtog.js → invoicingConfig.composable-DEF0lzNP.js} +2 -2
- package/dist/{issuerSettings.query-D8T34N7f.js → issuerSettings.query-Cu-I6OAg.js} +5 -5
- package/dist/libs/i18n.lib.d.ts +182 -12
- package/dist/locales/en-US.json.d.ts +98 -13
- package/dist/locales/nl-BE.json.d.ts +98 -13
- package/dist/models/billing-document/billingDocumentDetail.model.d.ts +2 -2
- package/dist/models/file-reference/fileReference.transformer.d.ts +3 -0
- package/dist/modules/invoice/api/mutations/invoiceApprovalUpdate.mutation.d.ts +16 -0
- package/dist/modules/invoice/api/mutations/invoiceApproveApproval.mutation.d.ts +2 -2
- package/dist/modules/invoice/api/mutations/invoiceRejectApproval.mutation.d.ts +2 -2
- package/dist/modules/invoice/api/mutations/invoiceSetApprovalMode.mutation.d.ts +7 -0
- package/dist/modules/invoice/api/services/invoice.service.d.ts +4 -2
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalMode.model.d.ts +3 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalMode.transformer.d.ts +6 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalModeForm.model.d.ts +7 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalNote.model.d.ts +2 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalUpdate.transformer.d.ts +7 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprovalUpdateForm.model.d.ts +13 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApprove.transformer.d.ts +3 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceApproveForm.model.d.ts +2 -2
- package/dist/modules/invoice/models/invoice/approval/invoiceReject.transformer.d.ts +3 -0
- package/dist/modules/invoice/models/invoice/approval/invoiceRejectForm.model.d.ts +2 -2
- package/dist/modules/invoice/models/invoice/detail/invoiceDetail.model.d.ts +5 -0
- package/dist/modules/invoice/models/invoice/invoiceStatus.util.d.ts +1 -0
- package/dist/modules/invoice/use-cases/detail/components/InvoiceApprovalBanner.vue.d.ts +13 -0
- package/dist/modules/invoice/use-cases/detail/composables/invoiceDetailHeaderActions.composable.d.ts +2 -0
- package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApprovalModeDialog.vue.d.ts +13 -0
- package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApprovalUpdateDialog.vue.d.ts +16 -0
- package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceApproveDialog.vue.d.ts +4 -0
- package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceRejectDialog.vue.d.ts +4 -0
- package/dist/modules/invoice/use-cases/detail/dialogs/InvoiceRejectDialogDataProvider.vue.d.ts +13 -0
- package/dist/modules/invoice-approval/api/mutations/approvalFollowUpPauseCreate.mutation.d.ts +7 -0
- package/dist/modules/invoice-approval/api/mutations/approvalFollowUpPauseDelete.mutation.d.ts +4 -0
- package/dist/modules/invoice-approval/api/mutations/approvalFollowUpPauseUpdate.mutation.d.ts +10 -0
- package/dist/modules/invoice-approval/api/mutations/approvalMailTemplateUpdate.mutation.d.ts +14 -0
- package/dist/modules/invoice-approval/api/mutations/approvalReminderConfigUpdate.mutation.d.ts +14 -1
- package/dist/modules/invoice-approval/api/queries/approvalFollowUpPauseIndex.query.d.ts +2 -0
- package/dist/modules/invoice-approval/api/queries/approvalReminderConfig.query.d.ts +1 -1
- package/dist/modules/invoice-approval/api/query-keys/invoiceApproval.queryKeys.d.ts +9 -2
- package/dist/modules/invoice-approval/api/services/invoiceApproval.service.d.ts +10 -2
- package/dist/modules/invoice-approval/models/approvalFollowUpPause.model.d.ts +11 -0
- package/dist/modules/invoice-approval/models/approvalFollowUpPause.transformer.d.ts +11 -0
- package/dist/modules/invoice-approval/models/approvalFollowUpPauseForm.model.d.ts +11 -0
- package/dist/modules/invoice-approval/models/approvalMailTemplate.transformer.d.ts +6 -0
- package/dist/modules/invoice-approval/models/approvalMailTemplate.transformer.spec.d.ts +1 -0
- package/dist/modules/invoice-approval/models/approvalMailTemplateForm.model.d.ts +18 -0
- package/dist/modules/invoice-approval/models/approvalReminderConfigForm.model.d.ts +15 -2
- package/dist/modules/invoice-approval/models/approvalSettingsForm.model.d.ts +39 -0
- package/dist/modules/invoice-approval/models/approvalSettingsForm.spec.d.ts +1 -0
- package/dist/modules/invoice-approval/use-cases/settings/components/ApprovalFollowUpPauseList.vue.d.ts +20 -0
- package/dist/modules/invoice-approval/use-cases/settings/components/ApprovalFollowUpPauseRow.vue.d.ts +20 -0
- package/dist/modules/invoice-approval/use-cases/settings/components/ApprovalFollowUpPausesPanel.vue.d.ts +7 -0
- package/dist/modules/invoice-approval/use-cases/settings/composables/approvalFollowUpPauseDialogs.composable.d.ts +8 -0
- package/dist/modules/invoice-approval/use-cases/settings/dialogs/ApprovalFollowUpPauseDeleteDialog.vue.d.ts +11 -0
- package/dist/modules/invoice-approval/use-cases/settings/dialogs/ApprovalFollowUpPauseFormDialog.vue.d.ts +14 -0
- package/dist/modules/invoice-approval/use-cases/settings/views/ApprovalReminderSettingsView.vue.d.ts +2 -1
- package/dist/modules/invoice-approval/utils/approvalFollowUpPausePeriod.util.d.ts +41 -0
- package/dist/modules/invoice-approval/utils/approvalFollowUpPausePeriod.util.spec.d.ts +1 -0
- package/dist/{reminderConfig.query-CFmCWWlO.js → reminderConfig.query-DHMHVOeX.js} +62 -109
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/ApprovalReminderSettingsViewDataProvider-DMWLX53_.js +0 -147
- package/dist/InvoiceRejectDialog-Ca-4nz4U.js +0 -361
- package/dist/invoiceApproval.service-oT1fvhsW.js +0 -73
- package/dist/modules/invoice/api/mutations/invoiceMarkAsPriorApprovalRequired.mutation.d.ts +0 -4
- package/dist/modules/invoice/api/mutations/invoiceUnmarkAsPriorApprovalRequired.mutation.d.ts +0 -4
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
import { t as e } from "./i18n.lib-B1H9r0km.js";
|
|
2
|
+
import "./api.util-lGbimoKL.js";
|
|
3
|
+
import { c as t, t as n } from "./documentTitle.composable-aTEYXgaZ.js";
|
|
4
|
+
import { M as r, N as i, W as a, ct as o, f as s, ft as c, gt as l, n as u, st as d, ut as f } from "./dist-DmVrfBOT.js";
|
|
5
|
+
import { n as p } from "./dist-CyUNvdkD.js";
|
|
6
|
+
import { t as m } from "./formango.util-D5c2ql--.js";
|
|
7
|
+
import { t as h } from "./DataProvider-BtnD-BzI.js";
|
|
8
|
+
import { t as g } from "./ReminderTemplatesPanel-DxmfU2xK.js";
|
|
9
|
+
import { a as _, i as v, n as y, o as b, r as x, t as S } from "./invoiceApproval.service-BtDIOHIo.js";
|
|
10
|
+
import { z as C } from "zod";
|
|
11
|
+
import { useI18n as w } from "vue-i18n";
|
|
12
|
+
import { Fragment as T, computed as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createVNode as j, defineComponent as M, mergeProps as N, openBlock as P, ref as F, renderList as I, toDisplayString as ee, unref as L, withCtx as R } from "vue";
|
|
13
|
+
import { ApiErrorUtil as te, useMutation as z, useQuery as ne } from "@wisemen/vue-core-api-utils";
|
|
14
|
+
import { Temporal as B } from "temporal-polyfill";
|
|
15
|
+
import { UIBadge as V, UIButton as H, UIDashboardPage as re, UIDashboardPageContent as ie, UIDashboardPageLoadingState as U, UIDateField as W, UIDateRangeField as G, UIDialogBody as ae, UIDialogFooter as K, UIDialogFooterCancel as q, UIDialogFooterSubmit as oe, UIDialogHeader as J, UIEmptyState as se, UIForm as ce, UIFormDialog as le, UIFormFieldGroup as ue, UIFormSubmitButton as de, UIIconButton as Y, UINumberField as fe, UISelect as pe, UITabs as me, UITabsItem as he, UITabsList as ge, UIText as X, UITextField as _e, createSelectOptions as ve, useOverlay as ye, useToast as Z } from "@wisemen/vue-core-design-system";
|
|
16
|
+
import { useForm as be } from "formango";
|
|
17
|
+
//#region src/modules/invoice-approval/api/queries/approvalReminderConfig.query.ts
|
|
18
|
+
function xe() {
|
|
19
|
+
return ne("approvalReminderConfig", {
|
|
20
|
+
params: {},
|
|
21
|
+
queryFn: () => S.getReminderConfigs()
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/modules/invoice-approval/api/mutations/approvalMailTemplateUpdate.mutation.ts
|
|
26
|
+
function Se() {
|
|
27
|
+
return z({
|
|
28
|
+
queryFn: (e) => S.updateMailTemplate(e.body),
|
|
29
|
+
queryKeysToInvalidate: { approvalReminderConfig: {} }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/modules/invoice-approval/api/mutations/approvalReminderConfigUpdate.mutation.ts
|
|
34
|
+
function Ce() {
|
|
35
|
+
return z({
|
|
36
|
+
queryFn: (e) => S.updateReminderConfigs(e.body),
|
|
37
|
+
queryKeysToInvalidate: { approvalReminderConfig: {} }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/modules/invoice-approval/models/approvalReminderConfigForm.model.ts
|
|
42
|
+
var we = 2, Te = C.object({
|
|
43
|
+
offsetDays: C.number().int().min(1).max(365),
|
|
44
|
+
schedule: C.enum(t),
|
|
45
|
+
sequence: C.number().int().min(1).max(we),
|
|
46
|
+
template: _
|
|
47
|
+
}), Ee = C.object({ reminders: C.array(Te).length(we) }).superRefine((n, r) => {
|
|
48
|
+
n.reminders[0]?.schedule !== t.AFTER_APPROVAL_REQUEST && r.addIssue({
|
|
49
|
+
code: "custom",
|
|
50
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.validation.level_one_after_request"),
|
|
51
|
+
path: [
|
|
52
|
+
"reminders",
|
|
53
|
+
0,
|
|
54
|
+
"schedule"
|
|
55
|
+
]
|
|
56
|
+
}), n.reminders[1]?.schedule !== t.AFTER_LAST_REMINDER && r.addIssue({
|
|
57
|
+
code: "custom",
|
|
58
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.validation.level_two_after_reminder"),
|
|
59
|
+
path: [
|
|
60
|
+
"reminders",
|
|
61
|
+
1,
|
|
62
|
+
"schedule"
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
let i = 0;
|
|
66
|
+
for (let [a, o] of n.reminders.entries()) {
|
|
67
|
+
let n = o.schedule === t.AFTER_APPROVAL_REQUEST ? o.offsetDays : i + o.offsetDays;
|
|
68
|
+
a > 0 && n <= i && r.addIssue({
|
|
69
|
+
code: "custom",
|
|
70
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.validation.chronological"),
|
|
71
|
+
path: [
|
|
72
|
+
"reminders",
|
|
73
|
+
a,
|
|
74
|
+
"offsetDays"
|
|
75
|
+
]
|
|
76
|
+
}), i = n;
|
|
77
|
+
}
|
|
78
|
+
}), De = C.object({
|
|
79
|
+
mailTemplate: _,
|
|
80
|
+
reminderConfig: Ee
|
|
81
|
+
});
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/modules/invoice-approval/api/mutations/approvalFollowUpPauseUpdate.mutation.ts
|
|
84
|
+
function Oe() {
|
|
85
|
+
return z({
|
|
86
|
+
queryFn: (e) => S.updateFollowUpPause(e.params.pauseUuid, e.body),
|
|
87
|
+
queryKeysToInvalidate: {
|
|
88
|
+
approvalFollowUpPauseIndex: {},
|
|
89
|
+
invoiceApprovalIndex: {}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/modules/invoice-approval/api/queries/approvalFollowUpPauseIndex.query.ts
|
|
95
|
+
function Q(e) {
|
|
96
|
+
return ne("approvalFollowUpPauseIndex", {
|
|
97
|
+
params: { isPast: e },
|
|
98
|
+
queryFn: () => S.getFollowUpPauses(e)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/modules/invoice-approval/utils/approvalFollowUpPausePeriod.util.ts
|
|
103
|
+
var ke = {
|
|
104
|
+
day: "numeric",
|
|
105
|
+
month: "short",
|
|
106
|
+
weekday: "short"
|
|
107
|
+
}, Ae = {
|
|
108
|
+
...ke,
|
|
109
|
+
year: "numeric"
|
|
110
|
+
}, $ = class {
|
|
111
|
+
static countDays(e, t) {
|
|
112
|
+
return e.until(t, { largestUnit: "days" }).days + 1;
|
|
113
|
+
}
|
|
114
|
+
static countDaysLeft(e, t) {
|
|
115
|
+
return this.countDays(t, e);
|
|
116
|
+
}
|
|
117
|
+
static countDaysUntilStart(e, t) {
|
|
118
|
+
return t.until(e, { largestUnit: "days" }).days;
|
|
119
|
+
}
|
|
120
|
+
static countYearsToNextOccurrence(e, t) {
|
|
121
|
+
let n = Math.max(1, t.year - e.year);
|
|
122
|
+
return B.PlainDate.compare(e.add({ years: n }), t) < 0 ? n + 1 : n;
|
|
123
|
+
}
|
|
124
|
+
static findOverlap(e, t, n) {
|
|
125
|
+
return e.find((e) => B.PlainDate.compare(e.startDate, n) <= 0 && B.PlainDate.compare(t, e.endDate) <= 0) ?? null;
|
|
126
|
+
}
|
|
127
|
+
static findUpcomingOccurrence(e, t, n) {
|
|
128
|
+
return e.map((e) => ({
|
|
129
|
+
startDate: e.startDate.add({ years: this.countYearsToNextOccurrence(e.endDate, t) }),
|
|
130
|
+
pause: e
|
|
131
|
+
})).filter((e) => this.countDaysUntilStart(e.startDate, t) <= n).toSorted((e, t) => B.PlainDate.compare(e.startDate, t.startDate)).at(0) ?? null;
|
|
132
|
+
}
|
|
133
|
+
static format(e, t, n, r = !1) {
|
|
134
|
+
let i = e.year === t.year, a = r && i ? ke : Ae, o = t.toLocaleString(n, a);
|
|
135
|
+
return B.PlainDate.compare(e, t) === 0 ? o : `${e.toLocaleString(n, i ? ke : Ae)} – ${o}`;
|
|
136
|
+
}
|
|
137
|
+
static formatStartsIn(e, t, n) {
|
|
138
|
+
let r = new Intl.RelativeTimeFormat(n, { numeric: "auto" }), i = this.countDaysUntilStart(e, t);
|
|
139
|
+
if (i <= 30) return r.format(i, "day");
|
|
140
|
+
if (i < 60) return r.format(Math.round(i / 7), "week");
|
|
141
|
+
let a = t.until(e, {
|
|
142
|
+
largestUnit: "months",
|
|
143
|
+
roundingMode: "halfExpand",
|
|
144
|
+
smallestUnit: "months"
|
|
145
|
+
}).months;
|
|
146
|
+
return a < 12 ? r.format(a, "month") : r.format(Math.round(a / 12), "year");
|
|
147
|
+
}
|
|
148
|
+
}, je = { class: "flex items-center justify-between gap-lg px-xl py-lg" }, Me = {
|
|
149
|
+
key: 0,
|
|
150
|
+
class: "flex min-w-0 flex-1 flex-col gap-xxs"
|
|
151
|
+
}, Ne = { class: "flex shrink-0 items-center gap-xs" }, Pe = /* @__PURE__ */ M({
|
|
152
|
+
__name: "ApprovalFollowUpPauseRow",
|
|
153
|
+
props: {
|
|
154
|
+
isPast: { type: Boolean },
|
|
155
|
+
isYearHidden: { type: Boolean },
|
|
156
|
+
pause: {}
|
|
157
|
+
},
|
|
158
|
+
emits: [
|
|
159
|
+
"copy",
|
|
160
|
+
"delete",
|
|
161
|
+
"end",
|
|
162
|
+
"update"
|
|
163
|
+
],
|
|
164
|
+
setup(e, { emit: t }) {
|
|
165
|
+
let n = e, o = t, s = w(), c = B.Now.plainDateISO(), l = E(() => {
|
|
166
|
+
let e = $.format(n.pause.startDate, n.pause.endDate, s.locale.value, n.isYearHidden), t = $.countDays(n.pause.startDate, n.pause.endDate);
|
|
167
|
+
return `${e} · ${s.t("wise_invoicing.invoice_approval.settings.pauses.days", { count: t }, t)}`;
|
|
168
|
+
}), u = E(() => !n.isPast && B.PlainDate.compare(n.pause.startDate, c) <= 0), f = E(() => u.value && B.PlainDate.compare(n.pause.endDate, c) > 0), p = E(() => {
|
|
169
|
+
if (n.isPast) return null;
|
|
170
|
+
if (u.value) {
|
|
171
|
+
let e = $.countDaysLeft(n.pause.endDate, c);
|
|
172
|
+
return s.t("wise_invoicing.invoice_approval.settings.pauses.days_left", { count: e }, e);
|
|
173
|
+
}
|
|
174
|
+
return s.t("wise_invoicing.invoice_approval.settings.pauses.starts_in", { relative: $.formatStartsIn(n.pause.startDate, c, s.locale.value) });
|
|
175
|
+
}), m = E(() => n.pause.startDate.add({ years: $.countYearsToNextOccurrence(n.pause.endDate, c) }).year);
|
|
176
|
+
return (e, t) => (P(), k("li", je, [n.isPast ? (P(), k("div", Me, [j(L(X), {
|
|
177
|
+
text: n.pause.name,
|
|
178
|
+
class: "text-sm font-medium text-primary"
|
|
179
|
+
}, null, 8, ["text"]), j(L(X), {
|
|
180
|
+
text: l.value,
|
|
181
|
+
class: "text-sm text-tertiary"
|
|
182
|
+
}, null, 8, ["text"])])) : (P(), k("button", {
|
|
183
|
+
key: 1,
|
|
184
|
+
class: "flex min-w-0 flex-1 cursor-pointer flex-col gap-xxs text-left",
|
|
185
|
+
type: "button",
|
|
186
|
+
onClick: t[0] ||= (e) => o("update")
|
|
187
|
+
}, [j(L(X), {
|
|
188
|
+
text: n.pause.name,
|
|
189
|
+
class: "text-sm font-medium text-primary"
|
|
190
|
+
}, null, 8, ["text"]), j(L(X), {
|
|
191
|
+
text: l.value,
|
|
192
|
+
class: "text-sm text-tertiary"
|
|
193
|
+
}, null, 8, ["text"])])), A("div", Ne, [p.value === null ? O("", !0) : (P(), D(L(V), {
|
|
194
|
+
key: 0,
|
|
195
|
+
color: u.value ? "success" : "gray",
|
|
196
|
+
label: p.value,
|
|
197
|
+
size: "sm"
|
|
198
|
+
}, null, 8, ["color", "label"])), n.isPast ? (P(), D(L(Y), {
|
|
199
|
+
key: 1,
|
|
200
|
+
icon: L(i),
|
|
201
|
+
label: L(s).t("wise_invoicing.invoice_approval.settings.pauses.copy_to_year", {
|
|
202
|
+
name: n.pause.name,
|
|
203
|
+
year: m.value
|
|
204
|
+
}),
|
|
205
|
+
variant: "tertiary",
|
|
206
|
+
onClick: t[1] ||= (e) => o("copy")
|
|
207
|
+
}, null, 8, ["icon", "label"])) : (P(), k(T, { key: 2 }, [j(L(Y), {
|
|
208
|
+
icon: L(r),
|
|
209
|
+
label: L(s).t("wise_invoicing.invoice_approval.settings.pauses.edit", { name: n.pause.name }),
|
|
210
|
+
variant: "tertiary",
|
|
211
|
+
onClick: t[2] ||= (e) => o("update")
|
|
212
|
+
}, null, 8, ["icon", "label"]), f.value ? (P(), D(L(Y), {
|
|
213
|
+
key: 0,
|
|
214
|
+
icon: L(d),
|
|
215
|
+
label: L(s).t("wise_invoicing.invoice_approval.settings.pauses.end_today", { name: n.pause.name }),
|
|
216
|
+
variant: "tertiary",
|
|
217
|
+
onClick: t[3] ||= (e) => o("end")
|
|
218
|
+
}, null, 8, ["icon", "label"])) : u.value ? O("", !0) : (P(), D(L(Y), {
|
|
219
|
+
key: 1,
|
|
220
|
+
icon: L(a),
|
|
221
|
+
label: L(s).t("wise_invoicing.invoice_approval.settings.pauses.delete_label", { name: n.pause.name }),
|
|
222
|
+
variant: "tertiary",
|
|
223
|
+
onClick: t[4] ||= (e) => o("delete")
|
|
224
|
+
}, null, 8, ["icon", "label"]))], 64))])]));
|
|
225
|
+
}
|
|
226
|
+
}), Fe = {
|
|
227
|
+
key: 0,
|
|
228
|
+
class: "flex flex-col gap-lg"
|
|
229
|
+
}, Ie = { class: "flex flex-col divide-y divide-secondary rounded-md border border-secondary" }, Le = {
|
|
230
|
+
key: 1,
|
|
231
|
+
class: "flex flex-col divide-y divide-secondary rounded-md border border-secondary"
|
|
232
|
+
}, Re = /* @__PURE__ */ M({
|
|
233
|
+
__name: "ApprovalFollowUpPauseList",
|
|
234
|
+
props: {
|
|
235
|
+
isGroupedByYear: { type: Boolean },
|
|
236
|
+
isPast: { type: Boolean },
|
|
237
|
+
pauses: {}
|
|
238
|
+
},
|
|
239
|
+
emits: [
|
|
240
|
+
"copy",
|
|
241
|
+
"delete",
|
|
242
|
+
"end",
|
|
243
|
+
"update"
|
|
244
|
+
],
|
|
245
|
+
setup(e, { emit: t }) {
|
|
246
|
+
let n = e, r = t, i = E(() => {
|
|
247
|
+
let e = [];
|
|
248
|
+
for (let t of n.pauses) {
|
|
249
|
+
let n = e.find((e) => e.year === t.startDate.year);
|
|
250
|
+
n === void 0 ? e.push({
|
|
251
|
+
pauses: [t],
|
|
252
|
+
year: t.startDate.year
|
|
253
|
+
}) : n.pauses.push(t);
|
|
254
|
+
}
|
|
255
|
+
return e;
|
|
256
|
+
});
|
|
257
|
+
return (e, t) => n.isGroupedByYear ? (P(), k("div", Fe, [(P(!0), k(T, null, I(i.value, (e) => (P(), k("div", {
|
|
258
|
+
key: e.year,
|
|
259
|
+
class: "flex flex-col gap-sm"
|
|
260
|
+
}, [j(L(X), {
|
|
261
|
+
text: String(e.year),
|
|
262
|
+
class: "text-xs font-medium text-tertiary"
|
|
263
|
+
}, null, 8, ["text"]), A("ul", Ie, [(P(!0), k(T, null, I(e.pauses, (e) => (P(), D(Pe, {
|
|
264
|
+
key: e.uuid,
|
|
265
|
+
"is-past": n.isPast,
|
|
266
|
+
"is-year-hidden": !0,
|
|
267
|
+
pause: e,
|
|
268
|
+
onCopy: (t) => r("copy", e),
|
|
269
|
+
onDelete: (t) => r("delete", e),
|
|
270
|
+
onEnd: (t) => r("end", e),
|
|
271
|
+
onUpdate: (t) => r("update", e)
|
|
272
|
+
}, null, 8, [
|
|
273
|
+
"is-past",
|
|
274
|
+
"pause",
|
|
275
|
+
"onCopy",
|
|
276
|
+
"onDelete",
|
|
277
|
+
"onEnd",
|
|
278
|
+
"onUpdate"
|
|
279
|
+
]))), 128))])]))), 128))])) : (P(), k("ul", Le, [(P(!0), k(T, null, I(n.pauses, (e) => (P(), D(Pe, {
|
|
280
|
+
key: e.uuid,
|
|
281
|
+
"is-past": n.isPast,
|
|
282
|
+
"is-year-hidden": !1,
|
|
283
|
+
pause: e,
|
|
284
|
+
onCopy: (t) => r("copy", e),
|
|
285
|
+
onDelete: (t) => r("delete", e),
|
|
286
|
+
onEnd: (t) => r("end", e),
|
|
287
|
+
onUpdate: (t) => r("update", e)
|
|
288
|
+
}, null, 8, [
|
|
289
|
+
"is-past",
|
|
290
|
+
"pause",
|
|
291
|
+
"onCopy",
|
|
292
|
+
"onDelete",
|
|
293
|
+
"onEnd",
|
|
294
|
+
"onUpdate"
|
|
295
|
+
]))), 128))]));
|
|
296
|
+
}
|
|
297
|
+
}), ze = { class: "flex flex-col gap-xl" }, Be = { class: "flex flex-col" }, Ve = ["aria-label"], He = ["aria-label"], Ue = { key: 0 }, We = ["aria-label"], Ge = 60, Ke = 3, qe = /* @__PURE__ */ M({
|
|
298
|
+
__name: "ApprovalFollowUpPausesPanel",
|
|
299
|
+
props: { dialogs: {} },
|
|
300
|
+
setup(e) {
|
|
301
|
+
let t = e, n = w(), r = Z(), i = Oe(), a = B.Now.plainDateISO(), s = Q(!1), d = E(() => s.result.value.match({
|
|
302
|
+
err: () => [],
|
|
303
|
+
loading: () => [],
|
|
304
|
+
ok: (e) => e
|
|
305
|
+
})), f = E(() => d.value.filter((e) => B.PlainDate.compare(e.startDate, a) <= 0)), p = E(() => d.value.filter((e) => B.PlainDate.compare(e.startDate, a) > 0)), m = F(!1), h = E(() => p.value.length > Ke), g = E(() => m.value ? p.value : p.value.slice(0, Ke)), _ = Q(!0), v = E(() => _.result.value.match({
|
|
306
|
+
err: () => [],
|
|
307
|
+
loading: () => [],
|
|
308
|
+
ok: (e) => e
|
|
309
|
+
})), y = F(!1), b = E(() => $.findUpcomingOccurrence(v.value, a, Ge)), x = E(() => {
|
|
310
|
+
if (b.value === null) return n.t("wise_invoicing.invoice_approval.settings.pauses.empty_description");
|
|
311
|
+
let { startDate: e, pause: t } = b.value;
|
|
312
|
+
return n.t("wise_invoicing.invoice_approval.settings.pauses.suggestion", {
|
|
313
|
+
name: t.name,
|
|
314
|
+
period: $.format(t.startDate, t.endDate, n.locale.value),
|
|
315
|
+
year: e.year
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
async function S() {
|
|
319
|
+
b.value !== null && await t.dialogs.openCopy(b.value.pause);
|
|
320
|
+
}
|
|
321
|
+
async function C(e) {
|
|
322
|
+
let t = await i.execute({
|
|
323
|
+
body: {
|
|
324
|
+
name: e.name,
|
|
325
|
+
period: {
|
|
326
|
+
from: e.startDate,
|
|
327
|
+
until: a
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
params: { pauseUuid: e.uuid }
|
|
331
|
+
});
|
|
332
|
+
t.isErr() ? r.apiError(t.error) : r.show({ message: n.t("wise_invoicing.invoice_approval.settings.pauses.end_success", { name: e.name }) });
|
|
333
|
+
}
|
|
334
|
+
return (e, r) => (P(), k("div", ze, [
|
|
335
|
+
A("div", Be, [j(L(X), {
|
|
336
|
+
text: L(n).t("wise_invoicing.invoice_approval.settings.pauses.description"),
|
|
337
|
+
truncate: !1,
|
|
338
|
+
class: "text-sm text-tertiary"
|
|
339
|
+
}, null, 8, ["text"]), j(L(X), {
|
|
340
|
+
text: L(n).t("wise_invoicing.invoice_approval.settings.pauses.scope_note"),
|
|
341
|
+
truncate: !1,
|
|
342
|
+
class: "text-sm text-tertiary"
|
|
343
|
+
}, null, 8, ["text"])]),
|
|
344
|
+
L(s).isError.value ? (P(), D(L(se), {
|
|
345
|
+
key: 0,
|
|
346
|
+
title: L(n).t("wise_invoicing.invoice_approval.settings.pauses.load_error_title"),
|
|
347
|
+
description: L(n).t("wise_invoicing.invoice_approval.settings.pauses.load_error_description"),
|
|
348
|
+
icon: L(l),
|
|
349
|
+
"primary-action": {
|
|
350
|
+
label: L(n).t("wise_invoicing.invoice_approval.settings.pauses.retry"),
|
|
351
|
+
onClick: L(s).refetch,
|
|
352
|
+
type: "button"
|
|
353
|
+
}
|
|
354
|
+
}, null, 8, [
|
|
355
|
+
"title",
|
|
356
|
+
"description",
|
|
357
|
+
"icon",
|
|
358
|
+
"primary-action"
|
|
359
|
+
])) : d.value.length === 0 && !L(s).isLoading.value ? (P(), D(L(se), {
|
|
360
|
+
key: 1,
|
|
361
|
+
title: L(n).t("wise_invoicing.invoice_approval.settings.pauses.empty_title"),
|
|
362
|
+
description: x.value,
|
|
363
|
+
icon: L(c),
|
|
364
|
+
"primary-action": b.value === null ? null : {
|
|
365
|
+
label: L(n).t("wise_invoicing.invoice_approval.settings.pauses.suggestion_action", { year: b.value.startDate.year }),
|
|
366
|
+
onClick: S,
|
|
367
|
+
type: "button"
|
|
368
|
+
}
|
|
369
|
+
}, null, 8, [
|
|
370
|
+
"title",
|
|
371
|
+
"description",
|
|
372
|
+
"icon",
|
|
373
|
+
"primary-action"
|
|
374
|
+
])) : O("", !0),
|
|
375
|
+
f.value.length > 0 ? (P(), k("section", {
|
|
376
|
+
key: 2,
|
|
377
|
+
"aria-label": L(n).t("wise_invoicing.invoice_approval.settings.pauses.active"),
|
|
378
|
+
class: "flex flex-col gap-md"
|
|
379
|
+
}, [j(L(X), {
|
|
380
|
+
text: L(n).t("wise_invoicing.invoice_approval.settings.pauses.active"),
|
|
381
|
+
class: "text-sm font-medium text-primary"
|
|
382
|
+
}, null, 8, ["text"]), j(Re, {
|
|
383
|
+
"is-grouped-by-year": !1,
|
|
384
|
+
"is-past": !1,
|
|
385
|
+
pauses: f.value,
|
|
386
|
+
onEnd: C,
|
|
387
|
+
onUpdate: t.dialogs.openUpdate
|
|
388
|
+
}, null, 8, ["pauses", "onUpdate"])], 8, Ve)) : O("", !0),
|
|
389
|
+
p.value.length > 0 ? (P(), k("section", {
|
|
390
|
+
key: 3,
|
|
391
|
+
"aria-label": L(n).t("wise_invoicing.invoice_approval.settings.pauses.planned"),
|
|
392
|
+
class: "flex flex-col gap-md"
|
|
393
|
+
}, [
|
|
394
|
+
j(L(X), {
|
|
395
|
+
text: L(n).t("wise_invoicing.invoice_approval.settings.pauses.planned_count", { count: p.value.length }),
|
|
396
|
+
class: "text-sm font-medium text-primary"
|
|
397
|
+
}, null, 8, ["text"]),
|
|
398
|
+
j(Re, {
|
|
399
|
+
"is-grouped-by-year": m.value,
|
|
400
|
+
"is-past": !1,
|
|
401
|
+
pauses: g.value,
|
|
402
|
+
onDelete: t.dialogs.openDelete,
|
|
403
|
+
onUpdate: t.dialogs.openUpdate
|
|
404
|
+
}, null, 8, [
|
|
405
|
+
"is-grouped-by-year",
|
|
406
|
+
"pauses",
|
|
407
|
+
"onDelete",
|
|
408
|
+
"onUpdate"
|
|
409
|
+
]),
|
|
410
|
+
h.value ? (P(), k("div", Ue, [j(L(H), {
|
|
411
|
+
label: m.value ? L(n).t("wise_invoicing.invoice_approval.settings.pauses.show_less") : L(n).t("wise_invoicing.invoice_approval.settings.pauses.show_more_planned", { count: p.value.length - Ke }),
|
|
412
|
+
size: "sm",
|
|
413
|
+
variant: "tertiary",
|
|
414
|
+
onClick: r[0] ||= (e) => m.value = !m.value
|
|
415
|
+
}, null, 8, ["label"])])) : O("", !0)
|
|
416
|
+
], 8, He)) : O("", !0),
|
|
417
|
+
v.value.length > 0 ? (P(), k("section", {
|
|
418
|
+
key: 4,
|
|
419
|
+
"aria-label": L(n).t("wise_invoicing.invoice_approval.settings.pauses.past"),
|
|
420
|
+
class: "flex flex-col gap-md"
|
|
421
|
+
}, [A("div", null, [j(L(H), {
|
|
422
|
+
"aria-expanded": y.value,
|
|
423
|
+
"icon-left": y.value ? L(o) : L(u),
|
|
424
|
+
label: L(n).t("wise_invoicing.invoice_approval.settings.pauses.past_count", { count: v.value.length }),
|
|
425
|
+
size: "sm",
|
|
426
|
+
variant: "tertiary",
|
|
427
|
+
onClick: r[1] ||= (e) => y.value = !y.value
|
|
428
|
+
}, null, 8, [
|
|
429
|
+
"aria-expanded",
|
|
430
|
+
"icon-left",
|
|
431
|
+
"label"
|
|
432
|
+
])]), y.value ? (P(), D(Re, {
|
|
433
|
+
key: 0,
|
|
434
|
+
"is-grouped-by-year": !0,
|
|
435
|
+
"is-past": !0,
|
|
436
|
+
pauses: v.value,
|
|
437
|
+
onCopy: t.dialogs.openCopy
|
|
438
|
+
}, null, 8, ["pauses", "onCopy"])) : O("", !0)], 8, We)) : O("", !0)
|
|
439
|
+
]));
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/modules/invoice-approval/api/mutations/approvalFollowUpPauseDelete.mutation.ts
|
|
444
|
+
function Je() {
|
|
445
|
+
return z({
|
|
446
|
+
queryFn: (e) => S.deleteFollowUpPause(e.params.pauseUuid),
|
|
447
|
+
queryKeysToInvalidate: {
|
|
448
|
+
approvalFollowUpPauseIndex: {},
|
|
449
|
+
invoiceApprovalIndex: {}
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/modules/invoice-approval/use-cases/settings/dialogs/ApprovalFollowUpPauseDeleteDialog.vue
|
|
455
|
+
var Ye = /* @__PURE__ */ M({
|
|
456
|
+
__name: "ApprovalFollowUpPauseDeleteDialog",
|
|
457
|
+
props: { pause: {} },
|
|
458
|
+
emits: ["close"],
|
|
459
|
+
setup(e, { emit: t }) {
|
|
460
|
+
let n = e, r = t, i = w(), o = Z(), s = Je(), c = be({
|
|
461
|
+
initialState: {},
|
|
462
|
+
schema: C.object({}),
|
|
463
|
+
onSubmit: async () => {
|
|
464
|
+
let e = await s.execute({ params: { pauseUuid: n.pause.uuid } });
|
|
465
|
+
e.isErr() ? o.apiError(e.error) : (o.show({ message: i.t("wise_invoicing.invoice_approval.settings.pauses.delete_success") }), r("close"));
|
|
466
|
+
},
|
|
467
|
+
onSubmitError: () => {
|
|
468
|
+
o.unableToSave();
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return (e, t) => (P(), D(L(le), {
|
|
472
|
+
form: L(c),
|
|
473
|
+
size: "sm",
|
|
474
|
+
onClose: t[0] ||= (e) => r("close")
|
|
475
|
+
}, {
|
|
476
|
+
default: R(() => [j(L(J), {
|
|
477
|
+
title: L(i).t("wise_invoicing.invoice_approval.settings.pauses.delete_title", { name: n.pause.name }),
|
|
478
|
+
description: L(i).t("wise_invoicing.invoice_approval.settings.pauses.delete_description"),
|
|
479
|
+
icon: L(a),
|
|
480
|
+
"icon-variant": "error"
|
|
481
|
+
}, null, 8, [
|
|
482
|
+
"title",
|
|
483
|
+
"description",
|
|
484
|
+
"icon"
|
|
485
|
+
]), j(L(K), null, {
|
|
486
|
+
default: R(() => [j(L(q)), j(L(oe), { label: L(i).t("wise_invoicing.invoice_approval.settings.pauses.delete") }, null, 8, ["label"])]),
|
|
487
|
+
_: 1
|
|
488
|
+
})]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 8, ["form"]));
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/modules/invoice-approval/api/mutations/approvalFollowUpPauseCreate.mutation.ts
|
|
495
|
+
function Xe() {
|
|
496
|
+
return z({
|
|
497
|
+
queryFn: (e) => S.createFollowUpPause(e.body),
|
|
498
|
+
queryKeysToInvalidate: {
|
|
499
|
+
approvalFollowUpPauseIndex: {},
|
|
500
|
+
invoiceApprovalIndex: {}
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
var Ze = C.object({
|
|
505
|
+
name: C.string().trim().min(1, e.global.t("wise_invoicing.invoice_approval.settings.validation.required")).max(100),
|
|
506
|
+
period: C.object({
|
|
507
|
+
from: p.nullable(),
|
|
508
|
+
until: p.nullable()
|
|
509
|
+
})
|
|
510
|
+
}).superRefine((t, n) => {
|
|
511
|
+
t.period.from === null || t.period.until === null ? n.addIssue({
|
|
512
|
+
code: "custom",
|
|
513
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.validation.required"),
|
|
514
|
+
path: ["period"]
|
|
515
|
+
}) : B.PlainDate.compare(t.period.until, t.period.from) < 0 ? n.addIssue({
|
|
516
|
+
code: "custom",
|
|
517
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.pauses.end_before_start"),
|
|
518
|
+
path: ["period"]
|
|
519
|
+
}) : B.PlainDate.compare(t.period.until, B.Now.plainDateISO()) < 0 && n.addIssue({
|
|
520
|
+
code: "custom",
|
|
521
|
+
message: e.global.t("wise_invoicing.invoice_approval.settings.pauses.period_in_past"),
|
|
522
|
+
path: ["period"]
|
|
523
|
+
});
|
|
524
|
+
}), Qe = "approval_follow_up_pause_overlap", $e = /* @__PURE__ */ M({
|
|
525
|
+
__name: "ApprovalFollowUpPauseFormDialog",
|
|
526
|
+
props: {
|
|
527
|
+
copyOf: {},
|
|
528
|
+
pause: {}
|
|
529
|
+
},
|
|
530
|
+
emits: ["close"],
|
|
531
|
+
setup(e, { emit: t }) {
|
|
532
|
+
let n = e, r = t, i = w(), a = B.Now.plainDateISO(), o = Z(), c = Xe(), l = Oe(), u = Q(!1), d = Q(!0), f = E(() => [u, d].flatMap((e) => e.result.value.match({
|
|
533
|
+
err: () => [],
|
|
534
|
+
loading: () => [],
|
|
535
|
+
ok: (e) => e
|
|
536
|
+
})).filter((e) => e.uuid !== n.pause?.uuid));
|
|
537
|
+
function p(e, t) {
|
|
538
|
+
let n = e === null || t === null ? null : $.findOverlap(f.value, e, t);
|
|
539
|
+
return n === null ? null : i.t("wise_invoicing.invoice_approval.settings.pauses.overlap_with", {
|
|
540
|
+
name: n.name,
|
|
541
|
+
period: $.format(n.startDate, n.endDate, i.locale.value)
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
let h = be({
|
|
545
|
+
initialState: n.copyOf === null ? b.toForm(n.pause) : b.toNextOccurrenceForm(n.copyOf, $.countYearsToNextOccurrence(n.copyOf.endDate, a)),
|
|
546
|
+
schema: Ze,
|
|
547
|
+
onSubmit: async (e) => {
|
|
548
|
+
let t = p(e.period.from, e.period.until);
|
|
549
|
+
if (t !== null) {
|
|
550
|
+
h.addErrors([{
|
|
551
|
+
message: t,
|
|
552
|
+
path: "period"
|
|
553
|
+
}]);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
let a = n.pause === null ? await c.execute({ body: e }) : await l.execute({
|
|
557
|
+
body: e,
|
|
558
|
+
params: { pauseUuid: n.pause.uuid }
|
|
559
|
+
});
|
|
560
|
+
if (a.isErr()) {
|
|
561
|
+
if (te.isExpectedApiError(a.error) && te.getApiErrorCode(a.error) === Qe) {
|
|
562
|
+
h.addErrors([{
|
|
563
|
+
message: i.t("wise_invoicing.invoice_approval.settings.pauses.overlap"),
|
|
564
|
+
path: "period"
|
|
565
|
+
}]);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
o.apiError(a.error);
|
|
569
|
+
} else o.show({ message: i.t("wise_invoicing.invoice_approval.settings.pauses.success") }), r("close");
|
|
570
|
+
},
|
|
571
|
+
onSubmitError: () => {
|
|
572
|
+
o.unableToSave();
|
|
573
|
+
}
|
|
574
|
+
}), g = h.register("name"), _ = h.register("period", {
|
|
575
|
+
from: null,
|
|
576
|
+
until: null
|
|
577
|
+
}), v = E(() => n.pause !== null && B.PlainDate.compare(n.pause.startDate, a) <= 0), y = E(() => {
|
|
578
|
+
if (n.pause === null) return "";
|
|
579
|
+
let e = i.t("wise_invoicing.invoice_approval.settings.pauses.started_on", { date: $.format(n.pause.startDate, n.pause.startDate, i.locale.value) }), t = _.modelValue.value.until;
|
|
580
|
+
if (t === null || B.PlainDate.compare(t, n.pause.startDate) < 0) return e;
|
|
581
|
+
let r = $.countDays(n.pause.startDate, t);
|
|
582
|
+
return `${e} · ${i.t("wise_invoicing.invoice_approval.settings.pauses.days", { count: r }, r)}`;
|
|
583
|
+
});
|
|
584
|
+
function x(e) {
|
|
585
|
+
_["onUpdate:modelValue"]({
|
|
586
|
+
from: _.modelValue.value.from,
|
|
587
|
+
until: e
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
let S = E(() => {
|
|
591
|
+
let e = _.modelValue.value.from;
|
|
592
|
+
return e !== null && B.PlainDate.compare(e, a) <= 0;
|
|
593
|
+
}), C = E(() => {
|
|
594
|
+
let { from: e, until: t } = _.modelValue.value;
|
|
595
|
+
if (e === null || t === null || B.PlainDate.compare(e, t) > 0) return i.t("wise_invoicing.invoice_approval.settings.pauses.period_hint");
|
|
596
|
+
let n = $.countDays(e, t);
|
|
597
|
+
return i.t("wise_invoicing.invoice_approval.settings.pauses.period_summary", {
|
|
598
|
+
days: i.t("wise_invoicing.invoice_approval.settings.pauses.days", { count: n }, n),
|
|
599
|
+
period: $.format(e, t, i.locale.value)
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
return (e, t) => (P(), D(L(le), {
|
|
603
|
+
form: L(h),
|
|
604
|
+
size: "sm",
|
|
605
|
+
onClose: t[0] ||= (e) => r("close")
|
|
606
|
+
}, {
|
|
607
|
+
default: R(() => [
|
|
608
|
+
j(L(J), {
|
|
609
|
+
title: L(i).t(n.pause === null ? "wise_invoicing.invoice_approval.settings.pauses.create_title" : "wise_invoicing.invoice_approval.settings.pauses.update_title"),
|
|
610
|
+
description: L(i).t("wise_invoicing.invoice_approval.settings.pauses.dialog_description"),
|
|
611
|
+
"is-description-hidden": n.pause !== null,
|
|
612
|
+
icon: L(s)
|
|
613
|
+
}, null, 8, [
|
|
614
|
+
"title",
|
|
615
|
+
"description",
|
|
616
|
+
"is-description-hidden",
|
|
617
|
+
"icon"
|
|
618
|
+
]),
|
|
619
|
+
j(L(ae), null, {
|
|
620
|
+
default: R(() => [j(L(ue), null, {
|
|
621
|
+
default: R(() => [
|
|
622
|
+
j(L(_e), N(L(m)(L(g)), {
|
|
623
|
+
"is-required": !0,
|
|
624
|
+
label: L(i).t("wise_invoicing.invoice_approval.settings.pauses.name"),
|
|
625
|
+
placeholder: L(i).t("wise_invoicing.invoice_approval.settings.pauses.name_placeholder"),
|
|
626
|
+
"data-lpignore": "true",
|
|
627
|
+
"data-1p-ignore": ""
|
|
628
|
+
}), null, 16, ["label", "placeholder"]),
|
|
629
|
+
v.value ? (P(), D(L(W), {
|
|
630
|
+
key: 0,
|
|
631
|
+
"error-message": L(m)(L(_)).errorMessage,
|
|
632
|
+
hint: y.value,
|
|
633
|
+
"is-required": !0,
|
|
634
|
+
"is-touched": L(_).isTouched.value,
|
|
635
|
+
label: L(i).t("wise_invoicing.invoice_approval.settings.pauses.end_date"),
|
|
636
|
+
"min-date": L(a),
|
|
637
|
+
"model-value": L(_).modelValue.value.until,
|
|
638
|
+
onBlur: L(_).onBlur,
|
|
639
|
+
"onUpdate:modelValue": x
|
|
640
|
+
}, null, 8, [
|
|
641
|
+
"error-message",
|
|
642
|
+
"hint",
|
|
643
|
+
"is-touched",
|
|
644
|
+
"label",
|
|
645
|
+
"min-date",
|
|
646
|
+
"model-value",
|
|
647
|
+
"onBlur"
|
|
648
|
+
])) : (P(), D(L(G), N({ key: 1 }, L(m)(L(_)), {
|
|
649
|
+
hint: C.value,
|
|
650
|
+
"is-required": !0,
|
|
651
|
+
label: L(i).t("wise_invoicing.invoice_approval.settings.pauses.period")
|
|
652
|
+
}), null, 16, ["hint", "label"])),
|
|
653
|
+
S.value && !v.value ? (P(), D(L(X), {
|
|
654
|
+
key: 2,
|
|
655
|
+
text: L(i).t("wise_invoicing.invoice_approval.settings.pauses.starts_today_hint"),
|
|
656
|
+
truncate: !1,
|
|
657
|
+
class: "text-sm text-tertiary"
|
|
658
|
+
}, null, 8, ["text"])) : O("", !0)
|
|
659
|
+
]),
|
|
660
|
+
_: 1
|
|
661
|
+
})]),
|
|
662
|
+
_: 1
|
|
663
|
+
}),
|
|
664
|
+
j(L(K), null, {
|
|
665
|
+
default: R(() => [j(L(q)), j(L(de), { label: L(i).t("shared.save_changes") }, null, 8, ["label"])]),
|
|
666
|
+
_: 1
|
|
667
|
+
})
|
|
668
|
+
]),
|
|
669
|
+
_: 1
|
|
670
|
+
}, 8, ["form"]));
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
//#endregion
|
|
674
|
+
//#region src/modules/invoice-approval/use-cases/settings/composables/approvalFollowUpPauseDialogs.composable.ts
|
|
675
|
+
function et() {
|
|
676
|
+
let e = ye(), t = e.create($e), n = e.create(Ye);
|
|
677
|
+
return {
|
|
678
|
+
openCopy: async (e) => {
|
|
679
|
+
await t.open({
|
|
680
|
+
copyOf: e,
|
|
681
|
+
pause: null
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
openCreate: async () => {
|
|
685
|
+
await t.open({
|
|
686
|
+
copyOf: null,
|
|
687
|
+
pause: null
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
openDelete: async (e) => {
|
|
691
|
+
await n.open({ pause: e });
|
|
692
|
+
},
|
|
693
|
+
openUpdate: async (e) => {
|
|
694
|
+
await t.open({
|
|
695
|
+
copyOf: null,
|
|
696
|
+
pause: e
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/modules/invoice-approval/use-cases/settings/views/ApprovalReminderSettingsView.vue?vue&type=script&setup=true&lang.ts
|
|
703
|
+
var tt = { class: "mx-auto flex w-full max-w-340 flex-col gap-xl" }, 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 = { class: "grid grid-cols-1 gap-lg md:grid-cols-2" }, ot = {
|
|
704
|
+
key: 2,
|
|
705
|
+
class: "flex flex-col"
|
|
706
|
+
}, st = /* @__PURE__ */ M({
|
|
707
|
+
__name: "ApprovalReminderSettingsView",
|
|
708
|
+
props: {
|
|
709
|
+
approvalMailTemplate: {},
|
|
710
|
+
reminderConfigs: {}
|
|
711
|
+
},
|
|
712
|
+
setup(e) {
|
|
713
|
+
let r = e, i = [{
|
|
714
|
+
index: 0,
|
|
715
|
+
labelKey: "wise_invoicing.invoice.approval_status.r1"
|
|
716
|
+
}, {
|
|
717
|
+
index: 1,
|
|
718
|
+
labelKey: "wise_invoicing.invoice.approval_status.r2"
|
|
719
|
+
}], a = [
|
|
720
|
+
"request",
|
|
721
|
+
"reminder-1",
|
|
722
|
+
"reminder-2"
|
|
723
|
+
], o = {
|
|
724
|
+
"reminder-1": "wise_invoicing.invoice.approval_status.r1",
|
|
725
|
+
"reminder-2": "wise_invoicing.invoice.approval_status.r2",
|
|
726
|
+
request: "wise_invoicing.invoice_approval.settings.templates.request"
|
|
727
|
+
}, s = {
|
|
728
|
+
[t.AFTER_APPROVAL_REQUEST]: "wise_invoicing.invoice_approval.settings.schedule.after_approval_request",
|
|
729
|
+
[t.AFTER_LAST_REMINDER]: "wise_invoicing.invoice_approval.settings.schedule.after_last_reminder"
|
|
730
|
+
}, c = w(), l = Z(), u = n(), d = Ce(), p = Se(), h = et(), _ = F("reminders"), b = F("request"), S = F("en-US");
|
|
731
|
+
u.set(() => c.t("wise_invoicing.invoice_approval.settings.title"));
|
|
732
|
+
let C = E(() => ({
|
|
733
|
+
mailTemplate: x.toForm(r.approvalMailTemplate),
|
|
734
|
+
reminderConfig: y.toForm(r.reminderConfigs)
|
|
735
|
+
}));
|
|
736
|
+
function O(e) {
|
|
737
|
+
return JSON.stringify(y.toDto(e.reminderConfig)) !== JSON.stringify(y.toDto(C.value.reminderConfig));
|
|
738
|
+
}
|
|
739
|
+
function M(e) {
|
|
740
|
+
return JSON.stringify(x.toDto(e.mailTemplate)) !== JSON.stringify(x.toDto(C.value.mailTemplate));
|
|
741
|
+
}
|
|
742
|
+
function te(e) {
|
|
743
|
+
let t = e?.split(".") ?? [], n = v.find((e) => t.includes(e));
|
|
744
|
+
t[0] === "mailTemplate" ? (_.value = "templates", b.value = "request") : t.includes("template") ? (_.value = "templates", b.value = t[2] === "0" ? "reminder-1" : "reminder-2") : _.value = "reminders", n !== void 0 && (S.value = n);
|
|
745
|
+
}
|
|
746
|
+
let z = be({
|
|
747
|
+
initialState: C,
|
|
748
|
+
schema: De,
|
|
749
|
+
onSubmit: async (e) => {
|
|
750
|
+
if (O(e)) {
|
|
751
|
+
let t = await d.execute({ body: e.reminderConfig });
|
|
752
|
+
if (t.isErr()) {
|
|
753
|
+
l.apiError(t.error);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (M(e)) {
|
|
758
|
+
let t = await p.execute({ body: e.mailTemplate });
|
|
759
|
+
if (t.isErr()) {
|
|
760
|
+
l.apiError(t.error);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
l.show({ message: c.t("wise_invoicing.invoice_approval.settings.success") });
|
|
765
|
+
},
|
|
766
|
+
onSubmitError: ({ errors: e }) => {
|
|
767
|
+
te(e[0]?.path), l.unableToSave();
|
|
768
|
+
}
|
|
769
|
+
}), ne = z.registerArray("reminderConfig.reminders"), B = i.map((e) => {
|
|
770
|
+
let t = ne.register(`${e.index}`), n = t.register("template");
|
|
771
|
+
return {
|
|
772
|
+
offsetDays: t.register("offsetDays"),
|
|
773
|
+
schedule: t.register("schedule"),
|
|
774
|
+
template: {
|
|
775
|
+
"en-US": {
|
|
776
|
+
body: n.register("en-US").register("body"),
|
|
777
|
+
subject: n.register("en-US").register("subject")
|
|
778
|
+
},
|
|
779
|
+
"fr-BE": {
|
|
780
|
+
body: n.register("fr-BE").register("body"),
|
|
781
|
+
subject: n.register("fr-BE").register("subject")
|
|
782
|
+
},
|
|
783
|
+
"nl-BE": {
|
|
784
|
+
body: n.register("nl-BE").register("body"),
|
|
785
|
+
subject: n.register("nl-BE").register("subject")
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
}), V = {
|
|
790
|
+
"reminder-1": B[0].template,
|
|
791
|
+
"reminder-2": B[1].template,
|
|
792
|
+
request: {
|
|
793
|
+
"en-US": {
|
|
794
|
+
body: z.register("mailTemplate.en-US.body"),
|
|
795
|
+
subject: z.register("mailTemplate.en-US.subject")
|
|
796
|
+
},
|
|
797
|
+
"fr-BE": {
|
|
798
|
+
body: z.register("mailTemplate.fr-BE.body"),
|
|
799
|
+
subject: z.register("mailTemplate.fr-BE.subject")
|
|
800
|
+
},
|
|
801
|
+
"nl-BE": {
|
|
802
|
+
body: z.register("mailTemplate.nl-BE.body"),
|
|
803
|
+
subject: z.register("mailTemplate.nl-BE.subject")
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}, U = E({
|
|
807
|
+
get: () => b.value,
|
|
808
|
+
set: (e) => {
|
|
809
|
+
let t = a.find((t) => t === e);
|
|
810
|
+
t !== void 0 && (b.value = t);
|
|
811
|
+
}
|
|
812
|
+
}), W = E({
|
|
813
|
+
get: () => S.value,
|
|
814
|
+
set: (e) => {
|
|
815
|
+
let t = v.find((t) => t === e);
|
|
816
|
+
t !== void 0 && (S.value = t);
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
function G(e, t) {
|
|
820
|
+
let n = V[e][t];
|
|
821
|
+
return (n.subject.modelValue.value ?? "").trim() === "" || (n.body.modelValue.value ?? "").trim() === "";
|
|
822
|
+
}
|
|
823
|
+
let ae = E(() => a.map((e) => ({
|
|
824
|
+
hasMissingContent: G(e, S.value),
|
|
825
|
+
label: c.t(o[e]),
|
|
826
|
+
value: e
|
|
827
|
+
}))), K = E(() => v.map((e) => ({
|
|
828
|
+
hasMissingContent: G(b.value, e),
|
|
829
|
+
label: c.t(`wise_invoicing.invoice_approval.settings.templates.locale.${e}`),
|
|
830
|
+
value: e
|
|
831
|
+
}))), q = E(() => c.t("wise_invoicing.invoice_approval.settings.templates.card_title", {
|
|
832
|
+
language: c.t(`wise_invoicing.invoice_approval.settings.templates.locale_name.${S.value}`),
|
|
833
|
+
template: c.t(o[b.value])
|
|
834
|
+
}));
|
|
835
|
+
function oe(e) {
|
|
836
|
+
return ve([e === 0 ? t.AFTER_APPROVAL_REQUEST : t.AFTER_LAST_REMINDER]);
|
|
837
|
+
}
|
|
838
|
+
function J(e) {
|
|
839
|
+
return c.t(s[e]);
|
|
840
|
+
}
|
|
841
|
+
return (e, t) => (P(), D(L(re), {
|
|
842
|
+
description: L(c).t("wise_invoicing.invoice_approval.settings.description"),
|
|
843
|
+
title: L(c).t("wise_invoicing.invoice_approval.settings.title")
|
|
844
|
+
}, {
|
|
845
|
+
default: R(() => [j(L(ie), null, {
|
|
846
|
+
default: R(() => [j(L(ce), {
|
|
847
|
+
form: L(z),
|
|
848
|
+
"prompt-on-unsaved-changes": !0
|
|
849
|
+
}, {
|
|
850
|
+
default: R(() => [A("div", tt, [
|
|
851
|
+
A("div", nt, [A("div", null, [A("h2", rt, ee(L(c).t("wise_invoicing.invoice_approval.settings.title")), 1), A("p", it, ee(L(c).t("wise_invoicing.invoice_approval.settings.description")), 1)]), _.value === "pauses" ? (P(), D(L(H), {
|
|
852
|
+
key: 0,
|
|
853
|
+
"icon-left": L(f),
|
|
854
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.pauses.add"),
|
|
855
|
+
class: "shrink-0",
|
|
856
|
+
onClick: L(h).openCreate
|
|
857
|
+
}, null, 8, [
|
|
858
|
+
"icon-left",
|
|
859
|
+
"label",
|
|
860
|
+
"onClick"
|
|
861
|
+
])) : (P(), D(L(de), {
|
|
862
|
+
key: 1,
|
|
863
|
+
label: L(c).t("shared.save_changes"),
|
|
864
|
+
class: "shrink-0"
|
|
865
|
+
}, null, 8, ["label"]))]),
|
|
866
|
+
j(L(me), {
|
|
867
|
+
modelValue: _.value,
|
|
868
|
+
"onUpdate:modelValue": t[0] ||= (e) => _.value = e,
|
|
869
|
+
"aria-label": L(c).t("wise_invoicing.invoice_approval.settings.navigation"),
|
|
870
|
+
variant: "button-border"
|
|
871
|
+
}, {
|
|
872
|
+
default: R(() => [j(L(ge), null, {
|
|
873
|
+
default: R(() => [
|
|
874
|
+
j(L(he), {
|
|
875
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.reminders.tab"),
|
|
876
|
+
value: "reminders"
|
|
877
|
+
}, null, 8, ["label"]),
|
|
878
|
+
j(L(he), {
|
|
879
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.templates.tab"),
|
|
880
|
+
value: "templates"
|
|
881
|
+
}, null, 8, ["label"]),
|
|
882
|
+
j(L(he), {
|
|
883
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.pauses.tab"),
|
|
884
|
+
value: "pauses"
|
|
885
|
+
}, null, 8, ["label"])
|
|
886
|
+
]),
|
|
887
|
+
_: 1
|
|
888
|
+
})]),
|
|
889
|
+
_: 1
|
|
890
|
+
}, 8, ["modelValue", "aria-label"]),
|
|
891
|
+
_.value === "reminders" ? (P(), k(T, { key: 0 }, [j(L(X), {
|
|
892
|
+
text: L(c).t("wise_invoicing.invoice_approval.settings.reminders.description"),
|
|
893
|
+
truncate: !1,
|
|
894
|
+
class: "text-sm text-tertiary"
|
|
895
|
+
}, null, 8, ["text"]), (P(), k(T, null, I(i, (e) => A("div", {
|
|
896
|
+
key: e.index,
|
|
897
|
+
class: "flex flex-col gap-md"
|
|
898
|
+
}, [j(L(X), {
|
|
899
|
+
text: L(c).t(e.labelKey),
|
|
900
|
+
class: "text-sm font-medium text-primary"
|
|
901
|
+
}, null, 8, ["text"]), A("div", at, [j(L(fe), N({ ref_for: !0 }, L(m)(L(B)[e.index].offsetDays), {
|
|
902
|
+
"is-required": !0,
|
|
903
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.offset_days"),
|
|
904
|
+
max: 365,
|
|
905
|
+
min: 1,
|
|
906
|
+
step: 1
|
|
907
|
+
}), null, 16, ["label"]), j(L(pe), N({ ref_for: !0 }, L(m)(L(B)[e.index].schedule), {
|
|
908
|
+
"display-fn": J,
|
|
909
|
+
"is-required": !0,
|
|
910
|
+
items: oe(e.index),
|
|
911
|
+
label: L(c).t("wise_invoicing.invoice_approval.settings.schedule_label")
|
|
912
|
+
}), null, 16, ["items", "label"])])])), 64))], 64)) : _.value === "pauses" ? (P(), D(qe, {
|
|
913
|
+
key: 1,
|
|
914
|
+
dialogs: L(h)
|
|
915
|
+
}, null, 8, ["dialogs"])) : (P(), k("div", ot, [j(L(X), {
|
|
916
|
+
text: L(c).t("wise_invoicing.invoice_approval.settings.templates.description"),
|
|
917
|
+
truncate: !1,
|
|
918
|
+
class: "text-sm text-tertiary"
|
|
919
|
+
}, null, 8, ["text"]), j(g, {
|
|
920
|
+
"active-level": U.value,
|
|
921
|
+
"onUpdate:activeLevel": t[1] ||= (e) => U.value = e,
|
|
922
|
+
"active-locale": W.value,
|
|
923
|
+
"onUpdate:activeLocale": t[2] ||= (e) => W.value = e,
|
|
924
|
+
"body-field": V[b.value][S.value].body,
|
|
925
|
+
"can-update": !0,
|
|
926
|
+
"card-title": q.value,
|
|
927
|
+
"level-items": ae.value,
|
|
928
|
+
"locale-items": K.value,
|
|
929
|
+
"subject-field": V[b.value][S.value].subject
|
|
930
|
+
}, null, 8, [
|
|
931
|
+
"active-level",
|
|
932
|
+
"active-locale",
|
|
933
|
+
"body-field",
|
|
934
|
+
"card-title",
|
|
935
|
+
"level-items",
|
|
936
|
+
"locale-items",
|
|
937
|
+
"subject-field"
|
|
938
|
+
])]))
|
|
939
|
+
])]),
|
|
940
|
+
_: 1
|
|
941
|
+
}, 8, ["form"])]),
|
|
942
|
+
_: 1
|
|
943
|
+
})]),
|
|
944
|
+
_: 1
|
|
945
|
+
}, 8, ["description", "title"]));
|
|
946
|
+
}
|
|
947
|
+
}), ct = /* @__PURE__ */ M({
|
|
948
|
+
__name: "ApprovalReminderSettingsViewDataProvider",
|
|
949
|
+
setup(e) {
|
|
950
|
+
let t = xe();
|
|
951
|
+
return (e, n) => (P(), D(h, { queries: { reminderConfigs: L(t) } }, {
|
|
952
|
+
default: R(({ data: e }) => [j(st, {
|
|
953
|
+
"approval-mail-template": e.reminderConfigs.approvalMailTemplate,
|
|
954
|
+
"reminder-configs": e.reminderConfigs.items
|
|
955
|
+
}, null, 8, ["approval-mail-template", "reminder-configs"])]),
|
|
956
|
+
loading: R(() => [j(L(U), { breadcrumbs: [] })]),
|
|
957
|
+
_: 1
|
|
958
|
+
}, 8, ["queries"]));
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
//#endregion
|
|
962
|
+
export { ct as default };
|