@wisemen/wise-invoicing-web 0.0.0-alpha.1

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 (85) hide show
  1. package/dist/AddOpenBoundaryIcon-BEbt7idt.js +28 -0
  2. package/dist/AirlineIcon-CiRX64yU.js +31 -0
  3. package/dist/AirplaneIcon-ySlq4lyE.js +21 -0
  4. package/dist/AirportIcon-B84mgPeW.js +18 -0
  5. package/dist/AlertTriangleIcon-CBaygowk.js +24 -0
  6. package/dist/AllocationsIcon-BEq-KzFl.js +18 -0
  7. package/dist/ArrowNarrowRightIcon-CeV9G-PX.js +24 -0
  8. package/dist/AssetIcon-CgYKjgAv.js +18 -0
  9. package/dist/BarChartIcon-180sKdWD.js +24 -0
  10. package/dist/BellIcon-k_e3dHc9.js +23 -0
  11. package/dist/BillingDocumentDetailViewDataProvider.css +1 -0
  12. package/dist/BillingDocumentDetailViewDataProvider.vue_vue_type_script_setup_true_lang-CWKBYgXH.js +5161 -0
  13. package/dist/BuildingIcon-vsvoi83j.js +24 -0
  14. package/dist/ChargerIcon-Bp3Up7jS.js +18 -0
  15. package/dist/ChevronDownIcon-D9nXH3kA.js +24 -0
  16. package/dist/ChevronUpIcon-CkYZnNds.js +24 -0
  17. package/dist/ClockIcon-DltYwVJC.js +24 -0
  18. package/dist/ClockSnoozeIcon-x_plYT2B.js +24 -0
  19. package/dist/CopyIcon-DOqno1Gb.js +21 -0
  20. package/dist/CreditNoteDetailViewDataProvider-Dc_APzSS.js +873 -0
  21. package/dist/CreditNotePdfViewDataProvider-zdBDlMRD.js +36 -0
  22. package/dist/DownloadCloudIcon-CHztnC6f.js +24 -0
  23. package/dist/EditIcon-L73PCCiu.js +23 -0
  24. package/dist/EraserIcon-CRVRD-F9.js +24 -0
  25. package/dist/FileIcon-Fuwo_cD0.js +26 -0
  26. package/dist/FilterLinesIcon-CRaEthek.js +24 -0
  27. package/dist/GlobeIcon-UmFqS-_n.js +24 -0
  28. package/dist/HelpIcon-CyOF59jk.js +26 -0
  29. package/dist/HourGlassIcon-mbgmoOa_.js +24 -0
  30. package/dist/InfoCircleIcon-DdlwGcMV.js +24 -0
  31. package/dist/InvoiceDetailViewDataProvider-DeS1LPn1.js +1942 -0
  32. package/dist/InvoiceOverviewView-BELZjC4d.js +14297 -0
  33. package/dist/InvoicePdfViewDataProvider-CzzbJS9s.js +36 -0
  34. package/dist/InvoicePublicPdfViewDataProvider-B7fszuGq.js +4 -0
  35. package/dist/InvoiceSettlementStatusBadge.vue_vue_type_script_setup_true_lang-YngYVFcS.js +196 -0
  36. package/dist/IssuerSettingsViewDataProvider-CbKj-AK2.js +250 -0
  37. package/dist/KeyboardIcon-BYex7WoL.js +24 -0
  38. package/dist/LinkExternalIcon-QJt5WMfk.js +24 -0
  39. package/dist/LinkIcon-D9WPvO58.js +24 -0
  40. package/dist/MarkerIcon-Dacom7sa.js +31 -0
  41. package/dist/MobileBatteryIcon-i1TxVu66.js +18 -0
  42. package/dist/MonitorIcon-B6-by77x.js +24 -0
  43. package/dist/NotificationIcon-D5mgxQ3P.js +21 -0
  44. package/dist/ParkingIcon-DJzqSxFU.js +29 -0
  45. package/dist/PlanningIcon-Dj8UH1Cl.js +18 -0
  46. package/dist/PreferenceIcon-DrDfTl-0.js +24 -0
  47. package/dist/ReceiptCheckIcon-DfUkv_G6.js +24 -0
  48. package/dist/RefreshIcon-CykNw3qm.js +24 -0
  49. package/dist/RemoveOpenBoundaryIcon-8vTxISBg.js +31 -0
  50. package/dist/RewindIcon-K0KiISjE.js +24 -0
  51. package/dist/SettingsIcon-BA4bIP5a.js +28 -0
  52. package/dist/ShieldIcon-B6OfkWmr.js +21 -0
  53. package/dist/ShieldOffIcon-RppEweJ9.js +24 -0
  54. package/dist/SignOutIcon-C6x_Sv0W.js +23 -0
  55. package/dist/SlashCircleIcon-CbwLUV0p.js +24 -0
  56. package/dist/StandIcon-DW1SUHPC.js +24 -0
  57. package/dist/StarsIcon-I4S_hN5F.js +26 -0
  58. package/dist/StopwatchIcon-D8KogezG.js +24 -0
  59. package/dist/TargetIcon-DZL7Hi3v.js +24 -0
  60. package/dist/ThreeDotsIcon-CKO5p_ZD.js +32 -0
  61. package/dist/ToolIcon-Dbvw1D-H.js +24 -0
  62. package/dist/TrashIcon-02miWCrc.js +21 -0
  63. package/dist/TurnaroundIcon-Dee23oaX.js +30 -0
  64. package/dist/UploadCloudIcon-DhtpTfwc.js +24 -0
  65. package/dist/UserIcon-DbdAYeNN.js +24 -0
  66. package/dist/UsersIcon-CHaIEI5X.js +24 -0
  67. package/dist/VerifiedIcon-CTveuqDt.js +26 -0
  68. package/dist/WifiIcon-DHt-RpM2.js +24 -0
  69. package/dist/WifiOffIcon-D8xUKqLP.js +24 -0
  70. package/dist/ZapIcon-C95VuzXS.js +24 -0
  71. package/dist/ZoomInIcon-qDywyLfc.js +24 -0
  72. package/dist/ZoomOutIcon-KL3_B-6s.js +24 -0
  73. package/dist/_plugin-vue_export-helper-3S5xkc9H.js +453 -0
  74. package/dist/creditNoteDetail.query-JGvG5yYz.js +159 -0
  75. package/dist/formango.util-D66mMTWb.js +12 -0
  76. package/dist/index-Beg0OAsI.js +8082 -0
  77. package/dist/index-DCE3vzbe.js +7 -0
  78. package/dist/index.css +1 -0
  79. package/dist/index.d.ts +1608 -0
  80. package/dist/index.js +40 -0
  81. package/dist/invoiceDetail.query-C3Llz0nF.js +13 -0
  82. package/dist/issuerSettings.query-H83T7-h9.js +130 -0
  83. package/dist/style.css +1 -0
  84. package/dist/style.d.ts +1 -0
  85. package/package.json +103 -0
@@ -0,0 +1,873 @@
1
+ import { defineComponent as N, computed as l, openBlock as v, createBlock as f, unref as i, withCtx as r, createVNode as a, createCommentVNode as q, resolveDynamicComponent as ne, normalizeClass as M, renderSlot as ae, ref as X, createElementVNode as oe, mergeProps as H, createElementBlock as re, Fragment as se } from "vue";
2
+ import { useI18n as y } from "vue-i18n";
3
+ import { C as w, a as j, u as ce } from "./creditNoteDetail.query-JGvG5yYz.js";
4
+ import { useToast as S, UIFormDialog as le, UIDialogHeader as ue, UIDialogFooter as de, UIDialogFooterCancel as me, UIDialogFooterSubmit as ve, useOverlay as fe, UIForm as B, UIRowLayout as P, UIText as U, UIColumnLayout as E, UIClickableElement as _e, UIBadge as pe, UIAnimateHeight as ge, UITextField as be, UIDateField as Ne, UISeparator as Y } from "@wisemen/vue-core-design-system";
5
+ import { y as ye, e as g, j as Q, o as we, L as xe, D as he, r as De, T as Ue, w as Ie, h as ke, z as Fe, a3 as Ce, J as Ee, B as Se, H as Ae, U as Re, R as Te } from "./index-Beg0OAsI.js";
6
+ import { useForm as $ } from "formango";
7
+ import Le, { z as k } from "zod";
8
+ import { _ as $e, u as qe, F as Me, B as je, a as z, b as Be, c as Pe, d as ze, e as Ve, f as Oe, g as Ke, h as He, j as Ye, k as Qe, i as Ge, l as Je, m as Xe, n as Ze, o as We, p as et, q as tt, r as it } from "./BillingDocumentDetailViewDataProvider.vue_vue_type_script_setup_true_lang-CWKBYgXH.js";
9
+ import { useMutation as I, useKeysetInfiniteQuery as nt } from "@wisemen/vue-core-api-utils";
10
+ import { m as at, I as ot, p as rt } from "./_plugin-vue_export-helper-3S5xkc9H.js";
11
+ import { useRouter as st } from "vue-router";
12
+ import { t as G } from "./formango.util-D66mMTWb.js";
13
+ function V() {
14
+ return I({
15
+ queryFn: (e) => w.update(
16
+ e.params.creditNoteUuid,
17
+ e.body
18
+ ),
19
+ queryKeysToInvalidate: {
20
+ creditNoteDetail: {
21
+ creditNoteUuid: (e) => e.creditNoteUuid
22
+ },
23
+ invoiceIndex: {}
24
+ }
25
+ });
26
+ }
27
+ const Z = k.object({
28
+ issuedOn: at,
29
+ externalRemarks: k.string().nullable(),
30
+ poNumber: k.string().nullable(),
31
+ subject: k.string().nullable()
32
+ }).superRefine((e, t) => {
33
+ e.externalRemarks?.trim() === "" && t.addIssue({
34
+ code: "custom",
35
+ message: ye.global.t("wise_invoicing.credit_note.finalize.validation.external_remarks_required"),
36
+ path: [
37
+ "externalRemarks"
38
+ ]
39
+ });
40
+ }), ct = k.object({
41
+ subject: k.string().nullable()
42
+ });
43
+ function lt() {
44
+ return I({
45
+ queryFn: (e) => w.finalize(
46
+ e.params.creditNoteUuid
47
+ ),
48
+ queryKeysToInvalidate: {
49
+ creditNoteDetail: {
50
+ creditNoteUuid: (e) => e.creditNoteUuid
51
+ },
52
+ invoiceDetail: {
53
+ invoiceUuid: (e) => e.invoiceUuid
54
+ },
55
+ invoiceIndex: {}
56
+ }
57
+ });
58
+ }
59
+ function ut() {
60
+ return I({
61
+ queryFn: (e) => w.markAsDraft(e.params.creditNoteUuid),
62
+ queryKeysToInvalidate: {
63
+ creditNoteDetail: {
64
+ creditNoteUuid: (e) => e.creditNoteUuid
65
+ },
66
+ invoiceDetail: {
67
+ invoiceUuid: (e) => e.invoiceUuid
68
+ },
69
+ invoiceIndex: {}
70
+ }
71
+ });
72
+ }
73
+ function dt() {
74
+ return I({
75
+ queryFn: (e) => w.markAsReady(
76
+ e.params.creditNoteUuid
77
+ ),
78
+ queryKeysToInvalidate: {
79
+ creditNoteDetail: {
80
+ creditNoteUuid: (e) => e.creditNoteUuid
81
+ },
82
+ invoiceDetail: {
83
+ invoiceUuid: (e) => e.invoiceUuid
84
+ },
85
+ invoiceIndex: {}
86
+ }
87
+ });
88
+ }
89
+ function mt() {
90
+ return I({
91
+ queryFn: (e) => w.send(
92
+ e.params.creditNoteUuid
93
+ ),
94
+ queryKeysToInvalidate: {
95
+ creditNoteDetail: {
96
+ creditNoteUuid: (e) => e.creditNoteUuid
97
+ }
98
+ }
99
+ });
100
+ }
101
+ function vt() {
102
+ return I({
103
+ queryFn: (e) => w.delete(e.params.creditNoteUuid),
104
+ queryKeysToInvalidate: {
105
+ invoiceIndex: {}
106
+ }
107
+ });
108
+ }
109
+ const ft = /* @__PURE__ */ N({
110
+ __name: "CreditNoteDeleteDialog",
111
+ props: {
112
+ creditNote: {}
113
+ },
114
+ emits: ["close", "deleted"],
115
+ setup(e, { emit: t }) {
116
+ const n = e, o = t, s = y(), c = st(), d = S(), _ = vt(), p = l(() => n.creditNote.sequence ?? n.creditNote.subject ?? s.t("wise_invoicing.credit_note.detail.fallback_title")), m = $({
117
+ schema: Le.object({}),
118
+ onSubmit: async () => {
119
+ const b = await _.execute({
120
+ params: {
121
+ creditNoteUuid: n.creditNote.uuid
122
+ }
123
+ });
124
+ if (b.isErr()) {
125
+ d.apiError(b.error);
126
+ return;
127
+ }
128
+ d.show({
129
+ message: p.value
130
+ }), o("deleted"), o("close"), await c.push({
131
+ name: "invoicing-invoice-overview"
132
+ });
133
+ }
134
+ });
135
+ return (b, x) => (v(), f(i(le), {
136
+ form: i(m),
137
+ size: "xs",
138
+ onClose: x[0] || (x[0] = (A) => o("close"))
139
+ }, {
140
+ default: r(() => [
141
+ a(i(ue), {
142
+ title: i(s).t("wise_invoicing.credit_note.delete.title"),
143
+ description: i(s).t("wise_invoicing.credit_note.delete.description", {
144
+ creditNoteIdentifier: p.value
145
+ }),
146
+ "is-description-visible": !0
147
+ }, null, 8, ["title", "description"]),
148
+ a(i(de), null, {
149
+ right: r(() => [
150
+ a(i(me), { label: "cancel" }),
151
+ a(i(ve), {
152
+ "is-destructive": !0,
153
+ label: i(s).t("wise_invoicing.credit_note.delete.submit_button")
154
+ }, null, 8, ["label"])
155
+ ]),
156
+ _: 1
157
+ })
158
+ ]),
159
+ _: 1
160
+ }, 8, ["form"]));
161
+ }
162
+ });
163
+ function _t(e) {
164
+ const t = y(), n = S(), o = fe(), s = o.create(ft), c = o.create($e), d = lt(), _ = ut(), p = dt(), m = mt(), {
165
+ shouldSkipConfirmation: b
166
+ } = qe(), x = l(() => e.value.originalInvoice?.uuid ?? e.value.uuid), A = l(() => e.value.status !== g.DRAFT && e.value.status !== g.READY);
167
+ async function F() {
168
+ const u = await p.execute({
169
+ params: {
170
+ creditNoteUuid: e.value.uuid,
171
+ invoiceUuid: x.value
172
+ }
173
+ });
174
+ if (u.isErr()) {
175
+ n.apiError(u.error);
176
+ return;
177
+ }
178
+ n.show({
179
+ message: t.t("wise_invoicing.credit_note.mark_as_ready.success")
180
+ });
181
+ }
182
+ async function R() {
183
+ const u = await d.execute({
184
+ params: {
185
+ creditNoteUuid: e.value.uuid,
186
+ invoiceUuid: x.value
187
+ }
188
+ });
189
+ return u.isErr() ? (n.apiError(u.error), !1) : (n.show({
190
+ message: t.t("wise_invoicing.credit_note.finalize.success")
191
+ }), !0);
192
+ }
193
+ async function T() {
194
+ if (b.value) {
195
+ await R();
196
+ return;
197
+ }
198
+ await c.open({
199
+ billingDocumentType: "credit_note",
200
+ onConfirm: R
201
+ });
202
+ }
203
+ async function D() {
204
+ const u = await _.execute({
205
+ params: {
206
+ creditNoteUuid: e.value.uuid,
207
+ invoiceUuid: x.value
208
+ }
209
+ });
210
+ if (u.isErr()) {
211
+ n.apiError(u.error);
212
+ return;
213
+ }
214
+ n.show({
215
+ message: t.t("wise_invoicing.credit_note.mark_as_draft.success")
216
+ });
217
+ }
218
+ async function O() {
219
+ const u = await m.execute({
220
+ params: {
221
+ creditNoteUuid: e.value.uuid
222
+ }
223
+ });
224
+ if (u.isErr()) {
225
+ n.apiError(u.error);
226
+ return;
227
+ }
228
+ n.show({
229
+ message: t.t("wise_invoicing.credit_note.send.success")
230
+ });
231
+ }
232
+ async function W() {
233
+ const u = await m.execute({
234
+ params: {
235
+ creditNoteUuid: e.value.uuid
236
+ }
237
+ });
238
+ if (u.isErr()) {
239
+ n.apiError(u.error);
240
+ return;
241
+ }
242
+ n.show({
243
+ message: t.t("wise_invoicing.credit_note.reminder.success")
244
+ });
245
+ }
246
+ async function ee() {
247
+ await s.open({
248
+ creditNote: e.value
249
+ });
250
+ }
251
+ async function te() {
252
+ const u = await w.getByUuid(e.value.uuid);
253
+ if (u.isErr()) {
254
+ n.apiError(u.error);
255
+ return;
256
+ }
257
+ const C = u.value.file;
258
+ if (C === null) {
259
+ n.show({
260
+ message: t.t("wise_invoicing.invoice.download_pdf.generation_in_progress")
261
+ });
262
+ return;
263
+ }
264
+ const h = await Me.getDownloadUrl(C.uuid);
265
+ h !== null && Ie.downloadUrl(h, C.name);
266
+ }
267
+ const ie = l(() => [
268
+ {
269
+ isLoading: m.isLoading.value,
270
+ iconLeft: Q,
271
+ key: "send",
272
+ label: t.t("wise_invoicing.invoice.detail.actions.send"),
273
+ variant: "primary",
274
+ visible: e.value.status === g.FINALIZED,
275
+ onClick: O
276
+ },
277
+ {
278
+ isLoading: m.isLoading.value,
279
+ iconLeft: Q,
280
+ key: "sendReminder",
281
+ label: t.t("wise_invoicing.invoice.detail.header.send_reminder"),
282
+ variant: "primary",
283
+ visible: e.value.status === g.SENT,
284
+ onClick: W
285
+ },
286
+ {
287
+ isLoading: p.isLoading.value,
288
+ iconRight: we,
289
+ key: "markAsReady",
290
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_ready"),
291
+ visible: e.value.status === g.DRAFT,
292
+ onClick: F
293
+ },
294
+ {
295
+ isLoading: d.isLoading.value,
296
+ iconRight: xe,
297
+ key: "finalize",
298
+ label: t.t("wise_invoicing.invoice.detail.actions.finalize"),
299
+ visible: e.value.status === g.READY,
300
+ onClick: T
301
+ }
302
+ ].filter((u) => u.visible)), K = l(() => {
303
+ const u = [
304
+ {
305
+ icon: he,
306
+ key: "downloadPdf",
307
+ label: t.t("wise_invoicing.common.download_pdf"),
308
+ visible: A.value,
309
+ onSelect: te
310
+ },
311
+ {
312
+ icon: De,
313
+ key: "backToDraft",
314
+ label: t.t("wise_invoicing.invoice.detail.actions.mark_as_draft"),
315
+ visible: e.value.status === g.READY,
316
+ onSelect: D
317
+ }
318
+ ], C = [
319
+ {
320
+ icon: Ue,
321
+ key: "delete",
322
+ label: t.t("wise_invoicing.credit_note.detail.actions.delete"),
323
+ visible: ot.isEditable(e.value.status),
324
+ onSelect: ee
325
+ }
326
+ ];
327
+ return [
328
+ {
329
+ items: u.filter((h) => h.visible),
330
+ key: "secondary"
331
+ },
332
+ {
333
+ items: C.filter((h) => h.visible),
334
+ key: "destructive"
335
+ }
336
+ ].filter((h) => h.items.length > 0);
337
+ });
338
+ return {
339
+ isActionMenuVisible: l(() => K.value.length > 0),
340
+ menuGroups: K,
341
+ primaryButtons: ie
342
+ };
343
+ }
344
+ const pt = /* @__PURE__ */ N({
345
+ __name: "CreditNoteDetailHeaderSection",
346
+ props: {
347
+ isPdfViewActive: { type: Boolean },
348
+ creditNote: {}
349
+ },
350
+ emits: ["togglePdfView"],
351
+ setup(e, { emit: t }) {
352
+ const n = e, o = t, s = y(), c = S(), d = V(), {
353
+ menuGroups: _,
354
+ primaryButtons: p
355
+ } = _t(l(() => n.creditNote)), m = l(() => new je(n.creditNote.status)), b = l(() => m.value.color), x = l(() => s.t(m.value.translationKey)), A = l(() => n.creditNote.status !== g.DRAFT && n.creditNote.status !== g.READY), F = $({
356
+ initialState: {
357
+ subject: n.creditNote.subject
358
+ },
359
+ schema: ct,
360
+ onSubmit: async (T) => {
361
+ const D = await d.execute({
362
+ body: {
363
+ ...j.toForm(n.creditNote),
364
+ subject: T.subject
365
+ },
366
+ params: {
367
+ creditNoteUuid: n.creditNote.uuid
368
+ }
369
+ });
370
+ D.isErr() && c.apiError(D.error);
371
+ }
372
+ }), R = F.register("subject");
373
+ return z({
374
+ form: F
375
+ }), (T, D) => (v(), f(i(B), {
376
+ form: i(F),
377
+ "prompt-on-unsaved-changes": !1
378
+ }, {
379
+ default: r(() => [
380
+ a(Be, {
381
+ "fallback-title": i(s).t("wise_invoicing.credit_note.detail.fallback_title"),
382
+ "is-disabled": A.value,
383
+ sequence: n.creditNote.sequence,
384
+ "status-color": b.value,
385
+ "status-label": x.value,
386
+ icon: i(ke),
387
+ "subject-field": i(R),
388
+ "subject-placeholder": i(s).t("wise_invoicing.invoice.detail.header.subject_placeholder")
389
+ }, {
390
+ actions: r(() => [
391
+ a(ze, {
392
+ "is-pdf-view-active": n.isPdfViewActive,
393
+ "menu-groups": i(_),
394
+ "primary-buttons": i(p),
395
+ onTogglePdfView: D[0] || (D[0] = (O) => o("togglePdfView"))
396
+ }, null, 8, ["is-pdf-view-active", "menu-groups", "primary-buttons"])
397
+ ]),
398
+ status: r(() => [
399
+ a(i(P), {
400
+ gap: "xs",
401
+ class: "flex-wrap items-start"
402
+ }, {
403
+ default: r(() => [
404
+ n.creditNote.isOverdue ? (v(), f(Pe, { key: 0 })) : q("", !0)
405
+ ]),
406
+ _: 1
407
+ })
408
+ ]),
409
+ _: 1
410
+ }, 8, ["fallback-title", "is-disabled", "sequence", "status-color", "status-label", "icon", "subject-field", "subject-placeholder"])
411
+ ]),
412
+ _: 1
413
+ }, 8, ["form"]));
414
+ }
415
+ }), gt = /* @__PURE__ */ N({
416
+ __name: "CreditNoteDetailRemarksSection",
417
+ props: {
418
+ creditNote: {}
419
+ },
420
+ setup(e) {
421
+ const t = e, n = y(), o = S(), s = V(), c = $({
422
+ initialState: l(() => j.toForm(t.creditNote)),
423
+ schema: Z,
424
+ onSubmit: async (p) => {
425
+ const m = await s.execute({
426
+ body: p,
427
+ params: {
428
+ creditNoteUuid: t.creditNote.uuid
429
+ }
430
+ });
431
+ m.isErr() && o.apiError(m.error);
432
+ }
433
+ }), d = c.register("externalRemarks"), _ = l(() => t.creditNote.status !== g.DRAFT && t.creditNote.status !== g.READY);
434
+ return z({
435
+ form: c
436
+ }), (p, m) => (v(), f(i(B), {
437
+ form: i(c),
438
+ "prompt-on-unsaved-changes": !1
439
+ }, {
440
+ default: r(() => [
441
+ a(Ve, {
442
+ "is-disabled": _.value,
443
+ placeholder: i(n).t("wise_invoicing.invoice.detail.remarks.placeholder"),
444
+ "remarks-field": i(d),
445
+ title: i(n).t("wise_invoicing.invoice.detail.remarks.title")
446
+ }, null, 8, ["is-disabled", "placeholder", "remarks-field", "title"])
447
+ ]),
448
+ _: 1
449
+ }, 8, ["form"]));
450
+ }
451
+ });
452
+ function bt(e) {
453
+ return nt("creditNoteActivityLogIndex", {
454
+ params: {
455
+ creditNoteUuid: e
456
+ },
457
+ queryFn: (t) => w.getActivityLogs(e.value, {
458
+ pagination: t
459
+ })
460
+ });
461
+ }
462
+ const Nt = /* @__PURE__ */ N({
463
+ __name: "CreditNoteDetailSidebarActivityTab",
464
+ props: {
465
+ creditNote: {}
466
+ },
467
+ setup(e) {
468
+ const t = e, n = y(), {
469
+ hasNextPage: o,
470
+ isFetchingNextPage: s,
471
+ isLoading: c,
472
+ fetchNextPage: d,
473
+ result: _
474
+ } = bt(l(() => t.creditNote.uuid)), p = l(() => _.value.unwrapOr({
475
+ data: [],
476
+ meta: {
477
+ next: null
478
+ }
479
+ }).data);
480
+ return (m, b) => (v(), f(Oe, {
481
+ "current-billing-document": {
482
+ role: i(Fe).CREDIT_NOTE,
483
+ uuid: t.creditNote.uuid
484
+ },
485
+ "empty-message": i(n).t("wise_invoicing.credit_note.detail.sidebar.activity_empty"),
486
+ entries: p.value,
487
+ "fetch-next-page": i(d),
488
+ "has-next-page": i(o),
489
+ "is-fetching-next-page": i(s),
490
+ "is-loading": i(c)
491
+ }, null, 8, ["current-billing-document", "empty-message", "entries", "fetch-next-page", "has-next-page", "is-fetching-next-page", "is-loading"]));
492
+ }
493
+ }), L = /* @__PURE__ */ N({
494
+ __name: "BillingDocumentDetailSidebarInfoItem",
495
+ props: {
496
+ hasError: { type: Boolean, default: !1 },
497
+ icon: {},
498
+ label: {}
499
+ },
500
+ setup(e) {
501
+ const t = e;
502
+ return (n, o) => (v(), f(i(P), null, {
503
+ default: r(() => [
504
+ (v(), f(ne(t.icon), {
505
+ class: M([{
506
+ "text-error-primary": t.hasError,
507
+ "text-tertiary": !t.hasError
508
+ }, "size-3.5 shrink-0"])
509
+ }, null, 8, ["class"])),
510
+ a(i(U), {
511
+ text: t.label,
512
+ class: M([{
513
+ "text-error-primary": t.hasError,
514
+ "text-tertiary": !t.hasError
515
+ }, "w-24 shrink-0 text-xs"])
516
+ }, null, 8, ["text", "class"]),
517
+ ae(n.$slots, "default")
518
+ ]),
519
+ _: 3
520
+ }));
521
+ }
522
+ }), J = /* @__PURE__ */ N({
523
+ __name: "BillingDocumentDetailSidebarPartySection",
524
+ props: {
525
+ title: {},
526
+ isDefaultOpen: { type: Boolean, default: !1 },
527
+ name: {},
528
+ address: {}
529
+ },
530
+ setup(e) {
531
+ const t = e, n = X(t.isDefaultOpen);
532
+ function o() {
533
+ n.value = !n.value;
534
+ }
535
+ return (s, c) => (v(), f(i(E), { class: "w-full" }, {
536
+ default: r(() => [
537
+ a(i(P), { justify: "between" }, {
538
+ default: r(() => [
539
+ a(i(_e), { class: "rounded-sm" }, {
540
+ default: r(() => [
541
+ oe("button", {
542
+ type: "button",
543
+ class: "flex w-full items-center gap-sm",
544
+ onClick: o
545
+ }, [
546
+ a(i(U), {
547
+ text: t.title,
548
+ class: "text-xs font-semibold text-primary"
549
+ }, null, 8, ["text"]),
550
+ a(i(pe), {
551
+ label: t.name,
552
+ color: "gray",
553
+ variant: "outline"
554
+ }, null, 8, ["label"]),
555
+ a(i(Ce), {
556
+ class: M([{
557
+ "rotate-180": n.value
558
+ }, "size-4 text-tertiary transition-all duration-100"])
559
+ }, null, 8, ["class"])
560
+ ])
561
+ ]),
562
+ _: 1
563
+ })
564
+ ]),
565
+ _: 1
566
+ }),
567
+ a(i(ge), null, {
568
+ default: r(() => [
569
+ n.value ? (v(), f(i(E), {
570
+ key: 0,
571
+ gap: "xs"
572
+ }, {
573
+ default: r(() => [
574
+ a(i(U), {
575
+ text: t.name,
576
+ class: "text-xs font-medium text-primary"
577
+ }, null, 8, ["text"]),
578
+ t.address ? (v(), f(i(U), {
579
+ key: 0,
580
+ truncate: !1,
581
+ text: i(Ee).format(t.address),
582
+ class: "text-xs text-primary"
583
+ }, null, 8, ["text"])) : q("", !0)
584
+ ]),
585
+ _: 1
586
+ })) : q("", !0)
587
+ ]),
588
+ _: 1
589
+ })
590
+ ]),
591
+ _: 1
592
+ }));
593
+ }
594
+ }), yt = /* @__PURE__ */ N({
595
+ __name: "CreditNoteDetailSidebarInfoTab",
596
+ props: {
597
+ creditNote: {}
598
+ },
599
+ setup(e) {
600
+ const t = e, n = y(), o = S(), s = V(), c = $({
601
+ initialState: l(() => j.toForm(t.creditNote)),
602
+ schema: Z,
603
+ onSubmit: async (m) => {
604
+ const b = await s.execute({
605
+ body: m,
606
+ params: {
607
+ creditNoteUuid: t.creditNote.uuid
608
+ }
609
+ });
610
+ b.isErr() && o.apiError(b.error);
611
+ }
612
+ }), d = c.register("issuedOn"), _ = c.register("poNumber"), p = l(() => t.creditNote.status !== g.DRAFT && t.creditNote.status !== g.READY);
613
+ return z({
614
+ form: c
615
+ }), (m, b) => (v(), f(i(B), {
616
+ form: i(c),
617
+ "prompt-on-unsaved-changes": !1
618
+ }, {
619
+ default: r(() => [
620
+ a(i(E), {
621
+ gap: "lg",
622
+ class: "px-2xl py-xl"
623
+ }, {
624
+ default: r(() => [
625
+ a(i(E), null, {
626
+ default: r(() => [
627
+ a(i(U), {
628
+ text: i(n).t("wise_invoicing.invoice.detail.sidebar.general"),
629
+ class: "text-xs font-semibold text-primary"
630
+ }, null, 8, ["text"]),
631
+ a(i(E), { gap: "lg" }, {
632
+ default: r(() => [
633
+ a(L, {
634
+ icon: i(Se),
635
+ label: i(n).t("wise_invoicing.invoice.detail.header.invoice_id")
636
+ }, {
637
+ default: r(() => [
638
+ a(i(U), {
639
+ text: t.creditNote.sequence ?? "-",
640
+ class: "text-xs text-primary"
641
+ }, null, 8, ["text"])
642
+ ]),
643
+ _: 1
644
+ }, 8, ["icon", "label"]),
645
+ a(L, {
646
+ icon: i(Ae),
647
+ "has-error": i(_).errors.value.length > 0,
648
+ label: i(n).t("wise_invoicing.invoice.detail.header.po_number")
649
+ }, {
650
+ default: r(() => [
651
+ a(i(be), H(i(G)(i(_)), {
652
+ "is-disabled": p.value,
653
+ label: null,
654
+ class: "w-full"
655
+ }), null, 16, ["is-disabled"])
656
+ ]),
657
+ _: 1
658
+ }, 8, ["icon", "has-error", "label"]),
659
+ a(L, {
660
+ icon: i(Re),
661
+ label: i(n).t("wise_invoicing.invoice.detail.header.issuer")
662
+ }, {
663
+ default: r(() => [
664
+ a(i(U), {
665
+ text: t.creditNote.issuer.name ?? "-",
666
+ class: "text-xs text-primary"
667
+ }, null, 8, ["text"])
668
+ ]),
669
+ _: 1
670
+ }, 8, ["icon", "label"]),
671
+ a(L, {
672
+ icon: i(Te),
673
+ "has-error": i(d).errors.value.length > 0,
674
+ label: i(n).t("wise_invoicing.invoice.detail.header.invoice_date")
675
+ }, {
676
+ default: r(() => [
677
+ a(i(Ne), H({ "is-disabled": p.value }, i(G)(i(d))), null, 16, ["is-disabled"])
678
+ ]),
679
+ _: 1
680
+ }, 8, ["icon", "has-error", "label"])
681
+ ]),
682
+ _: 1
683
+ })
684
+ ]),
685
+ _: 1
686
+ }),
687
+ a(i(Y)),
688
+ a(Ke, {
689
+ "original-invoice": t.creditNote.originalInvoice
690
+ }, null, 8, ["original-invoice"]),
691
+ a(J, {
692
+ "is-default-open": !0,
693
+ name: t.creditNote.customer.name ?? "-",
694
+ title: i(n).t("wise_invoicing.invoice.detail.header.bill_to"),
695
+ address: t.creditNote.customer.address
696
+ }, null, 8, ["name", "title", "address"]),
697
+ a(i(Y)),
698
+ a(J, {
699
+ name: t.creditNote.issuer.email ?? "-",
700
+ title: i(n).t("wise_invoicing.invoice.detail.header.bill_from"),
701
+ address: t.creditNote.issuer.address
702
+ }, null, 8, ["name", "title", "address"])
703
+ ]),
704
+ _: 1
705
+ })
706
+ ]),
707
+ _: 1
708
+ }, 8, ["form"]));
709
+ }
710
+ }), wt = /* @__PURE__ */ N({
711
+ __name: "CreditNoteDetailSidebar",
712
+ props: {
713
+ creditNote: {}
714
+ },
715
+ setup(e) {
716
+ const t = e, n = y(), o = rt(), s = l(() => n.t("wise_invoicing.invoice.detail.sidebar.updated_on", {
717
+ date: o.toDateTime(t.creditNote.updatedAt)
718
+ }));
719
+ return (c, d) => (v(), f(He, {
720
+ "billing-document": t.creditNote,
721
+ "updated-footer": s.value
722
+ }, {
723
+ activity: r(() => [
724
+ a(Nt, {
725
+ "credit-note": t.creditNote
726
+ }, null, 8, ["credit-note"])
727
+ ]),
728
+ info: r(() => [
729
+ a(yt, {
730
+ "credit-note": t.creditNote
731
+ }, null, 8, ["credit-note"])
732
+ ]),
733
+ _: 1
734
+ }, 8, ["billing-document", "updated-footer"]));
735
+ }
736
+ });
737
+ function xt() {
738
+ return I({
739
+ queryFn: (e) => w.updateLines(
740
+ e.params.creditNoteUuid,
741
+ e.body
742
+ ),
743
+ queryKeysToInvalidate: {
744
+ creditNoteDetail: {
745
+ creditNoteUuid: (e) => e.creditNoteUuid
746
+ },
747
+ invoiceIndex: {}
748
+ }
749
+ });
750
+ }
751
+ const ht = /* @__PURE__ */ N({
752
+ __name: "CreditNoteLineItemsTableSection",
753
+ props: {
754
+ creditNote: {}
755
+ },
756
+ setup(e) {
757
+ const t = e, n = l(() => t.creditNote), o = xt(), s = Ye({
758
+ isSaving: l(() => o.isLoading.value),
759
+ billingDocument: () => n.value,
760
+ updateLines: (c) => o.execute({
761
+ body: c,
762
+ params: {
763
+ creditNoteUuid: t.creditNote.uuid
764
+ }
765
+ })
766
+ });
767
+ return Qe(s), (c, d) => (v(), f(Ge, null, {
768
+ default: r(() => [
769
+ a(Je, { "show-apply-discount": !1 }),
770
+ a(Xe),
771
+ a(Ze, {
772
+ "billing-document": t.creditNote
773
+ }, null, 8, ["billing-document"]),
774
+ a(We)
775
+ ]),
776
+ _: 1
777
+ }));
778
+ }
779
+ }), Dt = /* @__PURE__ */ N({
780
+ __name: "CreditNoteDetailView",
781
+ props: {
782
+ creditNote: {}
783
+ },
784
+ setup(e) {
785
+ const t = e, n = y(), o = X(!1), s = l(() => [
786
+ {
787
+ label: n.t("wise_invoicing.invoice.overview.title"),
788
+ to: {
789
+ name: "invoicing-invoice-overview"
790
+ }
791
+ },
792
+ {
793
+ label: t.creditNote.originalInvoice?.sequence ?? n.t("wise_invoicing.credit_note.detail.breadcrumb.parent_invoice"),
794
+ to: t.creditNote.originalInvoice === null ? void 0 : {
795
+ name: "invoicing-invoice-detail",
796
+ params: {
797
+ invoiceUuid: t.creditNote.originalInvoice.uuid
798
+ }
799
+ }
800
+ },
801
+ {
802
+ label: n.t("wise_invoicing.invoice.detail.credit_notes.untitled")
803
+ },
804
+ {
805
+ label: t.creditNote.sequence ?? n.t("wise_invoicing.credit_note.detail.fallback_title")
806
+ }
807
+ ]);
808
+ return (c, d) => (v(), f(et, {
809
+ "billing-document": t.creditNote,
810
+ breadcrumbs: s.value,
811
+ title: i(n).t("wise_invoicing.credit_note.detail.fallback_title")
812
+ }, {
813
+ header: r(() => [
814
+ a(pt, {
815
+ "credit-note": t.creditNote,
816
+ "is-pdf-view-active": o.value,
817
+ class: "w-full",
818
+ onTogglePdfView: d[0] || (d[0] = (_) => o.value = !o.value)
819
+ }, null, 8, ["credit-note", "is-pdf-view-active"])
820
+ ]),
821
+ default: r(() => [
822
+ o.value ? (v(), f(tt, {
823
+ key: 0,
824
+ "billing-document": t.creditNote,
825
+ class: "w-full"
826
+ }, null, 8, ["billing-document"])) : (v(), re(se, { key: 1 }, [
827
+ a(ht, {
828
+ "credit-note": t.creditNote
829
+ }, null, 8, ["credit-note"]),
830
+ a(gt, {
831
+ "credit-note": t.creditNote,
832
+ class: "w-full"
833
+ }, null, 8, ["credit-note"])
834
+ ], 64))
835
+ ]),
836
+ sidebar: r(() => [
837
+ a(wt, {
838
+ "credit-note": t.creditNote
839
+ }, null, 8, ["credit-note"])
840
+ ]),
841
+ _: 1
842
+ }, 8, ["billing-document", "breadcrumbs", "title"]));
843
+ }
844
+ }), Mt = /* @__PURE__ */ N({
845
+ __name: "CreditNoteDetailViewDataProvider",
846
+ props: {
847
+ creditNoteUuid: {}
848
+ },
849
+ setup(e) {
850
+ const t = e, n = y(), o = l(() => [
851
+ {
852
+ label: n.t("wise_invoicing.invoice.overview.title"),
853
+ to: {
854
+ name: "invoicing-invoice-overview"
855
+ }
856
+ }
857
+ ]), s = ce(l(
858
+ () => t.creditNoteUuid
859
+ ));
860
+ return (c, d) => (v(), f(it, {
861
+ query: i(s),
862
+ "loading-breadcrumbs": o.value
863
+ }, {
864
+ default: r(({ billingDocument: _ }) => [
865
+ a(Dt, { "credit-note": _ }, null, 8, ["credit-note"])
866
+ ]),
867
+ _: 1
868
+ }, 8, ["query", "loading-breadcrumbs"]));
869
+ }
870
+ });
871
+ export {
872
+ Mt as default
873
+ };