@wisemen/wise-invoicing-web 0.11.2 → 0.11.3

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 (32) hide show
  1. package/dist/{ApprovalReminderSettingsViewDataProvider-D0kpogSQ.js → ApprovalReminderSettingsViewDataProvider-BOzuwgOd.js} +2 -6
  2. package/dist/{BillingDocumentDetailViewDataProvider-D_oc3-0D.js → BillingDocumentDetailViewDataProvider-a3kGQ6K1.js} +75 -167
  3. package/dist/{BillingDocumentPdf-wlv-k8KE.js → BillingDocumentPdf-DrOZdixo.js} +12 -18
  4. package/dist/{CreditNoteDetailViewDataProvider-DoFm2xgo.js → CreditNoteDetailViewDataProvider-9CTOmMw8.js} +6 -26
  5. package/dist/{CreditNotePdfViewDataProvider-QpzNsVsK.js → CreditNotePdfViewDataProvider-DX_y_ZIS.js} +2 -2
  6. package/dist/{DataProvider-C3uEds9v.js → DataProvider-BtnD-BzI.js} +1 -1
  7. package/dist/{DunningCaseSendDialog-Bol8NF1J.js → DunningCaseSendDialog-BFGLaor0.js} +3 -11
  8. package/dist/{InvoiceApprovalOutOfSyncIndicator-C4ZLDRiv.js → InvoiceApprovalOutOfSyncIndicator-Pc40MY4q.js} +1 -1
  9. package/dist/{InvoiceApprovalOverviewView-BAmEOum7.js → InvoiceApprovalOverviewView-wBqCXtEF.js} +5 -13
  10. package/dist/{InvoiceApproveDialogDataProvider-S81Mc5oS.js → InvoiceApproveDialogDataProvider-DUeMi7qI.js} +10 -26
  11. package/dist/{InvoiceDetailViewDataProvider-Dqu6qlky.js → InvoiceDetailViewDataProvider-Dy4AN8tQ.js} +40 -114
  12. package/dist/{InvoicePdfView-D0G-Pik3.js → InvoicePdfView-B-DBwFx-.js} +1 -1
  13. package/dist/{InvoicePdfViewDataProvider-DXXbPe-Z.js → InvoicePdfViewDataProvider-aRN8o_EF.js} +3 -3
  14. package/dist/{InvoicePublicProFormaPdfViewDataProvider-CdGFZD-G.js → InvoicePublicProFormaPdfViewDataProvider-CGddJNyW.js} +3 -3
  15. package/dist/{IssuerSettingsViewDataProvider-Ca7GPCDE.js → IssuerSettingsViewDataProvider-BlKorJfv.js} +2 -6
  16. package/dist/{PeppolSettingsViewDataProvider-ZdJQGqux.js → PeppolSettingsViewDataProvider-CH0iMxBL.js} +4 -18
  17. package/dist/{dist-DALBiuub.js → dist-BZgvL8_m.js} +19 -30
  18. package/dist/index.js +4496 -227
  19. package/dist/{invoice.service-jakQLnDu.js → invoice.service-CXCNJz0L.js} +1 -1
  20. package/dist/{invoiceCustomer.service-Bp59E0ZJ.js → invoiceCustomer.service-CknXiBt9.js} +1 -1
  21. package/dist/{invoiceDetail.query-BBhA0ZAn.js → invoiceDetail.query-Cp9AnTrw.js} +1 -1
  22. package/dist/{invoiceIndexCache.util-Ba2MGULh.js → invoiceIndexCache.util-By0N8jal.js} +1 -5
  23. package/dist/{src-DUSgQTKr.js → src-Vz2dm4sM.js} +1 -3
  24. package/package.json +2 -2
  25. package/dist/DunningCaseDetailViewDataProvider-uRJFWZtQ.js +0 -439
  26. package/dist/DunningCaseOverviewView-DpQoXamE.js +0 -799
  27. package/dist/DunningCaseReminderPdfViewDataProvider-D-CfDeC8.js +0 -490
  28. package/dist/InvoiceOverviewViewDataProvider-WKzgF7cl.js +0 -1929
  29. package/dist/InvoicePublicPdfViewDataProvider-ndVoAAY3.js +0 -45
  30. package/dist/ReminderSettingsViewDataProvider-DTC0Ud5z.js +0 -709
  31. package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
  32. /package/dist/{DunningCaseReminderPdfViewDataProvider.css → index.css} +0 -0
@@ -1,1929 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import "./api.util-B3JqQVJA.js";
3
- import { A as t, E as n, _ as r, a as i, b as a, c as o, d as s, l as c, o as l, t as u, u as d, v as f, x as p, y as m } from "./documentTitle.composable-RvqrZTBa.js";
4
- import { n as h, r as g, t as _ } from "./useCurrencyFormat.composable-MtZaqKnO.js";
5
- import { t as v } from "./search.composable-CU9OpyUB.js";
6
- import { t as y } from "./src-DUSgQTKr.js";
7
- import { t as b } from "./invoice.service-jakQLnDu.js";
8
- import { a as x, i as S, n as ee, r as te, t as ne } from "./CustomFieldValueText-DZzqLZ0K.js";
9
- import { r as re, t as ie } from "./plainDate.transformer-Bhiz9jW7.js";
10
- import { L as ae, Tt as oe, ct as se, d as ce, dt as le, i as ue, nt as de, rt as fe } from "./dist-BMzyJZTx.js";
11
- import { n as pe, t as me } from "./customerUuid.model-ClN4Vi9n.js";
12
- import { n as he } from "./dist-Cdbpkd3Y.js";
13
- import { t as ge } from "./DataProvider-C3uEds9v.js";
14
- import { a as _e, c as C, d as ve, f as w, i as ye, l as T, n as be, o as xe, r as E, s as Se, t as Ce, u as we } from "./dist-DALBiuub.js";
15
- import { t as Te } from "./formango.util-D5c2ql--.js";
16
- import { t as D } from "./invoiceApprovalStatus.util-Nd4E3qlZ.js";
17
- import { n as Ee, t as De } from "./InvoiceApprovalOutOfSyncIndicator-C4ZLDRiv.js";
18
- import { a as Oe, i as ke, n as Ae, o as je, r as Me, t as O } from "./invoiceIndexCache.util-Ba2MGULh.js";
19
- import { t as Ne } from "./InvoiceApprovalStatusBadge-C2Wj9b_Z.js";
20
- import { t as Pe } from "./issuerSettings.query-BOgWdNmP.js";
21
- import { t as Fe } from "./dashboard-BaWGNEek.js";
22
- import { z as k } from "zod";
23
- import { useI18n as A } from "vue-i18n";
24
- import { Fragment as Ie, computed as j, createBlock as M, createCommentVNode as N, createElementBlock as P, createElementVNode as F, createTextVNode as Le, createVNode as I, defineComponent as L, isRef as Re, mergeModels as ze, mergeProps as Be, normalizeClass as Ve, onMounted as He, openBlock as R, ref as z, renderList as Ue, renderSlot as We, shallowRef as Ge, toDisplayString as B, unref as V, useModel as Ke, watch as qe, withCtx as H } from "vue";
25
- import { useMutation as U, useOffsetInfiniteQuery as Je } from "@wisemen/vue-core-api-utils";
26
- import { useLocalStorage as Ye, watchDebounced as Xe } from "@vueuse/core";
27
- import { RouterLink as Ze, useRouter as Qe } from "vue-router";
28
- import { Temporal as $e } from "temporal-polyfill";
29
- import { UIAutocomplete as et, UIBadge as tt, UIButton as W, UIColumnLayout as G, UIDashboardPage as nt, UIDashboardPageActions as rt, UIDateRangePicker as it, UIDialog as at, UIDialogBody as ot, UIDialogFooter as st, UIDialogFooterCancel as ct, UIDialogFooterPrimary as lt, UIDialogFooterSubmit as ut, UIDialogHeader as dt, UIFormDialog as ft, UILoader as pt, UIPopover as mt, UIRowLayout as K, UITable as ht, UITableCell as q, UITableCellInteractiveElement as gt, UITableCellText as _t, UITabs as vt, UITabsItem as yt, UITabsList as bt, UIText as J, UITextField as xt, UITooltip as St, UITooltipContent as Ct, createAutocompleteOptions as wt, createComponent as Y, defineTableColumns as Tt, useOverlay as Et, useTableCustomizeColumns as Dt, useToast as X } from "@wisemen/vue-core-design-system";
30
- import { useForm as Ot } from "formango";
31
- import { useRouteQuery as kt } from "@vueuse/router";
32
- //#region src/modules/invoice/api/queries/invoiceIndex.query.ts
33
- function At(e) {
34
- let t = j(() => ({
35
- filters: e?.params?.filters?.value,
36
- search: e?.params?.search?.value,
37
- sort: e?.params?.sort?.value ?? []
38
- }));
39
- return Je("invoiceIndex", {
40
- params: { queryParams: t },
41
- queryFn: (t) => b.getAll({
42
- filters: e?.params?.filters?.value,
43
- pagination: t,
44
- search: e?.params?.search?.value,
45
- sort: e?.params?.sort?.value ?? []
46
- })
47
- });
48
- }
49
- //#endregion
50
- //#region src/modules/invoice/api/mutations/invoiceCreate.mutation.ts
51
- function jt() {
52
- return U({
53
- queryFn: (e) => b.create(e.body),
54
- queryKeysToInvalidate: { invoiceIndex: {} }
55
- });
56
- }
57
- //#endregion
58
- //#region src/modules/invoice/components/form/InvoiceFormCustomerField.vue
59
- var Mt = /* @__PURE__ */ L({
60
- __name: "InvoiceFormCustomerField",
61
- props: {
62
- isLoading: { type: Boolean },
63
- customers: {},
64
- field: {}
65
- },
66
- emits: ["nextPage", "updateSearch"],
67
- setup(e, { emit: t }) {
68
- let n = e, r = t, i = A(), a = j(() => wt(n.customers));
69
- function o(e) {
70
- return e.name;
71
- }
72
- function c(e) {
73
- switch (e) {
74
- case s.BUSINESS: return i.t("wise_invoicing.customer.type.business");
75
- case s.INDIVIDUAL: return i.t("wise_invoicing.customer.type.individual");
76
- }
77
- return "-";
78
- }
79
- function l(e) {
80
- return { description: {
81
- layout: "block",
82
- value: c(e.type)
83
- } };
84
- }
85
- function u(e) {
86
- r("updateSearch", e);
87
- }
88
- function d(e) {
89
- n.field.setValue(e), e !== null && r("updateSearch", "");
90
- }
91
- return (e, t) => (R(), M(V(et), Be(V(Te)(n.field), {
92
- "display-fn": o,
93
- "get-item-config": l,
94
- "is-loading": n.isLoading,
95
- "is-required": !0,
96
- items: a.value,
97
- label: V(i).t("wise_invoicing.invoice.create.fields.customer"),
98
- placeholder: V(i).t("component.autocomplete.search_placeholder"),
99
- "search-mode": "remote",
100
- onNextPage: t[0] ||= (e) => r("nextPage"),
101
- "onUpdate:modelValue": d,
102
- "onUpdate:search": u
103
- }), null, 16, [
104
- "is-loading",
105
- "items",
106
- "label",
107
- "placeholder"
108
- ]));
109
- }
110
- }), Nt = k.enum(s), Pt = k.object({
111
- uuid: me,
112
- name: k.string().min(1),
113
- type: Nt
114
- }), Ft = k.object({ customer: Pt }), It = /* @__PURE__ */ L({
115
- __name: "InvoiceCreateDialog",
116
- emits: ["close"],
117
- setup(e, { emit: t }) {
118
- let n = t, r = A(), i = X(), a = Qe(), o = jt(), s = v({ debounceMs: 250 }), c = Ee({ params: { search: s.debouncedSearch } }), l = j(() => c.result.value.match({
119
- err: () => [],
120
- loading: () => [],
121
- ok: (e) => e.data
122
- })), u = Ot({
123
- initialState: { customer: null },
124
- schema: Ft,
125
- onSubmit: async (e) => {
126
- let t = await o.execute({ body: e });
127
- if (t.isErr()) {
128
- i.apiError(t.error);
129
- return;
130
- }
131
- n("close"), await a.push({
132
- name: "invoicing-invoice-detail",
133
- params: { invoiceUuid: t.value }
134
- });
135
- }
136
- }), d = u.register("customer");
137
- function f(e) {
138
- s.updateSearch(e);
139
- }
140
- return (e, t) => (R(), M(V(ft), {
141
- form: V(u),
142
- size: "xs",
143
- onClose: t[0] ||= (e) => n("close")
144
- }, {
145
- default: H(() => [
146
- I(V(dt), {
147
- title: V(r).t("wise_invoicing.invoice.create.modal_title"),
148
- description: V(r).t("wise_invoicing.invoice.create.modal_description"),
149
- icon: V(de)
150
- }, null, 8, [
151
- "title",
152
- "description",
153
- "icon"
154
- ]),
155
- I(V(ot), null, {
156
- default: H(() => [I(Mt, {
157
- customers: l.value,
158
- field: V(d),
159
- "is-loading": V(c).isLoading.value,
160
- onNextPage: V(c).fetchNextPage,
161
- onUpdateSearch: f
162
- }, null, 8, [
163
- "customers",
164
- "field",
165
- "is-loading",
166
- "onNextPage"
167
- ])]),
168
- _: 1
169
- }),
170
- I(V(st), null, {
171
- right: H(() => [I(V(ct), { label: "cancel" }), I(V(ut), { label: V(r).t("wise_invoicing.invoice.create.confirm") }, null, 8, ["label"])]),
172
- _: 1
173
- })
174
- ]),
175
- _: 1
176
- }, 8, ["form"]));
177
- }
178
- }), Lt = {
179
- key: 0,
180
- class: "pointer-events-none fixed inset-x-0 bottom-4 z-20 flex justify-center px-lg"
181
- }, Rt = /* @__PURE__ */ L({
182
- __name: "InvoiceOverviewBulkActionBar",
183
- props: {
184
- canFinalize: { type: Boolean },
185
- canMarkAsReady: { type: Boolean },
186
- canSend: { type: Boolean },
187
- canSendApproval: { type: Boolean },
188
- selectedCount: {}
189
- },
190
- emits: [
191
- "cancel",
192
- "finalize",
193
- "markAsReady",
194
- "send",
195
- "sendApproval"
196
- ],
197
- setup(e, { emit: t }) {
198
- let n = e, r = t, i = A();
199
- return (e, t) => n.selectedCount > 0 ? (R(), P("div", Lt, [I(V(K), { class: "pointer-events-auto rounded-xl border border-secondary bg-primary px-lg py-sm shadow-lg" }, {
200
- default: H(() => [
201
- I(V(J), {
202
- text: V(i).t("wise_invoicing.invoice.overview.bulk.selected_documents", { count: n.selectedCount }),
203
- class: "text-sm text-secondary"
204
- }, null, 8, ["text"]),
205
- n.canMarkAsReady ? (R(), M(V(W), {
206
- key: 0,
207
- label: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.action"),
208
- onClick: t[0] ||= (e) => r("markAsReady")
209
- }, null, 8, ["label"])) : N("", !0),
210
- n.canFinalize ? (R(), M(V(W), {
211
- key: 1,
212
- label: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.action"),
213
- onClick: t[1] ||= (e) => r("finalize")
214
- }, null, 8, ["label"])) : N("", !0),
215
- n.canSend ? (R(), M(V(W), {
216
- key: 2,
217
- label: V(i).t("wise_invoicing.invoice.overview.bulk.send.action"),
218
- onClick: t[2] ||= (e) => r("send")
219
- }, null, 8, ["label"])) : N("", !0),
220
- n.canSendApproval ? (R(), M(V(W), {
221
- key: 3,
222
- label: V(i).t("wise_invoicing.invoice.overview.bulk.send_approval.action"),
223
- onClick: t[3] ||= (e) => r("sendApproval")
224
- }, null, 8, ["label"])) : N("", !0),
225
- I(V(W), {
226
- label: V(i).t("wise_invoicing.invoice.overview.bulk.cancel"),
227
- variant: "tertiary",
228
- onClick: t[4] ||= (e) => r("cancel")
229
- }, null, 8, ["label"])
230
- ]),
231
- _: 1
232
- })])) : N("", !0);
233
- }
234
- });
235
- //#endregion
236
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewBulkSendEligibility.composable.ts
237
- function zt(e) {
238
- let t = z(null), n = j(() => e.selectedInvoices().filter((e) => e.status === a.FINALIZED).map((e) => e.uuid)), r = j(() => {
239
- let t = e.matching?.() ?? null;
240
- return t === null ? n.value.length === 0 ? null : {
241
- invoiceUuids: n.value,
242
- type: "invoices"
243
- } : t.target;
244
- }), i = j(() => {
245
- let e = r.value;
246
- return e === null ? "" : e.type === "invoices" ? e.invoiceUuids.toSorted().join(",") : JSON.stringify(e);
247
- });
248
- return Xe(i, async (e) => {
249
- let a = r.value;
250
- if (a === null) {
251
- t.value = null;
252
- return;
253
- }
254
- let o = await b.previewBulkSend(a);
255
- i.value === e && (t.value = o.isErr() ? n.value.length : o.value.meta.processed);
256
- }, { debounce: 300 }), { canSend: j(() => r.value !== null && (t.value ?? 0) > 0) };
257
- }
258
- //#endregion
259
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewCustomFieldFilter.util.ts
260
- function Z(e) {
261
- return Array.isArray(e) && e.every((e) => typeof e == "string");
262
- }
263
- function Bt(e, t) {
264
- try {
265
- switch (e) {
266
- case d.DATE: return ie.toDto(ie.fromDto(t));
267
- case d.TIMESTAMP: return re.toDto(re.fromDto(t));
268
- default: return t;
269
- }
270
- } catch {
271
- return null;
272
- }
273
- }
274
- var Q = class {
275
- static getFreeformOptions(e, t) {
276
- let n = t.trim();
277
- if (n.length === 0) return [];
278
- let r = Bt(e.type, n);
279
- return r === null ? [] : [r];
280
- }
281
- static getKey(e) {
282
- return `custom-field-${e.uuid}`;
283
- }
284
- static getMajorUnitRule(e, t, n) {
285
- let r = this.getRuleNumber(e, t);
286
- return r === void 0 || n === void 0 ? void 0 : _(r, n);
287
- }
288
- static getMonetaryCurrency(e, t) {
289
- let n = e.rules?.currencies;
290
- if (!Array.isArray(n)) return t;
291
- let r = new Set(Object.values(o)), i = n.filter((e) => typeof e == "string" && r.has(e));
292
- return i.includes(t) ? t : i[0] ?? t;
293
- }
294
- static getRuleNumber(e, t) {
295
- let n = e.rules?.[t];
296
- return typeof n == "number" ? n : void 0;
297
- }
298
- static toFilters(e, t, n) {
299
- switch (e.type) {
300
- case d.BOOLEAN: return typeof t == "boolean" ? [{
301
- definitionUuid: e.uuid,
302
- type: d.BOOLEAN,
303
- value: t
304
- }] : [];
305
- case d.MONETARY: {
306
- let r = this.getRuleNumber(e, "precision"), i = this.getMonetaryCurrency(e, n);
307
- return typeof t == "number" && r !== void 0 ? [{
308
- definitionUuid: e.uuid,
309
- type: d.MONETARY,
310
- value: {
311
- amount: h(t, r),
312
- currency: i,
313
- precision: r
314
- }
315
- }] : [];
316
- }
317
- case d.NUMBER: return typeof t == "number" ? [{
318
- definitionUuid: e.uuid,
319
- type: d.NUMBER,
320
- value: t
321
- }] : [];
322
- case d.MULTI_SELECT: return Z(t) && t.length > 0 ? [{
323
- definitionUuid: e.uuid,
324
- type: d.MULTI_SELECT,
325
- value: t
326
- }] : [];
327
- case d.TEXT_ARRAY: return Z(t) && t.length > 0 ? [{
328
- definitionUuid: e.uuid,
329
- type: d.TEXT_ARRAY,
330
- value: t
331
- }] : [];
332
- case d.DATE: return Z(t) ? t.map((t) => ({
333
- definitionUuid: e.uuid,
334
- type: d.DATE,
335
- value: t
336
- })) : [];
337
- case d.SINGLE_SELECT: return Z(t) ? t.map((t) => ({
338
- definitionUuid: e.uuid,
339
- type: d.SINGLE_SELECT,
340
- value: t
341
- })) : [];
342
- case d.TEXT: return Z(t) ? t.map((t) => ({
343
- definitionUuid: e.uuid,
344
- type: d.TEXT,
345
- value: t
346
- })) : [];
347
- case d.TIMESTAMP: return Z(t) ? t.map((t) => ({
348
- definitionUuid: e.uuid,
349
- type: d.TIMESTAMP,
350
- value: t
351
- })) : [];
352
- default: throw TypeError("Unsupported custom field definition type");
353
- }
354
- }
355
- };
356
- //#endregion
357
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewDataTableFilters.composable.ts
358
- function Vt(e) {
359
- let t = A(), n = v({ debounceMs: 250 }), r = Ee({ params: { search: n.debouncedSearch } }), a = j(() => r.result.value.match({
360
- err: () => [],
361
- loading: () => [],
362
- ok: (e) => e.data
363
- })), o = e.customFieldDefinitions.filter((e) => e.type !== d.REFERENCE), s = o.map((n) => {
364
- let r = Q.getKey(n), i = te.getLabel(n, t.locale.value);
365
- switch (n.type) {
366
- case d.BOOLEAN: return C({
367
- entityLabel: i,
368
- key: r,
369
- label: i
370
- });
371
- case d.MONETARY: {
372
- let t = Q.getRuleNumber(n, "precision"), a = Q.getMonetaryCurrency(n, e.currency);
373
- return ve({
374
- customUnit: a,
375
- defaultValue: {
376
- operator: we.EQUALS,
377
- value: null
378
- },
379
- disableOperators: !0,
380
- key: r,
381
- label: i,
382
- max: Q.getMajorUnitRule(n, "max", t),
383
- min: Q.getMajorUnitRule(n, "min", t),
384
- step: t === void 0 ? void 0 : 1 / 10 ** t
385
- });
386
- }
387
- case d.NUMBER: return ve({
388
- defaultValue: {
389
- operator: we.EQUALS,
390
- value: null
391
- },
392
- disableOperators: !0,
393
- key: r,
394
- label: i,
395
- max: Q.getRuleNumber(n, "max"),
396
- min: Q.getRuleNumber(n, "min")
397
- });
398
- case d.MULTI_SELECT:
399
- case d.SINGLE_SELECT: return _e({
400
- defaultValue: {
401
- operator: E.INCLUDES,
402
- value: []
403
- },
404
- disableOperators: !0,
405
- displayFn: (e) => te.getChoiceLabel(n, e, t.locale.value),
406
- key: r,
407
- label: i,
408
- options: () => n.choices.map((e) => e.value)
409
- });
410
- case d.DATE:
411
- case d.TEXT:
412
- case d.TEXT_ARRAY:
413
- case d.TIMESTAMP: return w({
414
- defaultValue: {
415
- operator: E.INCLUDES,
416
- value: []
417
- },
418
- disableOperators: !0,
419
- displayFn: (e) => e,
420
- key: r,
421
- label: i,
422
- options: (e) => Promise.resolve(Q.getFreeformOptions(n, e))
423
- });
424
- default: throw TypeError("Unsupported custom field definition type");
425
- }
426
- }), c = ye({
427
- actionGroup: { name: "invoices" },
428
- filters: [
429
- w({
430
- defaultValue: {
431
- operator: E.INCLUDES,
432
- value: []
433
- },
434
- disableOperators: !0,
435
- displayFn: (e) => a.value.find((t) => t.uuid === e)?.name ?? e,
436
- key: "customerUuids",
437
- label: t.t("wise_invoicing.invoice.overview.filters.customer"),
438
- options: async (e) => (n.updateSearch(e), await new Promise((e) => setTimeout(e, 0)), a.value.map((e) => e.uuid))
439
- }),
440
- T({
441
- defaultValue: {
442
- operator: Ce.IS_BETWEEN,
443
- value: {
444
- from: null,
445
- until: null
446
- }
447
- },
448
- disableOperators: !0,
449
- key: "dueOnRange",
450
- label: t.t("wise_invoicing.invoice.overview.filters.due_on")
451
- }),
452
- _e({
453
- defaultValue: {
454
- operator: E.INCLUDES,
455
- value: []
456
- },
457
- disableOperators: !0,
458
- displayFn: (e) => t.t(ee.getLifecycleMetadata(e).translationKey),
459
- key: "lifecycleStatuses",
460
- label: t.t("wise_invoicing.invoice.overview.filters.lifecycle"),
461
- options: () => Object.values(m)
462
- }),
463
- _e({
464
- defaultValue: {
465
- operator: E.INCLUDES,
466
- value: []
467
- },
468
- disableOperators: !0,
469
- displayFn: (e) => t.t(D.getFilterTranslationKey(e)),
470
- key: "approvalStatuses",
471
- label: t.t("wise_invoicing.invoice.overview.filters.approval"),
472
- options: () => Object.values(i)
473
- }),
474
- C({
475
- defaultValue: null,
476
- entityLabel: t.t("wise_invoicing.invoice.overview.filters.out_of_sync"),
477
- key: "hasChangesSinceApprovalSent",
478
- label: t.t("wise_invoicing.invoice.overview.filters.out_of_sync")
479
- }),
480
- ...s
481
- ]
482
- }), l = j(() => {
483
- let e = c.values.value.customerUuids.value;
484
- return e?.length ? e : null;
485
- }), u = j(() => {
486
- let e = c.values.value.dueOnRange.value;
487
- return e.from === null || e.until === null ? null : e;
488
- }), f = j(() => {
489
- let t = c.values.value;
490
- return o.flatMap((n) => {
491
- let r = t[Q.getKey(n)], i = typeof r == "object" && r && "value" in r ? r.value : r;
492
- return Q.toFilters(n, i, e.currency);
493
- });
494
- }), p = j(() => {
495
- let e = c.values.value.lifecycleStatuses.value;
496
- return e?.length ? e : null;
497
- }), h = j(() => {
498
- let e = c.values.value.approvalStatuses.value;
499
- return e?.length ? e : null;
500
- });
501
- return {
502
- hasChangesSinceApprovalSent: j(() => {
503
- let e = c.values.value.hasChangesSinceApprovalSent;
504
- return typeof e == "boolean" ? e : null;
505
- }),
506
- approvalStatuses: h,
507
- customerUuids: l,
508
- customFields: f,
509
- dueOnRange: u,
510
- filters: c,
511
- lifecycleStatuses: p
512
- };
513
- }
514
- //#endregion
515
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewFilters.composable.ts
516
- var Ht = {
517
- approvals: { approvalStatuses: [
518
- i.AWAITING_APPROVAL,
519
- i.REMINDER_1,
520
- i.REMINDER_2,
521
- i.REJECTED,
522
- i.EXPIRED
523
- ] },
524
- awaiting_payment: {
525
- settlementStatuses: [n.UNPAID, n.PARTIALLY_PAID],
526
- statuses: [a.SENT]
527
- },
528
- credited: { settlementStatuses: [n.CREDITED] },
529
- overdue: { isOverdue: !0 },
530
- paid: { settlementStatuses: [n.PAID, n.OVERPAID] }
531
- };
532
- function Ut() {
533
- let e = A();
534
- return {
535
- getFilters: (e) => e === "all" ? {} : Ht[e],
536
- tabs: j(() => [
537
- {
538
- key: "all",
539
- label: e.t("wise_invoicing.invoice.overview.tabs.all")
540
- },
541
- {
542
- key: "awaiting_payment",
543
- label: e.t("wise_invoicing.invoice.overview.tabs.awaiting_payment")
544
- },
545
- {
546
- key: "paid",
547
- label: e.t("wise_invoicing.invoice.overview.tabs.paid")
548
- },
549
- {
550
- key: "overdue",
551
- label: e.t("wise_invoicing.invoice.overview.tabs.overdue")
552
- },
553
- {
554
- key: "credited",
555
- label: e.t("wise_invoicing.invoice.overview.tabs.credited")
556
- },
557
- {
558
- key: "approvals",
559
- label: e.t("wise_invoicing.invoice.overview.tabs.approvals")
560
- }
561
- ])
562
- };
563
- }
564
- //#endregion
565
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewSelection.composable.ts
566
- var Wt = {
567
- items: [],
568
- type: "includes"
569
- };
570
- function Gt(e) {
571
- let t = Ge(Wt), n = z(0), r = j(() => t.value.type === "excludes"), i = j(() => new Set(t.value.items.map((e) => e.uuid))), a = j(() => e.rows().filter((e) => {
572
- let t = i.value.has(e.uuid);
573
- return r.value ? !t : t;
574
- })), o = j(() => {
575
- if (!r.value) return null;
576
- let n = t.value.items.map((e) => e.uuid);
577
- return {
578
- count: Math.max(e.totalCount() - n.length, 0),
579
- target: {
580
- excludedInvoiceUuids: n,
581
- queryParams: e.queryParams(),
582
- type: "matching"
583
- }
584
- };
585
- }), s = j(() => o.value?.count ?? a.value.length);
586
- function c(e) {
587
- t.value = e;
588
- }
589
- function l() {
590
- !r.value && t.value.items.length === 0 || (t.value = Wt, n.value += 1);
591
- }
592
- return qe(e.queryParams, l, { deep: !0 }), {
593
- clearSelection: l,
594
- matching: o,
595
- selectedCount: s,
596
- selectedInvoices: a,
597
- tableKey: n,
598
- onSelect: c
599
- };
600
- }
601
- //#endregion
602
- //#region src/modules/invoice/use-cases/overview/components/InvoiceOverviewTableAmountCell.vue?vue&type=script&setup=true&lang.ts
603
- var Kt = { class: "font-medium text-secondary" }, qt = ["title"], Jt = /* @__PURE__ */ L({
604
- __name: "InvoiceOverviewTableAmountCell",
605
- props: { value: {} },
606
- setup(e) {
607
- let t = e, n = A(), r = g(), i = j(() => r.formatMonetary(t.value.total)), a = j(() => {
608
- let e = je.getSubtextParts({
609
- balanceDueAmount: t.value.balanceDueAmount,
610
- grossAmount: t.value.grossAmount,
611
- paidAmount: t.value.paidAmount,
612
- settlementStatus: t.value.settlementStatus,
613
- totalCreditedAmount: t.value.totalCreditedAmount
614
- });
615
- return e == null ? null : e.paidAmount !== null && e.overpaidAmount !== null ? n.t("wise_invoicing.invoice.status_subtext.paid_overpaid", {
616
- overpaidAmount: r.formatMonetary(e.overpaidAmount),
617
- paidAmount: r.formatMonetary(e.paidAmount)
618
- }) : e.paidAmount !== null && e.creditedAmount !== null ? n.t("wise_invoicing.invoice.status_subtext.paid_credited", {
619
- creditedAmount: r.formatMonetary(e.creditedAmount),
620
- paidAmount: r.formatMonetary(e.paidAmount)
621
- }) : e.paidAmount === null ? e.creditedAmount === null ? null : n.t("wise_invoicing.invoice.status_subtext.credited", { creditedAmount: r.formatMonetary(e.creditedAmount) }) : n.t("wise_invoicing.invoice.status_subtext.paid", { paidAmount: r.formatMonetary(e.paidAmount) });
622
- });
623
- return (e, t) => (R(), M(V(q), null, {
624
- default: H(() => [I(V(G), {
625
- gap: "xxs",
626
- class: "text-sm/tight"
627
- }, {
628
- default: H(() => [F("span", Kt, B(i.value), 1), a.value === null ? N("", !0) : (R(), P("span", {
629
- key: 0,
630
- title: a.value,
631
- class: "truncate text-xs text-secondary"
632
- }, B(a.value), 9, qt))]),
633
- _: 1
634
- })]),
635
- _: 1
636
- }));
637
- }
638
- }), Yt = /* @__PURE__ */ L({
639
- __name: "InvoiceOverviewTableApprovalCell",
640
- props: {
641
- hasChangesSinceApprovalSent: { type: Boolean },
642
- approval: {},
643
- requiresPriorApproval: { type: Boolean }
644
- },
645
- setup(e) {
646
- let t = e;
647
- return (e, n) => (R(), M(V(q), null, {
648
- default: H(() => [I(V(K), {
649
- align: "center",
650
- gap: "xs"
651
- }, {
652
- default: H(() => [I(Ne, {
653
- approval: t.approval,
654
- "requires-prior-approval": t.requiresPriorApproval
655
- }, null, 8, ["approval", "requires-prior-approval"]), t.hasChangesSinceApprovalSent ? (R(), M(De, { key: 0 })) : N("", !0)]),
656
- _: 1
657
- })]),
658
- _: 1
659
- }));
660
- }
661
- }), Xt = /* @__PURE__ */ L({
662
- __name: "InvoiceOverviewTableCustomFieldCell",
663
- props: {
664
- definition: {},
665
- value: {}
666
- },
667
- setup(e) {
668
- return (t, n) => (R(), M(V(q), null, {
669
- default: H(() => [e.value === void 0 ? (R(), M(V(J), {
670
- key: 1,
671
- text: "-",
672
- class: "text-sm/5 text-primary"
673
- })) : (R(), M(ne, {
674
- key: 0,
675
- definition: e.definition,
676
- value: e.value,
677
- size: "md"
678
- }, null, 8, ["definition", "value"]))]),
679
- _: 1
680
- }));
681
- }
682
- }), Zt = /* @__PURE__ */ L({
683
- __name: "InvoiceOverviewTableDueDateCell",
684
- props: {
685
- isOverdue: { type: Boolean },
686
- value: {}
687
- },
688
- setup(e) {
689
- let t = e, n = he(), r = j(() => t.value === null ? "-" : n.formatPlainDate(t.value)), i = j(() => {
690
- if (!t.isOverdue || t.value === null) return null;
691
- let e = t.value.toZonedDateTime($e.Now.timeZoneId()).toInstant();
692
- return n.toRelativeTime(e);
693
- });
694
- return (e, n) => (R(), M(V(q), null, {
695
- default: H(() => [I(V(K), { gap: "sm" }, {
696
- default: H(() => [I(V(J), {
697
- class: Ve([{
698
- "text-error-primary": t.isOverdue,
699
- "text-primary": !t.isOverdue
700
- }, "text-sm"]),
701
- text: r.value
702
- }, null, 8, ["class", "text"]), i.value === null ? N("", !0) : (R(), M(V(tt), {
703
- key: 0,
704
- label: i.value,
705
- color: "error",
706
- size: "sm",
707
- variant: "translucent"
708
- }, null, 8, ["label"]))]),
709
- _: 1
710
- })]),
711
- _: 1
712
- }));
713
- }
714
- }), Qt = /* @__PURE__ */ L({
715
- __name: "InvoiceOverviewTableIssuedDateCell",
716
- props: { value: {} },
717
- setup(e) {
718
- let t = e, n = he(), r = j(() => t.value === null ? "-" : n.formatPlainDate(t.value));
719
- return (e, t) => (R(), M(V(q), null, {
720
- default: H(() => [I(V(J), {
721
- text: r.value,
722
- class: "text-sm/5 text-primary"
723
- }, null, 8, ["text"])]),
724
- _: 1
725
- }));
726
- }
727
- }), $t = /* @__PURE__ */ L({
728
- __name: "InvoiceOverviewTableLifecycleCell",
729
- props: {
730
- isDisputed: { type: Boolean },
731
- lifecycleStatus: {}
732
- },
733
- setup(e) {
734
- let t = e;
735
- return (e, n) => (R(), M(V(q), null, {
736
- default: H(() => [I(V(K), { gap: "xs" }, {
737
- default: H(() => [I(ke, { "lifecycle-status": t.lifecycleStatus }, null, 8, ["lifecycle-status"]), t.isDisputed ? (R(), M(Oe, { key: 0 })) : N("", !0)]),
738
- _: 1
739
- })]),
740
- _: 1
741
- }));
742
- }
743
- }), en = { class: "flex flex-col leading-tight" }, tn = ["title"], nn = ["title"], rn = /* @__PURE__ */ L({
744
- __name: "InvoiceOverviewTableNameCell",
745
- props: {
746
- customerName: {},
747
- subject: {},
748
- type: {}
749
- },
750
- setup(e) {
751
- let t = e, n = A();
752
- return (e, r) => (R(), M(V(q), null, {
753
- default: H(() => [F("div", en, [I(V(K), null, {
754
- default: H(() => [F("span", {
755
- title: t.customerName,
756
- class: "truncate text-sm/4 font-medium text-primary"
757
- }, B(t.customerName), 9, tn), t.type === V(p).CREDIT_NOTE ? (R(), M(V(le), {
758
- key: 0,
759
- "aria-label": V(n).t("wise_invoicing.invoice.type.credit_note"),
760
- class: "size-3 shrink-0 text-warning-primary",
761
- role: "img"
762
- }, null, 8, ["aria-label"])) : N("", !0)]),
763
- _: 1
764
- }), F("span", {
765
- title: t.subject ?? void 0,
766
- class: "truncate text-xs/4 text-secondary"
767
- }, B(t.subject ?? "-"), 9, nn)])]),
768
- _: 1
769
- }));
770
- }
771
- }), an = /* @__PURE__ */ L({
772
- __name: "InvoiceOverviewTableSentCell",
773
- props: { deliveryStatus: {} },
774
- setup(e) {
775
- let t = e, n = A(), r = j(() => [f.SENT, f.VIEWED].includes(t.deliveryStatus));
776
- return (e, i) => (R(), M(V(q), null, {
777
- default: H(() => [r.value ? (R(), M(V(ue), {
778
- key: 0,
779
- class: "size-4 text-brand-600"
780
- })) : t.deliveryStatus === V(f).PROCESSING ? (R(), M(V(pt), {
781
- key: 1,
782
- "aria-label": V(n).t("wise_invoicing.invoice.delivery_status.processing"),
783
- "aria-hidden": "false",
784
- role: "img",
785
- class: "size-4 text-tertiary"
786
- }, null, 8, ["aria-label"])) : t.deliveryStatus === V(f).FAILED ? (R(), M(V(St), {
787
- key: 2,
788
- "popover-side-offset": 8,
789
- "popover-align": "center",
790
- "popover-side": "bottom"
791
- }, {
792
- trigger: H(() => [I(V(gt), null, {
793
- default: H(() => [I(V(ce), {
794
- "aria-label": V(n).t("wise_invoicing.invoice.overview.send_failed"),
795
- class: "size-4 text-error-primary"
796
- }, null, 8, ["aria-label"])]),
797
- _: 1
798
- })]),
799
- content: H(() => [I(V(Ct), null, {
800
- default: H(() => [I(V(J), {
801
- text: V(n).t("wise_invoicing.invoice.overview.send_failed"),
802
- class: "text-sm text-primary"
803
- }, null, 8, ["text"])]),
804
- _: 1
805
- })]),
806
- _: 1
807
- })) : N("", !0)]),
808
- _: 1
809
- }));
810
- }
811
- }), on = /* @__PURE__ */ L({
812
- __name: "InvoiceOverviewTableSequenceCell",
813
- props: { sequence: {} },
814
- setup(e) {
815
- return (t, n) => (R(), M(V(q), null, {
816
- default: H(() => [I(V(_t), { text: e.sequence ?? "-" }, null, 8, ["text"])]),
817
- _: 1
818
- }));
819
- }
820
- }), sn = /* @__PURE__ */ L({
821
- __name: "InvoiceOverviewTableStatusCell",
822
- props: { value: {} },
823
- setup(e) {
824
- let t = e, n = j(() => t.value.type === p.CREDIT_NOTE), r = j(() => Ae.isSent(t.value.deliveryStatus));
825
- return (e, i) => (R(), M(V(q), null, {
826
- default: H(() => [n.value ? N("", !0) : (R(), M(Me, {
827
- key: 0,
828
- "is-sent": r.value,
829
- "balance-due-amount": t.value.balanceDueAmount,
830
- "gross-amount": t.value.grossAmount,
831
- "paid-amount": t.value.paidAmount,
832
- "settlement-status": t.value.settlementStatus,
833
- "show-subtext": !1,
834
- "total-credited-amount": t.value.totalCreditedAmount
835
- }, null, 8, [
836
- "is-sent",
837
- "balance-due-amount",
838
- "gross-amount",
839
- "paid-amount",
840
- "settlement-status",
841
- "total-credited-amount"
842
- ]))]),
843
- _: 1
844
- }));
845
- }
846
- });
847
- //#endregion
848
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewTableColumns.composable.ts
849
- function cn(e) {
850
- let n = A();
851
- return j(() => {
852
- let r = e?.customFieldDefinitions?.().map((e) => ({
853
- headerLabel: te.getLabel(e, n.locale.value),
854
- key: Q.getKey(e),
855
- size: {
856
- max: "1fr",
857
- min: "10rem"
858
- },
859
- component: (t) => Y(Xt, {
860
- definition: e,
861
- value: t.customFields.find((t) => t.definitionUuid === e.uuid)
862
- })
863
- })) ?? [];
864
- return Tt()([
865
- {
866
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.recipient"),
867
- key: t.CUSTOMER,
868
- size: {
869
- max: "16rem",
870
- min: "16rem"
871
- },
872
- component: (e) => Y(rn, {
873
- customerName: e.customerName,
874
- subject: e.subject,
875
- type: e.type
876
- })
877
- },
878
- {
879
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.invoice_number"),
880
- key: t.SEQUENCE,
881
- size: {
882
- max: "9rem",
883
- min: "9rem"
884
- },
885
- component: (e) => Y(on, { sequence: e.sequence })
886
- },
887
- {
888
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.lifecycle"),
889
- key: "lifecycleStatus",
890
- size: {
891
- max: "12rem",
892
- min: "8rem"
893
- },
894
- component: (e) => Y($t, {
895
- isDisputed: e.isDisputed,
896
- lifecycleStatus: e.lifecycleStatus
897
- })
898
- },
899
- {
900
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.invoice_date"),
901
- key: t.ISSUED_ON,
902
- size: {
903
- max: "8rem",
904
- min: "8rem"
905
- },
906
- component: (e) => Y(Qt, { value: e.issuedOn })
907
- },
908
- {
909
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.sent"),
910
- key: "deliveryStatus",
911
- size: {
912
- max: "8rem",
913
- min: "8rem"
914
- },
915
- component: (e) => Y(an, { deliveryStatus: e.deliveryStatus })
916
- },
917
- {
918
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.settlement"),
919
- key: "status",
920
- size: {
921
- max: "10rem",
922
- min: "10rem"
923
- },
924
- component: (e) => Y(sn, { value: e })
925
- },
926
- {
927
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.approval"),
928
- key: "approval",
929
- size: {
930
- max: "12rem",
931
- min: "10rem"
932
- },
933
- component: (e) => Y(Yt, {
934
- hasChangesSinceApprovalSent: e.hasChangesSinceApprovalSent && e.lifecycleStatus !== m.FINALIZED,
935
- approval: e.approval,
936
- requiresPriorApproval: e.requiresPriorApproval
937
- })
938
- },
939
- {
940
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.due_date"),
941
- key: "dueOn",
942
- size: {
943
- max: "16rem",
944
- min: "16rem"
945
- },
946
- component: (e) => Y(Zt, {
947
- isOverdue: e.isOverdue,
948
- value: e.dueOn
949
- })
950
- },
951
- {
952
- headerLabel: n.t("wise_invoicing.invoice.overview.columns.amount_excl_vat"),
953
- key: t.NET_AMOUNT,
954
- size: {
955
- max: "1fr",
956
- min: "10rem"
957
- },
958
- component: (e) => Y(Jt, { value: e })
959
- },
960
- ...r
961
- ]);
962
- });
963
- }
964
- //#endregion
965
- //#region src/modules/invoice/api/mutations/invoiceBulkFinalize.mutation.ts
966
- function ln() {
967
- return U({
968
- queryFn: (e) => b.bulkFinalize(e.params.target),
969
- queryKeysToInvalidate: { invoiceDetail: {} }
970
- });
971
- }
972
- //#endregion
973
- //#region src/modules/invoice/use-cases/overview/utils/invoiceOverviewBulkActionFeedback.util.ts
974
- var un = {
975
- approval_already_sent_error: "wise_invoicing.invoice.overview.bulk.skip_reason.approval_already_sent",
976
- approval_requires_customer_prior_approval: "wise_invoicing.invoice.overview.bulk.skip_reason.approval_not_required",
977
- approval_requires_editable_invoice: "wise_invoicing.invoice.overview.bulk.skip_reason.not_editable",
978
- approval_requires_standard_invoice: "wise_invoicing.invoice.overview.bulk.skip_reason.not_standard",
979
- customer_has_no_approval_email: "wise_invoicing.invoice.overview.bulk.skip_reason.no_approval_email",
980
- customer_has_no_default_recipient: "wise_invoicing.invoice.overview.bulk.skip_reason.no_recipient",
981
- invoice_finalization_requires_approval: "wise_invoicing.invoice.finalize.blocked_by_approval",
982
- invoice_not_found: "wise_invoicing.invoice.overview.bulk.skip_reason.not_found"
983
- }, dn = k.object({
984
- approvalStatus: k.enum(r).nullable(),
985
- level: k.enum(l).nullable()
986
- }), fn = "wise_invoicing.invoice.overview.bulk.skip_reason.unknown", $ = class {
987
- static createEmptyPreview() {
988
- return {
989
- skipped: [],
990
- meta: {
991
- processed: 0,
992
- skipped: 0,
993
- total: 0
994
- }
995
- };
996
- }
997
- static createSkippedToast(e) {
998
- let t = [], n = {};
999
- for (let [r, i] of e.invoices.entries()) {
1000
- let a = `invoice${r}`, o = e.reasons?.[i.uuid];
1001
- t.push(o === void 0 ? `{${a}}` : `{${a}}: ${o}`), n[a] = {
1002
- label: this.getInvoiceLabel(i),
1003
- to: this.getInvoiceDetailLink(i)
1004
- };
1005
- }
1006
- let r = t.join(e.reasons === void 0 ? ", " : " ");
1007
- return {
1008
- id: e.id,
1009
- duration: Infinity,
1010
- interactableModels: n,
1011
- message: r === "" ? e.message : `${e.message} ${r}`,
1012
- variant: "error"
1013
- };
1014
- }
1015
- static getBlockingApprovalStatusKeys(e) {
1016
- let t = {};
1017
- for (let n of e) {
1018
- let e = dn.safeParse(n.errors[0]?.errors[0]?.meta);
1019
- if (!e.success) continue;
1020
- let r = D.getDisplayStatus({
1021
- approval: e.data.approvalStatus === null ? null : {
1022
- reminderSentAt: null,
1023
- sentAt: null,
1024
- level: e.data.level,
1025
- status: e.data.approvalStatus
1026
- },
1027
- requiresPriorApproval: !0
1028
- });
1029
- r !== null && (t[n.uuid] = D.getMetadata(r).translationKey);
1030
- }
1031
- return t;
1032
- }
1033
- static getInvoiceDetailLink(e) {
1034
- return e.type === p.CREDIT_NOTE ? {
1035
- name: "invoicing-credit-note-detail",
1036
- params: { creditNoteUuid: e.uuid }
1037
- } : {
1038
- name: "invoicing-invoice-detail",
1039
- params: { invoiceUuid: e.uuid }
1040
- };
1041
- }
1042
- static getInvoiceLabel(e) {
1043
- return e.sequence ?? e.subject ?? e.customerName;
1044
- }
1045
- static getSkipReasonKeys(e) {
1046
- let t = {};
1047
- for (let n of e) {
1048
- let e = n.errors[0]?.errors[0]?.code;
1049
- t[n.uuid] = e === void 0 ? fn : un[e] ?? fn;
1050
- }
1051
- return t;
1052
- }
1053
- static getUnskippedInvoiceUuids(e, t) {
1054
- let n = new Set(t.map((e) => e.uuid));
1055
- return e.filter((e) => !n.has(e.uuid)).map((e) => e.uuid);
1056
- }
1057
- };
1058
- //#endregion
1059
- //#region src/modules/invoice/use-cases/overview/composables/invoiceOverviewBulkActionPlan.composable.ts
1060
- function pn(e) {
1061
- let t = j(() => e.preview()?.meta.processed ?? 0), n = j(() => $.getUnskippedInvoiceUuids(e.eligibleInvoices(), e.preview()?.skipped ?? [])), r = j(() => {
1062
- let t = e.matching();
1063
- if (t !== null) return t.target;
1064
- let n = e.eligibleInvoices().map((e) => e.uuid);
1065
- return n.length === 0 ? null : {
1066
- invoiceUuids: n,
1067
- type: "invoices"
1068
- };
1069
- }), i = j(() => {
1070
- let r = e.matching();
1071
- return r === null ? n.value.length === 0 ? null : {
1072
- invoiceUuids: n.value,
1073
- type: "invoices"
1074
- } : t.value > 0 ? r.target : null;
1075
- }), a = j(() => {
1076
- if (e.matching() !== null) {
1077
- let t = new Set((e.preview()?.skipped ?? []).map((e) => e.uuid));
1078
- return e.invoices().filter((e) => t.has(e.uuid));
1079
- }
1080
- let t = new Set(n.value);
1081
- return e.invoices().filter((e) => !t.has(e.uuid));
1082
- }), o = j(() => e.matching() === null ? a.value.length : e.preview()?.meta.skipped ?? 0), s = j(() => e.preview() === null ? e.matching()?.count ?? e.invoices().length : t.value);
1083
- function c(t, n) {
1084
- let r = new Set(n.map((e) => e.uuid));
1085
- return (t.type === "invoices" ? t.invoiceUuids : e.invoices().map((e) => e.uuid)).filter((e) => !r.has(e));
1086
- }
1087
- return {
1088
- getProcessedInvoiceUuids: c,
1089
- previewTarget: r,
1090
- processableCount: t,
1091
- skippedCount: o,
1092
- skippedInvoices: a,
1093
- submitTarget: i,
1094
- titleCount: s
1095
- };
1096
- }
1097
- //#endregion
1098
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkActionDialog.vue?vue&type=script&setup=true&lang.ts
1099
- var mn = {
1100
- key: 0,
1101
- class: "text-sm text-error-primary"
1102
- }, hn = {
1103
- key: 1,
1104
- class: "text-sm text-secondary"
1105
- }, gn = {
1106
- key: 0,
1107
- class: "text-sm text-primary"
1108
- }, _n = {
1109
- key: 1,
1110
- class: "text-sm text-secondary"
1111
- }, vn = { class: "text-sm text-secondary" }, yn = {
1112
- key: 0,
1113
- class: "text-xs text-tertiary"
1114
- }, bn = /* @__PURE__ */ L({
1115
- __name: "InvoiceOverviewBulkActionDialog",
1116
- props: {
1117
- title: {},
1118
- isPreviewLoading: { type: Boolean },
1119
- isSubmitting: { type: Boolean },
1120
- confirmLabel: {},
1121
- description: {},
1122
- icon: {},
1123
- loadingLabel: {},
1124
- noneProcessableLabel: {},
1125
- previewErrorLabel: {},
1126
- processableCount: {},
1127
- processableLabel: {},
1128
- skippedInvoices: {},
1129
- skippedPreviewLabel: {},
1130
- skipReasons: {}
1131
- },
1132
- emits: ["close", "confirm"],
1133
- setup(e, { emit: t }) {
1134
- let n = e, r = t;
1135
- return (e, t) => (R(), M(V(at), {
1136
- size: "sm",
1137
- onClose: t[1] ||= (e) => r("close")
1138
- }, {
1139
- default: H(() => [
1140
- I(V(dt), {
1141
- title: n.title,
1142
- description: n.description,
1143
- icon: n.icon
1144
- }, null, 8, [
1145
- "title",
1146
- "description",
1147
- "icon"
1148
- ]),
1149
- I(V(ot), null, {
1150
- default: H(() => [I(V(G), null, {
1151
- default: H(() => [n.previewErrorLabel === null ? n.isPreviewLoading ? (R(), P("p", hn, B(n.loadingLabel), 1)) : (R(), P(Ie, { key: 2 }, [n.processableCount > 0 ? (R(), P("p", gn, B(n.processableLabel), 1)) : (R(), P("p", _n, B(n.noneProcessableLabel), 1)), n.skippedInvoices.length > 0 ? (R(), M(V(G), {
1152
- key: 2,
1153
- gap: "sm",
1154
- class: "rounded-lg border border-secondary bg-secondary p-md"
1155
- }, {
1156
- default: H(() => [F("p", vn, B(n.skippedPreviewLabel), 1), I(V(G), { gap: "xs" }, {
1157
- default: H(() => [(R(!0), P(Ie, null, Ue(n.skippedInvoices, (e) => (R(), M(V(G), {
1158
- key: e.uuid,
1159
- gap: "none"
1160
- }, {
1161
- default: H(() => [I(V(Ze), {
1162
- to: V($).getInvoiceDetailLink(e),
1163
- class: "text-sm text-brand-primary hover:underline"
1164
- }, {
1165
- default: H(() => [Le(B(V($).getInvoiceLabel(e)), 1)]),
1166
- _: 2
1167
- }, 1032, ["to"]), n.skipReasons?.[e.uuid] === void 0 ? N("", !0) : (R(), P("p", yn, B(n.skipReasons[e.uuid]), 1))]),
1168
- _: 2
1169
- }, 1024))), 128))]),
1170
- _: 1
1171
- })]),
1172
- _: 1
1173
- })) : N("", !0)], 64)) : (R(), P("p", mn, B(n.previewErrorLabel), 1))]),
1174
- _: 1
1175
- })]),
1176
- _: 1
1177
- }),
1178
- I(V(st), null, {
1179
- right: H(() => [I(V(ct)), I(V(lt), {
1180
- "is-disabled": n.isPreviewLoading || n.processableCount === 0,
1181
- "is-loading": n.isSubmitting,
1182
- label: n.confirmLabel,
1183
- onClick: t[0] ||= (e) => r("confirm")
1184
- }, null, 8, [
1185
- "is-disabled",
1186
- "is-loading",
1187
- "label"
1188
- ])]),
1189
- _: 1
1190
- })
1191
- ]),
1192
- _: 1
1193
- }));
1194
- }
1195
- }), xn = /* @__PURE__ */ L({
1196
- __name: "InvoiceOverviewBulkFinalizeDialog",
1197
- props: {
1198
- invoices: {},
1199
- matching: {},
1200
- onFinalized: { type: Function }
1201
- },
1202
- emits: ["close"],
1203
- setup(e, { emit: t }) {
1204
- let n = e, r = t, i = A(), o = X(), s = ln(), c = z(!0), l = z(!1), u = z(null), d = z(null), { getProcessedInvoiceUuids: f, previewTarget: p, processableCount: h, skippedCount: g, skippedInvoices: _, submitTarget: v, titleCount: y } = pn({
1205
- eligibleInvoices: () => n.invoices.filter((e) => e.status === a.READY),
1206
- invoices: () => n.invoices,
1207
- matching: () => n.matching,
1208
- preview: () => u.value
1209
- }), x = j(() => {
1210
- let e = u.value?.skipped ?? [], t = $.getSkipReasonKeys(e), n = $.getBlockingApprovalStatusKeys(e);
1211
- return Object.fromEntries(Object.entries(t).map(([e, t]) => {
1212
- let r = n[e];
1213
- return [e, i.t(t, { status: r === void 0 ? "" : i.t(r) })];
1214
- }));
1215
- });
1216
- async function S() {
1217
- let e = v.value;
1218
- if (e === null || l.value) return;
1219
- l.value = !0;
1220
- let t = await s.execute({ params: { target: e } });
1221
- if (l.value = !1, t.isErr()) {
1222
- o.apiError(t.error);
1223
- return;
1224
- }
1225
- let c = f(e, t.value.skipped);
1226
- u.value = t.value, c.length > 0 && O.reflectBulkAction(c, {
1227
- lifecycleStatus: m.FINALIZED,
1228
- status: a.FINALIZED
1229
- }), t.value.meta.processed > 0 && o.show({ message: i.t("wise_invoicing.invoice.overview.bulk.finalize.success", { count: t.value.meta.processed }) }), g.value > 0 && o.show($.createSkippedToast({
1230
- id: "invoice-overview-bulk-finalize-skipped",
1231
- invoices: _.value,
1232
- message: i.t("wise_invoicing.invoice.overview.bulk.finalize.skipped", { count: g.value })
1233
- })), t.value.meta.processed !== 0 && (n.onFinalized(), r("close"));
1234
- }
1235
- async function ee() {
1236
- c.value = !0;
1237
- let e = p.value;
1238
- if (e === null) {
1239
- u.value = $.createEmptyPreview(), c.value = !1;
1240
- return;
1241
- }
1242
- let t = await b.previewBulkFinalize(e);
1243
- if (t.isErr()) {
1244
- d.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), c.value = !1;
1245
- return;
1246
- }
1247
- u.value = t.value, c.value = !1;
1248
- }
1249
- return He(() => {
1250
- ee();
1251
- }), (e, t) => (R(), M(bn, {
1252
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.confirm"),
1253
- description: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.description"),
1254
- icon: V(ae),
1255
- "is-preview-loading": c.value,
1256
- "is-submitting": l.value,
1257
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.loading"),
1258
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.none_processable"),
1259
- "preview-error-label": d.value,
1260
- "processable-count": V(h),
1261
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.processable", { count: V(h) }),
1262
- "skip-reasons": x.value,
1263
- "skipped-invoices": V(_),
1264
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.finalize.skipped_preview", { count: V(g) }),
1265
- title: V(i).t("wise_invoicing.invoice.overview.bulk.finalize.title", { count: V(y) }),
1266
- onClose: t[0] ||= (e) => r("close"),
1267
- onConfirm: S
1268
- }, null, 8, [
1269
- "confirm-label",
1270
- "description",
1271
- "icon",
1272
- "is-preview-loading",
1273
- "is-submitting",
1274
- "loading-label",
1275
- "none-processable-label",
1276
- "preview-error-label",
1277
- "processable-count",
1278
- "processable-label",
1279
- "skip-reasons",
1280
- "skipped-invoices",
1281
- "skipped-preview-label",
1282
- "title"
1283
- ]));
1284
- }
1285
- });
1286
- //#endregion
1287
- //#region src/modules/invoice/api/mutations/invoiceBulkMarkAsReady.mutation.ts
1288
- function Sn() {
1289
- return U({
1290
- queryFn: (e) => b.bulkMarkAsReady(e.params.target),
1291
- queryKeysToInvalidate: { invoiceDetail: {} }
1292
- });
1293
- }
1294
- //#endregion
1295
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkMarkAsReadyDialog.vue
1296
- var Cn = /* @__PURE__ */ L({
1297
- __name: "InvoiceOverviewBulkMarkAsReadyDialog",
1298
- props: {
1299
- invoices: {},
1300
- matching: {},
1301
- onMarkedAsReady: { type: Function }
1302
- },
1303
- emits: ["close"],
1304
- setup(e, { emit: t }) {
1305
- let n = e, r = t, i = A(), o = X(), s = Sn(), c = z(!0), l = z(!1), u = z(null), d = z(null), { getProcessedInvoiceUuids: f, previewTarget: p, processableCount: h, skippedCount: g, skippedInvoices: _, submitTarget: v, titleCount: y } = pn({
1306
- eligibleInvoices: () => n.invoices.filter((e) => e.status === a.DRAFT),
1307
- invoices: () => n.invoices,
1308
- matching: () => n.matching,
1309
- preview: () => u.value
1310
- });
1311
- async function x() {
1312
- let e = v.value;
1313
- if (e === null || l.value) return;
1314
- l.value = !0;
1315
- let t = await s.execute({ params: { target: e } });
1316
- if (l.value = !1, t.isErr()) {
1317
- o.apiError(t.error);
1318
- return;
1319
- }
1320
- let c = f(e, t.value.skipped);
1321
- u.value = t.value, c.length > 0 && O.reflectBulkAction(c, {
1322
- lifecycleStatus: m.READY,
1323
- status: a.READY
1324
- }), t.value.meta.processed > 0 && o.show({ message: i.t("wise_invoicing.invoice.overview.bulk.mark_as_ready.success", { count: t.value.meta.processed }) }), g.value > 0 && o.show($.createSkippedToast({
1325
- id: "invoice-overview-bulk-mark-as-ready-skipped",
1326
- invoices: _.value,
1327
- message: i.t("wise_invoicing.invoice.overview.bulk.mark_as_ready.skipped", { count: g.value })
1328
- })), t.value.meta.processed !== 0 && (n.onMarkedAsReady(), r("close"));
1329
- }
1330
- async function S() {
1331
- c.value = !0;
1332
- let e = p.value;
1333
- if (e === null) {
1334
- u.value = $.createEmptyPreview(), c.value = !1;
1335
- return;
1336
- }
1337
- let t = await b.previewBulkMarkAsReady(e);
1338
- if (t.isErr()) {
1339
- d.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), c.value = !1;
1340
- return;
1341
- }
1342
- u.value = t.value, c.value = !1;
1343
- }
1344
- return He(() => {
1345
- S();
1346
- }), (e, t) => (R(), M(bn, {
1347
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.confirm"),
1348
- description: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.description"),
1349
- icon: V(de),
1350
- "is-preview-loading": c.value,
1351
- "is-submitting": l.value,
1352
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.loading"),
1353
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.none_processable"),
1354
- "preview-error-label": d.value,
1355
- "processable-count": V(h),
1356
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.processable", { count: V(h) }),
1357
- "skipped-invoices": V(_),
1358
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.skipped_preview", { count: V(g) }),
1359
- title: V(i).t("wise_invoicing.invoice.overview.bulk.mark_as_ready.title", { count: V(y) }),
1360
- onClose: t[0] ||= (e) => r("close"),
1361
- onConfirm: x
1362
- }, null, 8, [
1363
- "confirm-label",
1364
- "description",
1365
- "icon",
1366
- "is-preview-loading",
1367
- "is-submitting",
1368
- "loading-label",
1369
- "none-processable-label",
1370
- "preview-error-label",
1371
- "processable-count",
1372
- "processable-label",
1373
- "skipped-invoices",
1374
- "skipped-preview-label",
1375
- "title"
1376
- ]));
1377
- }
1378
- });
1379
- //#endregion
1380
- //#region src/modules/invoice/api/mutations/invoiceBulkSendApproval.mutation.ts
1381
- function wn() {
1382
- return U({
1383
- queryFn: (e) => b.bulkSendApproval(e.params.target),
1384
- queryKeysToInvalidate: {
1385
- invoiceApprovalIndex: {},
1386
- invoiceDetail: {}
1387
- }
1388
- });
1389
- }
1390
- //#endregion
1391
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkSendApprovalDialog.vue
1392
- var Tn = /* @__PURE__ */ L({
1393
- __name: "InvoiceOverviewBulkSendApprovalDialog",
1394
- props: {
1395
- invoices: {},
1396
- matching: {},
1397
- onSent: { type: Function }
1398
- },
1399
- emits: ["close"],
1400
- setup(e, { emit: t }) {
1401
- let n = e, a = t, o = A(), s = X(), c = wn(), l = z(!0), u = z(!1), d = z(null), f = z(null), { getProcessedInvoiceUuids: p, previewTarget: m, processableCount: h, skippedCount: g, skippedInvoices: _, submitTarget: v, titleCount: y } = pn({
1402
- eligibleInvoices: () => n.invoices.filter((e) => {
1403
- let t = D.getDisplayStatus({
1404
- approval: e.approval,
1405
- requiresPriorApproval: e.requiresPriorApproval
1406
- });
1407
- return t !== null && t !== i.APPROVED;
1408
- }),
1409
- invoices: () => n.invoices,
1410
- matching: () => n.matching,
1411
- preview: () => d.value
1412
- }), x = j(() => {
1413
- let e = $.getSkipReasonKeys(d.value?.skipped ?? []), t = {};
1414
- for (let n of _.value) {
1415
- let r = e[n.uuid];
1416
- if (r !== void 0) {
1417
- t[n.uuid] = o.t(r);
1418
- continue;
1419
- }
1420
- let a = D.getDisplayStatus({
1421
- approval: n.approval,
1422
- requiresPriorApproval: n.requiresPriorApproval
1423
- });
1424
- t[n.uuid] = a === i.APPROVED ? o.t("wise_invoicing.invoice.overview.bulk.skip_reason.already_approved") : o.t("wise_invoicing.invoice.overview.bulk.skip_reason.approval_not_required");
1425
- }
1426
- return t;
1427
- });
1428
- async function S() {
1429
- let e = v.value;
1430
- if (e === null || u.value) return;
1431
- let t = _.value, i = x.value;
1432
- u.value = !0;
1433
- let l = await c.execute({ params: { target: e } });
1434
- if (u.value = !1, l.isErr()) {
1435
- s.apiError(l.error);
1436
- return;
1437
- }
1438
- let d = new Set(l.value.skipped.map((e) => e.uuid)), f = n.invoices.filter((e) => d.has(e.uuid)), m = n.matching === null ? [...t, ...f] : f, h = n.matching === null ? m.length : l.value.meta.skipped, g = p(e, l.value.skipped);
1439
- if (g.length > 0 && O.reflectBulkAction(g, {
1440
- hasChangesSinceApprovalSent: !1,
1441
- approval: {
1442
- reminderSentAt: null,
1443
- sentAt: $e.Now.instant(),
1444
- level: null,
1445
- status: r.REQUESTED
1446
- }
1447
- }), l.value.meta.processed > 0 && s.show({ message: o.t("wise_invoicing.invoice.overview.bulk.send_approval.success", { count: l.value.meta.processed }) }), h > 0) {
1448
- let e = { ...i }, t = $.getSkipReasonKeys(l.value.skipped);
1449
- for (let [n, r] of Object.entries(t)) e[n] = o.t(r);
1450
- s.show($.createSkippedToast({
1451
- id: "invoice-overview-bulk-send-approval-skipped",
1452
- invoices: m,
1453
- message: o.t("wise_invoicing.invoice.overview.bulk.send_approval.skipped", { count: h }),
1454
- reasons: e
1455
- }));
1456
- }
1457
- l.value.meta.processed !== 0 && (n.onSent(), a("close"));
1458
- }
1459
- async function ee() {
1460
- l.value = !0;
1461
- let e = m.value;
1462
- if (e === null) {
1463
- d.value = $.createEmptyPreview(), l.value = !1;
1464
- return;
1465
- }
1466
- let t = await b.previewBulkSendApproval(e);
1467
- if (t.isErr()) {
1468
- f.value = o.t("wise_invoicing.invoice.overview.bulk.preview_error"), l.value = !1;
1469
- return;
1470
- }
1471
- d.value = t.value, l.value = !1;
1472
- }
1473
- return He(() => {
1474
- ee();
1475
- }), (e, t) => (R(), M(bn, {
1476
- "confirm-label": V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.confirm"),
1477
- description: V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.description"),
1478
- icon: V(oe),
1479
- "is-preview-loading": l.value,
1480
- "is-submitting": u.value,
1481
- "loading-label": V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.loading"),
1482
- "none-processable-label": V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.none_processable"),
1483
- "preview-error-label": f.value,
1484
- "processable-count": V(h),
1485
- "processable-label": V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.processable", { count: V(h) }),
1486
- "skip-reasons": x.value,
1487
- "skipped-invoices": V(_),
1488
- "skipped-preview-label": V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.skipped_preview", { count: V(g) }),
1489
- title: V(o).t("wise_invoicing.invoice.overview.bulk.send_approval.title", { count: V(y) }),
1490
- onClose: t[0] ||= (e) => a("close"),
1491
- onConfirm: S
1492
- }, null, 8, [
1493
- "confirm-label",
1494
- "description",
1495
- "icon",
1496
- "is-preview-loading",
1497
- "is-submitting",
1498
- "loading-label",
1499
- "none-processable-label",
1500
- "preview-error-label",
1501
- "processable-count",
1502
- "processable-label",
1503
- "skip-reasons",
1504
- "skipped-invoices",
1505
- "skipped-preview-label",
1506
- "title"
1507
- ]));
1508
- }
1509
- });
1510
- //#endregion
1511
- //#region src/modules/invoice/api/mutations/invoiceBulkSend.mutation.ts
1512
- function En() {
1513
- return U({
1514
- queryFn: (e) => b.bulkSend(e.params.target),
1515
- queryKeysToInvalidate: { invoiceDetail: {} }
1516
- });
1517
- }
1518
- //#endregion
1519
- //#region src/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkSendDialog.vue
1520
- var Dn = /* @__PURE__ */ L({
1521
- __name: "InvoiceOverviewBulkSendDialog",
1522
- props: {
1523
- invoices: {},
1524
- matching: {},
1525
- onSent: { type: Function }
1526
- },
1527
- emits: ["close"],
1528
- setup(e, { emit: t }) {
1529
- let n = e, r = t, i = A(), o = X(), s = En(), c = z(!0), l = z(!1), u = z(null), d = z(null), { getProcessedInvoiceUuids: p, previewTarget: m, processableCount: h, skippedCount: g, skippedInvoices: _, submitTarget: v, titleCount: y } = pn({
1530
- eligibleInvoices: () => n.invoices.filter((e) => e.status === a.FINALIZED),
1531
- invoices: () => n.invoices,
1532
- matching: () => n.matching,
1533
- preview: () => u.value
1534
- });
1535
- async function x() {
1536
- let e = v.value;
1537
- if (e === null || l.value) return;
1538
- l.value = !0;
1539
- let t = await s.execute({ params: { target: e } });
1540
- if (l.value = !1, t.isErr()) {
1541
- o.apiError(t.error);
1542
- return;
1543
- }
1544
- let a = p(e, t.value.skipped);
1545
- u.value = t.value, a.length > 0 && O.reflectBulkAction(a, { deliveryStatus: f.PROCESSING }), t.value.meta.processed > 0 && o.show({ message: i.t("wise_invoicing.invoice.overview.bulk.send.success", { count: t.value.meta.processed }) }), g.value > 0 && o.show($.createSkippedToast({
1546
- id: "invoice-overview-bulk-send-skipped",
1547
- invoices: _.value,
1548
- message: i.t("wise_invoicing.invoice.overview.bulk.send.skipped", { count: g.value })
1549
- })), t.value.meta.processed !== 0 && (n.onSent(), r("close"));
1550
- }
1551
- async function S() {
1552
- c.value = !0;
1553
- let e = m.value;
1554
- if (e === null) {
1555
- u.value = $.createEmptyPreview(), c.value = !1;
1556
- return;
1557
- }
1558
- let t = await b.previewBulkSend(e);
1559
- if (t.isErr()) {
1560
- d.value = i.t("wise_invoicing.invoice.overview.bulk.preview_error"), c.value = !1;
1561
- return;
1562
- }
1563
- u.value = t.value, c.value = !1;
1564
- }
1565
- return He(() => {
1566
- S();
1567
- }), (e, t) => (R(), M(bn, {
1568
- "confirm-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.confirm"),
1569
- description: V(i).t("wise_invoicing.invoice.overview.bulk.send.description"),
1570
- icon: V(oe),
1571
- "is-preview-loading": c.value,
1572
- "is-submitting": l.value,
1573
- "loading-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.loading"),
1574
- "none-processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.none_processable"),
1575
- "preview-error-label": d.value,
1576
- "processable-count": V(h),
1577
- "processable-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.processable", { count: V(h) }),
1578
- "skipped-invoices": V(_),
1579
- "skipped-preview-label": V(i).t("wise_invoicing.invoice.overview.bulk.send.skipped_preview", { count: V(g) }),
1580
- title: V(i).t("wise_invoicing.invoice.overview.bulk.send.title", { count: V(y) }),
1581
- onClose: t[0] ||= (e) => r("close"),
1582
- onConfirm: x
1583
- }, null, 8, [
1584
- "confirm-label",
1585
- "description",
1586
- "icon",
1587
- "is-preview-loading",
1588
- "is-submitting",
1589
- "loading-label",
1590
- "none-processable-label",
1591
- "preview-error-label",
1592
- "processable-count",
1593
- "processable-label",
1594
- "skipped-invoices",
1595
- "skipped-preview-label",
1596
- "title"
1597
- ]));
1598
- }
1599
- }), On = /* @__PURE__ */ L({
1600
- __name: "DateRangeFilterButton",
1601
- props: /*@__PURE__*/ ze({ ariaLabel: {} }, {
1602
- modelValue: { default: null },
1603
- modelModifiers: {}
1604
- }),
1605
- emits: ["update:modelValue"],
1606
- setup(e) {
1607
- let t = e, n = Ke(e, "modelValue"), r = A(), i = z(!1), a = z({
1608
- from: null,
1609
- until: null
1610
- });
1611
- qe(i, (e) => {
1612
- e && (a.value = {
1613
- from: n.value?.from ?? null,
1614
- until: n.value?.until ?? null
1615
- });
1616
- });
1617
- let o = he(), s = j(() => n.value === null ? r.t("component.date_range_filter_button.select_dates") : n.value.from !== null && n.value.until !== null && n.value.from.equals(n.value.until) ? o.formatPlainDate(n.value.from) : `${n.value.from === null ? "-" : o.formatPlainDate(n.value.from)} - ${n.value.until === null ? "-" : o.formatPlainDate(n.value.until)}`);
1618
- function c() {
1619
- n.value = a.value.from !== null || a.value.until !== null ? { ...a.value } : null, i.value = !1;
1620
- }
1621
- function l() {
1622
- i.value = !1;
1623
- }
1624
- function u() {
1625
- n.value = null, i.value = !1;
1626
- }
1627
- return (e, n) => (R(), M(V(mt), {
1628
- "is-open": i.value,
1629
- "onUpdate:isOpen": n[1] ||= (e) => i.value = e,
1630
- "popover-side": "bottom",
1631
- "popover-align": "end"
1632
- }, {
1633
- trigger: H(() => [I(V(W), {
1634
- "aria-label": t.ariaLabel,
1635
- label: s.value,
1636
- "icon-right": V(se),
1637
- variant: "secondary"
1638
- }, null, 8, [
1639
- "aria-label",
1640
- "label",
1641
- "icon-right"
1642
- ])]),
1643
- content: H(() => [I(V(it), {
1644
- modelValue: a.value,
1645
- "onUpdate:modelValue": n[0] ||= (e) => a.value = e,
1646
- class: "p-lg"
1647
- }, null, 8, ["modelValue"]), I(V(K), {
1648
- justify: "end",
1649
- gap: "sm",
1650
- class: "border-t border-secondary p-md"
1651
- }, {
1652
- default: H(() => [
1653
- I(V(W), {
1654
- label: V(r).t("shared.cancel"),
1655
- variant: "tertiary",
1656
- onClick: l
1657
- }, null, 8, ["label"]),
1658
- I(V(W), {
1659
- label: V(r).t("shared.clear"),
1660
- variant: "tertiary",
1661
- onClick: u
1662
- }, null, 8, ["label"]),
1663
- I(V(W), {
1664
- label: V(r).t("component.filters_date_range_dialog.apply"),
1665
- variant: "primary",
1666
- onClick: c
1667
- }, null, 8, ["label"])
1668
- ]),
1669
- _: 1
1670
- })]),
1671
- _: 1
1672
- }, 8, ["is-open"]));
1673
- }
1674
- }), kn = { class: "relative flex min-h-0 flex-1 flex-col" }, An = /* @__PURE__ */ L({
1675
- __name: "InvoiceOverviewView",
1676
- props: {
1677
- currency: {},
1678
- customFieldDefinitions: {},
1679
- onCreateInvoice: { type: Function }
1680
- },
1681
- setup(e) {
1682
- let n = e, r = A(), o = u(), s = Et(), c = s.create(It), l = s.create(xn), d = s.create(Cn), m = s.create(Dn), h = s.create(Tn), g = v({ debounceMs: 300 }), _ = kt("tab", "all"), b = y({
1683
- initialValues: [{
1684
- direction: "desc",
1685
- key: t.ISSUED_ON
1686
- }],
1687
- keys: [
1688
- t.CUSTOMER,
1689
- t.SEQUENCE,
1690
- t.ISSUED_ON,
1691
- t.NET_AMOUNT
1692
- ]
1693
- }), S = Ut(), ee = j(() => te.filterByView(n.customFieldDefinitions, x.INVOICE_OVERVIEW)), { hasChangesSinceApprovalSent: ne, approvalStatuses: re, customerUuids: ie, customFields: ae, dueOnRange: oe, filters: se, lifecycleStatuses: ce } = Vt({
1694
- currency: n.currency,
1695
- customFieldDefinitions: ee.value
1696
- });
1697
- be(se);
1698
- let le = z(null), ue = j(() => S.getFilters(_.value)), de = j(() => ({
1699
- hasChangesSinceApprovalSent: ne.value,
1700
- issuedOnRange: le.value,
1701
- approvalStatuses: re.value,
1702
- customerUuids: ie.value,
1703
- customFields: ae.value,
1704
- dueOnRange: oe.value,
1705
- lifecycleStatuses: ce.value,
1706
- ...ue.value
1707
- })), { isFetchingNextPage: me, isLoading: he, fetchNextPage: ge, refetch: _e, result: C } = At({ params: {
1708
- filters: de,
1709
- search: g.debouncedSearch,
1710
- sort: b.values
1711
- } });
1712
- o.set(() => r.t("wise_invoicing.invoice.overview.title"));
1713
- let ve = { name: () => r.t("wise_invoicing.invoice.overview.title") }, w = j(() => C.value.isOk() ? C.value.getValue().data : []), ye = j(() => C.value.isOk() ? C.value.getValue().meta.total : 0), T = Gt({
1714
- queryParams: () => ({
1715
- filters: de.value,
1716
- search: g.debouncedSearch.value
1717
- }),
1718
- rows: () => w.value,
1719
- totalCount: () => ye.value
1720
- });
1721
- pe({
1722
- refetch: _e,
1723
- sendingUuids: () => w.value.filter((e) => e.deliveryStatus === f.PROCESSING).map((e) => e.uuid)
1724
- });
1725
- let E = cn({ customFieldDefinitions: () => ee.value }), { customizedColumns: Ce, customizeTableAction: we } = Dt({
1726
- actionGroup: ve,
1727
- availableColumns: E,
1728
- initialState: Ye("invoice-overview-columns", []).value
1729
- }), Te = j(() => C.value.isErr() ? C.value.getError() : null), Ee = j(() => se.activeFilters.value.length), De = j(() => (g.debouncedSearch.value?.trim().length ?? 0) > 0), Oe = j(() => T.matching.value !== null), ke = j(() => Oe.value || T.selectedInvoices.value.some((e) => e.status === a.READY)), Ae = j(() => Oe.value || T.selectedInvoices.value.some((e) => e.status === a.DRAFT)), { canSend: je } = zt({
1730
- matching: () => T.matching.value,
1731
- selectedInvoices: () => T.selectedInvoices.value
1732
- }), Me = j(() => Oe.value || T.selectedInvoices.value.some((e) => {
1733
- let t = D.getDisplayStatus({
1734
- approval: e.approval,
1735
- requiresPriorApproval: e.requiresPriorApproval
1736
- });
1737
- return t !== null && t !== i.APPROVED;
1738
- }));
1739
- function O() {
1740
- if (n.onCreateInvoice !== void 0) {
1741
- n.onCreateInvoice();
1742
- return;
1743
- }
1744
- c.open();
1745
- }
1746
- async function Ne() {
1747
- await d.open({
1748
- invoices: T.selectedInvoices.value,
1749
- matching: T.matching.value,
1750
- onMarkedAsReady: () => {
1751
- T.clearSelection();
1752
- }
1753
- });
1754
- }
1755
- async function Pe() {
1756
- await l.open({
1757
- invoices: T.selectedInvoices.value,
1758
- matching: T.matching.value,
1759
- onFinalized: () => {
1760
- T.clearSelection();
1761
- }
1762
- });
1763
- }
1764
- async function Fe() {
1765
- await m.open({
1766
- invoices: T.selectedInvoices.value,
1767
- matching: T.matching.value,
1768
- onSent: () => {
1769
- T.clearSelection();
1770
- }
1771
- });
1772
- }
1773
- async function k() {
1774
- await h.open({
1775
- invoices: T.selectedInvoices.value,
1776
- matching: T.matching.value,
1777
- onSent: () => {
1778
- T.clearSelection();
1779
- }
1780
- });
1781
- }
1782
- function N(e) {
1783
- return e.type === p.CREDIT_NOTE ? {
1784
- name: "invoicing-credit-note-detail",
1785
- params: { creditNoteUuid: e.uuid }
1786
- } : {
1787
- name: "invoicing-invoice-detail",
1788
- params: { invoiceUuid: e.uuid }
1789
- };
1790
- }
1791
- return (e, t) => (R(), M(V(nt), { title: V(r).t("wise_invoicing.invoice.overview.title") }, {
1792
- "page-actions-left": H(() => [I(V(vt), {
1793
- modelValue: V(_),
1794
- "onUpdate:modelValue": t[0] ||= (e) => Re(_) ? _.value = e : null,
1795
- variant: "button-border"
1796
- }, {
1797
- default: H(() => [I(V(bt), null, {
1798
- default: H(() => [(R(!0), P(Ie, null, Ue(V(S).tabs.value, (e) => (R(), M(V(yt), {
1799
- key: e.key,
1800
- value: e.key,
1801
- label: e.label
1802
- }, null, 8, ["value", "label"]))), 128))]),
1803
- _: 1
1804
- })]),
1805
- _: 1
1806
- }, 8, ["modelValue"])]),
1807
- default: H(() => [
1808
- I(V(rt), null, {
1809
- left: H(() => [I(V(K), { class: "items-stretch" }, {
1810
- default: H(() => [I(On, {
1811
- modelValue: le.value,
1812
- "onUpdate:modelValue": t[1] ||= (e) => le.value = e,
1813
- "aria-label": V(r).t("wise_invoicing.invoice.overview.filters.issued_on")
1814
- }, null, 8, ["modelValue", "aria-label"]), I(V(xt), {
1815
- modelValue: V(g).search.value,
1816
- "onUpdate:modelValue": t[2] ||= (e) => V(g).search.value = e,
1817
- label: null,
1818
- "icon-left": V(fe),
1819
- placeholder: V(r).t("wise_invoicing.common.search"),
1820
- size: "sm",
1821
- type: "search"
1822
- }, null, 8, [
1823
- "modelValue",
1824
- "icon-left",
1825
- "placeholder"
1826
- ])]),
1827
- _: 1
1828
- })]),
1829
- right: H(() => [I(V(K), { justify: "end" }, {
1830
- default: H(() => [We(e.$slots, "actions"), I(V(W), {
1831
- label: V(r).t("wise_invoicing.invoice.create.title"),
1832
- onClick: O
1833
- }, null, 8, ["label"])]),
1834
- _: 3
1835
- })]),
1836
- _: 3
1837
- }),
1838
- I(V(rt), null, {
1839
- default: H(() => [I(V(K), { justify: "between" }, {
1840
- default: H(() => [I(V(xe)), I(V(Se))]),
1841
- _: 1
1842
- })]),
1843
- _: 1
1844
- }),
1845
- F("div", kn, [(R(), M(V(ht), {
1846
- key: V(T).tableKey.value,
1847
- columns: V(Ce),
1848
- data: w.value,
1849
- "is-loading": V(he),
1850
- "is-fetching-next-page": V(me),
1851
- error: Te.value,
1852
- "is-selectable": !0,
1853
- "has-active-search": De.value,
1854
- "active-filter-count": Ee.value,
1855
- "get-key": (e) => e.uuid,
1856
- "header-actions": [V(we)],
1857
- "get-link": N,
1858
- "get-action-model": (e) => ({
1859
- modelName: "Invoice",
1860
- key: e.uuid,
1861
- ...e
1862
- }),
1863
- onNextPage: V(ge),
1864
- onClearSearch: t[3] ||= (e) => V(g).clear(),
1865
- onClearFilters: t[4] ||= (e) => V(se).clearAll(),
1866
- onSelect: V(T).onSelect
1867
- }, null, 8, [
1868
- "columns",
1869
- "data",
1870
- "is-loading",
1871
- "is-fetching-next-page",
1872
- "error",
1873
- "has-active-search",
1874
- "active-filter-count",
1875
- "get-key",
1876
- "header-actions",
1877
- "get-action-model",
1878
- "onNextPage",
1879
- "onSelect"
1880
- ])), I(Rt, {
1881
- "can-finalize": ke.value,
1882
- "can-mark-as-ready": Ae.value,
1883
- "can-send": V(je),
1884
- "can-send-approval": Me.value,
1885
- "selected-count": V(T).selectedCount.value,
1886
- onCancel: t[5] ||= (e) => V(T).clearSelection(),
1887
- onFinalize: t[6] ||= (e) => Pe(),
1888
- onMarkAsReady: t[7] ||= (e) => Ne(),
1889
- onSend: t[8] ||= (e) => Fe(),
1890
- onSendApproval: t[9] ||= (e) => k()
1891
- }, null, 8, [
1892
- "can-finalize",
1893
- "can-mark-as-ready",
1894
- "can-send",
1895
- "can-send-approval",
1896
- "selected-count"
1897
- ])])
1898
- ]),
1899
- _: 3
1900
- }, 8, ["title"]));
1901
- }
1902
- }), jn = /*@__PURE__*/ L({
1903
- __name: "InvoiceOverviewViewDataProvider",
1904
- props: { onCreateInvoice: { type: Function } },
1905
- setup(e) {
1906
- let t = S(j(() => ({ entityTypes: [c.INVOICE] }))), n = Pe();
1907
- return (r, i) => (R(), M(ge, { queries: {
1908
- customFieldDefinitions: V(t),
1909
- issuerSettings: V(n)
1910
- } }, {
1911
- default: H(({ data: t }) => [I(An, {
1912
- currency: t.issuerSettings.currency,
1913
- "custom-field-definitions": t.customFieldDefinitions,
1914
- "on-create-invoice": e.onCreateInvoice
1915
- }, {
1916
- actions: H(() => [We(r.$slots, "actions")]),
1917
- _: 3
1918
- }, 8, [
1919
- "currency",
1920
- "custom-field-definitions",
1921
- "on-create-invoice"
1922
- ])]),
1923
- loading: H(() => [I(V(Fe).PageLoadingState, { breadcrumbs: [] })]),
1924
- _: 3
1925
- }, 8, ["queries"]));
1926
- }
1927
- }), Mn = /* @__PURE__ */ e({ default: () => Nn }), Nn = jn;
1928
- //#endregion
1929
- export { At as a, Yt as i, Mn as n, Xt as r, Nn as t };