@wisemen/wise-invoicing-web 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BillingDocumentDetailViewDataProvider-CwonTh2r.js → BillingDocumentDetailViewDataProvider-DdaNbuI2.js} +1085 -995
- package/dist/BillingDocumentDetailViewDataProvider.css +1 -1
- package/dist/{BillingDocumentPdf-GWCCjE6F.js → BillingDocumentPdf-D_NOfBhQ.js} +10 -10
- package/dist/{CreditNoteDetailViewDataProvider-CaucKK9o.js → CreditNoteDetailViewDataProvider-5ljhBOoN.js} +181 -181
- package/dist/{CreditNotePdfViewDataProvider-CDkvm-3m.js → CreditNotePdfViewDataProvider-CiWZN7Zy.js} +3 -3
- package/dist/{CustomFieldValueText-CC9spLWf.js → CustomFieldValueText-ne5yy02J.js} +2 -2
- package/dist/DataProvider-Dj34ljUX.js +75 -0
- package/dist/{DunningCaseDetailViewDataProvider-1Ui9yqUb.js → DunningCaseDetailViewDataProvider-CetbSmjq.js} +136 -130
- package/dist/DunningCaseOverviewView-Bq0BKVXG.js +747 -0
- package/dist/{DunningCaseReminderPdfViewDataProvider-CVnr9ge6.js → DunningCaseReminderPdfViewDataProvider-B3Y2aYFf.js} +5 -2
- package/dist/DunningCaseSendDialog-C47X_JjC.js +349 -0
- package/dist/InvoiceDetailViewDataProvider-DYH2ODDi.js +1670 -0
- package/dist/{InvoiceOverviewViewDataProvider-CNK7H5r2.js → InvoiceOverviewViewDataProvider-BT9cuQXw.js} +504 -440
- package/dist/{InvoicePdfView-CrWU8Xa-.js → InvoicePdfView-ug0BiMqe.js} +2 -2
- package/dist/{InvoicePdfViewDataProvider-nHZoeRxn.js → InvoicePdfViewDataProvider-WvjMiEZG.js} +3 -3
- package/dist/{InvoicePublicPdfViewDataProvider-CXWSg2pq.js → InvoicePublicPdfViewDataProvider-BI9RQqYp.js} +3 -3
- package/dist/{IssuerSettingsViewDataProvider-DcA6rgOJ.js → IssuerSettingsViewDataProvider-Bs4rEES2.js} +4 -4
- package/dist/ReminderSettingsViewDataProvider-5n2EfxPG.js +711 -0
- package/dist/{api.util-Dm_TQedZ.js → api.util-BCSgCfpS.js} +528 -509
- package/dist/{billingDocumentDetail.transformer-tmy9Tf_b.js → billingDocumentDetail.transformer-DIKAl4_L.js} +58 -89
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.gen.d.ts +28 -5
- package/dist/client/zod.gen.d.ts +869 -623
- package/dist/composables/invoicingConfig.composable.d.ts +0 -2
- package/dist/{creditNoteDetail.query-BM2saU0n.js → creditNoteDetail.query-DHP69UiB.js} +13 -13
- package/dist/{dist-DP8KNFVD.js → dist-D9lp7NDv.js} +20 -36
- package/dist/{dist-DJ8yJcb9.js → dist-PErDVE6-.js} +621 -671
- package/dist/{documentTitle.composable-D7XA-8iJ.js → documentTitle.composable-4ApFl9TZ.js} +22 -22
- package/dist/{invoicingConfig.composable-AjojW4qE.js → i18n.lib-B74GKndD.js} +58 -66
- package/dist/index.d.ts +51 -0
- package/dist/index.js +174 -175
- package/dist/{invoice.service-PsmVGGTR.js → invoice.service-DG5eacZC.js} +35 -35
- package/dist/{invoiceDeliveryStatus.util-CL8K78pD.js → invoiceDeliveryStatus.util-CX-IdqAu.js} +4 -4
- package/dist/{invoiceDetail.query-D2eFdE0j.js → invoiceDetail.query-C_IMGjOX.js} +1 -1
- package/dist/invoicingConfig.composable-BYqn1I9n.js +60 -0
- package/dist/{issuerSettings.query-d5i7Wd7j.js → issuerSettings.query-6wnSPphB.js} +2 -2
- package/dist/libs/i18n.lib.d.ts +50 -0
- package/dist/locales/en-US.json.d.ts +25 -0
- package/dist/locales/nl-BE.json.d.ts +25 -0
- package/dist/models/billing-document/billingDocumentLineItemGroupUpdateForm.model.d.ts +9 -3
- package/dist/modules/dunning-case/actions/dunningCase.actions.d.ts +12 -0
- package/dist/modules/dunning-case/actions/dunningCaseNavigateToCustomer.action.d.ts +1 -0
- package/dist/modules/dunning-case/actions/dunningCaseNavigateToDetail.action.d.ts +1 -0
- package/dist/modules/dunning-case/api/mutations/reminderConfigUpdate.mutation.d.ts +2 -0
- package/dist/modules/dunning-case/api/queries/dunningCaseIndex.query.d.ts +0 -1
- package/dist/modules/dunning-case/models/dunningCase.model.d.ts +12 -2
- package/dist/modules/dunning-case/models/reminderConfigForm.model.d.ts +3 -1
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewActionsCell.vue.d.ts +13 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewCustomerCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewDaysOverdueCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewLastReminderCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewLevelCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewMetrics.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewOutstandingCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/DunningCaseOverviewReminderCell.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/overview/components/dunningCaseOverviewLastReminderCell.spec.d.ts +1 -0
- package/dist/modules/dunning-case/use-cases/overview/components/dunningCaseOverviewReminderCell.spec.d.ts +1 -0
- package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverview.composable.d.ts +24 -0
- package/dist/modules/dunning-case/use-cases/overview/composables/dunningCaseOverviewTableColumns.composable.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendStat.vue.d.ts +9 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseBulkSendSummary.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendFeeRow.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceRow.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendInvoiceSummary.vue.d.ts +8 -0
- package/dist/modules/dunning-case/use-cases/send/components/DunningCaseSendRecipientAlert.vue.d.ts +7 -0
- package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseReminderSubject.composable.d.ts +6 -0
- package/dist/modules/dunning-case/use-cases/send/composables/dunningCaseSendRecipient.composable.d.ts +16 -0
- package/dist/modules/dunning-case/use-cases/send/dialogs/dunningCaseBulkSendDialog.spec.d.ts +1 -0
- package/dist/modules/dunning-case/use-cases/send/utils/dunningCaseSend.util.d.ts +13 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderFeeNotice.vue.d.ts +3 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderPanel.vue.d.ts +12 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderRow.vue.d.ts +28 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderLadderTimeline.vue.d.ts +13 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplateTabs.vue.d.ts +20 -0
- package/dist/modules/dunning-case/use-cases/settings/components/ReminderTemplatesPanel.vue.d.ts +24 -0
- package/dist/modules/dunning-case/use-cases/settings/components/reminderLadderFeeNotice.spec.d.ts +1 -0
- package/dist/modules/dunning-case/use-cases/settings/composables/reminderLadder.composable.d.ts +43 -0
- package/dist/modules/invoice/api/invoiceIndexCache.util.d.ts +4 -4
- package/dist/modules/invoice/api/queries/invoiceUserSearch.query.d.ts +3 -0
- package/dist/modules/invoice/api/query-keys/invoice.queryKeys.d.ts +8 -0
- package/dist/modules/invoice/api/services/invoiceUser.service.d.ts +6 -0
- package/dist/modules/invoice/components/form/InvoiceFormPreparedByField.vue.d.ts +16 -0
- package/dist/modules/invoice/models/invoice/update/invoicePreparer.model.d.ts +4 -0
- package/dist/modules/invoice/models/invoice/update/invoicePreparer.transformer.d.ts +5 -0
- package/dist/modules/invoice/models/invoice/update/invoiceUserSearchQueryParams.model.d.ts +3 -0
- package/dist/modules/invoice/models/invoice/update/invoiceUserSearchQueryParams.transformer.d.ts +6 -0
- package/dist/modules/invoice/use-cases/overview/dialogs/InvoiceOverviewBulkActionDialog.vue.d.ts +1 -0
- package/dist/{plainDate.transformer-BxvJpJOv.js → plainDate.transformer-Dfe5r84P.js} +32 -1
- package/dist/{reminderConfig.query-C7I3M2pu.js → reminderConfig.query-B9OQY7IT.js} +56 -54
- package/dist/search.composable-BCtYqudV.js +52 -0
- package/dist/style.css +1 -1
- package/dist/ui/billing-document/table/billingDocumentLineItemsTable.context.d.ts +6 -6
- package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsEditor.composable.d.ts +1 -1
- package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsRowMutations.composable.d.ts +2 -2
- package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsRowMutations.composable.spec.d.ts +1 -0
- package/dist/ui/billing-document/table/composables/useBillingDocumentLineItemsTableDrag.composable.d.ts +3 -1
- package/dist/ui/billing-document/table/field/BillingDocumentLineItemsTableField.vue.d.ts +2 -0
- package/dist/ui/billing-document/table/field/BillingDocumentLineItemsTableTextField.vue.d.ts +1 -0
- package/dist/ui/billing-document/table/utils/billingDocumentLineItemsEditor.util.d.ts +19 -0
- package/dist/ui/data-provider/DataProviderErrorState.vue.d.ts +7 -0
- package/dist/ui/data-provider/dataProviderErrorState.spec.d.ts +1 -0
- package/package.json +6 -1
- package/dist/DataProvider-CfHLB3rH.js +0 -48
- package/dist/DunningCaseOverviewView-Bvwaj4_y.js +0 -507
- package/dist/InvoiceDetailViewDataProvider-DfRDFCEb.js +0 -1578
- package/dist/PermissionGuard-DDw-lDGL.js +0 -301
- package/dist/ReminderSettingsViewDataProvider-C4qz2Rli.js +0 -502
- package/dist/composables/permission-guard/permissionGuard.composable.d.ts +0 -4
- package/dist/ui/permission-guard/PermissionGuard.vue.d.ts +0 -22
- /package/dist/modules/dunning-case/{api/queries/dunningCaseIndex.query.spec.d.ts → use-cases/overview/components/dunningCaseOverviewActionsCell.spec.d.ts} +0 -0
|
@@ -0,0 +1,1670 @@
|
|
|
1
|
+
import { t as e } from "./i18n.lib-B74GKndD.js";
|
|
2
|
+
import { Y as t, t as n } from "./api.util-BCSgCfpS.js";
|
|
3
|
+
import { a as r, h as i, l as a, m as o, o as s, p as c, r as l, v as u } from "./documentTitle.composable-4ApFl9TZ.js";
|
|
4
|
+
import { r as d } from "./useCurrencyFormat.composable-MtZaqKnO.js";
|
|
5
|
+
import { t as f } from "./search.composable-BCtYqudV.js";
|
|
6
|
+
import { a as p, i as m, n as h, o as g, t as _ } from "./invoice.service-DG5eacZC.js";
|
|
7
|
+
import { t as v } from "./download.util-PjaUQR6r.js";
|
|
8
|
+
import { n as y } from "./invoicingConfig.composable-BYqn1I9n.js";
|
|
9
|
+
import { r as b } from "./address.transformer-B8C0pwT1.js";
|
|
10
|
+
import { D as ee, I as x, M as te, O as ne, Q as re, W as ie, X as ae, f as oe, g as se, h as S, i as ce, j as le, l as ue, t as C, tt as de, v as fe, w as pe } from "./dist-D9lp7NDv.js";
|
|
11
|
+
import { n as me, t as he } from "./dist-YTXTCfo1.js";
|
|
12
|
+
import { i as w, n as ge, r as _e } from "./CustomFieldValueText-ne5yy02J.js";
|
|
13
|
+
import { t as T } from "./formango.util-D5c2ql--.js";
|
|
14
|
+
import { a as ve, c as ye, i as be, n as xe, o as Se, r as Ce, s as we, t as E, u as Te } from "./invoiceDeliveryStatus.util-CX-IdqAu.js";
|
|
15
|
+
import { t as Ee } from "./issuerSettings.query-6wnSPphB.js";
|
|
16
|
+
import { C as De, S as Oe, T as ke, _ as Ae, a as je, b as Me, c as Ne, d as Pe, f as Fe, g as Ie, h as Le, i as Re, l as ze, m as Be, n as Ve, o as He, p as Ue, r as We, s as Ge, t as Ke, u as qe, v as Je, w as Ye, x as Xe, y as Ze } from "./BillingDocumentDetailViewDataProvider-DdaNbuI2.js";
|
|
17
|
+
import { t as Qe } from "./invoiceDetail.query-C_IMGjOX.js";
|
|
18
|
+
import { RouterLink as $e, useRouter as et } from "vue-router";
|
|
19
|
+
import tt, { z as D } from "zod";
|
|
20
|
+
import { useI18n as O } from "vue-i18n";
|
|
21
|
+
import { Fragment as nt, computed as k, createBlock as A, createCommentVNode as j, createElementBlock as M, createElementVNode as N, createSlots as rt, createVNode as P, defineComponent as F, mergeModels as it, mergeProps as I, openBlock as L, ref as at, renderList as ot, toDisplayString as st, unref as R, useModel as ct, watch as lt, withCtx as z } from "vue";
|
|
22
|
+
import { useKeysetInfiniteQuery as ut, useMutation as B, useOffsetInfiniteQuery as dt, useQuery as ft } from "@wisemen/vue-core-api-utils";
|
|
23
|
+
import { Temporal as pt } from "temporal-polyfill";
|
|
24
|
+
import { UIAutocomplete as mt, UIBadge as V, UIBadgeLabel as ht, UIBadgeSeparator as gt, UIButton as _t, UIColumnLayout as vt, UIConfirmDialog as yt, UIDateField as H, UIDetailList as bt, UIDetailListGroup as xt, UIDetailListGroupItem as U, UIDetailListGroupItemLabel as W, UIDetailListGroupItemValueText as G, UIDetailListGroupSeparator as St, UIDialogBody as Ct, UIDialogFooter as K, UIDialogFooterCancel as q, UIDialogFooterSubmit as wt, UIDialogHeader as J, UIForm as Tt, UIFormDialog as Et, UIFormFieldGrid as Dt, UIFormFieldGroup as Ot, UIFormSubmitButton as kt, UIIconButton as At, UINumberField as jt, UIRowLayout as Y, UISelect as Mt, UITable as Nt, UITableCell as Pt, UITableCellInteractiveElement as Ft, UIText as X, UITextField as It, createAutocompleteOptions as Lt, createComponent as Z, createSelectOptions as Rt, defineTableColumns as zt, useOverlay as Bt, useToast as Q } from "@wisemen/vue-core-design-system";
|
|
25
|
+
import { useForm as $ } from "formango";
|
|
26
|
+
//#region src/modules/invoice/api/mutations/invoiceUpdate.mutation.ts
|
|
27
|
+
function Vt() {
|
|
28
|
+
return B({
|
|
29
|
+
queryFn: (e) => _.update(e.params.invoiceUuid, e.body),
|
|
30
|
+
queryKeysToInvalidate: {
|
|
31
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
32
|
+
invoiceIndex: {}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/modules/invoice/components/InvoiceDeliveryStatusBadge.vue
|
|
38
|
+
var Ht = /* @__PURE__ */ F({
|
|
39
|
+
__name: "InvoiceDeliveryStatusBadge",
|
|
40
|
+
props: {
|
|
41
|
+
deliveryStatus: {},
|
|
42
|
+
size: { default: "sm" }
|
|
43
|
+
},
|
|
44
|
+
setup(e) {
|
|
45
|
+
let t = e, n = O(), r = k(() => E.getMetadata(t.deliveryStatus)), i = k(() => n.t(r.value.translationKey));
|
|
46
|
+
return (e, n) => (L(), A(R(V), {
|
|
47
|
+
label: i.value,
|
|
48
|
+
color: r.value.tone,
|
|
49
|
+
size: t.size,
|
|
50
|
+
variant: "translucent"
|
|
51
|
+
}, null, 8, [
|
|
52
|
+
"label",
|
|
53
|
+
"color",
|
|
54
|
+
"size"
|
|
55
|
+
]));
|
|
56
|
+
}
|
|
57
|
+
}), Ut = D.string().nullable(), Wt = D.object({ subject: Ut });
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/modules/invoice/api/mutations/invoiceCreateCreditNote.mutation.ts
|
|
60
|
+
function Gt() {
|
|
61
|
+
return B({
|
|
62
|
+
queryFn: (e) => _.createCreditNote(e.params.invoiceUuid),
|
|
63
|
+
queryKeysToInvalidate: {
|
|
64
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
65
|
+
invoiceIndex: {}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/modules/invoice/api/mutations/invoiceDuplicate.mutation.ts
|
|
71
|
+
function Kt() {
|
|
72
|
+
return B({
|
|
73
|
+
queryFn: (e) => _.duplicate(e.params.invoiceUuid),
|
|
74
|
+
queryKeysToInvalidate: { invoiceIndex: {} }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/modules/invoice/api/mutations/invoiceFinalize.mutation.ts
|
|
79
|
+
function qt() {
|
|
80
|
+
return B({
|
|
81
|
+
queryFn: (e) => _.finalize(e.params.invoiceUuid),
|
|
82
|
+
queryKeysToInvalidate: {
|
|
83
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
84
|
+
invoiceIndex: {}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/modules/invoice/api/mutations/invoiceMarkAsDraft.mutation.ts
|
|
90
|
+
function Jt() {
|
|
91
|
+
return B({
|
|
92
|
+
queryFn: (e) => _.markAsDraft(e.params.invoiceUuid),
|
|
93
|
+
queryKeysToInvalidate: {
|
|
94
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
95
|
+
invoiceIndex: {}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/modules/invoice/api/mutations/invoiceMarkAsPaid.mutation.ts
|
|
101
|
+
function Yt() {
|
|
102
|
+
return B({
|
|
103
|
+
queryFn: (e) => _.markAsPaid(e.params.invoiceUuid),
|
|
104
|
+
queryKeysToInvalidate: {
|
|
105
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
106
|
+
invoiceIndex: {}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/modules/invoice/api/mutations/invoiceMarkAsProtested.mutation.ts
|
|
112
|
+
function Xt() {
|
|
113
|
+
return B({
|
|
114
|
+
queryFn: (e) => _.markAsProtested(e.params.invoiceUuid),
|
|
115
|
+
queryKeysToInvalidate: {
|
|
116
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
117
|
+
invoiceIndex: {}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/modules/invoice/api/mutations/invoiceMarkAsReady.mutation.ts
|
|
123
|
+
function Zt() {
|
|
124
|
+
return B({
|
|
125
|
+
queryFn: (e) => _.markAsReady(e.params.invoiceUuid),
|
|
126
|
+
queryKeysToInvalidate: {
|
|
127
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
128
|
+
invoiceIndex: {}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/modules/invoice/api/mutations/invoiceSend.mutation.ts
|
|
134
|
+
function Qt() {
|
|
135
|
+
return B({
|
|
136
|
+
queryFn: (e) => _.send(e.params.invoiceUuid),
|
|
137
|
+
queryKeysToInvalidate: {
|
|
138
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
139
|
+
invoiceIndex: {}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/modules/invoice/api/mutations/invoiceWithdrawProtest.mutation.ts
|
|
145
|
+
function $t() {
|
|
146
|
+
return B({
|
|
147
|
+
queryFn: (e) => _.withdrawProtest(e.params.invoiceUuid),
|
|
148
|
+
queryKeysToInvalidate: {
|
|
149
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
150
|
+
invoiceIndex: {}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/modules/invoice/api/mutations/invoiceDelete.mutation.ts
|
|
156
|
+
function en() {
|
|
157
|
+
return B({
|
|
158
|
+
queryFn: (e) => _.delete(e.params.invoiceUuid),
|
|
159
|
+
queryKeysToInvalidate: { invoiceIndex: {} }
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/modules/invoice/use-cases/detail/dialogs/InvoiceDeleteDialog.vue
|
|
164
|
+
var tn = /* @__PURE__ */ F({
|
|
165
|
+
__name: "InvoiceDeleteDialog",
|
|
166
|
+
props: { invoice: {} },
|
|
167
|
+
emits: ["close", "deleted"],
|
|
168
|
+
setup(e, { emit: t }) {
|
|
169
|
+
let n = e, r = t, i = O(), a = et(), o = Q(), s = en(), c = $({
|
|
170
|
+
schema: tt.object({}),
|
|
171
|
+
onSubmit: async () => {
|
|
172
|
+
let e = await s.execute({ params: { invoiceUuid: n.invoice.uuid } });
|
|
173
|
+
if (e.isErr()) {
|
|
174
|
+
o.apiError(e.error);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
o.show({ message: i.t("wise_invoicing.invoice.delete.success_toast") }), r("deleted"), r("close"), await a.push({ name: "invoicing-invoice-overview" });
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return (e, t) => (L(), A(R(Et), {
|
|
181
|
+
form: R(c),
|
|
182
|
+
size: "xs",
|
|
183
|
+
onClose: t[0] ||= (e) => r("close")
|
|
184
|
+
}, {
|
|
185
|
+
default: z(() => [P(R(J), {
|
|
186
|
+
title: R(i).t("wise_invoicing.invoice.delete.title"),
|
|
187
|
+
description: R(i).t("wise_invoicing.invoice.delete.description"),
|
|
188
|
+
"is-description-visible": !0
|
|
189
|
+
}, null, 8, ["title", "description"]), P(R(K), null, {
|
|
190
|
+
right: z(() => [P(R(q), { label: "cancel" }), P(R(wt), {
|
|
191
|
+
"is-destructive": !0,
|
|
192
|
+
label: R(i).t("wise_invoicing.invoice.delete.submit_button")
|
|
193
|
+
}, null, 8, ["label"])]),
|
|
194
|
+
_: 1
|
|
195
|
+
})]),
|
|
196
|
+
_: 1
|
|
197
|
+
}, 8, ["form"]));
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/modules/invoice/use-cases/detail/composables/invoiceDetailHeaderActions.composable.ts
|
|
202
|
+
function nn(e) {
|
|
203
|
+
let t = O(), n = Q(), r = et(), a = Bt(), s = a.create(tn), c = a.create(Xe), l = Qt(), u = Gt(), d = Kt(), f = qt(), p = Jt(), m = Yt(), h = Xt(), g = Zt(), y = $t(), { shouldSkipConfirmation: b } = Oe(), x = at(null), ae = k(() => w.getMetadata(e.value.status)), S = k(() => x.value ?? e.value.isDisputed), le = k(() => e.value.status !== i.DRAFT && e.value.status !== i.READY), ue = k(() => e.value.lifecycleStatus === o.FINALIZED);
|
|
204
|
+
function C(e) {
|
|
205
|
+
return ae.value.actions.includes(e);
|
|
206
|
+
}
|
|
207
|
+
lt(() => e.value.isDisputed, (e) => {
|
|
208
|
+
x.value === e && (x.value = null);
|
|
209
|
+
});
|
|
210
|
+
async function fe() {
|
|
211
|
+
let r = await f.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
212
|
+
return r.isErr() ? (n.apiError(r.error), !1) : (n.show({ message: t.t("wise_invoicing.invoice.finalize.success") }), !0);
|
|
213
|
+
}
|
|
214
|
+
async function me() {
|
|
215
|
+
if (b.value) {
|
|
216
|
+
await fe();
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
await c.open({
|
|
220
|
+
billingDocumentType: "invoice",
|
|
221
|
+
onConfirm: fe
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async function he() {
|
|
225
|
+
let r = await g.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
226
|
+
if (r.isErr()) {
|
|
227
|
+
n.apiError(r.error);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
n.show({ message: t.t("wise_invoicing.invoice.mark_as_ready.success") });
|
|
231
|
+
}
|
|
232
|
+
async function ge() {
|
|
233
|
+
let r = await p.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
234
|
+
if (r.isErr()) {
|
|
235
|
+
n.apiError(r.error);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
n.show({ message: t.t("wise_invoicing.invoice.mark_as_draft.success") });
|
|
239
|
+
}
|
|
240
|
+
async function _e() {
|
|
241
|
+
let r = await m.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
242
|
+
if (r.isErr()) {
|
|
243
|
+
n.apiError(r.error);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
n.show({ message: t.t("wise_invoicing.invoice.mark_as_paid.success") });
|
|
247
|
+
}
|
|
248
|
+
async function T() {
|
|
249
|
+
x.value = !0;
|
|
250
|
+
let r = await h.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
251
|
+
if (r.isErr()) {
|
|
252
|
+
x.value = null, n.apiError(r.error);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
n.show({ message: t.t("wise_invoicing.invoice.mark_as_disputed.success") });
|
|
256
|
+
}
|
|
257
|
+
async function ve() {
|
|
258
|
+
x.value = !1;
|
|
259
|
+
let r = await y.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
260
|
+
if (r.isErr()) {
|
|
261
|
+
x.value = null, n.apiError(r.error);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
n.show({ message: t.t("wise_invoicing.invoice.withdraw_dispute.success") });
|
|
265
|
+
}
|
|
266
|
+
async function ye() {
|
|
267
|
+
let r = await l.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
268
|
+
if (r.isErr()) {
|
|
269
|
+
n.apiError(r.error);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
n.show({ message: t.t("wise_invoicing.invoice.send.success") });
|
|
273
|
+
}
|
|
274
|
+
async function be() {
|
|
275
|
+
await s.open({ invoice: e.value });
|
|
276
|
+
}
|
|
277
|
+
async function xe() {
|
|
278
|
+
let r = await _.getByUuid(e.value.uuid);
|
|
279
|
+
if (r.isErr()) {
|
|
280
|
+
n.apiError(r.error);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
let i = r.value.file;
|
|
284
|
+
if (i === null) {
|
|
285
|
+
n.show({ message: t.t("wise_invoicing.invoice.download_pdf.generation_in_progress") });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
let a = await De.getDownloadUrl(i.uuid);
|
|
289
|
+
a !== null && v.downloadUrl(a, i.name);
|
|
290
|
+
}
|
|
291
|
+
async function Se() {
|
|
292
|
+
let i = await d.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
293
|
+
if (i.isErr()) {
|
|
294
|
+
n.apiError(i.error);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
n.show({
|
|
298
|
+
button: {
|
|
299
|
+
label: t.t("wise_invoicing.invoice.duplicate.view_action"),
|
|
300
|
+
onClick: () => {
|
|
301
|
+
r.push({
|
|
302
|
+
name: "invoicing-invoice-detail",
|
|
303
|
+
params: { invoiceUuid: i.value }
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
message: t.t("wise_invoicing.invoice.duplicate.success")
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
async function Ce() {
|
|
311
|
+
let i = await u.execute({ params: { invoiceUuid: e.value.uuid } });
|
|
312
|
+
if (i.isErr()) {
|
|
313
|
+
n.apiError(i.error);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
n.show({
|
|
317
|
+
button: {
|
|
318
|
+
label: t.t("wise_invoicing.credit_note.create.view_action"),
|
|
319
|
+
onClick: () => {
|
|
320
|
+
r.push({
|
|
321
|
+
name: "invoicing-credit-note-detail",
|
|
322
|
+
params: { creditNoteUuid: i.value }
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
message: t.t("wise_invoicing.credit_note.create.success")
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
let we = k(() => [
|
|
330
|
+
{
|
|
331
|
+
isLoading: l.isLoading.value,
|
|
332
|
+
iconLeft: de,
|
|
333
|
+
key: "send",
|
|
334
|
+
label: t.t("wise_invoicing.invoice.detail.actions.send"),
|
|
335
|
+
variant: "primary",
|
|
336
|
+
visible: e.value.status === i.FINALIZED,
|
|
337
|
+
onClick: ye
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
isLoading: g.isLoading.value,
|
|
341
|
+
iconRight: ce,
|
|
342
|
+
key: "markAsReady",
|
|
343
|
+
label: t.t("wise_invoicing.invoice.detail.actions.mark_as_ready"),
|
|
344
|
+
visible: C("markAsReady"),
|
|
345
|
+
onClick: he
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
isLoading: f.isLoading.value,
|
|
349
|
+
iconLeft: pe,
|
|
350
|
+
key: "finalize",
|
|
351
|
+
label: t.t("wise_invoicing.invoice.detail.actions.finalize"),
|
|
352
|
+
visible: C("finalize"),
|
|
353
|
+
onClick: me
|
|
354
|
+
}
|
|
355
|
+
].filter((e) => e.visible)), E = k(() => {
|
|
356
|
+
let n = [
|
|
357
|
+
{
|
|
358
|
+
icon: ie,
|
|
359
|
+
key: "markAsProtested",
|
|
360
|
+
label: t.t("wise_invoicing.invoice.detail.actions.mark_as_disputed"),
|
|
361
|
+
visible: ue.value && !S.value,
|
|
362
|
+
onSelect: T
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
icon: re,
|
|
366
|
+
key: "markAsPaid",
|
|
367
|
+
label: t.t("wise_invoicing.invoice.detail.actions.mark_as_paid"),
|
|
368
|
+
visible: C("markAsPaid"),
|
|
369
|
+
onSelect: _e
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
icon: ce,
|
|
373
|
+
key: "withdrawProtest",
|
|
374
|
+
label: t.t("wise_invoicing.invoice.detail.actions.withdraw_dispute"),
|
|
375
|
+
visible: ue.value && S.value,
|
|
376
|
+
onSelect: ve
|
|
377
|
+
}
|
|
378
|
+
], r = [
|
|
379
|
+
i.FINALIZED,
|
|
380
|
+
i.PAID,
|
|
381
|
+
i.SENT,
|
|
382
|
+
i.OVERDUE,
|
|
383
|
+
i.PROTESTED
|
|
384
|
+
].includes(e.value.status), a = [
|
|
385
|
+
{
|
|
386
|
+
icon: se,
|
|
387
|
+
key: "downloadPdf",
|
|
388
|
+
label: t.t("wise_invoicing.common.download_pdf"),
|
|
389
|
+
visible: le.value,
|
|
390
|
+
onSelect: xe
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
icon: ne,
|
|
394
|
+
key: "backToDraft",
|
|
395
|
+
label: t.t("wise_invoicing.invoice.detail.actions.mark_as_draft"),
|
|
396
|
+
visible: C("markAsDraft"),
|
|
397
|
+
onSelect: ge
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
icon: oe,
|
|
401
|
+
key: "duplicate",
|
|
402
|
+
label: t.t("wise_invoicing.invoice.detail.actions.duplicate"),
|
|
403
|
+
visible: !0,
|
|
404
|
+
onSelect: Se
|
|
405
|
+
}
|
|
406
|
+
], o = [{
|
|
407
|
+
icon: te,
|
|
408
|
+
key: "createCreditNote",
|
|
409
|
+
label: t.t("wise_invoicing.invoice.detail.header.cancel_with_credit_note"),
|
|
410
|
+
visible: r,
|
|
411
|
+
onSelect: Ce
|
|
412
|
+
}, {
|
|
413
|
+
icon: ee,
|
|
414
|
+
key: "delete",
|
|
415
|
+
label: t.t("wise_invoicing.invoice.detail.actions.delete"),
|
|
416
|
+
visible: ae.value.isEditable,
|
|
417
|
+
onSelect: be
|
|
418
|
+
}];
|
|
419
|
+
return [
|
|
420
|
+
{
|
|
421
|
+
items: n.filter((e) => e.visible),
|
|
422
|
+
key: "lifecycle"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
items: a.filter((e) => e.visible),
|
|
426
|
+
key: "secondary"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
items: o.filter((e) => e.visible),
|
|
430
|
+
key: "destructive"
|
|
431
|
+
}
|
|
432
|
+
].filter((e) => e.items.length > 0);
|
|
433
|
+
});
|
|
434
|
+
return {
|
|
435
|
+
isActionMenuVisible: k(() => E.value.length > 0),
|
|
436
|
+
isDisputed: S,
|
|
437
|
+
menuGroups: E,
|
|
438
|
+
primaryButtons: we
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/modules/invoice/use-cases/detail/components/InvoiceDetailHeaderSection.vue
|
|
443
|
+
var rn = /* @__PURE__ */ F({
|
|
444
|
+
__name: "InvoiceDetailHeaderSection",
|
|
445
|
+
props: {
|
|
446
|
+
isPdfViewActive: { type: Boolean },
|
|
447
|
+
invoice: {}
|
|
448
|
+
},
|
|
449
|
+
emits: ["togglePdfView"],
|
|
450
|
+
setup(e, { emit: t }) {
|
|
451
|
+
let n = e, r = t, i = O(), a = Q(), { isDisputed: o, menuGroups: s, primaryButtons: l } = nn(k(() => n.invoice)), u = Vt(), d = k(() => new Ye(n.invoice.status)), f = k(() => d.value.color), p = k(() => i.t(d.value.translationKey)), m = k(() => n.invoice.deliveryStatus !== c.UNSENT), g = k(() => E.isSent(n.invoice.deliveryStatus)), _ = k(() => !w.isEditable(n.invoice.status)), v = $({
|
|
452
|
+
initialState: { subject: n.invoice.subject },
|
|
453
|
+
schema: Wt,
|
|
454
|
+
onSubmit: async (e) => {
|
|
455
|
+
let t = await u.execute({
|
|
456
|
+
body: {
|
|
457
|
+
...h.toForm(n.invoice),
|
|
458
|
+
subject: e.subject
|
|
459
|
+
},
|
|
460
|
+
params: { invoiceUuid: n.invoice.uuid }
|
|
461
|
+
});
|
|
462
|
+
t.isErr() && a.apiError(t.error);
|
|
463
|
+
}
|
|
464
|
+
}), y = v.register("subject");
|
|
465
|
+
return ke({ form: v }), (e, t) => (L(), A(R(Tt), {
|
|
466
|
+
form: R(v),
|
|
467
|
+
"prompt-on-unsaved-changes": !1
|
|
468
|
+
}, {
|
|
469
|
+
default: z(() => [P(Ze, {
|
|
470
|
+
"fallback-title": R(i).t("wise_invoicing.invoice.detail.fallback_title"),
|
|
471
|
+
"is-disabled": _.value,
|
|
472
|
+
sequence: n.invoice.sequence,
|
|
473
|
+
"status-color": f.value,
|
|
474
|
+
"status-label": p.value,
|
|
475
|
+
icon: R(x),
|
|
476
|
+
"subject-field": R(y),
|
|
477
|
+
"subject-placeholder": R(i).t("wise_invoicing.invoice.detail.header.subject_placeholder")
|
|
478
|
+
}, {
|
|
479
|
+
actions: z(() => [P(Je, {
|
|
480
|
+
"is-pdf-view-active": n.isPdfViewActive,
|
|
481
|
+
"menu-groups": R(s),
|
|
482
|
+
"primary-buttons": R(l),
|
|
483
|
+
onTogglePdfView: t[0] ||= (e) => r("togglePdfView")
|
|
484
|
+
}, null, 8, [
|
|
485
|
+
"is-pdf-view-active",
|
|
486
|
+
"menu-groups",
|
|
487
|
+
"primary-buttons"
|
|
488
|
+
])]),
|
|
489
|
+
status: z(() => [P(R(Y), {
|
|
490
|
+
gap: "xs",
|
|
491
|
+
class: "flex-wrap items-start"
|
|
492
|
+
}, {
|
|
493
|
+
default: z(() => [
|
|
494
|
+
P(we, { "lifecycle-status": n.invoice.lifecycleStatus }, null, 8, ["lifecycle-status"]),
|
|
495
|
+
P(xe, {
|
|
496
|
+
"is-sent": g.value,
|
|
497
|
+
"balance-due-amount": n.invoice.balanceDueAmount,
|
|
498
|
+
"gross-amount": n.invoice.grossAmount,
|
|
499
|
+
"paid-amount": n.invoice.paidAmount,
|
|
500
|
+
"settlement-status": n.invoice.settlementStatus,
|
|
501
|
+
"total-credited-amount": n.invoice.totalCreditedAmount
|
|
502
|
+
}, null, 8, [
|
|
503
|
+
"is-sent",
|
|
504
|
+
"balance-due-amount",
|
|
505
|
+
"gross-amount",
|
|
506
|
+
"paid-amount",
|
|
507
|
+
"settlement-status",
|
|
508
|
+
"total-credited-amount"
|
|
509
|
+
]),
|
|
510
|
+
n.invoice.isOverdue ? (L(), A(Me, { key: 0 })) : j("", !0),
|
|
511
|
+
R(o) ? (L(), A(ye, { key: 1 })) : j("", !0),
|
|
512
|
+
m.value ? (L(), A(Ht, {
|
|
513
|
+
key: 2,
|
|
514
|
+
"delivery-status": n.invoice.deliveryStatus
|
|
515
|
+
}, null, 8, ["delivery-status"])) : j("", !0)
|
|
516
|
+
]),
|
|
517
|
+
_: 1
|
|
518
|
+
})]),
|
|
519
|
+
_: 1
|
|
520
|
+
}, 8, [
|
|
521
|
+
"fallback-title",
|
|
522
|
+
"is-disabled",
|
|
523
|
+
"sequence",
|
|
524
|
+
"status-color",
|
|
525
|
+
"status-label",
|
|
526
|
+
"icon",
|
|
527
|
+
"subject-field",
|
|
528
|
+
"subject-placeholder"
|
|
529
|
+
])]),
|
|
530
|
+
_: 1
|
|
531
|
+
}, 8, ["form"]));
|
|
532
|
+
}
|
|
533
|
+
}), an = { class: "grid w-full grid-cols-1 gap-md lg:grid-cols-3" }, on = /* @__PURE__ */ F({
|
|
534
|
+
__name: "InvoiceDetailLinkedCreditNotesSection",
|
|
535
|
+
props: { invoice: {} },
|
|
536
|
+
setup(e) {
|
|
537
|
+
let t = e, n = O(), r = d(), i = k(() => t.invoice.creditNotes.map((e) => {
|
|
538
|
+
let t = new Ye(e.status);
|
|
539
|
+
return {
|
|
540
|
+
uuid: e.uuid,
|
|
541
|
+
title: e.sequence === null ? n.t("wise_invoicing.invoice.detail.credit_notes.untitled") : n.t("wise_invoicing.invoice.detail.credit_notes.card_title", { sequence: e.sequence }),
|
|
542
|
+
amountLabel: r.formatMonetary(a(e)),
|
|
543
|
+
statusColor: t.color,
|
|
544
|
+
statusLabel: n.t(t.translationKey)
|
|
545
|
+
};
|
|
546
|
+
}));
|
|
547
|
+
function a(e) {
|
|
548
|
+
return {
|
|
549
|
+
...e.grossAmount,
|
|
550
|
+
amount: e.grossAmount.amount > 0 ? -e.grossAmount.amount : e.grossAmount.amount
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return (e, t) => i.value.length > 0 ? (L(), A(R(vt), {
|
|
554
|
+
key: 0,
|
|
555
|
+
as: "section",
|
|
556
|
+
gap: "md",
|
|
557
|
+
class: "w-full"
|
|
558
|
+
}, {
|
|
559
|
+
default: z(() => [P(R(X), {
|
|
560
|
+
text: R(n).t("wise_invoicing.invoice.detail.credit_notes.title"),
|
|
561
|
+
as: "h2",
|
|
562
|
+
class: "text-sm font-semibold text-primary"
|
|
563
|
+
}, null, 8, ["text"]), N("div", an, [(L(!0), M(nt, null, ot(i.value, (e) => (L(), A(R($e), {
|
|
564
|
+
key: e.uuid,
|
|
565
|
+
to: {
|
|
566
|
+
name: "invoicing-credit-note-detail",
|
|
567
|
+
params: { creditNoteUuid: e.uuid }
|
|
568
|
+
},
|
|
569
|
+
class: "min-w-0 rounded-lg border border-secondary bg-primary p-lg transition-colors hover:bg-secondary"
|
|
570
|
+
}, {
|
|
571
|
+
default: z(() => [P(R(Y), {
|
|
572
|
+
align: "center",
|
|
573
|
+
gap: "md",
|
|
574
|
+
class: "min-w-0"
|
|
575
|
+
}, {
|
|
576
|
+
default: z(() => [
|
|
577
|
+
P(R(X), {
|
|
578
|
+
text: e.title,
|
|
579
|
+
class: "min-w-0 flex-1 truncate text-xs font-semibold text-primary"
|
|
580
|
+
}, null, 8, ["text"]),
|
|
581
|
+
P(R(V), {
|
|
582
|
+
label: e.statusLabel,
|
|
583
|
+
color: e.statusColor,
|
|
584
|
+
size: "sm",
|
|
585
|
+
variant: "translucent"
|
|
586
|
+
}, null, 8, ["label", "color"]),
|
|
587
|
+
P(R(V), {
|
|
588
|
+
label: e.amountLabel,
|
|
589
|
+
variant: "translucent",
|
|
590
|
+
size: "sm"
|
|
591
|
+
}, null, 8, ["label"])
|
|
592
|
+
]),
|
|
593
|
+
_: 2
|
|
594
|
+
}, 1024)]),
|
|
595
|
+
_: 2
|
|
596
|
+
}, 1032, ["to"]))), 128))])]),
|
|
597
|
+
_: 1
|
|
598
|
+
})) : j("", !0);
|
|
599
|
+
}
|
|
600
|
+
}), sn = D.object({
|
|
601
|
+
deliveredOn: he.nullable(),
|
|
602
|
+
dueOn: he,
|
|
603
|
+
issuedOn: he,
|
|
604
|
+
customFields: D.array(D.custom()),
|
|
605
|
+
externalRemarks: D.string().nullable(),
|
|
606
|
+
poNumber: D.string().nullable(),
|
|
607
|
+
preparedBy: D.object({
|
|
608
|
+
uuid: D.uuid(),
|
|
609
|
+
name: D.string()
|
|
610
|
+
}),
|
|
611
|
+
subject: D.string().nullable()
|
|
612
|
+
}).superRefine((t, n) => {
|
|
613
|
+
Temporal.PlainDate.compare(t.dueOn, t.issuedOn) < 0 && n.addIssue({
|
|
614
|
+
code: "custom",
|
|
615
|
+
message: e.global.t("invoicing.invoice.validation.due_date_after_issue_date"),
|
|
616
|
+
path: ["dueOn"]
|
|
617
|
+
});
|
|
618
|
+
}), cn = /* @__PURE__ */ F({
|
|
619
|
+
__name: "InvoiceDetailRemarksSection",
|
|
620
|
+
props: { invoice: {} },
|
|
621
|
+
setup(e) {
|
|
622
|
+
let t = e, n = O(), r = Q(), i = Vt(), a = $({
|
|
623
|
+
initialState: k(() => h.toForm(t.invoice)),
|
|
624
|
+
schema: sn,
|
|
625
|
+
onSubmit: async (e) => {
|
|
626
|
+
let n = await i.execute({
|
|
627
|
+
body: e,
|
|
628
|
+
params: { invoiceUuid: t.invoice.uuid }
|
|
629
|
+
});
|
|
630
|
+
n.isErr() && r.apiError(n.error);
|
|
631
|
+
}
|
|
632
|
+
}), o = a.register("externalRemarks"), s = k(() => !w.isEditable(t.invoice.status));
|
|
633
|
+
return ke({ form: a }), (e, t) => (L(), A(R(Tt), {
|
|
634
|
+
form: R(a),
|
|
635
|
+
"prompt-on-unsaved-changes": !1
|
|
636
|
+
}, {
|
|
637
|
+
default: z(() => [P(Ae, {
|
|
638
|
+
"is-disabled": s.value,
|
|
639
|
+
placeholder: R(n).t("wise_invoicing.invoice.detail.remarks.placeholder"),
|
|
640
|
+
"remarks-field": R(o),
|
|
641
|
+
title: R(n).t("wise_invoicing.invoice.detail.remarks.title")
|
|
642
|
+
}, null, 8, [
|
|
643
|
+
"is-disabled",
|
|
644
|
+
"placeholder",
|
|
645
|
+
"remarks-field",
|
|
646
|
+
"title"
|
|
647
|
+
])]),
|
|
648
|
+
_: 1
|
|
649
|
+
}, 8, ["form"]));
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
//#endregion
|
|
653
|
+
//#region src/modules/invoice/api/queries/invoiceActivityLogIndex.query.ts
|
|
654
|
+
function ln(e) {
|
|
655
|
+
return ut("invoiceActivityLogIndex", {
|
|
656
|
+
params: { invoiceUuid: e },
|
|
657
|
+
queryFn: (t) => _.getActivityLogs(e.value, { pagination: t })
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/modules/invoice/use-cases/detail/components/sidebar/InvoiceDetailSidebarActivityTab.vue
|
|
662
|
+
var un = /* @__PURE__ */ F({
|
|
663
|
+
__name: "InvoiceDetailSidebarActivityTab",
|
|
664
|
+
props: { invoice: {} },
|
|
665
|
+
setup(e) {
|
|
666
|
+
let t = e, n = O(), { hasNextPage: r, isFetchingNextPage: i, isLoading: a, fetchNextPage: o, result: s } = ln(k(() => t.invoice.uuid)), c = k(() => s.value.unwrapOr({
|
|
667
|
+
data: [],
|
|
668
|
+
meta: { next: null }
|
|
669
|
+
}).data);
|
|
670
|
+
return (e, s) => (L(), A(Ie, {
|
|
671
|
+
"current-billing-document": {
|
|
672
|
+
role: R(l).INVOICE,
|
|
673
|
+
uuid: t.invoice.uuid
|
|
674
|
+
},
|
|
675
|
+
"empty-message": R(n).t("wise_invoicing.invoice.detail.sidebar.activity_empty"),
|
|
676
|
+
entries: c.value,
|
|
677
|
+
"fetch-next-page": R(o),
|
|
678
|
+
"has-next-page": R(r),
|
|
679
|
+
"is-fetching-next-page": R(i),
|
|
680
|
+
"is-loading": R(a)
|
|
681
|
+
}, null, 8, [
|
|
682
|
+
"current-billing-document",
|
|
683
|
+
"empty-message",
|
|
684
|
+
"entries",
|
|
685
|
+
"fetch-next-page",
|
|
686
|
+
"has-next-page",
|
|
687
|
+
"is-fetching-next-page",
|
|
688
|
+
"is-loading"
|
|
689
|
+
]));
|
|
690
|
+
}
|
|
691
|
+
}), dn = /* @__PURE__ */ F({
|
|
692
|
+
__name: "CustomFieldFieldset",
|
|
693
|
+
props: /*@__PURE__*/ it({
|
|
694
|
+
isDisabled: { type: Boolean },
|
|
695
|
+
currency: {},
|
|
696
|
+
definitions: {},
|
|
697
|
+
precision: {},
|
|
698
|
+
size: {}
|
|
699
|
+
}, {
|
|
700
|
+
modelValue: { required: !0 },
|
|
701
|
+
modelModifiers: {}
|
|
702
|
+
}),
|
|
703
|
+
emits: ["update:modelValue"],
|
|
704
|
+
setup(e) {
|
|
705
|
+
let t = e, n = ct(e, "modelValue");
|
|
706
|
+
function r(e) {
|
|
707
|
+
return qe.findByDefinition(n.value, e);
|
|
708
|
+
}
|
|
709
|
+
function i(e, t) {
|
|
710
|
+
n.value = qe.upsert(n.value, e, t);
|
|
711
|
+
}
|
|
712
|
+
return (e, n) => t.definitions.length > 0 ? (L(), A(R(vt), {
|
|
713
|
+
key: 0,
|
|
714
|
+
gap: t.size === "sm" ? "xs" : "md",
|
|
715
|
+
align: "stretch"
|
|
716
|
+
}, {
|
|
717
|
+
default: z(() => [(L(!0), M(nt, null, ot(t.definitions, (e) => (L(), A(ze, {
|
|
718
|
+
key: e.uuid,
|
|
719
|
+
currency: t.currency,
|
|
720
|
+
definition: e,
|
|
721
|
+
"is-disabled": t.isDisabled,
|
|
722
|
+
"model-value": r(e.uuid),
|
|
723
|
+
precision: t.precision,
|
|
724
|
+
size: t.size,
|
|
725
|
+
"onUpdate:modelValue": (t) => i(e.uuid, t)
|
|
726
|
+
}, null, 8, [
|
|
727
|
+
"currency",
|
|
728
|
+
"definition",
|
|
729
|
+
"is-disabled",
|
|
730
|
+
"model-value",
|
|
731
|
+
"precision",
|
|
732
|
+
"size",
|
|
733
|
+
"onUpdate:modelValue"
|
|
734
|
+
]))), 128))]),
|
|
735
|
+
_: 1
|
|
736
|
+
}, 8, ["gap"])) : j("", !0);
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/modules/invoice/api/queries/invoiceCustomerDetail.query.ts
|
|
741
|
+
function fn(e) {
|
|
742
|
+
return ft("invoiceCustomerDetail", {
|
|
743
|
+
params: { customerUuid: e },
|
|
744
|
+
queryFn: () => Te.getByUuid(e.value)
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/modules/invoice/models/invoice/update/invoicePreparer.transformer.ts
|
|
749
|
+
var pn = class {
|
|
750
|
+
static fromDto(e) {
|
|
751
|
+
let t = `${e.firstName ?? ""} ${e.lastName ?? ""}`.trim();
|
|
752
|
+
return {
|
|
753
|
+
uuid: e.uuid,
|
|
754
|
+
name: t === "" ? e.email ?? e.uuid : t
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
}, mn = class {
|
|
758
|
+
static toDto(e) {
|
|
759
|
+
return {
|
|
760
|
+
pagination: e.pagination,
|
|
761
|
+
search: g.toDto(e.search)
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
}, hn = class {
|
|
765
|
+
static async getAll(e) {
|
|
766
|
+
return (await n.fromPromise(t({ query: mn.toDto(e) }))).map((e) => ({
|
|
767
|
+
data: e.data.items.map(pn.fromDto),
|
|
768
|
+
meta: e.data.meta
|
|
769
|
+
}));
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/modules/invoice/api/queries/invoiceUserSearch.query.ts
|
|
774
|
+
function gn(e) {
|
|
775
|
+
let t = k(() => ({ search: e.params.search?.value }));
|
|
776
|
+
return dt("invoiceUserSearch", {
|
|
777
|
+
params: { queryParams: t },
|
|
778
|
+
queryFn: (t) => hn.getAll({
|
|
779
|
+
pagination: t,
|
|
780
|
+
search: e.params.search?.value ?? ""
|
|
781
|
+
})
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/modules/invoice/components/form/InvoiceFormPreparedByField.vue
|
|
786
|
+
var _n = /* @__PURE__ */ F({
|
|
787
|
+
__name: "InvoiceFormPreparedByField",
|
|
788
|
+
props: {
|
|
789
|
+
isLoading: { type: Boolean },
|
|
790
|
+
field: {},
|
|
791
|
+
users: {}
|
|
792
|
+
},
|
|
793
|
+
emits: ["nextPage", "updateSearch"],
|
|
794
|
+
setup(e, { emit: t }) {
|
|
795
|
+
let n = e, r = t, i = O(), a = k(() => Lt(n.users));
|
|
796
|
+
function o(e) {
|
|
797
|
+
return e.name;
|
|
798
|
+
}
|
|
799
|
+
function s(e) {
|
|
800
|
+
e !== null && (n.field.setValue(e), r("updateSearch", ""));
|
|
801
|
+
}
|
|
802
|
+
return (e, t) => (L(), A(R(mt), I(R(T)(n.field), {
|
|
803
|
+
"display-fn": o,
|
|
804
|
+
"is-loading": n.isLoading,
|
|
805
|
+
"is-required": !0,
|
|
806
|
+
items: a.value,
|
|
807
|
+
label: R(i).t("wise_invoicing.invoice.detail.header.created_by"),
|
|
808
|
+
placeholder: R(i).t("component.autocomplete.search_placeholder"),
|
|
809
|
+
"search-mode": "remote",
|
|
810
|
+
onNextPage: t[0] ||= (e) => r("nextPage"),
|
|
811
|
+
"onUpdate:modelValue": s,
|
|
812
|
+
"onUpdate:search": t[1] ||= (e) => r("updateSearch", e)
|
|
813
|
+
}), null, 16, [
|
|
814
|
+
"is-loading",
|
|
815
|
+
"items",
|
|
816
|
+
"label",
|
|
817
|
+
"placeholder"
|
|
818
|
+
]));
|
|
819
|
+
}
|
|
820
|
+
}), vn = /* @__PURE__ */ F({
|
|
821
|
+
__name: "InvoiceUpdateDialog",
|
|
822
|
+
props: {
|
|
823
|
+
customFieldDefinitions: {},
|
|
824
|
+
invoice: {}
|
|
825
|
+
},
|
|
826
|
+
emits: ["close"],
|
|
827
|
+
setup(e, { emit: t }) {
|
|
828
|
+
let n = e, r = t, i = O(), a = Q(), o = Vt(), s = Ee(), c = y(), l = f({ debounceMs: 250 }), u = gn({ params: { search: l.debouncedSearch } }), d = k(() => u.result.value.match({
|
|
829
|
+
err: () => [],
|
|
830
|
+
loading: () => [],
|
|
831
|
+
ok: (e) => e.data
|
|
832
|
+
})), p = fn(k(() => n.invoice.customer.uuid)), m = k(() => {
|
|
833
|
+
let e = p.result.value;
|
|
834
|
+
if (e.isOk()) return e.getValue().defaultPaymentTermDays;
|
|
835
|
+
let t = s.result.value;
|
|
836
|
+
return t.isOk() ? t.getValue().defaultPaymentTermDays ?? 0 : 0;
|
|
837
|
+
}), g = $({
|
|
838
|
+
initialState: k(() => h.toForm(n.invoice)),
|
|
839
|
+
schema: sn,
|
|
840
|
+
onSubmit: async (e) => {
|
|
841
|
+
let t = await o.execute({
|
|
842
|
+
body: e,
|
|
843
|
+
params: { invoiceUuid: n.invoice.uuid }
|
|
844
|
+
});
|
|
845
|
+
if (t.isErr()) {
|
|
846
|
+
a.apiError(t.error);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
r("close");
|
|
850
|
+
},
|
|
851
|
+
onSubmitError: () => {
|
|
852
|
+
a.unableToSave();
|
|
853
|
+
}
|
|
854
|
+
}), _ = g.register("issuedOn"), v = g.register("dueOn"), b = g.register("deliveredOn"), ee = g.register("poNumber"), x = g.register("preparedBy"), te = g.register("subject"), ne = g.register("customFields"), re = k({
|
|
855
|
+
get: () => ne.modelValue.value ?? [],
|
|
856
|
+
set: (e) => {
|
|
857
|
+
ne.setValue(e);
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
function ie(e) {
|
|
861
|
+
e !== null && v.setValue(e.add({ days: m.value }));
|
|
862
|
+
}
|
|
863
|
+
function oe(e) {
|
|
864
|
+
l.updateSearch(e);
|
|
865
|
+
}
|
|
866
|
+
return (e, t) => (L(), A(R(Et), {
|
|
867
|
+
form: R(g),
|
|
868
|
+
size: "sm",
|
|
869
|
+
onClose: t[1] ||= (e) => r("close")
|
|
870
|
+
}, {
|
|
871
|
+
default: z(() => [
|
|
872
|
+
P(R(J), {
|
|
873
|
+
icon: R(ae),
|
|
874
|
+
"is-description-visible": !1,
|
|
875
|
+
title: R(i).t("wise_invoicing.invoice.detail.header.edit_info"),
|
|
876
|
+
description: ""
|
|
877
|
+
}, null, 8, ["icon", "title"]),
|
|
878
|
+
P(R(Ct), null, {
|
|
879
|
+
default: z(() => [P(R(Ot), null, {
|
|
880
|
+
default: z(() => [P(R(Dt), {
|
|
881
|
+
lg: 2,
|
|
882
|
+
sm: 1
|
|
883
|
+
}, {
|
|
884
|
+
default: z(() => [
|
|
885
|
+
P(R(H), I(R(T)(R(_)), {
|
|
886
|
+
label: R(i).t("wise_invoicing.invoice.detail.header.invoice_date"),
|
|
887
|
+
"is-required": !0,
|
|
888
|
+
"onUpdate:modelValue": ie
|
|
889
|
+
}), null, 16, ["label"]),
|
|
890
|
+
P(R(H), I(R(T)(R(v)), {
|
|
891
|
+
label: R(i).t("wise_invoicing.invoice.detail.header.due_date"),
|
|
892
|
+
"is-required": !0,
|
|
893
|
+
"min-date": R(_).modelValue.value
|
|
894
|
+
}), null, 16, ["label", "min-date"]),
|
|
895
|
+
R(c).isDeliveryDateVisible.value ? (L(), A(R(H), I({ key: 0 }, R(T)(R(b)), { label: R(i).t("wise_invoicing.invoice.detail.header.delivery_date") }), null, 16, ["label"])) : j("", !0),
|
|
896
|
+
P(_n, {
|
|
897
|
+
field: R(x),
|
|
898
|
+
"is-loading": R(u).isLoading.value,
|
|
899
|
+
users: d.value,
|
|
900
|
+
onNextPage: R(u).fetchNextPage,
|
|
901
|
+
onUpdateSearch: oe
|
|
902
|
+
}, null, 8, [
|
|
903
|
+
"field",
|
|
904
|
+
"is-loading",
|
|
905
|
+
"users",
|
|
906
|
+
"onNextPage"
|
|
907
|
+
]),
|
|
908
|
+
P(R(It), I(R(T)(R(ee)), { label: R(i).t("wise_invoicing.invoice.detail.header.po_number") }), null, 16, ["label"]),
|
|
909
|
+
P(R(It), I(R(T)(R(te)), {
|
|
910
|
+
label: R(i).t("wise_invoicing.invoice.detail.header.subject"),
|
|
911
|
+
placeholder: R(i).t("wise_invoicing.invoice.detail.header.subject_placeholder")
|
|
912
|
+
}), null, 16, ["label", "placeholder"])
|
|
913
|
+
]),
|
|
914
|
+
_: 1
|
|
915
|
+
}), P(dn, {
|
|
916
|
+
modelValue: re.value,
|
|
917
|
+
"onUpdate:modelValue": t[0] ||= (e) => re.value = e,
|
|
918
|
+
currency: n.invoice.currency,
|
|
919
|
+
definitions: n.customFieldDefinitions,
|
|
920
|
+
"is-disabled": !0,
|
|
921
|
+
precision: n.invoice.grossAmount.precision,
|
|
922
|
+
class: "w-full"
|
|
923
|
+
}, null, 8, [
|
|
924
|
+
"modelValue",
|
|
925
|
+
"currency",
|
|
926
|
+
"definitions",
|
|
927
|
+
"precision"
|
|
928
|
+
])]),
|
|
929
|
+
_: 1
|
|
930
|
+
})]),
|
|
931
|
+
_: 1
|
|
932
|
+
}),
|
|
933
|
+
P(R(K), null, {
|
|
934
|
+
right: z(() => [P(R(q), { label: "cancel" }), P(R(wt), { label: R(i).t("wise_invoicing.invoice.detail.header.edit_info") }, null, 8, ["label"])]),
|
|
935
|
+
_: 1
|
|
936
|
+
})
|
|
937
|
+
]),
|
|
938
|
+
_: 1
|
|
939
|
+
}, 8, ["form"]));
|
|
940
|
+
}
|
|
941
|
+
}), yn = /* @__PURE__ */ F({
|
|
942
|
+
__name: "InvoiceDetailSidebarInfoTab",
|
|
943
|
+
props: {
|
|
944
|
+
customFieldDefinitions: {},
|
|
945
|
+
invoice: {}
|
|
946
|
+
},
|
|
947
|
+
setup(e) {
|
|
948
|
+
let t = e, n = O(), r = me(), i = y(), a = Bt().create(vn), o = k(() => w.isEditable(t.invoice.status)), c = k(() => ge.filterByEntityType(t.customFieldDefinitions, s.INVOICE)), l = k(() => {
|
|
949
|
+
if (!t.invoice.isOverdue) return null;
|
|
950
|
+
let e = t.invoice.dueOn.toZonedDateTime(pt.Now.timeZoneId()).toInstant();
|
|
951
|
+
return r.toRelativeTime(e);
|
|
952
|
+
});
|
|
953
|
+
async function u() {
|
|
954
|
+
await a.open({
|
|
955
|
+
customFieldDefinitions: c.value,
|
|
956
|
+
invoice: t.invoice
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function d(e) {
|
|
960
|
+
return e === null ? "-" : r.formatPlainDate(e);
|
|
961
|
+
}
|
|
962
|
+
return (e, r) => (L(), A(R(bt), { class: "px-2xl py-xl" }, {
|
|
963
|
+
default: z(() => [
|
|
964
|
+
P(R(xt), { label: R(n).t("wise_invoicing.invoice.detail.sidebar.general") }, rt({
|
|
965
|
+
default: z(() => [
|
|
966
|
+
P(R(U), null, {
|
|
967
|
+
default: z(() => [P(R(W), {
|
|
968
|
+
icon: R(S),
|
|
969
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.invoice_id")
|
|
970
|
+
}, null, 8, ["icon", "label"]), P(R(G), { text: t.invoice.sequence ?? "-" }, null, 8, ["text"])]),
|
|
971
|
+
_: 1
|
|
972
|
+
}),
|
|
973
|
+
P(R(U), null, {
|
|
974
|
+
default: z(() => [P(R(W), {
|
|
975
|
+
icon: R(le),
|
|
976
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.po_number")
|
|
977
|
+
}, null, 8, ["icon", "label"]), P(R(G), { text: t.invoice.poNumber ?? "-" }, null, 8, ["text"])]),
|
|
978
|
+
_: 1
|
|
979
|
+
}),
|
|
980
|
+
P(R(U), null, {
|
|
981
|
+
default: z(() => [P(R(W), {
|
|
982
|
+
icon: R(ue),
|
|
983
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.issuer")
|
|
984
|
+
}, null, 8, ["icon", "label"]), P(R(G), { text: t.invoice.issuer.name ?? "-" }, null, 8, ["text"])]),
|
|
985
|
+
_: 1
|
|
986
|
+
}),
|
|
987
|
+
P(R(U), null, {
|
|
988
|
+
default: z(() => [P(R(W), {
|
|
989
|
+
icon: R(x),
|
|
990
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.invoice_date")
|
|
991
|
+
}, null, 8, ["icon", "label"]), P(R(G), { text: d(t.invoice.issueOn) }, null, 8, ["text"])]),
|
|
992
|
+
_: 1
|
|
993
|
+
}),
|
|
994
|
+
P(R(U), null, {
|
|
995
|
+
default: z(() => [P(R(W), {
|
|
996
|
+
icon: R(ie),
|
|
997
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.due_date"),
|
|
998
|
+
variant: t.invoice.isOverdue ? "error" : "default"
|
|
999
|
+
}, null, 8, [
|
|
1000
|
+
"icon",
|
|
1001
|
+
"label",
|
|
1002
|
+
"variant"
|
|
1003
|
+
]), P(R(Y), { gap: "xs" }, {
|
|
1004
|
+
default: z(() => [P(R(G), {
|
|
1005
|
+
text: d(t.invoice.dueOn),
|
|
1006
|
+
variant: t.invoice.isOverdue ? "error" : "default"
|
|
1007
|
+
}, null, 8, ["text", "variant"]), l.value === null ? j("", !0) : (L(), A(R(V), {
|
|
1008
|
+
key: 0,
|
|
1009
|
+
label: l.value,
|
|
1010
|
+
color: "error",
|
|
1011
|
+
size: "sm",
|
|
1012
|
+
variant: "translucent"
|
|
1013
|
+
}, null, 8, ["label"]))]),
|
|
1014
|
+
_: 1
|
|
1015
|
+
})]),
|
|
1016
|
+
_: 1
|
|
1017
|
+
}),
|
|
1018
|
+
R(i).isDeliveryDateVisible.value ? (L(), A(R(U), { key: 0 }, {
|
|
1019
|
+
default: z(() => [P(R(W), {
|
|
1020
|
+
icon: R(de),
|
|
1021
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.delivery_date")
|
|
1022
|
+
}, null, 8, ["icon", "label"]), P(R(G), { text: d(t.invoice.deliveredOn) }, null, 8, ["text"])]),
|
|
1023
|
+
_: 1
|
|
1024
|
+
})) : j("", !0),
|
|
1025
|
+
P(Le, {
|
|
1026
|
+
definitions: t.customFieldDefinitions,
|
|
1027
|
+
values: t.invoice.customFields
|
|
1028
|
+
}, null, 8, ["definitions", "values"])
|
|
1029
|
+
]),
|
|
1030
|
+
_: 2
|
|
1031
|
+
}, [o.value ? {
|
|
1032
|
+
name: "actions",
|
|
1033
|
+
fn: z(() => [P(R(At), {
|
|
1034
|
+
icon: R(fe),
|
|
1035
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.edit_info"),
|
|
1036
|
+
variant: "tertiary",
|
|
1037
|
+
onClick: u
|
|
1038
|
+
}, null, 8, ["icon", "label"])]),
|
|
1039
|
+
key: "0"
|
|
1040
|
+
} : void 0]), 1032, ["label"]),
|
|
1041
|
+
P(Be, { "original-invoice": t.invoice.originalInvoice }, null, 8, ["original-invoice"]),
|
|
1042
|
+
P(R(St)),
|
|
1043
|
+
P(R(xt), {
|
|
1044
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.bill_to"),
|
|
1045
|
+
"collapse-options": {
|
|
1046
|
+
isCollapsible: !0,
|
|
1047
|
+
isOpenByDefault: !0,
|
|
1048
|
+
badge: { label: t.invoice.customer.name ?? "-" }
|
|
1049
|
+
}
|
|
1050
|
+
}, {
|
|
1051
|
+
default: z(() => [P(R(U), { orientation: "vertical" }, {
|
|
1052
|
+
default: z(() => [P(R(X), {
|
|
1053
|
+
text: t.invoice.customer.name ?? "-",
|
|
1054
|
+
class: "text-xs font-medium"
|
|
1055
|
+
}, null, 8, ["text"]), t.invoice.customer.address ? (L(), M(nt, { key: 0 }, [P(R(X), {
|
|
1056
|
+
text: R(b).formatLines(t.invoice.customer.address)[0] ?? "",
|
|
1057
|
+
class: "text-xs"
|
|
1058
|
+
}, null, 8, ["text"]), t.invoice.customer.address ? (L(), A(R(X), {
|
|
1059
|
+
key: 0,
|
|
1060
|
+
text: R(b).formatLines(t.invoice.customer.address)[1] ?? "",
|
|
1061
|
+
class: "text-xs"
|
|
1062
|
+
}, null, 8, ["text"])) : j("", !0)], 64)) : j("", !0)]),
|
|
1063
|
+
_: 1
|
|
1064
|
+
})]),
|
|
1065
|
+
_: 1
|
|
1066
|
+
}, 8, ["label", "collapse-options"]),
|
|
1067
|
+
P(R(St)),
|
|
1068
|
+
P(R(xt), {
|
|
1069
|
+
label: R(n).t("wise_invoicing.invoice.detail.header.bill_from"),
|
|
1070
|
+
"collapse-options": {
|
|
1071
|
+
isCollapsible: !0,
|
|
1072
|
+
isOpenByDefault: !1,
|
|
1073
|
+
badge: { label: t.invoice.issuer.email ?? "-" }
|
|
1074
|
+
}
|
|
1075
|
+
}, {
|
|
1076
|
+
default: z(() => [P(R(U), { orientation: "vertical" }, {
|
|
1077
|
+
default: z(() => [P(R(W), { label: t.invoice.issuer.email ?? "-" }, null, 8, ["label"]), t.invoice.issuer.address ? (L(), A(R(G), {
|
|
1078
|
+
key: 0,
|
|
1079
|
+
text: R(b).format(t.invoice.issuer.address)
|
|
1080
|
+
}, null, 8, ["text"])) : j("", !0)]),
|
|
1081
|
+
_: 1
|
|
1082
|
+
})]),
|
|
1083
|
+
_: 1
|
|
1084
|
+
}, 8, ["label", "collapse-options"])
|
|
1085
|
+
]),
|
|
1086
|
+
_: 1
|
|
1087
|
+
}));
|
|
1088
|
+
}
|
|
1089
|
+
}), bn = /* @__PURE__ */ F({
|
|
1090
|
+
__name: "InvoiceDetailSidebar",
|
|
1091
|
+
props: {
|
|
1092
|
+
customFieldDefinitions: {},
|
|
1093
|
+
invoice: {}
|
|
1094
|
+
},
|
|
1095
|
+
setup(e) {
|
|
1096
|
+
let t = e, n = O(), r = me(), i = k(() => n.t("wise_invoicing.invoice.detail.sidebar.updated_on", { date: r.toDateTime(t.invoice.updatedAt) }));
|
|
1097
|
+
return (e, n) => (L(), A(Ue, {
|
|
1098
|
+
"billing-document": t.invoice,
|
|
1099
|
+
"updated-footer": i.value
|
|
1100
|
+
}, {
|
|
1101
|
+
activity: z(() => [P(un, { invoice: t.invoice }, null, 8, ["invoice"])]),
|
|
1102
|
+
info: z(() => [P(yn, {
|
|
1103
|
+
"custom-field-definitions": t.customFieldDefinitions,
|
|
1104
|
+
invoice: t.invoice
|
|
1105
|
+
}, null, 8, ["custom-field-definitions", "invoice"])]),
|
|
1106
|
+
_: 1
|
|
1107
|
+
}, 8, ["billing-document", "updated-footer"]));
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/modules/invoice/api/mutations/invoicePaymentDelete.mutation.ts
|
|
1112
|
+
function xn() {
|
|
1113
|
+
return B({
|
|
1114
|
+
queryFn: (e) => _.deletePayment(e.params.invoiceUuid, e.params.paymentUuid),
|
|
1115
|
+
queryKeysToInvalidate: {
|
|
1116
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
1117
|
+
invoicePaymentIndex: { invoiceUuid: (e) => e.invoiceUuid }
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/modules/invoice/api/queries/invoicePaymentIndex.query.ts
|
|
1123
|
+
function Sn(e) {
|
|
1124
|
+
return ft("invoicePaymentIndex", {
|
|
1125
|
+
params: { invoiceUuid: e },
|
|
1126
|
+
queryFn: () => _.getPayments(e.value)
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
//#endregion
|
|
1130
|
+
//#region src/modules/invoice/use-cases/detail/components/table/InvoiceDetailPaymentActionsCell.vue
|
|
1131
|
+
var Cn = /* @__PURE__ */ F({
|
|
1132
|
+
__name: "InvoiceDetailPaymentActionsCell",
|
|
1133
|
+
props: {
|
|
1134
|
+
payment: {},
|
|
1135
|
+
onDelete: { type: Function }
|
|
1136
|
+
},
|
|
1137
|
+
setup(e) {
|
|
1138
|
+
let t = e, n = O();
|
|
1139
|
+
return (e, r) => (L(), A(R(Pt), null, {
|
|
1140
|
+
default: z(() => [P(R(Ft), null, {
|
|
1141
|
+
default: z(() => [t.payment.source === R(u).MANUAL ? (L(), A(R(At), {
|
|
1142
|
+
key: 0,
|
|
1143
|
+
label: R(n).t("wise_invoicing.invoice.detail.payments.delete.title"),
|
|
1144
|
+
icon: R(Ce),
|
|
1145
|
+
size: "sm",
|
|
1146
|
+
variant: "tertiary",
|
|
1147
|
+
onClick: r[0] ||= (e) => t.onDelete(t.payment)
|
|
1148
|
+
}, null, 8, ["label", "icon"])) : j("", !0)]),
|
|
1149
|
+
_: 1
|
|
1150
|
+
})]),
|
|
1151
|
+
_: 1
|
|
1152
|
+
}));
|
|
1153
|
+
}
|
|
1154
|
+
}), wn = /* @__PURE__ */ F({
|
|
1155
|
+
__name: "InvoiceDetailPaymentManualCell",
|
|
1156
|
+
props: { payment: {} },
|
|
1157
|
+
setup(e) {
|
|
1158
|
+
let t = e;
|
|
1159
|
+
return (e, n) => (L(), A(R(Pt), null, {
|
|
1160
|
+
default: z(() => [t.payment.source === R(u).MANUAL ? (L(), A(R(Se), {
|
|
1161
|
+
key: 0,
|
|
1162
|
+
class: "size-4 text-brand-600"
|
|
1163
|
+
})) : j("", !0)]),
|
|
1164
|
+
_: 1
|
|
1165
|
+
}));
|
|
1166
|
+
}
|
|
1167
|
+
}), Tn = /* @__PURE__ */ F({
|
|
1168
|
+
__name: "InvoiceDetailPaymentsTableTextCell",
|
|
1169
|
+
props: { text: {} },
|
|
1170
|
+
setup(e) {
|
|
1171
|
+
let t = e;
|
|
1172
|
+
return (e, n) => (L(), A(R(Pt), null, {
|
|
1173
|
+
default: z(() => [P(R(X), {
|
|
1174
|
+
text: t.text ?? "-",
|
|
1175
|
+
class: "text-sm/5 text-primary"
|
|
1176
|
+
}, null, 8, ["text"])]),
|
|
1177
|
+
_: 1
|
|
1178
|
+
}));
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/modules/invoice/use-cases/detail/composables/invoiceDetailPaymentsTableColumns.composable.ts
|
|
1183
|
+
function En(e) {
|
|
1184
|
+
let t = O(), n = me(), r = d();
|
|
1185
|
+
return k(() => zt()([
|
|
1186
|
+
{
|
|
1187
|
+
headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.date"),
|
|
1188
|
+
key: "date",
|
|
1189
|
+
size: {
|
|
1190
|
+
max: "12rem",
|
|
1191
|
+
min: "12rem"
|
|
1192
|
+
},
|
|
1193
|
+
component: (e) => Z(Tn, { text: n.formatPlainDate(e.date) })
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.reference"),
|
|
1197
|
+
key: "reference",
|
|
1198
|
+
size: {
|
|
1199
|
+
max: "14rem",
|
|
1200
|
+
min: "12rem"
|
|
1201
|
+
},
|
|
1202
|
+
component: (e) => Z(Tn, { text: e.paymentReference ?? "—" })
|
|
1203
|
+
},
|
|
1204
|
+
{
|
|
1205
|
+
headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.remark"),
|
|
1206
|
+
key: "remark",
|
|
1207
|
+
size: {
|
|
1208
|
+
max: "1fr",
|
|
1209
|
+
min: "12rem"
|
|
1210
|
+
},
|
|
1211
|
+
component: (e) => Z(Tn, { text: e.remarks ?? "—" })
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.manual"),
|
|
1215
|
+
key: "manual",
|
|
1216
|
+
size: {
|
|
1217
|
+
max: "6rem",
|
|
1218
|
+
min: "6rem"
|
|
1219
|
+
},
|
|
1220
|
+
component: (e) => Z(wn, { payment: e })
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
headerLabel: t.t("wise_invoicing.invoice.detail.payments.columns.amount"),
|
|
1224
|
+
key: "amount",
|
|
1225
|
+
size: {
|
|
1226
|
+
max: "10rem",
|
|
1227
|
+
min: "10rem"
|
|
1228
|
+
},
|
|
1229
|
+
component: (e) => Z(Tn, { text: r.formatMonetary(e.amount) })
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
headerLabel: "",
|
|
1233
|
+
key: "actions",
|
|
1234
|
+
size: {
|
|
1235
|
+
max: "5rem",
|
|
1236
|
+
min: "5rem"
|
|
1237
|
+
},
|
|
1238
|
+
component: (t) => Z(Cn, {
|
|
1239
|
+
payment: t,
|
|
1240
|
+
onDelete: e.onDelete
|
|
1241
|
+
})
|
|
1242
|
+
}
|
|
1243
|
+
]));
|
|
1244
|
+
}
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/modules/invoice/api/mutations/invoicePaymentCreate.mutation.ts
|
|
1247
|
+
function Dn() {
|
|
1248
|
+
return B({
|
|
1249
|
+
queryFn: (e) => _.createPayment(e.params.invoiceUuid, e.body),
|
|
1250
|
+
queryKeysToInvalidate: {
|
|
1251
|
+
invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid },
|
|
1252
|
+
invoicePaymentIndex: { invoiceUuid: (e) => e.invoiceUuid }
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region src/modules/invoice/models/invoice/payment/invoicePaymentCreateForm.model.ts
|
|
1258
|
+
var On = D.object({
|
|
1259
|
+
amount: D.number().positive(),
|
|
1260
|
+
currency: D.enum(r),
|
|
1261
|
+
date: m,
|
|
1262
|
+
paymentReference: D.string().nullable(),
|
|
1263
|
+
precision: D.number().int().nonnegative(),
|
|
1264
|
+
remarks: D.string().nullable()
|
|
1265
|
+
}), kn = { class: "pr-md text-xs text-secondary" }, An = /* @__PURE__ */ F({
|
|
1266
|
+
__name: "InvoicePaymentCreateDialog",
|
|
1267
|
+
props: { invoice: {} },
|
|
1268
|
+
emits: ["close"],
|
|
1269
|
+
setup(e, { emit: t }) {
|
|
1270
|
+
let n = e, r = t, i = O(), a = Q(), o = d(), s = Dn(), c = k(() => o.getSymbol(n.invoice.grossAmount.currency)), l = $({
|
|
1271
|
+
initialState: {
|
|
1272
|
+
amount: null,
|
|
1273
|
+
currency: n.invoice.grossAmount.currency,
|
|
1274
|
+
date: p.getToday(),
|
|
1275
|
+
paymentReference: null,
|
|
1276
|
+
precision: n.invoice.grossAmount.precision,
|
|
1277
|
+
remarks: null
|
|
1278
|
+
},
|
|
1279
|
+
schema: On,
|
|
1280
|
+
onSubmit: async (e) => {
|
|
1281
|
+
let t = await s.execute({
|
|
1282
|
+
body: e,
|
|
1283
|
+
params: { invoiceUuid: n.invoice.uuid }
|
|
1284
|
+
});
|
|
1285
|
+
if (t.isErr()) {
|
|
1286
|
+
a.apiError(t.error);
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
a.show({ message: i.t("wise_invoicing.invoice.detail.payments.create.success") }), r("close");
|
|
1290
|
+
},
|
|
1291
|
+
onSubmitError: () => {
|
|
1292
|
+
a.unableToSave();
|
|
1293
|
+
}
|
|
1294
|
+
}), u = l.register("amount"), f = l.register("date"), m = l.register("paymentReference"), h = l.register("remarks");
|
|
1295
|
+
return (e, t) => (L(), A(R(Et), {
|
|
1296
|
+
form: R(l),
|
|
1297
|
+
size: "sm",
|
|
1298
|
+
onClose: t[0] ||= (e) => r("close")
|
|
1299
|
+
}, {
|
|
1300
|
+
default: z(() => [
|
|
1301
|
+
P(R(J), {
|
|
1302
|
+
title: R(i).t("wise_invoicing.invoice.detail.payments.create.title"),
|
|
1303
|
+
description: R(i).t("wise_invoicing.invoice.detail.payments.create.description"),
|
|
1304
|
+
icon: R(ve),
|
|
1305
|
+
"is-description-visible": !0
|
|
1306
|
+
}, null, 8, [
|
|
1307
|
+
"title",
|
|
1308
|
+
"description",
|
|
1309
|
+
"icon"
|
|
1310
|
+
]),
|
|
1311
|
+
P(R(Ct), null, {
|
|
1312
|
+
default: z(() => [P(R(Ot), null, {
|
|
1313
|
+
default: z(() => [P(R(Dt), {
|
|
1314
|
+
lg: 2,
|
|
1315
|
+
sm: 1
|
|
1316
|
+
}, {
|
|
1317
|
+
default: z(() => [
|
|
1318
|
+
P(R(jt), I(R(T)(R(u)), {
|
|
1319
|
+
"is-required": !0,
|
|
1320
|
+
label: R(i).t("wise_invoicing.invoice.detail.payments.create.fields.amount"),
|
|
1321
|
+
min: .01,
|
|
1322
|
+
step: .01
|
|
1323
|
+
}), {
|
|
1324
|
+
right: z(() => [N("span", kn, st(c.value.symbol), 1)]),
|
|
1325
|
+
_: 1
|
|
1326
|
+
}, 16, ["label"]),
|
|
1327
|
+
P(R(H), I(R(T)(R(f)), {
|
|
1328
|
+
"is-required": !0,
|
|
1329
|
+
label: R(i).t("wise_invoicing.invoice.detail.payments.create.fields.date")
|
|
1330
|
+
}), null, 16, ["label"]),
|
|
1331
|
+
P(R(It), I(R(T)(R(m)), { label: R(i).t("wise_invoicing.invoice.detail.payments.create.fields.reference") }), null, 16, ["label"]),
|
|
1332
|
+
P(R(It), I(R(T)(R(h)), { label: R(i).t("wise_invoicing.invoice.detail.payments.create.fields.remarks") }), null, 16, ["label"])
|
|
1333
|
+
]),
|
|
1334
|
+
_: 1
|
|
1335
|
+
})]),
|
|
1336
|
+
_: 1
|
|
1337
|
+
})]),
|
|
1338
|
+
_: 1
|
|
1339
|
+
}),
|
|
1340
|
+
P(R(K), null, {
|
|
1341
|
+
right: z(() => [P(R(q), { label: "cancel" }), P(R(kt), { label: R(i).t("wise_invoicing.invoice.detail.payments.create.submit") }, null, 8, ["label"])]),
|
|
1342
|
+
_: 1
|
|
1343
|
+
})
|
|
1344
|
+
]),
|
|
1345
|
+
_: 1
|
|
1346
|
+
}, 8, ["form"]));
|
|
1347
|
+
}
|
|
1348
|
+
}), jn = /* @__PURE__ */ F({
|
|
1349
|
+
__name: "InvoiceDetailPaymentsSection",
|
|
1350
|
+
props: { invoice: {} },
|
|
1351
|
+
setup(e) {
|
|
1352
|
+
let t = e, n = O(), r = d(), i = k(() => t.invoice.uuid), a = k(() => t.invoice.balanceDueAmount === null ? null : r.formatMonetary(t.invoice.balanceDueAmount)), { isLoading: o, result: s } = Sn(i), c = Bt(), l = Q(), u = c.create(An), f = c.create(yt), p = xn(), m = k(() => s.value.match({
|
|
1353
|
+
err: () => [],
|
|
1354
|
+
loading: () => [],
|
|
1355
|
+
ok: (e) => e
|
|
1356
|
+
})), h = k(() => s.value.match({
|
|
1357
|
+
err: (e) => e,
|
|
1358
|
+
loading: () => null,
|
|
1359
|
+
ok: () => null
|
|
1360
|
+
})), g = k(() => !w.getMetadata(t.invoice.status).isTerminal);
|
|
1361
|
+
function _() {
|
|
1362
|
+
u.open({ invoice: t.invoice });
|
|
1363
|
+
}
|
|
1364
|
+
function v(e) {
|
|
1365
|
+
f.open({
|
|
1366
|
+
title: n.t("wise_invoicing.invoice.detail.payments.delete.title"),
|
|
1367
|
+
isDestructive: !0,
|
|
1368
|
+
confirmLabel: n.t("wise_invoicing.invoice.detail.payments.delete.submit"),
|
|
1369
|
+
description: n.t("wise_invoicing.invoice.detail.payments.delete.description"),
|
|
1370
|
+
onConfirm: async () => {
|
|
1371
|
+
let r = await p.execute({ params: {
|
|
1372
|
+
invoiceUuid: t.invoice.uuid,
|
|
1373
|
+
paymentUuid: e.uuid
|
|
1374
|
+
} });
|
|
1375
|
+
if (r.isErr()) {
|
|
1376
|
+
l.apiError(r.error);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
l.show({ message: n.t("wise_invoicing.invoice.detail.payments.delete.success") }), f.close();
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
let y = En({ onDelete: v });
|
|
1384
|
+
return (e, t) => (L(), A(He, null, {
|
|
1385
|
+
default: z(() => [P(R(Y), {
|
|
1386
|
+
justify: "between",
|
|
1387
|
+
class: "w-full gap-lg border-b border-secondary px-lg py-md"
|
|
1388
|
+
}, {
|
|
1389
|
+
default: z(() => [P(R(Y), { gap: "sm" }, {
|
|
1390
|
+
default: z(() => [P(R(X), {
|
|
1391
|
+
text: R(n).t("wise_invoicing.invoice.detail.payments.title"),
|
|
1392
|
+
as: "h2",
|
|
1393
|
+
class: "text-sm font-semibold text-primary"
|
|
1394
|
+
}, null, 8, ["text"]), a.value === null ? j("", !0) : (L(), A(R(V), {
|
|
1395
|
+
key: 0,
|
|
1396
|
+
color: "gray",
|
|
1397
|
+
size: "sm",
|
|
1398
|
+
variant: "outline"
|
|
1399
|
+
}, {
|
|
1400
|
+
default: z(() => [
|
|
1401
|
+
P(R(ht), { label: R(n).t("wise_invoicing.invoice.detail.payments.balance_due") }, null, 8, ["label"]),
|
|
1402
|
+
P(R(gt)),
|
|
1403
|
+
P(R(ht), { label: a.value }, null, 8, ["label"])
|
|
1404
|
+
]),
|
|
1405
|
+
_: 1
|
|
1406
|
+
}))]),
|
|
1407
|
+
_: 1
|
|
1408
|
+
}), g.value ? (L(), A(R(_t), {
|
|
1409
|
+
key: 0,
|
|
1410
|
+
label: R(n).t("wise_invoicing.invoice.detail.payments.add"),
|
|
1411
|
+
"icon-left": R(be),
|
|
1412
|
+
size: "sm",
|
|
1413
|
+
onClick: _
|
|
1414
|
+
}, null, 8, ["label", "icon-left"])) : j("", !0)]),
|
|
1415
|
+
_: 1
|
|
1416
|
+
}), P(R(Nt), {
|
|
1417
|
+
"active-filter-count": 0,
|
|
1418
|
+
columns: R(y),
|
|
1419
|
+
data: m.value,
|
|
1420
|
+
error: h.value,
|
|
1421
|
+
"get-key": (e) => e.uuid,
|
|
1422
|
+
"has-active-search": !1,
|
|
1423
|
+
"header-actions": [],
|
|
1424
|
+
"is-fetching-next-page": !1,
|
|
1425
|
+
"is-loading": R(o)
|
|
1426
|
+
}, null, 8, [
|
|
1427
|
+
"columns",
|
|
1428
|
+
"data",
|
|
1429
|
+
"error",
|
|
1430
|
+
"get-key",
|
|
1431
|
+
"is-loading"
|
|
1432
|
+
])]),
|
|
1433
|
+
_: 1
|
|
1434
|
+
}));
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/modules/invoice/api/mutations/invoiceUpdateLines.mutation.ts
|
|
1439
|
+
function Mn() {
|
|
1440
|
+
return B({
|
|
1441
|
+
queryFn: (e) => _.updateLines(e.params.invoiceUuid, e.body),
|
|
1442
|
+
queryKeysToInvalidate: { invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid } }
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region src/modules/invoice/api/mutations/invoiceApplyDiscount.mutation.ts
|
|
1447
|
+
function Nn() {
|
|
1448
|
+
return B({
|
|
1449
|
+
queryFn: (e) => _.applyDiscount(e.params.invoiceUuid, e.body),
|
|
1450
|
+
queryKeysToInvalidate: { invoiceDetail: { invoiceUuid: (e) => e.invoiceUuid } }
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region src/modules/invoice/models/invoice/update/invoiceApplyDiscountForm.model.ts
|
|
1455
|
+
var Pn = D.object({
|
|
1456
|
+
currency: D.enum(r),
|
|
1457
|
+
precision: D.number().int().nonnegative(),
|
|
1458
|
+
type: D.enum(a),
|
|
1459
|
+
value: D.number()
|
|
1460
|
+
}).refine((e) => e.type !== a.PERCENTAGE || e.value <= 100, { path: ["value"] }), Fn = { class: "pr-md text-xs text-secondary" }, In = /* @__PURE__ */ F({
|
|
1461
|
+
__name: "InvoiceApplyDiscountDialog",
|
|
1462
|
+
props: { invoice: {} },
|
|
1463
|
+
emits: ["close"],
|
|
1464
|
+
setup(e, { emit: t }) {
|
|
1465
|
+
let n = e, r = t, i = O(), o = Q(), s = d(), c = Nn(), l = k(() => Rt([a.PERCENTAGE, a.AMOUNT])), u = $({
|
|
1466
|
+
initialState: {
|
|
1467
|
+
currency: n.invoice.grossAmount.currency,
|
|
1468
|
+
precision: n.invoice.grossAmount.precision,
|
|
1469
|
+
type: a.PERCENTAGE,
|
|
1470
|
+
value: null
|
|
1471
|
+
},
|
|
1472
|
+
schema: Pn,
|
|
1473
|
+
onSubmit: async (e) => {
|
|
1474
|
+
let t = await c.execute({
|
|
1475
|
+
body: e,
|
|
1476
|
+
params: { invoiceUuid: n.invoice.uuid }
|
|
1477
|
+
});
|
|
1478
|
+
if (t.isErr()) {
|
|
1479
|
+
o.apiError(t.error);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
r("close");
|
|
1483
|
+
},
|
|
1484
|
+
onSubmitError: () => {
|
|
1485
|
+
o.unableToSave();
|
|
1486
|
+
}
|
|
1487
|
+
}), f = u.register("value"), p = u.register("type"), m = k(() => p.modelValue.value === a.PERCENTAGE), h = k(() => p.modelValue.value === a.AMOUNT), g = k(() => s.getSymbol(n.invoice.grossAmount.currency));
|
|
1488
|
+
function _(e) {
|
|
1489
|
+
return i.t(`wise_invoicing.invoice.detail.global_discount.type.${e}`);
|
|
1490
|
+
}
|
|
1491
|
+
return (e, t) => (L(), A(R(Et), {
|
|
1492
|
+
form: R(u),
|
|
1493
|
+
size: "sm",
|
|
1494
|
+
onClose: t[0] ||= (e) => r("close")
|
|
1495
|
+
}, {
|
|
1496
|
+
default: z(() => [
|
|
1497
|
+
P(R(J), {
|
|
1498
|
+
title: R(i).t("wise_invoicing.invoice.detail.line_items.global_discount"),
|
|
1499
|
+
description: R(i).t("wise_invoicing.invoice.detail.global_discount.description"),
|
|
1500
|
+
icon: R(C),
|
|
1501
|
+
"is-description-visible": !0
|
|
1502
|
+
}, null, 8, [
|
|
1503
|
+
"title",
|
|
1504
|
+
"description",
|
|
1505
|
+
"icon"
|
|
1506
|
+
]),
|
|
1507
|
+
P(R(Ct), null, {
|
|
1508
|
+
default: z(() => [P(R(Ot), null, {
|
|
1509
|
+
default: z(() => [P(R(Dt), {
|
|
1510
|
+
lg: 2,
|
|
1511
|
+
sm: 1
|
|
1512
|
+
}, {
|
|
1513
|
+
default: z(() => [
|
|
1514
|
+
P(R(Mt), I(R(T)(R(p)), {
|
|
1515
|
+
"display-fn": _,
|
|
1516
|
+
"is-required": !0,
|
|
1517
|
+
items: l.value,
|
|
1518
|
+
label: R(i).t("wise_invoicing.invoice.detail.global_discount.type.label")
|
|
1519
|
+
}), null, 16, ["items", "label"]),
|
|
1520
|
+
m.value ? (L(), A(R(jt), I({ key: 0 }, R(T)(R(f)), {
|
|
1521
|
+
hint: R(i).t("wise_invoicing.invoice.detail.global_discount.amount.hint"),
|
|
1522
|
+
"is-required": !0,
|
|
1523
|
+
label: R(i).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
|
|
1524
|
+
max: 100,
|
|
1525
|
+
min: 0,
|
|
1526
|
+
step: .01
|
|
1527
|
+
}), {
|
|
1528
|
+
right: z(() => [...t[1] ||= [N("span", { class: "pr-md text-xs text-secondary" }, " % ", -1)]]),
|
|
1529
|
+
_: 1
|
|
1530
|
+
}, 16, ["hint", "label"])) : j("", !0),
|
|
1531
|
+
h.value ? (L(), A(R(jt), I({ key: 1 }, R(T)(R(f)), {
|
|
1532
|
+
"is-required": !0,
|
|
1533
|
+
label: R(i).t("wise_invoicing.invoice.detail.global_discount.amount.label"),
|
|
1534
|
+
min: .01,
|
|
1535
|
+
step: .01
|
|
1536
|
+
}), {
|
|
1537
|
+
right: z(() => [N("span", Fn, st(g.value.symbol), 1)]),
|
|
1538
|
+
_: 1
|
|
1539
|
+
}, 16, ["label"])) : j("", !0)
|
|
1540
|
+
]),
|
|
1541
|
+
_: 1
|
|
1542
|
+
})]),
|
|
1543
|
+
_: 1
|
|
1544
|
+
})]),
|
|
1545
|
+
_: 1
|
|
1546
|
+
}),
|
|
1547
|
+
P(R(K), null, {
|
|
1548
|
+
right: z(() => [P(R(q), { label: "cancel" }), P(R(wt), { label: R(i).t("wise_invoicing.invoice.detail.global_discount.confirm") }, null, 8, ["label"])]),
|
|
1549
|
+
_: 1
|
|
1550
|
+
})
|
|
1551
|
+
]),
|
|
1552
|
+
_: 1
|
|
1553
|
+
}, 8, ["form"]));
|
|
1554
|
+
}
|
|
1555
|
+
}), Ln = /* @__PURE__ */ F({
|
|
1556
|
+
__name: "InvoiceLineItemsTableSection",
|
|
1557
|
+
props: {
|
|
1558
|
+
customFieldDefinitions: {},
|
|
1559
|
+
invoice: {}
|
|
1560
|
+
},
|
|
1561
|
+
setup(e) {
|
|
1562
|
+
let t = e, n = k(() => t.invoice), r = y(), i = Mn(), a = k(() => w.isEditable(t.invoice.status)), o = Re({
|
|
1563
|
+
isSaving: k(() => i.isLoading.value),
|
|
1564
|
+
billingDocument: () => n.value,
|
|
1565
|
+
canEdit: a,
|
|
1566
|
+
customFieldDefinitions: () => t.customFieldDefinitions,
|
|
1567
|
+
updateLines: (e) => i.execute({
|
|
1568
|
+
body: e,
|
|
1569
|
+
params: { invoiceUuid: t.invoice.uuid }
|
|
1570
|
+
})
|
|
1571
|
+
}), s = Bt().create(In);
|
|
1572
|
+
function c() {
|
|
1573
|
+
s.open({ invoice: t.invoice });
|
|
1574
|
+
}
|
|
1575
|
+
return Fe(o), (e, n) => (L(), A(He, null, {
|
|
1576
|
+
default: z(() => [
|
|
1577
|
+
P(Ge, {
|
|
1578
|
+
"show-apply-discount": R(r).isGlobalDiscountEnabled.value,
|
|
1579
|
+
onApplyDiscount: c
|
|
1580
|
+
}, null, 8, ["show-apply-discount"]),
|
|
1581
|
+
P(Ne),
|
|
1582
|
+
P(je, { "billing-document": t.invoice }, null, 8, ["billing-document"]),
|
|
1583
|
+
P(Pe)
|
|
1584
|
+
]),
|
|
1585
|
+
_: 1
|
|
1586
|
+
}));
|
|
1587
|
+
}
|
|
1588
|
+
}), Rn = /* @__PURE__ */ F({
|
|
1589
|
+
__name: "InvoiceDetailView",
|
|
1590
|
+
props: {
|
|
1591
|
+
customFieldDefinitions: {},
|
|
1592
|
+
invoice: {}
|
|
1593
|
+
},
|
|
1594
|
+
setup(e) {
|
|
1595
|
+
let t = e, n = O(), r = at(!1), i = k(() => [{
|
|
1596
|
+
label: n.t("wise_invoicing.invoice.overview.title"),
|
|
1597
|
+
to: { name: "invoicing-invoice-overview" }
|
|
1598
|
+
}, { label: t.invoice.sequence ?? t.invoice.subject ?? n.t("wise_invoicing.invoice.detail.fallback_title") }]);
|
|
1599
|
+
return (e, a) => (L(), A(We, {
|
|
1600
|
+
"billing-document": t.invoice,
|
|
1601
|
+
breadcrumbs: i.value,
|
|
1602
|
+
title: R(n).t("wise_invoicing.invoice.detail.fallback_title")
|
|
1603
|
+
}, {
|
|
1604
|
+
header: z(() => [P(rn, {
|
|
1605
|
+
invoice: t.invoice,
|
|
1606
|
+
"is-pdf-view-active": r.value,
|
|
1607
|
+
class: "w-full",
|
|
1608
|
+
onTogglePdfView: a[0] ||= (e) => r.value = !r.value
|
|
1609
|
+
}, null, 8, ["invoice", "is-pdf-view-active"])]),
|
|
1610
|
+
default: z(() => [r.value ? (L(), A(Ve, {
|
|
1611
|
+
key: 0,
|
|
1612
|
+
"billing-document": t.invoice,
|
|
1613
|
+
class: "w-full"
|
|
1614
|
+
}, null, 8, ["billing-document"])) : (L(), M(nt, { key: 1 }, [
|
|
1615
|
+
P(Ln, {
|
|
1616
|
+
"custom-field-definitions": t.customFieldDefinitions,
|
|
1617
|
+
invoice: t.invoice
|
|
1618
|
+
}, null, 8, ["custom-field-definitions", "invoice"]),
|
|
1619
|
+
R(w).isEditable(t.invoice.status) ? j("", !0) : (L(), A(jn, {
|
|
1620
|
+
key: 0,
|
|
1621
|
+
invoice: t.invoice,
|
|
1622
|
+
class: "w-full"
|
|
1623
|
+
}, null, 8, ["invoice"])),
|
|
1624
|
+
P(on, {
|
|
1625
|
+
invoice: t.invoice,
|
|
1626
|
+
class: "w-full"
|
|
1627
|
+
}, null, 8, ["invoice"]),
|
|
1628
|
+
P(cn, {
|
|
1629
|
+
invoice: t.invoice,
|
|
1630
|
+
class: "w-full"
|
|
1631
|
+
}, null, 8, ["invoice"])
|
|
1632
|
+
], 64))]),
|
|
1633
|
+
sidebar: z(() => [P(bn, {
|
|
1634
|
+
"custom-field-definitions": t.customFieldDefinitions,
|
|
1635
|
+
invoice: t.invoice
|
|
1636
|
+
}, null, 8, ["custom-field-definitions", "invoice"])]),
|
|
1637
|
+
_: 1
|
|
1638
|
+
}, 8, [
|
|
1639
|
+
"billing-document",
|
|
1640
|
+
"breadcrumbs",
|
|
1641
|
+
"title"
|
|
1642
|
+
]));
|
|
1643
|
+
}
|
|
1644
|
+
}), zn = /* @__PURE__ */ F({
|
|
1645
|
+
__name: "InvoiceDetailViewDataProvider",
|
|
1646
|
+
props: { invoiceUuid: {} },
|
|
1647
|
+
setup(e) {
|
|
1648
|
+
let t = e, n = O(), r = k(() => [{
|
|
1649
|
+
label: n.t("wise_invoicing.invoice.overview.title"),
|
|
1650
|
+
to: { name: "invoicing-invoice-overview" }
|
|
1651
|
+
}]), i = Qe(k(() => t.invoiceUuid)), a = _e();
|
|
1652
|
+
return (e, t) => (L(), A(Ke, {
|
|
1653
|
+
"custom-field-definitions-query": R(a),
|
|
1654
|
+
query: R(i),
|
|
1655
|
+
"loading-breadcrumbs": r.value
|
|
1656
|
+
}, {
|
|
1657
|
+
default: z(({ billingDocument: e, customFieldDefinitions: t }) => [P(Rn, {
|
|
1658
|
+
"custom-field-definitions": t,
|
|
1659
|
+
invoice: e
|
|
1660
|
+
}, null, 8, ["custom-field-definitions", "invoice"])]),
|
|
1661
|
+
_: 1
|
|
1662
|
+
}, 8, [
|
|
1663
|
+
"custom-field-definitions-query",
|
|
1664
|
+
"query",
|
|
1665
|
+
"loading-breadcrumbs"
|
|
1666
|
+
]));
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
//#endregion
|
|
1670
|
+
export { zn as default };
|