@wisemen/wise-invoicing-web 0.0.0-alpha.2 → 0.0.2

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 (83) hide show
  1. package/dist/{AddOpenBoundaryIcon-D1VTMYxH.js → AddOpenBoundaryIcon-LcnpqCb7.js} +3 -3
  2. package/dist/{AirlineIcon-D0tWIPfE.js → AirlineIcon-29r8leGB.js} +5 -5
  3. package/dist/{AirplaneIcon-D0ekSjiY.js → AirplaneIcon-B9jZP9r0.js} +3 -3
  4. package/dist/{AirportIcon-NH15gAI7.js → AirportIcon-C4PxDtDr.js} +5 -5
  5. package/dist/{AlertTriangleIcon-BBYmnaAC.js → AlertTriangleIcon-BD58hKRP.js} +5 -5
  6. package/dist/{AllocationsIcon-DLXGGcv8.js → AllocationsIcon-BQan6NWO.js} +1 -1
  7. package/dist/{ArrowNarrowRightIcon-BiR4Ks5h.js → ArrowNarrowRightIcon-BA1c_QRh.js} +1 -1
  8. package/dist/{AssetIcon-u4XHl08p.js → AssetIcon-DnK5wAyN.js} +1 -1
  9. package/dist/{BarChartIcon-RH_ekDDa.js → BarChartIcon-CKrBCh6x.js} +5 -5
  10. package/dist/{BellIcon-puqswqdp.js → BellIcon-BT2cGatU.js} +5 -5
  11. package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
  12. package/dist/BillingDocumentDetailViewDataProvider.vue_vue_type_script_setup_true_lang-C5j9jPsk.js +5374 -0
  13. package/dist/{BuildingIcon-BWZ0eFpf.js → BuildingIcon-CUOTWDHc.js} +4 -4
  14. package/dist/{ChargerIcon-vHUzH_hu.js → ChargerIcon-BhrjeyKv.js} +1 -1
  15. package/dist/{ChevronDownIcon-CdhHldqJ.js → ChevronDownIcon-DljNUnFk.js} +5 -5
  16. package/dist/{ChevronUpIcon-W5KGnOfx.js → ChevronUpIcon-CoxFAIp_.js} +5 -5
  17. package/dist/{ClockIcon-CI6Sc8X9.js → ClockIcon-CTnAGb9i.js} +3 -3
  18. package/dist/{ClockSnoozeIcon-lE4H6nKn.js → ClockSnoozeIcon-BRoTw_Vn.js} +3 -3
  19. package/dist/{CopyIcon-CLgwQ7ER.js → CopyIcon-JiNI8Dfg.js} +2 -2
  20. package/dist/{CreditNoteDetailViewDataProvider-CMCepBqQ.js → CreditNoteDetailViewDataProvider-Cy1j_m3I.js} +35 -35
  21. package/dist/{CreditNotePdfViewDataProvider-cKScYDhN.js → CreditNotePdfViewDataProvider-B7-HFIKD.js} +2 -2
  22. package/dist/{DownloadCloudIcon-4NDn0tgR.js → DownloadCloudIcon-DKHwnpvk.js} +3 -3
  23. package/dist/{EditIcon-DARh2XoZ.js → EditIcon-DtGrCf8G.js} +1 -1
  24. package/dist/{EraserIcon-Rw6lBcnV.js → EraserIcon-Cb0Ep_Yq.js} +3 -3
  25. package/dist/{FileIcon-BSXsPI_S.js → FileIcon-C4wGvJpt.js} +3 -3
  26. package/dist/{FilterLinesIcon-DmsLFTQN.js → FilterLinesIcon-B7wPXDy1.js} +1 -1
  27. package/dist/{GlobeIcon-B17f0Sw9.js → GlobeIcon-B-Idmck1.js} +3 -3
  28. package/dist/{HelpIcon-BigMpLbH.js → HelpIcon-CdKWaEaB.js} +5 -5
  29. package/dist/{HourGlassIcon-ZmlVyW-C.js → HourGlassIcon-CQLPiXVW.js} +3 -3
  30. package/dist/{InfoCircleIcon-DwdOFjnE.js → InfoCircleIcon-5gjQoNog.js} +5 -5
  31. package/dist/InvoiceDetailViewDataProvider-4lGG7Wtq.js +1918 -0
  32. package/dist/InvoiceOverviewView-Boqvwabl.js +4 -0
  33. package/dist/{InvoicePdfViewDataProvider-BmrOVRDd.js → InvoicePdfViewDataProvider-CJ3fL71W.js} +2 -2
  34. package/dist/InvoicePublicPdfViewDataProvider-CzgGk_V5.js +4 -0
  35. package/dist/{IssuerSettingsViewDataProvider-DmvaAVK2.js → IssuerSettingsViewDataProvider-TM-bmC55.js} +2 -2
  36. package/dist/{KeyboardIcon-mBAQAv2I.js → KeyboardIcon-DlAp0VUG.js} +5 -5
  37. package/dist/{LinkExternalIcon-BPgF1F2w.js → LinkExternalIcon-BPO_c7Ke.js} +1 -1
  38. package/dist/{LinkIcon-gZ4s2jux.js → LinkIcon-9M0uzW4a.js} +1 -1
  39. package/dist/{MarkerIcon-DZWwiwxW.js → MarkerIcon-pId64QTW.js} +5 -5
  40. package/dist/{MobileBatteryIcon-B0owrgV_.js → MobileBatteryIcon-Dq6Vh0d5.js} +1 -1
  41. package/dist/{MonitorIcon-D56qHBwO.js → MonitorIcon-PsvDF5LA.js} +1 -1
  42. package/dist/{NotificationIcon-BY3lBaZc.js → NotificationIcon-C-mhyH5v.js} +5 -5
  43. package/dist/{ParkingIcon-DERwLY3G.js → ParkingIcon-BD0RoGv5.js} +6 -6
  44. package/dist/{PlanningIcon-jk8reD1e.js → PlanningIcon-BBIuwW2I.js} +1 -1
  45. package/dist/{PreferenceIcon-DDmaGMpX.js → PreferenceIcon-zR5mjygu.js} +1 -1
  46. package/dist/{ReceiptCheckIcon--es-D4rJ.js → ReceiptCheckIcon-CHEEnJEK.js} +1 -1
  47. package/dist/{RefreshIcon-C9ekNY5e.js → RefreshIcon-CfjOS7Vw.js} +5 -5
  48. package/dist/{RemoveOpenBoundaryIcon-DSDcL43x.js → RemoveOpenBoundaryIcon-CEbBT9CX.js} +5 -5
  49. package/dist/{RewindIcon-BKVEoXWC.js → RewindIcon-9PFea9gA.js} +1 -1
  50. package/dist/{SettingsIcon-CJnrJvXJ.js → SettingsIcon-CSIbrANE.js} +3 -3
  51. package/dist/{ShieldIcon-CNcXplVB.js → ShieldIcon-CU4mxKxP.js} +2 -2
  52. package/dist/{ShieldOffIcon-CZDPiURK.js → ShieldOffIcon-D6_I1MKn.js} +1 -1
  53. package/dist/{SignOutIcon-C2DLXM7d.js → SignOutIcon-ClrPsj39.js} +1 -1
  54. package/dist/{SlashCircleIcon-NyOs9XGb.js → SlashCircleIcon-DBy7XjBm.js} +5 -5
  55. package/dist/{StandIcon-ToGuM9SZ.js → StandIcon-vV8J4-3H.js} +5 -5
  56. package/dist/{StarsIcon-DNESJiIB.js → StarsIcon-RO6wNbsC.js} +6 -6
  57. package/dist/{StopwatchIcon-BXLU_VPa.js → StopwatchIcon-DubYBmeN.js} +1 -1
  58. package/dist/{TargetIcon-BXhOhl2b.js → TargetIcon-BwVw7rVC.js} +5 -5
  59. package/dist/{ThreeDotsIcon-PwHbGTa6.js → ThreeDotsIcon-BvRfi-Lm.js} +3 -3
  60. package/dist/{ToolIcon-CvkFiH-c.js → ToolIcon-Dw-vgiL1.js} +3 -3
  61. package/dist/{TrashIcon-C2VRPBqs.js → TrashIcon-Dh6ASxXd.js} +3 -3
  62. package/dist/{TurnaroundIcon-DJfDuWTg.js → TurnaroundIcon-Hn5nPhvb.js} +1 -1
  63. package/dist/{UploadCloudIcon-hn2-5rcP.js → UploadCloudIcon-BV7b8ygQ.js} +3 -3
  64. package/dist/{UserIcon-B0wazUGB.js → UserIcon-BRrPmqkm.js} +5 -5
  65. package/dist/{UsersIcon-Cxe1cZmK.js → UsersIcon-fORcf4YV.js} +5 -5
  66. package/dist/{VerifiedIcon-CDjL926Z.js → VerifiedIcon-BtqxtP6h.js} +1 -1
  67. package/dist/{WifiIcon-CQyPwaZz.js → WifiIcon-Bd9TvVVJ.js} +4 -4
  68. package/dist/{WifiOffIcon-dkmX-4K0.js → WifiOffIcon-CpATjY4j.js} +4 -4
  69. package/dist/{ZapIcon-CmHyTbuV.js → ZapIcon-BG6cVpfC.js} +5 -5
  70. package/dist/{ZoomInIcon-BnPb-diM.js → ZoomInIcon-CQ_R4Ydf.js} +5 -5
  71. package/dist/{ZoomOutIcon-ClHp0a0J.js → ZoomOutIcon-DlcCdCda.js} +5 -5
  72. package/dist/{creditNoteDetail.query-2ctS1BaN.js → creditNoteDetail.query-Dj6oKRTO.js} +10 -10
  73. package/dist/{index-D6s8cO_k.js → index-CYV9qUlg.js} +6770 -6776
  74. package/dist/index.d.ts +1224 -54
  75. package/dist/index.js +31 -31
  76. package/dist/{invoiceDetail.query-C-VnK-YW.js → invoiceDetail.query-Wtw3VSKd.js} +1 -1
  77. package/dist/{issuerSettings.query-DbdqHL2Y.js → issuerSettings.query-H5-5e_KF.js} +1 -1
  78. package/dist/style.css +1 -1
  79. package/package.json +4 -2
  80. package/dist/BillingDocumentDetailViewDataProvider.vue_vue_type_script_setup_true_lang-D1IyyjGz.js +0 -5165
  81. package/dist/InvoiceDetailViewDataProvider-B6X5IWOI.js +0 -1954
  82. package/dist/InvoiceOverviewView-DfRvtHOp.js +0 -4
  83. package/dist/InvoicePublicPdfViewDataProvider-DtQz41ga.js +0 -4
@@ -0,0 +1,1918 @@
1
+ import { openBlock as r, createElementBlock as K, createElementVNode as N, defineComponent as x, computed as c, createBlock as v, unref as e, withCtx as s, createVNode as o, Fragment as ae, renderList as Te, ref as Pe, watch as di, createCommentVNode as D, mergeProps as P, createSlots as vi, toDisplayString as Me } from "vue";
2
+ import { useI18n as h } from "vue-i18n";
3
+ import { u as mi } from "./invoiceDetail.query-Wtw3VSKd.js";
4
+ import { d as ge, I as k, e as Le, p as se, f as G, g as $, h as pi, S as _e, i as Ae, L as _i, A as $e, j as fi, D as gi, F as yi, k as bi, l as wi, T as Ii, m as xi, n as Di, o as ye, R as qe, q as hi, r as ki, s as Ui, u as X, v as ve, w as Ci, x as Si, y as Ai, z as be, E as Ei, t as M, P as Fi, H as Ti, U as Pi, B as Mi, G as me, J as Re, K as Li, M as $i, C as Oe, N as qi, O as B, Q as Ri } from "./index-CYV9qUlg.js";
5
+ import { UIBadge as Q, UITooltip as Oi, UITooltipContent as zi, UIColumnLayout as ze, UIText as R, useToast as O, UIFormDialog as le, UIDialogHeader as ce, UIDialogFooter as re, UIDialogFooterCancel as ue, UIDialogFooterSubmit as we, useOverlay as de, UIForm as Ve, UIRowLayout as Y, UIDialogBody as Ie, UIFormFieldGroup as xe, UIFormFieldGrid as De, UIDateField as te, UITextField as oe, UIDetailList as Vi, UIDetailListGroup as pe, UIDetailListGroupItem as q, UIDetailListGroupItemLabel as V, UIDetailListGroupItemValueText as j, UIIconButton as je, UIDetailListGroupSeparator as Ee, UITableCell as he, UITableCellInteractiveElement as ji, defineTableColumns as Bi, createComponent as H, UINumberField as fe, UIFormSubmitButton as Ni, UIConfirmDialog as Ki, UIBadgeLabel as Fe, UIBadgeSeparator as Gi, UIButton as Hi, UITable as Qi, createSelectOptions as Zi, UISelect as Wi } from "@wisemen/vue-core-design-system";
6
+ import { useForm as Z } from "formango";
7
+ import Ji, { z as I } from "zod";
8
+ import { _ as Yi, u as Xi, F as en, B as Be, a as Ne, b as nn, c as tn, d as on, e as an, f as sn, g as ln, h as cn, i as Ke, j as rn, k as un, l as dn, m as vn, n as mn, o as pn, p as _n, q as fn, r as gn } from "./BillingDocumentDetailViewDataProvider.vue_vue_type_script_setup_true_lang-C5j9jPsk.js";
9
+ import { useMutation as E, useKeysetInfiniteQuery as yn, useQuery as Ge } from "@wisemen/vue-core-api-utils";
10
+ import { Temporal as He } from "temporal-polyfill";
11
+ import { useRouter as Qe, RouterLink as bn } from "vue-router";
12
+ import { u as wn } from "./issuerSettings.query-H5-5e_KF.js";
13
+ const In = {}, xn = {
14
+ width: "100%",
15
+ height: "100%",
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ xmlns: "http://www.w3.org/2000/svg"
19
+ };
20
+ function Dn(i, n) {
21
+ return r(), K("svg", xn, [...n[0] || (n[0] = [
22
+ N("path", {
23
+ d: "M6 16C6 18.2091 7.79086 20 10 20H14C16.2091 20 18 18.2091 18 16C18 13.7909 16.2091 12 14 12H10C7.79086 12 6 10.2091 6 8C6 5.79086 7.79086 4 10 4H14C16.2091 4 18 5.79086 18 8M12 2V22",
24
+ stroke: "currentColor",
25
+ "stroke-width": "2",
26
+ "stroke-linecap": "round",
27
+ "stroke-linejoin": "round"
28
+ }, null, -1)
29
+ ])]);
30
+ }
31
+ const hn = /* @__PURE__ */ ge(In, [["render", Dn]]), kn = {}, Un = {
32
+ width: "100%",
33
+ height: "100%",
34
+ viewBox: "0 0 24 24",
35
+ fill: "none",
36
+ xmlns: "http://www.w3.org/2000/svg"
37
+ };
38
+ function Cn(i, n) {
39
+ return r(), K("svg", Un, [...n[0] || (n[0] = [
40
+ N("path", {
41
+ d: "M12 5V19M5 12H19",
42
+ stroke: "currentColor",
43
+ "stroke-width": "2",
44
+ "stroke-linecap": "round",
45
+ "stroke-linejoin": "round"
46
+ }, null, -1)
47
+ ])]);
48
+ }
49
+ const Sn = /* @__PURE__ */ ge(kn, [["render", Cn]]), An = {}, En = {
50
+ width: "100%",
51
+ height: "100%",
52
+ viewBox: "0 0 24 24",
53
+ fill: "none",
54
+ xmlns: "http://www.w3.org/2000/svg"
55
+ };
56
+ function Fn(i, n) {
57
+ return r(), K("svg", En, [...n[0] || (n[0] = [
58
+ N("path", {
59
+ d: "M16 6V5.2C16 4.0799 16 3.51984 15.782 3.09202C15.5903 2.71569 15.2843 2.40973 14.908 2.21799C14.4802 2 13.9201 2 12.8 2H11.2C10.0799 2 9.51984 2 9.09202 2.21799C8.71569 2.40973 8.40973 2.71569 8.21799 3.09202C8 3.51984 8 4.0799 8 5.2V6M10 11.5V16.5M14 11.5V16.5M3 6H21M19 6V17.2C19 18.8802 19 19.7202 18.673 20.362C18.3854 20.9265 17.9265 21.3854 17.362 21.673C16.7202 22 15.8802 22 14.2 22H9.8C8.11984 22 7.27976 22 6.63803 21.673C6.07354 21.3854 5.6146 20.9265 5.32698 20.362C5 19.7202 5 18.8802 5 17.2V6",
60
+ stroke: "currentColor",
61
+ "stroke-width": "2",
62
+ "stroke-linecap": "round",
63
+ "stroke-linejoin": "round"
64
+ }, null, -1)
65
+ ])]);
66
+ }
67
+ const Tn = /* @__PURE__ */ ge(An, [["render", Fn]]);
68
+ function ke() {
69
+ return E({
70
+ queryFn: (i) => k.update(
71
+ i.params.invoiceUuid,
72
+ i.body
73
+ ),
74
+ queryKeysToInvalidate: {
75
+ invoiceDetail: {
76
+ invoiceUuid: (i) => i.invoiceUuid
77
+ },
78
+ invoiceIndex: {}
79
+ }
80
+ });
81
+ }
82
+ const Pn = /* @__PURE__ */ x({
83
+ __name: "InvoiceDeliveryStatusBadge",
84
+ props: {
85
+ deliveryStatus: {},
86
+ size: { default: "sm" }
87
+ },
88
+ setup(i) {
89
+ const n = i, t = h(), l = c(
90
+ () => Le.getMetadata(n.deliveryStatus)
91
+ ), a = c(() => t.t(l.value.translationKey));
92
+ return (m, d) => (r(), v(e(Q), {
93
+ label: a.value,
94
+ color: l.value.tone,
95
+ size: n.size,
96
+ variant: "translucent"
97
+ }, null, 8, ["label", "color", "size"]));
98
+ }
99
+ }), Mn = /* @__PURE__ */ x({
100
+ __name: "InvoiceReminderBadge",
101
+ props: {
102
+ reminders: {},
103
+ size: { default: "sm" }
104
+ },
105
+ setup(i) {
106
+ const n = i, t = h(), l = se(), a = c(() => t.t("wise_invoicing.invoice.reminder.badge", {
107
+ count: n.reminders.length
108
+ }));
109
+ function m(d) {
110
+ return l.formatPlainDate(
111
+ d.toZonedDateTimeISO(He.Now.timeZoneId()).toPlainDate()
112
+ );
113
+ }
114
+ return (d, f) => (r(), v(e(Oi), {
115
+ "popover-side-offset": 8,
116
+ "popover-align": "start",
117
+ "popover-side": "bottom"
118
+ }, {
119
+ trigger: s(() => [
120
+ o(e(Q), {
121
+ label: a.value,
122
+ size: n.size,
123
+ color: "gray",
124
+ variant: "translucent"
125
+ }, null, 8, ["label", "size"])
126
+ ]),
127
+ content: s(() => [
128
+ o(e(zi), null, {
129
+ default: s(() => [
130
+ o(e(ze), {
131
+ gap: "xs",
132
+ class: "max-w-80"
133
+ }, {
134
+ default: s(() => [
135
+ (r(!0), K(ae, null, Te(n.reminders, (p, _) => (r(), v(e(R), {
136
+ key: p.uuid,
137
+ text: e(t).t("wise_invoicing.invoice.reminder.tooltip_line", {
138
+ number: _ + 1,
139
+ date: m(p.sentAt)
140
+ }),
141
+ class: "text-sm text-primary"
142
+ }, null, 8, ["text"]))), 128))
143
+ ]),
144
+ _: 1
145
+ })
146
+ ]),
147
+ _: 1
148
+ })
149
+ ]),
150
+ _: 1
151
+ }));
152
+ }
153
+ }), Ln = I.string().nullable(), $n = I.object({
154
+ subject: Ln
155
+ });
156
+ function qn() {
157
+ return E({
158
+ queryFn: (i) => k.createCreditNote(
159
+ i.params.invoiceUuid
160
+ ),
161
+ queryKeysToInvalidate: {
162
+ invoiceDetail: {
163
+ invoiceUuid: (i) => i.invoiceUuid
164
+ },
165
+ invoiceIndex: {}
166
+ }
167
+ });
168
+ }
169
+ function Rn() {
170
+ return E({
171
+ queryFn: (i) => k.duplicate(
172
+ i.params.invoiceUuid
173
+ ),
174
+ queryKeysToInvalidate: {
175
+ invoiceIndex: {}
176
+ }
177
+ });
178
+ }
179
+ function On() {
180
+ return E({
181
+ queryFn: (i) => k.finalize(
182
+ i.params.invoiceUuid
183
+ ),
184
+ queryKeysToInvalidate: {
185
+ invoiceDetail: {
186
+ invoiceUuid: (i) => i.invoiceUuid
187
+ },
188
+ invoiceIndex: {}
189
+ }
190
+ });
191
+ }
192
+ function zn() {
193
+ return E({
194
+ queryFn: (i) => k.markAsDraft(
195
+ i.params.invoiceUuid
196
+ ),
197
+ queryKeysToInvalidate: {
198
+ invoiceDetail: {
199
+ invoiceUuid: (i) => i.invoiceUuid
200
+ },
201
+ invoiceIndex: {}
202
+ }
203
+ });
204
+ }
205
+ function Vn() {
206
+ return E({
207
+ queryFn: (i) => k.markAsPaid(
208
+ i.params.invoiceUuid
209
+ ),
210
+ queryKeysToInvalidate: {
211
+ invoiceDetail: {
212
+ invoiceUuid: (i) => i.invoiceUuid
213
+ },
214
+ invoiceIndex: {}
215
+ }
216
+ });
217
+ }
218
+ function jn() {
219
+ return E({
220
+ queryFn: (i) => k.markAsProtested(
221
+ i.params.invoiceUuid
222
+ ),
223
+ queryKeysToInvalidate: {
224
+ invoiceDetail: {
225
+ invoiceUuid: (i) => i.invoiceUuid
226
+ },
227
+ invoiceIndex: {}
228
+ }
229
+ });
230
+ }
231
+ function Bn() {
232
+ return E({
233
+ queryFn: (i) => k.markAsReady(
234
+ i.params.invoiceUuid
235
+ ),
236
+ queryKeysToInvalidate: {
237
+ invoiceDetail: {
238
+ invoiceUuid: (i) => i.invoiceUuid
239
+ },
240
+ invoiceIndex: {}
241
+ }
242
+ });
243
+ }
244
+ function Nn() {
245
+ return E({
246
+ queryFn: (i) => k.send(
247
+ i.params.invoiceUuid
248
+ ),
249
+ queryKeysToInvalidate: {
250
+ invoiceDetail: {
251
+ invoiceUuid: (i) => i.invoiceUuid
252
+ },
253
+ invoiceIndex: {}
254
+ }
255
+ });
256
+ }
257
+ function Kn() {
258
+ return E({
259
+ queryFn: (i) => k.withdrawProtest(
260
+ i.params.invoiceUuid
261
+ ),
262
+ queryKeysToInvalidate: {
263
+ invoiceDetail: {
264
+ invoiceUuid: (i) => i.invoiceUuid
265
+ },
266
+ invoiceIndex: {}
267
+ }
268
+ });
269
+ }
270
+ function Gn() {
271
+ return E({
272
+ queryFn: (i) => k.delete(i.params.invoiceUuid),
273
+ queryKeysToInvalidate: {
274
+ invoiceIndex: {}
275
+ }
276
+ });
277
+ }
278
+ const Hn = /* @__PURE__ */ x({
279
+ __name: "InvoiceDeleteDialog",
280
+ props: {
281
+ invoice: {}
282
+ },
283
+ emits: ["close", "deleted"],
284
+ setup(i, { emit: n }) {
285
+ const t = i, l = n, a = h(), m = Qe(), d = O(), f = Gn(), p = Z({
286
+ schema: Ji.object({}),
287
+ onSubmit: async () => {
288
+ const _ = await f.execute({
289
+ params: {
290
+ invoiceUuid: t.invoice.uuid
291
+ }
292
+ });
293
+ if (_.isErr()) {
294
+ d.apiError(_.error);
295
+ return;
296
+ }
297
+ d.show({
298
+ message: a.t("wise_invoicing.invoice.delete.success_toast")
299
+ }), l("deleted"), l("close"), await m.push({
300
+ name: "invoicing-invoice-overview"
301
+ });
302
+ }
303
+ });
304
+ return (_, g) => (r(), v(e(le), {
305
+ form: e(p),
306
+ size: "xs",
307
+ onClose: g[0] || (g[0] = (b) => l("close"))
308
+ }, {
309
+ default: s(() => [
310
+ o(e(ce), {
311
+ title: e(a).t("wise_invoicing.invoice.delete.title"),
312
+ description: e(a).t("wise_invoicing.invoice.delete.description"),
313
+ "is-description-visible": !0
314
+ }, null, 8, ["title", "description"]),
315
+ o(e(re), null, {
316
+ right: s(() => [
317
+ o(e(ue), { label: "cancel" }),
318
+ o(e(we), {
319
+ "is-destructive": !0,
320
+ label: e(a).t("wise_invoicing.invoice.delete.submit_button")
321
+ }, null, 8, ["label"])
322
+ ]),
323
+ _: 1
324
+ })
325
+ ]),
326
+ _: 1
327
+ }, 8, ["form"]));
328
+ }
329
+ });
330
+ function Qn(i) {
331
+ const n = h(), t = O(), l = Qe(), a = de(), m = a.create(Hn), d = a.create(Yi), f = Nn(), p = qn(), _ = Rn(), g = On(), b = zn(), U = Vn(), T = jn(), F = Bn(), C = Kn(), {
332
+ shouldSkipConfirmation: S
333
+ } = Xi(), w = Pe(null), L = c(() => G.getMetadata(i.value.status)), y = c(() => w.value ?? i.value.isDisputed), A = c(() => i.value.status !== $.DRAFT && i.value.status !== $.READY), W = c(() => i.value.lifecycleStatus === pi.FINALIZED), We = c(() => (i.value.status === $.SENT || i.value.status === $.OVERDUE) && i.value.maxReminderCount > 0), Ue = c(() => i.value.reminders.length >= i.value.maxReminderCount);
334
+ function ee(u) {
335
+ return L.value.actions.includes(u);
336
+ }
337
+ di(() => i.value.isDisputed, (u) => {
338
+ w.value === u && (w.value = null);
339
+ });
340
+ async function Ce() {
341
+ const u = await g.execute({
342
+ params: {
343
+ invoiceUuid: i.value.uuid
344
+ }
345
+ });
346
+ return u.isErr() ? (t.apiError(u.error), !1) : (t.show({
347
+ message: n.t("wise_invoicing.invoice.finalize.success")
348
+ }), !0);
349
+ }
350
+ async function Je() {
351
+ if (S.value) {
352
+ await Ce();
353
+ return;
354
+ }
355
+ await d.open({
356
+ billingDocumentType: "invoice",
357
+ onConfirm: Ce
358
+ });
359
+ }
360
+ async function Ye() {
361
+ const u = await F.execute({
362
+ params: {
363
+ invoiceUuid: i.value.uuid
364
+ }
365
+ });
366
+ if (u.isErr()) {
367
+ t.apiError(u.error);
368
+ return;
369
+ }
370
+ t.show({
371
+ message: n.t("wise_invoicing.invoice.mark_as_ready.success")
372
+ });
373
+ }
374
+ async function Xe() {
375
+ const u = await b.execute({
376
+ params: {
377
+ invoiceUuid: i.value.uuid
378
+ }
379
+ });
380
+ if (u.isErr()) {
381
+ t.apiError(u.error);
382
+ return;
383
+ }
384
+ t.show({
385
+ message: n.t("wise_invoicing.invoice.mark_as_draft.success")
386
+ });
387
+ }
388
+ async function ei() {
389
+ const u = await U.execute({
390
+ params: {
391
+ invoiceUuid: i.value.uuid
392
+ }
393
+ });
394
+ if (u.isErr()) {
395
+ t.apiError(u.error);
396
+ return;
397
+ }
398
+ t.show({
399
+ message: n.t("wise_invoicing.invoice.mark_as_paid.success")
400
+ });
401
+ }
402
+ async function ii() {
403
+ w.value = !0;
404
+ const u = await T.execute({
405
+ params: {
406
+ invoiceUuid: i.value.uuid
407
+ }
408
+ });
409
+ if (u.isErr()) {
410
+ w.value = null, t.apiError(u.error);
411
+ return;
412
+ }
413
+ t.show({
414
+ message: n.t("wise_invoicing.invoice.mark_as_disputed.success")
415
+ });
416
+ }
417
+ async function ni() {
418
+ w.value = !1;
419
+ const u = await C.execute({
420
+ params: {
421
+ invoiceUuid: i.value.uuid
422
+ }
423
+ });
424
+ if (u.isErr()) {
425
+ w.value = null, t.apiError(u.error);
426
+ return;
427
+ }
428
+ t.show({
429
+ message: n.t("wise_invoicing.invoice.withdraw_dispute.success")
430
+ });
431
+ }
432
+ async function ti() {
433
+ const u = await f.execute({
434
+ params: {
435
+ invoiceUuid: i.value.uuid
436
+ }
437
+ });
438
+ if (u.isErr()) {
439
+ t.apiError(u.error);
440
+ return;
441
+ }
442
+ t.show({
443
+ message: n.t("wise_invoicing.invoice.send.success")
444
+ });
445
+ }
446
+ async function oi() {
447
+ const u = await f.execute({
448
+ params: {
449
+ invoiceUuid: i.value.uuid
450
+ }
451
+ });
452
+ if (u.isErr()) {
453
+ t.apiError(u.error);
454
+ return;
455
+ }
456
+ t.show({
457
+ message: n.t("wise_invoicing.invoice.reminder.success")
458
+ });
459
+ }
460
+ async function ai() {
461
+ await m.open({
462
+ invoice: i.value
463
+ });
464
+ }
465
+ async function si() {
466
+ const u = await k.getByUuid(i.value.uuid);
467
+ if (u.isErr()) {
468
+ t.apiError(u.error);
469
+ return;
470
+ }
471
+ const J = u.value.file;
472
+ if (J === null) {
473
+ t.show({
474
+ message: n.t("wise_invoicing.invoice.download_pdf.generation_in_progress")
475
+ });
476
+ return;
477
+ }
478
+ const ie = await en.getDownloadUrl(J.uuid);
479
+ ie !== null && xi.downloadUrl(ie, J.name);
480
+ }
481
+ async function li() {
482
+ const u = await _.execute({
483
+ params: {
484
+ invoiceUuid: i.value.uuid
485
+ }
486
+ });
487
+ if (u.isErr()) {
488
+ t.apiError(u.error);
489
+ return;
490
+ }
491
+ t.show({
492
+ button: {
493
+ label: n.t("wise_invoicing.invoice.duplicate.view_action"),
494
+ onClick: () => {
495
+ l.push({
496
+ name: "invoicing-invoice-detail",
497
+ params: {
498
+ invoiceUuid: u.value
499
+ }
500
+ });
501
+ }
502
+ },
503
+ message: n.t("wise_invoicing.invoice.duplicate.success")
504
+ });
505
+ }
506
+ async function ci() {
507
+ const u = await p.execute({
508
+ params: {
509
+ invoiceUuid: i.value.uuid
510
+ }
511
+ });
512
+ if (u.isErr()) {
513
+ t.apiError(u.error);
514
+ return;
515
+ }
516
+ t.show({
517
+ button: {
518
+ label: n.t("wise_invoicing.credit_note.create.view_action"),
519
+ onClick: () => {
520
+ l.push({
521
+ name: "invoicing-credit-note-detail",
522
+ params: {
523
+ creditNoteUuid: u.value
524
+ }
525
+ });
526
+ }
527
+ },
528
+ message: n.t("wise_invoicing.credit_note.create.success")
529
+ });
530
+ }
531
+ const ri = c(() => [
532
+ {
533
+ isLoading: f.isLoading.value,
534
+ iconLeft: _e,
535
+ key: "send",
536
+ label: n.t("wise_invoicing.invoice.detail.actions.send"),
537
+ variant: "primary",
538
+ visible: i.value.status === $.FINALIZED,
539
+ onClick: ti
540
+ },
541
+ {
542
+ isDisabled: Ue.value,
543
+ isLoading: f.isLoading.value,
544
+ disabledReason: Ue.value ? n.t("wise_invoicing.invoice.reminder.max_reached") : null,
545
+ iconLeft: _e,
546
+ key: "sendReminder",
547
+ label: n.t("wise_invoicing.invoice.detail.header.send_reminder"),
548
+ variant: "primary",
549
+ visible: We.value,
550
+ onClick: oi
551
+ },
552
+ {
553
+ isLoading: F.isLoading.value,
554
+ iconRight: Ae,
555
+ key: "markAsReady",
556
+ label: n.t("wise_invoicing.invoice.detail.actions.mark_as_ready"),
557
+ visible: ee("markAsReady"),
558
+ onClick: Ye
559
+ },
560
+ {
561
+ isLoading: g.isLoading.value,
562
+ iconLeft: _i,
563
+ key: "finalize",
564
+ label: n.t("wise_invoicing.invoice.detail.actions.finalize"),
565
+ visible: ee("finalize"),
566
+ onClick: Je
567
+ }
568
+ ].filter((u) => u.visible)), Se = c(() => {
569
+ const u = [
570
+ {
571
+ icon: $e,
572
+ key: "markAsProtested",
573
+ label: n.t("wise_invoicing.invoice.detail.actions.mark_as_disputed"),
574
+ visible: W.value && !y.value,
575
+ onSelect: ii
576
+ },
577
+ {
578
+ icon: fi,
579
+ key: "markAsPaid",
580
+ label: n.t("wise_invoicing.invoice.detail.actions.mark_as_paid"),
581
+ visible: ee("markAsPaid"),
582
+ onSelect: ei
583
+ },
584
+ {
585
+ icon: Ae,
586
+ key: "withdrawProtest",
587
+ label: n.t("wise_invoicing.invoice.detail.actions.withdraw_dispute"),
588
+ visible: W.value && y.value,
589
+ onSelect: ni
590
+ }
591
+ ], J = [
592
+ $.FINALIZED,
593
+ $.PAID,
594
+ $.SENT,
595
+ $.OVERDUE,
596
+ $.PROTESTED
597
+ ].includes(i.value.status), ie = [
598
+ {
599
+ icon: gi,
600
+ key: "downloadPdf",
601
+ label: n.t("wise_invoicing.common.download_pdf"),
602
+ visible: A.value,
603
+ onSelect: si
604
+ },
605
+ {
606
+ icon: yi,
607
+ key: "backToDraft",
608
+ label: n.t("wise_invoicing.invoice.detail.actions.mark_as_draft"),
609
+ visible: ee("markAsDraft"),
610
+ onSelect: Xe
611
+ },
612
+ {
613
+ icon: bi,
614
+ key: "duplicate",
615
+ label: n.t("wise_invoicing.invoice.detail.actions.duplicate"),
616
+ visible: !0,
617
+ onSelect: li
618
+ }
619
+ ], ui = [
620
+ {
621
+ icon: wi,
622
+ key: "createCreditNote",
623
+ label: n.t("wise_invoicing.invoice.detail.header.cancel_with_credit_note"),
624
+ visible: J,
625
+ onSelect: ci
626
+ },
627
+ {
628
+ icon: Ii,
629
+ key: "delete",
630
+ label: n.t("wise_invoicing.invoice.detail.actions.delete"),
631
+ visible: L.value.isEditable,
632
+ onSelect: ai
633
+ }
634
+ ];
635
+ return [
636
+ {
637
+ items: u.filter((z) => z.visible),
638
+ key: "lifecycle"
639
+ },
640
+ {
641
+ items: ie.filter((z) => z.visible),
642
+ key: "secondary"
643
+ },
644
+ {
645
+ items: ui.filter((z) => z.visible),
646
+ key: "destructive"
647
+ }
648
+ ].filter((z) => z.items.length > 0);
649
+ });
650
+ return {
651
+ isActionMenuVisible: c(() => Se.value.length > 0),
652
+ isDisputed: y,
653
+ menuGroups: Se,
654
+ primaryButtons: ri
655
+ };
656
+ }
657
+ const Zn = /* @__PURE__ */ x({
658
+ __name: "InvoiceDetailHeaderSection",
659
+ props: {
660
+ isPdfViewActive: { type: Boolean },
661
+ invoice: {}
662
+ },
663
+ emits: ["togglePdfView"],
664
+ setup(i, { emit: n }) {
665
+ const t = i, l = n, a = h(), m = O(), {
666
+ isDisputed: d,
667
+ menuGroups: f,
668
+ primaryButtons: p
669
+ } = Qn(c(() => t.invoice)), _ = ke(), g = c(() => new Be(t.invoice.status)), b = c(() => g.value.color), U = c(() => a.t(g.value.translationKey)), T = c(() => t.invoice.deliveryStatus !== Di.UNSENT || t.invoice.reminders.length > 0), F = c(() => Le.isSent(t.invoice.deliveryStatus)), C = c(() => !G.isEditable(t.invoice.status)), S = Z({
670
+ initialState: {
671
+ subject: t.invoice.subject
672
+ },
673
+ schema: $n,
674
+ onSubmit: async (L) => {
675
+ const y = await _.execute({
676
+ body: {
677
+ ...ye.toForm(t.invoice),
678
+ subject: L.subject
679
+ },
680
+ params: {
681
+ invoiceUuid: t.invoice.uuid
682
+ }
683
+ });
684
+ y.isErr() && m.apiError(y.error);
685
+ }
686
+ }), w = S.register("subject");
687
+ return Ne({
688
+ form: S
689
+ }), (L, y) => (r(), v(e(Ve), {
690
+ form: e(S),
691
+ "prompt-on-unsaved-changes": !1
692
+ }, {
693
+ default: s(() => [
694
+ o(nn, {
695
+ "fallback-title": e(a).t("wise_invoicing.invoice.detail.fallback_title"),
696
+ "is-disabled": C.value,
697
+ sequence: t.invoice.sequence,
698
+ "status-color": b.value,
699
+ "status-label": U.value,
700
+ icon: e(qe),
701
+ "subject-field": e(w),
702
+ "subject-placeholder": e(a).t("wise_invoicing.invoice.detail.header.subject_placeholder")
703
+ }, {
704
+ actions: s(() => [
705
+ o(on, {
706
+ "is-pdf-view-active": t.isPdfViewActive,
707
+ "menu-groups": e(f),
708
+ "primary-buttons": e(p),
709
+ onTogglePdfView: y[0] || (y[0] = (A) => l("togglePdfView"))
710
+ }, null, 8, ["is-pdf-view-active", "menu-groups", "primary-buttons"])
711
+ ]),
712
+ status: s(() => [
713
+ o(e(Y), {
714
+ gap: "xs",
715
+ class: "flex-wrap items-start"
716
+ }, {
717
+ default: s(() => [
718
+ o(hi, {
719
+ "lifecycle-status": t.invoice.lifecycleStatus
720
+ }, null, 8, ["lifecycle-status"]),
721
+ o(ki, {
722
+ "is-sent": F.value,
723
+ "balance-due-amount": t.invoice.balanceDueAmount,
724
+ "gross-amount": t.invoice.grossAmount,
725
+ "paid-amount": t.invoice.paidAmount,
726
+ "settlement-status": t.invoice.settlementStatus,
727
+ "total-credited-amount": t.invoice.totalCreditedAmount
728
+ }, null, 8, ["is-sent", "balance-due-amount", "gross-amount", "paid-amount", "settlement-status", "total-credited-amount"]),
729
+ t.invoice.isOverdue ? (r(), v(tn, { key: 0 })) : D("", !0),
730
+ e(d) ? (r(), v(Ui, { key: 1 })) : D("", !0),
731
+ T.value ? (r(), v(Pn, {
732
+ key: 2,
733
+ "delivery-status": t.invoice.deliveryStatus
734
+ }, null, 8, ["delivery-status"])) : D("", !0),
735
+ t.invoice.reminders.length > 0 ? (r(), v(Mn, {
736
+ key: 3,
737
+ reminders: t.invoice.reminders
738
+ }, null, 8, ["reminders"])) : D("", !0)
739
+ ]),
740
+ _: 1
741
+ })
742
+ ]),
743
+ _: 1
744
+ }, 8, ["fallback-title", "is-disabled", "sequence", "status-color", "status-label", "icon", "subject-field", "subject-placeholder"])
745
+ ]),
746
+ _: 1
747
+ }, 8, ["form"]));
748
+ }
749
+ }), Wn = { class: "grid w-full grid-cols-1 gap-md lg:grid-cols-3" }, Jn = /* @__PURE__ */ x({
750
+ __name: "InvoiceDetailLinkedCreditNotesSection",
751
+ props: {
752
+ invoice: {}
753
+ },
754
+ setup(i) {
755
+ const n = i, t = h(), l = X(), a = c(() => n.invoice.creditNotes.map((d) => {
756
+ const f = new Be(d.status);
757
+ return {
758
+ uuid: d.uuid,
759
+ title: d.sequence === null ? t.t("wise_invoicing.invoice.detail.credit_notes.untitled") : t.t("wise_invoicing.invoice.detail.credit_notes.card_title", {
760
+ sequence: d.sequence
761
+ }),
762
+ amountLabel: l.formatMonetary(m(d)),
763
+ statusColor: f.color,
764
+ statusLabel: t.t(f.translationKey)
765
+ };
766
+ }));
767
+ function m(d) {
768
+ return {
769
+ ...d.grossAmount,
770
+ amount: d.grossAmount.amount > 0 ? -d.grossAmount.amount : d.grossAmount.amount
771
+ };
772
+ }
773
+ return (d, f) => a.value.length > 0 ? (r(), v(e(ze), {
774
+ key: 0,
775
+ as: "section",
776
+ gap: "md",
777
+ class: "w-full"
778
+ }, {
779
+ default: s(() => [
780
+ o(e(R), {
781
+ text: e(t).t("wise_invoicing.invoice.detail.credit_notes.title"),
782
+ as: "h2",
783
+ class: "text-sm font-semibold text-primary"
784
+ }, null, 8, ["text"]),
785
+ N("div", Wn, [
786
+ (r(!0), K(ae, null, Te(a.value, (p) => (r(), v(e(bn), {
787
+ key: p.uuid,
788
+ to: {
789
+ name: "invoicing-credit-note-detail",
790
+ params: { creditNoteUuid: p.uuid }
791
+ },
792
+ class: "min-w-0 rounded-lg border border-secondary bg-primary p-lg transition-colors hover:bg-secondary"
793
+ }, {
794
+ default: s(() => [
795
+ o(e(Y), {
796
+ align: "center",
797
+ gap: "md",
798
+ class: "min-w-0"
799
+ }, {
800
+ default: s(() => [
801
+ o(e(R), {
802
+ text: p.title,
803
+ class: "min-w-0 flex-1 truncate text-xs font-semibold text-primary"
804
+ }, null, 8, ["text"]),
805
+ o(e(Q), {
806
+ label: p.statusLabel,
807
+ color: p.statusColor,
808
+ size: "sm",
809
+ variant: "translucent"
810
+ }, null, 8, ["label", "color"]),
811
+ o(e(Q), {
812
+ label: p.amountLabel,
813
+ variant: "translucent",
814
+ size: "sm"
815
+ }, null, 8, ["label"])
816
+ ]),
817
+ _: 2
818
+ }, 1024)
819
+ ]),
820
+ _: 2
821
+ }, 1032, ["to"]))), 128))
822
+ ])
823
+ ]),
824
+ _: 1
825
+ })) : D("", !0);
826
+ }
827
+ }), Ze = I.object({
828
+ deliveredOn: ve.nullable(),
829
+ dueOn: ve,
830
+ issuedOn: ve,
831
+ externalRemarks: I.string().nullable(),
832
+ poNumber: I.string().nullable(),
833
+ preparedBy: I.object({
834
+ uuid: I.uuid(),
835
+ name: I.string()
836
+ }),
837
+ subject: I.string().nullable()
838
+ }).superRefine((i, n) => {
839
+ Temporal.PlainDate.compare(i.dueOn, i.issuedOn) < 0 && n.addIssue({
840
+ code: "custom",
841
+ message: Ci.global.t("invoicing.invoice.validation.due_date_after_issue_date"),
842
+ path: [
843
+ "dueOn"
844
+ ]
845
+ });
846
+ }), Yn = /* @__PURE__ */ x({
847
+ __name: "InvoiceDetailRemarksSection",
848
+ props: {
849
+ invoice: {}
850
+ },
851
+ setup(i) {
852
+ const n = i, t = h(), l = O(), a = ke(), m = Z({
853
+ initialState: c(() => ye.toForm(n.invoice)),
854
+ schema: Ze,
855
+ onSubmit: async (p) => {
856
+ const _ = await a.execute({
857
+ body: p,
858
+ params: {
859
+ invoiceUuid: n.invoice.uuid
860
+ }
861
+ });
862
+ _.isErr() && l.apiError(_.error);
863
+ }
864
+ }), d = m.register("externalRemarks"), f = c(() => !G.isEditable(n.invoice.status));
865
+ return Ne({
866
+ form: m
867
+ }), (p, _) => (r(), v(e(Ve), {
868
+ form: e(m),
869
+ "prompt-on-unsaved-changes": !1
870
+ }, {
871
+ default: s(() => [
872
+ o(an, {
873
+ "is-disabled": f.value,
874
+ placeholder: e(t).t("wise_invoicing.invoice.detail.remarks.placeholder"),
875
+ "remarks-field": e(d),
876
+ title: e(t).t("wise_invoicing.invoice.detail.remarks.title")
877
+ }, null, 8, ["is-disabled", "placeholder", "remarks-field", "title"])
878
+ ]),
879
+ _: 1
880
+ }, 8, ["form"]));
881
+ }
882
+ });
883
+ function Xn(i) {
884
+ return yn("invoiceActivityLogIndex", {
885
+ params: {
886
+ invoiceUuid: i
887
+ },
888
+ queryFn: (n) => k.getActivityLogs(i.value, {
889
+ pagination: n
890
+ })
891
+ });
892
+ }
893
+ const et = /* @__PURE__ */ x({
894
+ __name: "InvoiceDetailSidebarActivityTab",
895
+ props: {
896
+ invoice: {}
897
+ },
898
+ setup(i) {
899
+ const n = i, t = h(), {
900
+ hasNextPage: l,
901
+ isFetchingNextPage: a,
902
+ isLoading: m,
903
+ fetchNextPage: d,
904
+ result: f
905
+ } = Xn(c(() => n.invoice.uuid)), p = c(() => f.value.unwrapOr({
906
+ data: [],
907
+ meta: {
908
+ next: null
909
+ }
910
+ }).data);
911
+ return (_, g) => (r(), v(sn, {
912
+ "current-billing-document": {
913
+ role: e(Si).INVOICE,
914
+ uuid: n.invoice.uuid
915
+ },
916
+ "empty-message": e(t).t("wise_invoicing.invoice.detail.sidebar.activity_empty"),
917
+ entries: p.value,
918
+ "fetch-next-page": e(d),
919
+ "has-next-page": e(l),
920
+ "is-fetching-next-page": e(a),
921
+ "is-loading": e(m)
922
+ }, null, 8, ["current-billing-document", "empty-message", "entries", "fetch-next-page", "has-next-page", "is-fetching-next-page", "is-loading"]));
923
+ }
924
+ });
925
+ function it(i) {
926
+ return Ge("invoiceCustomerDetail", {
927
+ params: {
928
+ customerUuid: i
929
+ },
930
+ queryFn: () => Ai.getByUuid(i.value)
931
+ });
932
+ }
933
+ const nt = /* @__PURE__ */ x({
934
+ __name: "InvoiceUpdateDialog",
935
+ props: {
936
+ invoice: {}
937
+ },
938
+ emits: ["close"],
939
+ setup(i, { emit: n }) {
940
+ const t = i, l = n, a = h(), m = O(), d = ke(), f = wn(), p = be(), _ = c(() => t.invoice.customer.uuid), g = it(_), b = c(() => {
941
+ const y = g.result.value;
942
+ if (y.isOk())
943
+ return y.getValue().defaultPaymentTermDays;
944
+ const A = f.result.value;
945
+ return A.isOk() ? A.getValue().defaultPaymentTermDays ?? 0 : 0;
946
+ }), U = Z({
947
+ initialState: c(() => ye.toForm(t.invoice)),
948
+ schema: Ze,
949
+ onSubmit: async (y) => {
950
+ const A = await d.execute({
951
+ body: y,
952
+ params: {
953
+ invoiceUuid: t.invoice.uuid
954
+ }
955
+ });
956
+ if (A.isErr()) {
957
+ m.apiError(A.error);
958
+ return;
959
+ }
960
+ l("close");
961
+ },
962
+ onSubmitError: () => {
963
+ m.unableToSave();
964
+ }
965
+ }), T = U.register("issuedOn"), F = U.register("dueOn"), C = U.register("deliveredOn"), S = U.register("poNumber"), w = U.register("subject");
966
+ function L(y) {
967
+ y !== null && F.setValue(y.add({
968
+ days: b.value
969
+ }));
970
+ }
971
+ return (y, A) => (r(), v(e(le), {
972
+ form: e(U),
973
+ size: "sm",
974
+ onClose: A[0] || (A[0] = (W) => l("close"))
975
+ }, {
976
+ default: s(() => [
977
+ o(e(ce), {
978
+ icon: e(Ei),
979
+ "is-description-visible": !1,
980
+ title: e(a).t("wise_invoicing.invoice.detail.header.edit_info"),
981
+ description: ""
982
+ }, null, 8, ["icon", "title"]),
983
+ o(e(Ie), null, {
984
+ default: s(() => [
985
+ o(e(xe), null, {
986
+ default: s(() => [
987
+ o(e(De), {
988
+ lg: 2,
989
+ sm: 1
990
+ }, {
991
+ default: s(() => [
992
+ o(e(te), P(e(M)(e(T)), {
993
+ label: e(a).t("wise_invoicing.invoice.detail.header.invoice_date"),
994
+ "is-required": !0,
995
+ "onUpdate:modelValue": L
996
+ }), null, 16, ["label"]),
997
+ o(e(te), P(e(M)(e(F)), {
998
+ label: e(a).t("wise_invoicing.invoice.detail.header.due_date"),
999
+ "is-required": !0,
1000
+ "min-date": e(T).modelValue.value
1001
+ }), null, 16, ["label", "min-date"]),
1002
+ e(p).isDeliveryDateVisible.value ? (r(), v(e(te), P({ key: 0 }, e(M)(e(C)), {
1003
+ label: e(a).t("wise_invoicing.invoice.detail.header.delivery_date")
1004
+ }), null, 16, ["label"])) : D("", !0),
1005
+ o(e(oe), P(e(M)(e(S)), {
1006
+ label: e(a).t("wise_invoicing.invoice.detail.header.po_number")
1007
+ }), null, 16, ["label"]),
1008
+ o(e(oe), P(e(M)(e(w)), {
1009
+ label: e(a).t("wise_invoicing.invoice.detail.header.subject"),
1010
+ placeholder: e(a).t("wise_invoicing.invoice.detail.header.subject_placeholder")
1011
+ }), null, 16, ["label", "placeholder"])
1012
+ ]),
1013
+ _: 1
1014
+ })
1015
+ ]),
1016
+ _: 1
1017
+ })
1018
+ ]),
1019
+ _: 1
1020
+ }),
1021
+ o(e(re), null, {
1022
+ right: s(() => [
1023
+ o(e(ue), { label: "cancel" }),
1024
+ o(e(we), {
1025
+ label: e(a).t("wise_invoicing.invoice.detail.header.edit_info")
1026
+ }, null, 8, ["label"])
1027
+ ]),
1028
+ _: 1
1029
+ })
1030
+ ]),
1031
+ _: 1
1032
+ }, 8, ["form"]));
1033
+ }
1034
+ }), tt = /* @__PURE__ */ x({
1035
+ __name: "InvoiceDetailSidebarInfoTab",
1036
+ props: {
1037
+ invoice: {}
1038
+ },
1039
+ setup(i) {
1040
+ const n = i, t = h(), l = se(), a = be(), d = de().create(nt), f = c(() => G.isEditable(n.invoice.status)), p = c(() => {
1041
+ if (!n.invoice.isOverdue)
1042
+ return null;
1043
+ const b = n.invoice.dueOn.toZonedDateTime(He.Now.timeZoneId()).toInstant();
1044
+ return l.toRelativeTime(b);
1045
+ });
1046
+ async function _() {
1047
+ await d.open({
1048
+ invoice: n.invoice
1049
+ });
1050
+ }
1051
+ function g(b) {
1052
+ return b === null ? "-" : l.formatPlainDate(b);
1053
+ }
1054
+ return (b, U) => (r(), v(e(Vi), { class: "px-2xl py-xl" }, {
1055
+ default: s(() => [
1056
+ o(e(pe), {
1057
+ label: e(t).t("wise_invoicing.invoice.detail.sidebar.general")
1058
+ }, vi({
1059
+ default: s(() => [
1060
+ o(e(q), null, {
1061
+ default: s(() => [
1062
+ o(e(V), {
1063
+ icon: e(Fi),
1064
+ label: e(t).t("wise_invoicing.invoice.detail.header.invoice_id")
1065
+ }, null, 8, ["icon", "label"]),
1066
+ o(e(j), {
1067
+ text: n.invoice.sequence ?? "-"
1068
+ }, null, 8, ["text"])
1069
+ ]),
1070
+ _: 1
1071
+ }),
1072
+ o(e(q), null, {
1073
+ default: s(() => [
1074
+ o(e(V), {
1075
+ icon: e(Ti),
1076
+ label: e(t).t("wise_invoicing.invoice.detail.header.po_number")
1077
+ }, null, 8, ["icon", "label"]),
1078
+ o(e(j), {
1079
+ text: n.invoice.poNumber ?? "-"
1080
+ }, null, 8, ["text"])
1081
+ ]),
1082
+ _: 1
1083
+ }),
1084
+ o(e(q), null, {
1085
+ default: s(() => [
1086
+ o(e(V), {
1087
+ icon: e(Pi),
1088
+ label: e(t).t("wise_invoicing.invoice.detail.header.issuer")
1089
+ }, null, 8, ["icon", "label"]),
1090
+ o(e(j), {
1091
+ text: n.invoice.issuer.name ?? "-"
1092
+ }, null, 8, ["text"])
1093
+ ]),
1094
+ _: 1
1095
+ }),
1096
+ o(e(q), null, {
1097
+ default: s(() => [
1098
+ o(e(V), {
1099
+ icon: e(qe),
1100
+ label: e(t).t("wise_invoicing.invoice.detail.header.invoice_date")
1101
+ }, null, 8, ["icon", "label"]),
1102
+ o(e(j), {
1103
+ text: g(n.invoice.issueOn)
1104
+ }, null, 8, ["text"])
1105
+ ]),
1106
+ _: 1
1107
+ }),
1108
+ o(e(q), null, {
1109
+ default: s(() => [
1110
+ o(e(V), {
1111
+ icon: e($e),
1112
+ label: e(t).t("wise_invoicing.invoice.detail.header.due_date"),
1113
+ variant: n.invoice.isOverdue ? "error" : "default"
1114
+ }, null, 8, ["icon", "label", "variant"]),
1115
+ o(e(Y), { gap: "xs" }, {
1116
+ default: s(() => [
1117
+ o(e(j), {
1118
+ text: g(n.invoice.dueOn),
1119
+ variant: n.invoice.isOverdue ? "error" : "default"
1120
+ }, null, 8, ["text", "variant"]),
1121
+ p.value !== null ? (r(), v(e(Q), {
1122
+ key: 0,
1123
+ label: p.value,
1124
+ color: "error",
1125
+ size: "sm",
1126
+ variant: "translucent"
1127
+ }, null, 8, ["label"])) : D("", !0)
1128
+ ]),
1129
+ _: 1
1130
+ })
1131
+ ]),
1132
+ _: 1
1133
+ }),
1134
+ e(a).isDeliveryDateVisible.value ? (r(), v(e(q), { key: 0 }, {
1135
+ default: s(() => [
1136
+ o(e(V), {
1137
+ icon: e(_e),
1138
+ label: e(t).t("wise_invoicing.invoice.detail.header.delivery_date")
1139
+ }, null, 8, ["icon", "label"]),
1140
+ o(e(j), {
1141
+ text: g(n.invoice.deliveredOn)
1142
+ }, null, 8, ["text"])
1143
+ ]),
1144
+ _: 1
1145
+ })) : D("", !0)
1146
+ ]),
1147
+ _: 2
1148
+ }, [
1149
+ f.value ? {
1150
+ name: "actions",
1151
+ fn: s(() => [
1152
+ o(e(je), {
1153
+ icon: e(Mi),
1154
+ label: e(t).t("wise_invoicing.invoice.detail.header.edit_info"),
1155
+ variant: "tertiary",
1156
+ onClick: _
1157
+ }, null, 8, ["icon", "label"])
1158
+ ]),
1159
+ key: "0"
1160
+ } : void 0
1161
+ ]), 1032, ["label"]),
1162
+ o(ln, {
1163
+ "original-invoice": n.invoice.originalInvoice
1164
+ }, null, 8, ["original-invoice"]),
1165
+ o(e(Ee)),
1166
+ o(e(pe), {
1167
+ label: e(t).t("wise_invoicing.invoice.detail.header.bill_to"),
1168
+ "collapse-options": {
1169
+ isCollapsible: !0,
1170
+ isOpenByDefault: !0,
1171
+ badge: {
1172
+ label: n.invoice.customer.name ?? "-"
1173
+ }
1174
+ }
1175
+ }, {
1176
+ default: s(() => [
1177
+ o(e(q), { orientation: "vertical" }, {
1178
+ default: s(() => [
1179
+ o(e(R), {
1180
+ text: n.invoice.customer.name ?? "-",
1181
+ class: "text-xs font-medium"
1182
+ }, null, 8, ["text"]),
1183
+ n.invoice.customer.address ? (r(), K(ae, { key: 0 }, [
1184
+ o(e(R), {
1185
+ text: e(me).formatLines(n.invoice.customer.address)[0] ?? "",
1186
+ class: "text-xs"
1187
+ }, null, 8, ["text"]),
1188
+ n.invoice.customer.address ? (r(), v(e(R), {
1189
+ key: 0,
1190
+ text: e(me).formatLines(n.invoice.customer.address)[1] ?? "",
1191
+ class: "text-xs"
1192
+ }, null, 8, ["text"])) : D("", !0)
1193
+ ], 64)) : D("", !0)
1194
+ ]),
1195
+ _: 1
1196
+ })
1197
+ ]),
1198
+ _: 1
1199
+ }, 8, ["label", "collapse-options"]),
1200
+ o(e(Ee)),
1201
+ o(e(pe), {
1202
+ label: e(t).t("wise_invoicing.invoice.detail.header.bill_from"),
1203
+ "collapse-options": {
1204
+ isCollapsible: !0,
1205
+ isOpenByDefault: !1,
1206
+ badge: {
1207
+ label: n.invoice.issuer.email ?? "-"
1208
+ }
1209
+ }
1210
+ }, {
1211
+ default: s(() => [
1212
+ o(e(q), { orientation: "vertical" }, {
1213
+ default: s(() => [
1214
+ o(e(V), {
1215
+ label: n.invoice.issuer.email ?? "-"
1216
+ }, null, 8, ["label"]),
1217
+ n.invoice.issuer.address ? (r(), v(e(j), {
1218
+ key: 0,
1219
+ text: e(me).format(n.invoice.issuer.address)
1220
+ }, null, 8, ["text"])) : D("", !0)
1221
+ ]),
1222
+ _: 1
1223
+ })
1224
+ ]),
1225
+ _: 1
1226
+ }, 8, ["label", "collapse-options"])
1227
+ ]),
1228
+ _: 1
1229
+ }));
1230
+ }
1231
+ }), ot = /* @__PURE__ */ x({
1232
+ __name: "InvoiceDetailSidebar",
1233
+ props: {
1234
+ invoice: {}
1235
+ },
1236
+ setup(i) {
1237
+ const n = i, t = h(), l = se(), a = c(() => t.t("wise_invoicing.invoice.detail.sidebar.updated_on", {
1238
+ date: l.toDateTime(n.invoice.updatedAt)
1239
+ }));
1240
+ return (m, d) => (r(), v(cn, {
1241
+ "billing-document": n.invoice,
1242
+ "updated-footer": a.value
1243
+ }, {
1244
+ activity: s(() => [
1245
+ o(et, {
1246
+ invoice: n.invoice
1247
+ }, null, 8, ["invoice"])
1248
+ ]),
1249
+ info: s(() => [
1250
+ o(tt, {
1251
+ invoice: n.invoice
1252
+ }, null, 8, ["invoice"])
1253
+ ]),
1254
+ _: 1
1255
+ }, 8, ["billing-document", "updated-footer"]));
1256
+ }
1257
+ });
1258
+ function at() {
1259
+ return E({
1260
+ queryFn: (i) => k.deletePayment(
1261
+ i.params.invoiceUuid,
1262
+ i.params.paymentUuid
1263
+ ),
1264
+ queryKeysToInvalidate: {
1265
+ invoiceDetail: {
1266
+ invoiceUuid: (i) => i.invoiceUuid
1267
+ },
1268
+ invoicePaymentIndex: {
1269
+ invoiceUuid: (i) => i.invoiceUuid
1270
+ }
1271
+ }
1272
+ });
1273
+ }
1274
+ function st(i) {
1275
+ return Ge("invoicePaymentIndex", {
1276
+ params: {
1277
+ invoiceUuid: i
1278
+ },
1279
+ queryFn: () => k.getPayments(i.value)
1280
+ });
1281
+ }
1282
+ const lt = /* @__PURE__ */ x({
1283
+ __name: "InvoiceDetailPaymentActionsCell",
1284
+ props: {
1285
+ payment: {},
1286
+ onDelete: { type: Function }
1287
+ },
1288
+ setup(i) {
1289
+ const n = i, t = h();
1290
+ return (l, a) => (r(), v(e(he), null, {
1291
+ default: s(() => [
1292
+ o(e(ji), null, {
1293
+ default: s(() => [
1294
+ n.payment.source === e(Re).MANUAL ? (r(), v(e(je), {
1295
+ key: 0,
1296
+ label: e(t).t("wise_invoicing.invoice.detail.payments.delete.title"),
1297
+ icon: e(Tn),
1298
+ size: "sm",
1299
+ variant: "tertiary",
1300
+ onClick: a[0] || (a[0] = (m) => n.onDelete(n.payment))
1301
+ }, null, 8, ["label", "icon"])) : D("", !0)
1302
+ ]),
1303
+ _: 1
1304
+ })
1305
+ ]),
1306
+ _: 1
1307
+ }));
1308
+ }
1309
+ }), ct = /* @__PURE__ */ x({
1310
+ __name: "InvoiceDetailPaymentManualCell",
1311
+ props: {
1312
+ payment: {}
1313
+ },
1314
+ setup(i) {
1315
+ const n = i;
1316
+ return (t, l) => (r(), v(e(he), null, {
1317
+ default: s(() => [
1318
+ n.payment.source === e(Re).MANUAL ? (r(), v(e(Li), {
1319
+ key: 0,
1320
+ class: "size-4 text-brand-600"
1321
+ })) : D("", !0)
1322
+ ]),
1323
+ _: 1
1324
+ }));
1325
+ }
1326
+ }), ne = /* @__PURE__ */ x({
1327
+ __name: "InvoiceDetailPaymentsTableTextCell",
1328
+ props: {
1329
+ text: {}
1330
+ },
1331
+ setup(i) {
1332
+ const n = i;
1333
+ return (t, l) => (r(), v(e(he), null, {
1334
+ default: s(() => [
1335
+ o(e(R), {
1336
+ text: n.text ?? "-",
1337
+ class: "text-sm/5 text-primary"
1338
+ }, null, 8, ["text"])
1339
+ ]),
1340
+ _: 1
1341
+ }));
1342
+ }
1343
+ });
1344
+ function rt(i) {
1345
+ const n = h(), t = se(), l = X();
1346
+ return c(() => Bi()([
1347
+ {
1348
+ headerLabel: n.t("wise_invoicing.invoice.detail.payments.columns.date"),
1349
+ key: "date",
1350
+ size: {
1351
+ max: "12rem",
1352
+ min: "12rem"
1353
+ },
1354
+ component: (a) => H(ne, {
1355
+ text: t.formatPlainDate(a.date)
1356
+ })
1357
+ },
1358
+ {
1359
+ headerLabel: n.t("wise_invoicing.invoice.detail.payments.columns.reference"),
1360
+ key: "reference",
1361
+ size: {
1362
+ max: "14rem",
1363
+ min: "12rem"
1364
+ },
1365
+ component: (a) => H(ne, {
1366
+ text: a.paymentReference ?? "—"
1367
+ })
1368
+ },
1369
+ {
1370
+ headerLabel: n.t("wise_invoicing.invoice.detail.payments.columns.remark"),
1371
+ key: "remark",
1372
+ size: {
1373
+ max: "1fr",
1374
+ min: "12rem"
1375
+ },
1376
+ component: (a) => H(ne, {
1377
+ text: a.remarks ?? "—"
1378
+ })
1379
+ },
1380
+ {
1381
+ headerLabel: n.t("wise_invoicing.invoice.detail.payments.columns.manual"),
1382
+ key: "manual",
1383
+ size: {
1384
+ max: "6rem",
1385
+ min: "6rem"
1386
+ },
1387
+ component: (a) => H(ct, {
1388
+ payment: a
1389
+ })
1390
+ },
1391
+ {
1392
+ headerLabel: n.t("wise_invoicing.invoice.detail.payments.columns.amount"),
1393
+ key: "amount",
1394
+ size: {
1395
+ max: "10rem",
1396
+ min: "10rem"
1397
+ },
1398
+ component: (a) => H(ne, {
1399
+ text: l.formatMonetary(a.amount)
1400
+ })
1401
+ },
1402
+ {
1403
+ headerLabel: "",
1404
+ key: "actions",
1405
+ size: {
1406
+ max: "5rem",
1407
+ min: "5rem"
1408
+ },
1409
+ component: (a) => H(lt, {
1410
+ payment: a,
1411
+ onDelete: i.onDelete
1412
+ })
1413
+ }
1414
+ ]));
1415
+ }
1416
+ function ut() {
1417
+ return E({
1418
+ queryFn: (i) => k.createPayment(
1419
+ i.params.invoiceUuid,
1420
+ i.body
1421
+ ),
1422
+ queryKeysToInvalidate: {
1423
+ invoiceDetail: {
1424
+ invoiceUuid: (i) => i.invoiceUuid
1425
+ },
1426
+ invoicePaymentIndex: {
1427
+ invoiceUuid: (i) => i.invoiceUuid
1428
+ }
1429
+ }
1430
+ });
1431
+ }
1432
+ const dt = I.object({
1433
+ amount: I.number().positive(),
1434
+ currency: I.enum(Oe),
1435
+ date: $i,
1436
+ paymentReference: I.string().nullable(),
1437
+ precision: I.number().int().nonnegative(),
1438
+ remarks: I.string().nullable()
1439
+ }), vt = { class: "pr-md text-xs text-secondary" }, mt = /* @__PURE__ */ x({
1440
+ __name: "InvoicePaymentCreateDialog",
1441
+ props: {
1442
+ invoice: {}
1443
+ },
1444
+ emits: ["close"],
1445
+ setup(i, { emit: n }) {
1446
+ const t = i, l = n, a = h(), m = O(), d = X(), f = ut(), p = c(() => d.getSymbol(t.invoice.grossAmount.currency)), _ = Z({
1447
+ initialState: {
1448
+ amount: null,
1449
+ currency: t.invoice.grossAmount.currency,
1450
+ date: qi.getToday(),
1451
+ paymentReference: null,
1452
+ precision: t.invoice.grossAmount.precision,
1453
+ remarks: null
1454
+ },
1455
+ schema: dt,
1456
+ onSubmit: async (F) => {
1457
+ const C = await f.execute({
1458
+ body: F,
1459
+ params: {
1460
+ invoiceUuid: t.invoice.uuid
1461
+ }
1462
+ });
1463
+ if (C.isErr()) {
1464
+ m.apiError(C.error);
1465
+ return;
1466
+ }
1467
+ m.show({
1468
+ message: a.t("wise_invoicing.invoice.detail.payments.create.success")
1469
+ }), l("close");
1470
+ },
1471
+ onSubmitError: () => {
1472
+ m.unableToSave();
1473
+ }
1474
+ }), g = _.register("amount"), b = _.register("date"), U = _.register("paymentReference"), T = _.register("remarks");
1475
+ return (F, C) => (r(), v(e(le), {
1476
+ form: e(_),
1477
+ size: "sm",
1478
+ onClose: C[0] || (C[0] = (S) => l("close"))
1479
+ }, {
1480
+ default: s(() => [
1481
+ o(e(ce), {
1482
+ title: e(a).t("wise_invoicing.invoice.detail.payments.create.title"),
1483
+ description: e(a).t("wise_invoicing.invoice.detail.payments.create.description"),
1484
+ icon: e(hn),
1485
+ "is-description-visible": !0
1486
+ }, null, 8, ["title", "description", "icon"]),
1487
+ o(e(Ie), null, {
1488
+ default: s(() => [
1489
+ o(e(xe), null, {
1490
+ default: s(() => [
1491
+ o(e(De), {
1492
+ lg: 2,
1493
+ sm: 1
1494
+ }, {
1495
+ default: s(() => [
1496
+ o(e(fe), P(e(M)(e(g)), {
1497
+ "is-required": !0,
1498
+ label: e(a).t("wise_invoicing.invoice.detail.payments.create.fields.amount"),
1499
+ min: 0.01,
1500
+ step: 0.01
1501
+ }), {
1502
+ right: s(() => [
1503
+ N("span", vt, Me(p.value.symbol), 1)
1504
+ ]),
1505
+ _: 1
1506
+ }, 16, ["label"]),
1507
+ o(e(te), P(e(M)(e(b)), {
1508
+ "is-required": !0,
1509
+ label: e(a).t("wise_invoicing.invoice.detail.payments.create.fields.date")
1510
+ }), null, 16, ["label"]),
1511
+ o(e(oe), P(e(M)(e(U)), {
1512
+ label: e(a).t("wise_invoicing.invoice.detail.payments.create.fields.reference")
1513
+ }), null, 16, ["label"]),
1514
+ o(e(oe), P(e(M)(e(T)), {
1515
+ label: e(a).t("wise_invoicing.invoice.detail.payments.create.fields.remarks")
1516
+ }), null, 16, ["label"])
1517
+ ]),
1518
+ _: 1
1519
+ })
1520
+ ]),
1521
+ _: 1
1522
+ })
1523
+ ]),
1524
+ _: 1
1525
+ }),
1526
+ o(e(re), null, {
1527
+ right: s(() => [
1528
+ o(e(ue), { label: "cancel" }),
1529
+ o(e(Ni), {
1530
+ label: e(a).t("wise_invoicing.invoice.detail.payments.create.submit")
1531
+ }, null, 8, ["label"])
1532
+ ]),
1533
+ _: 1
1534
+ })
1535
+ ]),
1536
+ _: 1
1537
+ }, 8, ["form"]));
1538
+ }
1539
+ }), pt = /* @__PURE__ */ x({
1540
+ __name: "InvoiceDetailPaymentsSection",
1541
+ props: {
1542
+ invoice: {}
1543
+ },
1544
+ setup(i) {
1545
+ const n = i, t = h(), l = X(), a = c(() => n.invoice.uuid), m = c(() => n.invoice.balanceDueAmount === null ? null : l.formatMonetary(n.invoice.balanceDueAmount)), {
1546
+ isLoading: d,
1547
+ result: f
1548
+ } = st(a), p = de(), _ = O(), g = p.create(mt), b = p.create(Ki), U = at(), T = c(() => f.value.match({
1549
+ err: () => [],
1550
+ loading: () => [],
1551
+ ok: (y) => y
1552
+ })), F = c(() => f.value.match({
1553
+ err: (y) => y,
1554
+ loading: () => null,
1555
+ ok: () => null
1556
+ })), C = c(() => !G.getMetadata(n.invoice.status).isTerminal);
1557
+ function S() {
1558
+ g.open({
1559
+ invoice: n.invoice
1560
+ });
1561
+ }
1562
+ function w(y) {
1563
+ b.open({
1564
+ title: t.t("wise_invoicing.invoice.detail.payments.delete.title"),
1565
+ isDestructive: !0,
1566
+ confirmLabel: t.t("wise_invoicing.invoice.detail.payments.delete.submit"),
1567
+ description: t.t("wise_invoicing.invoice.detail.payments.delete.description"),
1568
+ onConfirm: async () => {
1569
+ const A = await U.execute({
1570
+ params: {
1571
+ invoiceUuid: n.invoice.uuid,
1572
+ paymentUuid: y.uuid
1573
+ }
1574
+ });
1575
+ if (A.isErr()) {
1576
+ _.apiError(A.error);
1577
+ return;
1578
+ }
1579
+ _.show({
1580
+ message: t.t("wise_invoicing.invoice.detail.payments.delete.success")
1581
+ }), b.close();
1582
+ }
1583
+ });
1584
+ }
1585
+ const L = rt({
1586
+ onDelete: w
1587
+ });
1588
+ return (y, A) => (r(), v(Ke, null, {
1589
+ default: s(() => [
1590
+ o(e(Y), {
1591
+ justify: "between",
1592
+ class: "w-full gap-lg border-b border-secondary px-lg py-md"
1593
+ }, {
1594
+ default: s(() => [
1595
+ o(e(Y), { gap: "sm" }, {
1596
+ default: s(() => [
1597
+ o(e(R), {
1598
+ text: e(t).t("wise_invoicing.invoice.detail.payments.title"),
1599
+ as: "h2",
1600
+ class: "text-sm font-semibold text-primary"
1601
+ }, null, 8, ["text"]),
1602
+ m.value !== null ? (r(), v(e(Q), {
1603
+ key: 0,
1604
+ color: "gray",
1605
+ size: "sm",
1606
+ variant: "outline"
1607
+ }, {
1608
+ default: s(() => [
1609
+ o(e(Fe), {
1610
+ label: e(t).t("wise_invoicing.invoice.detail.payments.balance_due")
1611
+ }, null, 8, ["label"]),
1612
+ o(e(Gi)),
1613
+ o(e(Fe), { label: m.value }, null, 8, ["label"])
1614
+ ]),
1615
+ _: 1
1616
+ })) : D("", !0)
1617
+ ]),
1618
+ _: 1
1619
+ }),
1620
+ C.value ? (r(), v(e(Hi), {
1621
+ key: 0,
1622
+ label: e(t).t("wise_invoicing.invoice.detail.payments.add"),
1623
+ "icon-left": e(Sn),
1624
+ size: "sm",
1625
+ onClick: S
1626
+ }, null, 8, ["label", "icon-left"])) : D("", !0)
1627
+ ]),
1628
+ _: 1
1629
+ }),
1630
+ o(e(Qi), {
1631
+ "active-filter-count": 0,
1632
+ columns: e(L),
1633
+ data: T.value,
1634
+ error: F.value,
1635
+ "get-key": (W) => W.uuid,
1636
+ "has-active-search": !1,
1637
+ "header-actions": [],
1638
+ "is-fetching-next-page": !1,
1639
+ "is-loading": e(d)
1640
+ }, null, 8, ["columns", "data", "error", "get-key", "is-loading"])
1641
+ ]),
1642
+ _: 1
1643
+ }));
1644
+ }
1645
+ });
1646
+ function _t() {
1647
+ return E({
1648
+ queryFn: (i) => k.updateLines(
1649
+ i.params.invoiceUuid,
1650
+ i.body
1651
+ ),
1652
+ queryKeysToInvalidate: {
1653
+ invoiceDetail: {
1654
+ invoiceUuid: (i) => i.invoiceUuid
1655
+ }
1656
+ }
1657
+ });
1658
+ }
1659
+ function ft() {
1660
+ return E({
1661
+ queryFn: (i) => k.applyDiscount(
1662
+ i.params.invoiceUuid,
1663
+ i.body
1664
+ ),
1665
+ queryKeysToInvalidate: {
1666
+ invoiceDetail: {
1667
+ invoiceUuid: (i) => i.invoiceUuid
1668
+ }
1669
+ }
1670
+ });
1671
+ }
1672
+ const gt = I.object({
1673
+ currency: I.enum(Oe),
1674
+ precision: I.number().int().nonnegative(),
1675
+ type: I.enum(B),
1676
+ value: I.number()
1677
+ }).refine((i) => i.type !== B.PERCENTAGE || i.value <= 100, {
1678
+ path: [
1679
+ "value"
1680
+ ]
1681
+ }), yt = { class: "pr-md text-xs text-secondary" }, bt = /* @__PURE__ */ x({
1682
+ __name: "InvoiceApplyDiscountDialog",
1683
+ props: {
1684
+ invoice: {}
1685
+ },
1686
+ emits: ["close"],
1687
+ setup(i, { emit: n }) {
1688
+ const t = i, l = n, a = h(), m = O(), d = X(), f = ft(), p = c(() => Zi([
1689
+ B.PERCENTAGE,
1690
+ B.AMOUNT
1691
+ ])), _ = Z({
1692
+ initialState: {
1693
+ currency: t.invoice.grossAmount.currency,
1694
+ precision: t.invoice.grossAmount.precision,
1695
+ type: B.PERCENTAGE,
1696
+ value: null
1697
+ },
1698
+ schema: gt,
1699
+ onSubmit: async (S) => {
1700
+ const w = await f.execute({
1701
+ body: S,
1702
+ params: {
1703
+ invoiceUuid: t.invoice.uuid
1704
+ }
1705
+ });
1706
+ if (w.isErr()) {
1707
+ m.apiError(w.error);
1708
+ return;
1709
+ }
1710
+ l("close");
1711
+ },
1712
+ onSubmitError: () => {
1713
+ m.unableToSave();
1714
+ }
1715
+ }), g = _.register("value"), b = _.register("type"), U = c(() => b.modelValue.value === B.PERCENTAGE), T = c(() => b.modelValue.value === B.AMOUNT), F = c(() => d.getSymbol(t.invoice.grossAmount.currency));
1716
+ function C(S) {
1717
+ return a.t(`wise_invoicing.invoice.detail.global_discount.type.${S}`);
1718
+ }
1719
+ return (S, w) => (r(), v(e(le), {
1720
+ form: e(_),
1721
+ size: "sm",
1722
+ onClose: w[0] || (w[0] = (L) => l("close"))
1723
+ }, {
1724
+ default: s(() => [
1725
+ o(e(ce), {
1726
+ title: e(a).t("wise_invoicing.invoice.detail.line_items.global_discount"),
1727
+ description: e(a).t("wise_invoicing.invoice.detail.global_discount.description"),
1728
+ icon: e(Ri),
1729
+ "is-description-visible": !0
1730
+ }, null, 8, ["title", "description", "icon"]),
1731
+ o(e(Ie), null, {
1732
+ default: s(() => [
1733
+ o(e(xe), null, {
1734
+ default: s(() => [
1735
+ o(e(De), {
1736
+ lg: 2,
1737
+ sm: 1
1738
+ }, {
1739
+ default: s(() => [
1740
+ o(e(Wi), P(e(M)(e(b)), {
1741
+ "display-fn": C,
1742
+ "is-required": !0,
1743
+ items: p.value,
1744
+ label: e(a).t("wise_invoicing.invoice.detail.global_discount.type.label")
1745
+ }), null, 16, ["items", "label"]),
1746
+ U.value ? (r(), v(e(fe), P({ key: 0 }, e(M)(e(g)), {
1747
+ hint: e(a).t("wise_invoicing.invoice.detail.global_discount.amount.hint"),
1748
+ "is-required": !0,
1749
+ label: e(a).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
1750
+ max: 100,
1751
+ min: 0,
1752
+ step: 0.01
1753
+ }), {
1754
+ right: s(() => [...w[1] || (w[1] = [
1755
+ N("span", { class: "pr-md text-xs text-secondary" }, " % ", -1)
1756
+ ])]),
1757
+ _: 1
1758
+ }, 16, ["hint", "label"])) : D("", !0),
1759
+ T.value ? (r(), v(e(fe), P({ key: 1 }, e(M)(e(g)), {
1760
+ "is-required": !0,
1761
+ label: e(a).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
1762
+ min: 0.01,
1763
+ step: 0.01
1764
+ }), {
1765
+ right: s(() => [
1766
+ N("span", yt, Me(F.value.symbol), 1)
1767
+ ]),
1768
+ _: 1
1769
+ }, 16, ["label"])) : D("", !0)
1770
+ ]),
1771
+ _: 1
1772
+ })
1773
+ ]),
1774
+ _: 1
1775
+ })
1776
+ ]),
1777
+ _: 1
1778
+ }),
1779
+ o(e(re), null, {
1780
+ right: s(() => [
1781
+ o(e(ue), { label: "cancel" }),
1782
+ o(e(we), {
1783
+ label: e(a).t("wise_invoicing.invoice.detail.global_discount.confirm")
1784
+ }, null, 8, ["label"])
1785
+ ]),
1786
+ _: 1
1787
+ })
1788
+ ]),
1789
+ _: 1
1790
+ }, 8, ["form"]));
1791
+ }
1792
+ }), wt = /* @__PURE__ */ x({
1793
+ __name: "InvoiceLineItemsTableSection",
1794
+ props: {
1795
+ invoice: {}
1796
+ },
1797
+ setup(i) {
1798
+ const n = i, t = c(() => n.invoice), l = be(), a = _t(), m = c(() => G.isEditable(n.invoice.status)), d = rn({
1799
+ isSaving: c(() => a.isLoading.value),
1800
+ billingDocument: () => t.value,
1801
+ canEdit: m,
1802
+ updateLines: (g) => a.execute({
1803
+ body: g,
1804
+ params: {
1805
+ invoiceUuid: n.invoice.uuid
1806
+ }
1807
+ })
1808
+ }), p = de().create(bt);
1809
+ function _() {
1810
+ p.open({
1811
+ invoice: n.invoice
1812
+ });
1813
+ }
1814
+ return un(d), (g, b) => (r(), v(Ke, null, {
1815
+ default: s(() => [
1816
+ o(dn, {
1817
+ "show-apply-discount": e(l).isGlobalDiscountEnabled.value,
1818
+ onApplyDiscount: _
1819
+ }, null, 8, ["show-apply-discount"]),
1820
+ o(vn),
1821
+ o(mn, {
1822
+ "billing-document": n.invoice
1823
+ }, null, 8, ["billing-document"]),
1824
+ o(pn)
1825
+ ]),
1826
+ _: 1
1827
+ }));
1828
+ }
1829
+ }), It = /* @__PURE__ */ x({
1830
+ __name: "InvoiceDetailView",
1831
+ props: {
1832
+ invoice: {}
1833
+ },
1834
+ setup(i) {
1835
+ const n = i, t = h(), l = Pe(!1), a = c(() => [
1836
+ {
1837
+ label: t.t("wise_invoicing.invoice.overview.title"),
1838
+ to: {
1839
+ name: "invoicing-invoice-overview"
1840
+ }
1841
+ },
1842
+ {
1843
+ label: n.invoice.sequence ?? n.invoice.subject ?? t.t("wise_invoicing.invoice.detail.fallback_title")
1844
+ }
1845
+ ]);
1846
+ return (m, d) => (r(), v(_n, {
1847
+ "billing-document": n.invoice,
1848
+ breadcrumbs: a.value,
1849
+ title: e(t).t("wise_invoicing.invoice.detail.fallback_title")
1850
+ }, {
1851
+ header: s(() => [
1852
+ o(Zn, {
1853
+ invoice: n.invoice,
1854
+ "is-pdf-view-active": l.value,
1855
+ class: "w-full",
1856
+ onTogglePdfView: d[0] || (d[0] = (f) => l.value = !l.value)
1857
+ }, null, 8, ["invoice", "is-pdf-view-active"])
1858
+ ]),
1859
+ default: s(() => [
1860
+ l.value ? (r(), v(fn, {
1861
+ key: 0,
1862
+ "billing-document": n.invoice,
1863
+ class: "w-full"
1864
+ }, null, 8, ["billing-document"])) : (r(), K(ae, { key: 1 }, [
1865
+ o(wt, {
1866
+ invoice: n.invoice
1867
+ }, null, 8, ["invoice"]),
1868
+ e(G).isEditable(n.invoice.status) ? D("", !0) : (r(), v(pt, {
1869
+ key: 0,
1870
+ invoice: n.invoice,
1871
+ class: "w-full"
1872
+ }, null, 8, ["invoice"])),
1873
+ o(Jn, {
1874
+ invoice: n.invoice,
1875
+ class: "w-full"
1876
+ }, null, 8, ["invoice"]),
1877
+ o(Yn, {
1878
+ invoice: n.invoice,
1879
+ class: "w-full"
1880
+ }, null, 8, ["invoice"])
1881
+ ], 64))
1882
+ ]),
1883
+ sidebar: s(() => [
1884
+ o(ot, {
1885
+ invoice: n.invoice
1886
+ }, null, 8, ["invoice"])
1887
+ ]),
1888
+ _: 1
1889
+ }, 8, ["billing-document", "breadcrumbs", "title"]));
1890
+ }
1891
+ }), Lt = /* @__PURE__ */ x({
1892
+ __name: "InvoiceDetailViewDataProvider",
1893
+ props: {
1894
+ invoiceUuid: {}
1895
+ },
1896
+ setup(i) {
1897
+ const n = i, t = h(), l = c(() => [
1898
+ {
1899
+ label: t.t("wise_invoicing.invoice.overview.title"),
1900
+ to: {
1901
+ name: "invoicing-invoice-overview"
1902
+ }
1903
+ }
1904
+ ]), a = mi(c(() => n.invoiceUuid));
1905
+ return (m, d) => (r(), v(gn, {
1906
+ query: e(a),
1907
+ "loading-breadcrumbs": l.value
1908
+ }, {
1909
+ default: s(({ billingDocument: f }) => [
1910
+ o(It, { invoice: f }, null, 8, ["invoice"])
1911
+ ]),
1912
+ _: 1
1913
+ }, 8, ["query", "loading-breadcrumbs"]));
1914
+ }
1915
+ });
1916
+ export {
1917
+ Lt as default
1918
+ };