@tesouro/embedded-components-react 0.5.247 → 0.5.249
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/README.md +27 -26
- package/dist/index.d.ts +2 -1
- package/dist/lib/ReceivablesWidget.d.ts +2 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +58 -57
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +52 -38
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +408 -396
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +140 -131
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -7,80 +7,87 @@ import { getStateOptions as t } from "../../../../../shared/util/dist/lib/usStat
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { COUNTERPART_MESSAGE_LABELS_EN as n } from "../../../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
9
9
|
import { getCounterpartEmail as r } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useCounterpartQuery as i } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
+
import { useCounterpartAddressesQuery as a } from "../../../../../shared/counterpart-management/data-access/dist/index7.js";
|
|
12
|
+
import { useCounterpartForm as o } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
12
13
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
14
|
import "../../../../ui/dist/index19.js";
|
|
14
15
|
import "../../../../ui/dist/index.js";
|
|
15
|
-
import { buildLineItemControls as
|
|
16
|
-
import { buildReceivableAttachmentsView as
|
|
17
|
-
import { getCurrencyOptions as
|
|
18
|
-
import { useMeasureUnitsQuery as
|
|
19
|
-
import { useMeasureUnits as
|
|
16
|
+
import { buildLineItemControls as ee, commitLineItemField as s, commitTaxRateInput as c, convertPriceInput as te, createLineItem as ne, getCurrencySymbol as re, lineItemFromProduct as ie, reconcileLineItemIds as ae, reconcileMeasureUnits as oe, sanitizeLineItemPatch as se, sanitizeTaxRateInput as ce, stepLineItemQuantity as le, stripBlankLineItems as ue, summarizeLineItemErrors as de, toSheetLineItem as fe, validateLineItems as pe } from "./lineItems.js";
|
|
17
|
+
import { buildReceivableAttachmentsView as me } from "./attachments.js";
|
|
18
|
+
import { getCurrencyOptions as he } from "../../../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
19
|
+
import { useMeasureUnitsQuery as ge } from "../../../../../shared/product-catalog/data-access/dist/index9.js";
|
|
20
|
+
import { useMeasureUnits as _e } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
20
21
|
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
21
|
-
import { getInlineItems as
|
|
22
|
-
import { buildCreateRecurrencePayload as
|
|
23
|
-
import { convertDiscountInput as
|
|
24
|
-
import { buildFormTotalsView as
|
|
25
|
-
import { createEmptyReceivableFormValues as
|
|
26
|
-
import { getIssueReminderBlocker as
|
|
27
|
-
import { useCreateReceivableMutation as
|
|
28
|
-
import { useCreateRecurrenceMutation as
|
|
22
|
+
import { getInlineItems as ve } from "./actionsModal.js";
|
|
23
|
+
import { buildCreateRecurrencePayload as ye, buildUpdateRecurrencePayload as be, clearRecurrenceRecipients as l, countIssuedIterations as xe, isRecurring as u, recurrenceToFormFields as Se, validateRecurrence as Ce, willRecurrenceIssue as we } from "./recurrence.js";
|
|
24
|
+
import { convertDiscountInput as Te, decorateDiscountInput as Ee, discountInputToMinorUnits as De, sanitizeDiscountInput as Oe } from "./discount.js";
|
|
25
|
+
import { buildFormTotalsView as ke, calculateFormTotals as Ae, validateDiscount as je, validateInvoiceTotals as Me } from "./totals.js";
|
|
26
|
+
import { createEmptyReceivableFormValues as Ne, hasReceivableFormErrors as Pe, receivableFormValuesToCreatePayload as Fe, receivableFormValuesToLineItemChanges as Ie, receivableFormValuesToUpdatePayload as Le, receivableToFormValues as Re, resolveCounterpartAddresses as ze, submittedLineItemRows as Be, validateReceivableForm as Ve } from "./helpers.js";
|
|
27
|
+
import { getIssueReminderBlocker as He, shouldShowRemindersInitially as Ue } from "./reminders.js";
|
|
28
|
+
import { useCreateReceivableMutation as We, useIssueReceivableMutation as Ge, useUpdateReceivableMutation as Ke } from "../../../../data-access/dist/index8.js";
|
|
29
|
+
import { useCreateRecurrenceMutation as qe, useRecurrenceQuery as Je, useUpdateRecurrenceMutation as Ye } from "../../../../data-access/dist/index12.js";
|
|
29
30
|
import "../../../../data-access/dist/index.js";
|
|
30
|
-
import { useReceivableIssuePreflight as
|
|
31
|
-
import { UNSUBMITTED_PAYLOAD_VARIANTS as
|
|
32
|
-
import { useReceivableAttachmentUploads as
|
|
33
|
-
import { useReceivablePaymentTerms as
|
|
34
|
-
import { useReceivableRecurrence as
|
|
35
|
-
import { useReceivableBankAccount as
|
|
36
|
-
import { useReceivableReminders as
|
|
37
|
-
import { useReceivablePreview as
|
|
38
|
-
import { useCallback as
|
|
31
|
+
import { useReceivableIssuePreflight as Xe } from "./useReceivableIssuePreflight.js";
|
|
32
|
+
import { UNSUBMITTED_PAYLOAD_VARIANTS as Ze, apiValidationErrorsToFormErrors as Qe, getApiErrorMessage as $e, parseApiValidationErrors as et } from "./apiValidationErrors.js";
|
|
33
|
+
import { useReceivableAttachmentUploads as tt } from "./useReceivableAttachmentUploads.js";
|
|
34
|
+
import { useReceivablePaymentTerms as nt } from "./useReceivablePaymentTerms.js";
|
|
35
|
+
import { useReceivableRecurrence as rt } from "./useReceivableRecurrence.js";
|
|
36
|
+
import { useReceivableBankAccount as it } from "./useReceivableBankAccount.js";
|
|
37
|
+
import { useReceivableReminders as at } from "./useReceivableReminders.js";
|
|
38
|
+
import { useReceivablePreview as ot } from "./useReceivablePreview.js";
|
|
39
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
39
40
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js
|
|
40
|
-
function
|
|
41
|
-
|
|
41
|
+
function st(e, t) {
|
|
42
|
+
return t === e.customerId ? e : l({
|
|
43
|
+
...e,
|
|
44
|
+
customerId: t,
|
|
45
|
+
billingAddressId: "",
|
|
46
|
+
shippingAddressId: ""
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, onCreated: ut }) {
|
|
50
|
+
let dt = We(), ft = Ke(), pt = qe(), mt = Ye(), ht = Ge(), g = m("draft"), gt = m(!1), [_t, vt] = h(), _ = m(!1), v = m(!1), yt = m(null), y = m(void 0), b = m([]), bt = m(""), [x, S] = h(!1), [C, xt] = h("create"), [St, Ct] = h(), [wt, Tt] = h(), [w, T] = h(() => Ne()), [Et, E] = h({}), [Dt, Ot] = h("none"), kt = _e(), D = ge(), O = D.data?.data, { unitNamesById: k } = kt, [At, jt] = h(), [A, Mt] = h(!1), Nt = m(!1), j = m(!1), M = m(!1), N = m({
|
|
42
51
|
lines: !1,
|
|
43
52
|
discount: !1
|
|
44
|
-
}), [
|
|
53
|
+
}), [Pt, P] = h(!1), Ft = p(() => t(), []), It = p(() => ({
|
|
45
54
|
...n,
|
|
46
|
-
...
|
|
47
|
-
}), [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
|
|
55
|
+
...ct
|
|
56
|
+
}), [ct]), Lt = a(w.customerId), Rt = i(w.customerId || void 0), zt = Lt.data?.data?.[0], { billingAddressId: F, billingAddress: Bt, shippingAddressId: Vt } = ze({
|
|
57
|
+
values: w,
|
|
58
|
+
counterpart: Rt.data,
|
|
59
|
+
addresses: Lt.data?.data
|
|
60
|
+
}), I = !!w.customerId && (Lt.isLoading || Rt.isLoading), L = Xe({
|
|
61
|
+
counterpartId: w.customerId,
|
|
62
|
+
billingAddressId: F,
|
|
63
|
+
billingCountry: Bt?.country
|
|
64
|
+
}), Ht = L.isLoading || I, Ut = d((e) => {
|
|
65
|
+
T((t) => ({
|
|
53
66
|
...t,
|
|
54
67
|
attachments: e(t.attachments)
|
|
55
68
|
}));
|
|
56
|
-
}, []),
|
|
57
|
-
attachments:
|
|
58
|
-
setAttachments:
|
|
59
|
-
receivableId:
|
|
60
|
-
}), { reset:
|
|
61
|
-
attachments:
|
|
62
|
-
pendingUploads:
|
|
63
|
-
isCountLimitReached:
|
|
64
|
-
isRecurring:
|
|
65
|
-
messages:
|
|
66
|
-
}) : void 0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, []), Ht = a({
|
|
75
|
-
view: Ct,
|
|
76
|
-
setView: wt,
|
|
77
|
-
selectedId: E.customerId || void 0,
|
|
78
|
-
setSelectedId: Vt,
|
|
79
|
-
messages: Mt,
|
|
69
|
+
}, []), R = tt({
|
|
70
|
+
attachments: w.attachments,
|
|
71
|
+
setAttachments: Ut,
|
|
72
|
+
receivableId: St
|
|
73
|
+
}), { reset: z, discardUploads: B, commitRemovals: Wt } = R, Gt = w.type === "invoice" ? me({
|
|
74
|
+
attachments: w.attachments,
|
|
75
|
+
pendingUploads: R.pendingUploads,
|
|
76
|
+
isCountLimitReached: R.isCountLimitReached,
|
|
77
|
+
isRecurring: u(w),
|
|
78
|
+
messages: l
|
|
79
|
+
}) : void 0, Kt = d((e) => {
|
|
80
|
+
T((t) => st(t, e ?? ""));
|
|
81
|
+
}, []), qt = o({
|
|
82
|
+
view: Dt,
|
|
83
|
+
setView: Ot,
|
|
84
|
+
selectedId: w.customerId || void 0,
|
|
85
|
+
setSelectedId: Kt,
|
|
86
|
+
messages: It,
|
|
80
87
|
counterpartType: "customer",
|
|
81
88
|
counterpart: void 0,
|
|
82
|
-
primaryAddress:
|
|
83
|
-
}),
|
|
89
|
+
primaryAddress: zt
|
|
90
|
+
}), Jt = d((e) => T((t) => {
|
|
84
91
|
let n = e({
|
|
85
92
|
paymentTermsId: t.paymentTermsId,
|
|
86
93
|
paymentTermsCustomDate: t.paymentTermsCustomDate
|
|
@@ -90,50 +97,50 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
|
|
|
90
97
|
...n,
|
|
91
98
|
...n.paymentTermsId === "receipt_due" ? { paymentReminderId: "" } : {}
|
|
92
99
|
};
|
|
93
|
-
}), []),
|
|
94
|
-
paymentTermsId:
|
|
95
|
-
paymentTermsCustomDate:
|
|
96
|
-
issueDate:
|
|
97
|
-
isRecurring:
|
|
98
|
-
messages:
|
|
99
|
-
onChange:
|
|
100
|
-
}),
|
|
100
|
+
}), []), Yt = nt({
|
|
101
|
+
paymentTermsId: w.paymentTermsId,
|
|
102
|
+
paymentTermsCustomDate: w.paymentTermsCustomDate,
|
|
103
|
+
issueDate: w.issueDate,
|
|
104
|
+
isRecurring: w.type === "invoice" && u(w),
|
|
105
|
+
messages: l,
|
|
106
|
+
onChange: Jt
|
|
107
|
+
}), Xt = Yt.reset, Zt = d((e) => T((t) => ({
|
|
101
108
|
...t,
|
|
102
109
|
...e
|
|
103
|
-
})), []), V =
|
|
104
|
-
open:
|
|
105
|
-
bankAccountId:
|
|
106
|
-
embeddedBankName:
|
|
107
|
-
messages:
|
|
108
|
-
onSelect:
|
|
109
|
-
}),
|
|
110
|
-
|
|
111
|
-
H && G.current !== H.id && (G.current = H.id,
|
|
110
|
+
})), []), V = it({
|
|
111
|
+
open: x,
|
|
112
|
+
bankAccountId: w.bankAccountId,
|
|
113
|
+
embeddedBankName: lt,
|
|
114
|
+
messages: l,
|
|
115
|
+
onSelect: Zt
|
|
116
|
+
}), Qt = V.reset, $t = Je(wt), H = wt ? $t.data : void 0, U = xe(H), en = U > 0, W = !!wt && $t.isLoading, G = m(void 0);
|
|
117
|
+
f(() => {
|
|
118
|
+
H && G.current !== H.id && (G.current = H.id, T((e) => ({
|
|
112
119
|
...e,
|
|
113
|
-
...
|
|
120
|
+
...Se(H)
|
|
114
121
|
})));
|
|
115
122
|
}, [H]);
|
|
116
|
-
let
|
|
123
|
+
let tn = d((e) => T(e), []), nn = d((e) => E((t) => {
|
|
117
124
|
if (!e.some((e) => e in t)) return t;
|
|
118
125
|
let n = { ...t };
|
|
119
126
|
return e.forEach((e) => delete n[e]), n;
|
|
120
|
-
}), []),
|
|
121
|
-
if (!
|
|
122
|
-
|
|
127
|
+
}), []), rn = m([]), an = d((e) => {
|
|
128
|
+
if (!A) {
|
|
129
|
+
nn(e);
|
|
123
130
|
return;
|
|
124
131
|
}
|
|
125
|
-
|
|
126
|
-
}, [
|
|
127
|
-
|
|
128
|
-
let e =
|
|
132
|
+
rn.current.push(...e);
|
|
133
|
+
}, [nn, A]);
|
|
134
|
+
f(() => {
|
|
135
|
+
let e = rn.current;
|
|
129
136
|
if (!e.length) return;
|
|
130
|
-
|
|
131
|
-
let t =
|
|
132
|
-
fields:
|
|
137
|
+
rn.current = [];
|
|
138
|
+
let t = Ce({
|
|
139
|
+
fields: w,
|
|
133
140
|
issuedCount: U,
|
|
134
|
-
messages:
|
|
141
|
+
messages: l
|
|
135
142
|
});
|
|
136
|
-
|
|
143
|
+
E((n) => {
|
|
137
144
|
let r = { ...n };
|
|
138
145
|
return e.forEach((e) => {
|
|
139
146
|
t[e] ? r[e] = t[e] : delete r[e];
|
|
@@ -141,206 +148,207 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
|
|
|
141
148
|
});
|
|
142
149
|
}, [
|
|
143
150
|
U,
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
l,
|
|
152
|
+
w
|
|
146
153
|
]);
|
|
147
|
-
let
|
|
148
|
-
values:
|
|
149
|
-
errors:
|
|
150
|
-
lockSchedule:
|
|
151
|
-
messages:
|
|
152
|
-
onChange:
|
|
153
|
-
onClearErrors:
|
|
154
|
-
onRevalidateErrors:
|
|
155
|
-
}), K =
|
|
154
|
+
let on = rt({
|
|
155
|
+
values: w,
|
|
156
|
+
errors: Et,
|
|
157
|
+
lockSchedule: en,
|
|
158
|
+
messages: l,
|
|
159
|
+
onChange: tn,
|
|
160
|
+
onClearErrors: nn,
|
|
161
|
+
onRevalidateErrors: an
|
|
162
|
+
}), K = on.reset, sn = d((e) => T((t) => ({
|
|
156
163
|
...t,
|
|
157
164
|
...e
|
|
158
|
-
})), []), q =
|
|
159
|
-
open:
|
|
160
|
-
isInvoice:
|
|
165
|
+
})), []), q = dt.isPending || ft.isPending || pt.isPending || mt.isPending || ht.isPending, cn = at({
|
|
166
|
+
open: x,
|
|
167
|
+
isInvoice: w.type === "invoice",
|
|
161
168
|
disabled: q,
|
|
162
|
-
paymentTermsId:
|
|
163
|
-
paymentTermsCustomDate:
|
|
164
|
-
paymentReminderId:
|
|
165
|
-
overdueReminderId:
|
|
166
|
-
messages:
|
|
167
|
-
onSelect:
|
|
168
|
-
}),
|
|
169
|
-
|
|
169
|
+
paymentTermsId: w.paymentTermsId,
|
|
170
|
+
paymentTermsCustomDate: w.paymentTermsCustomDate,
|
|
171
|
+
paymentReminderId: w.paymentReminderId,
|
|
172
|
+
overdueReminderId: w.overdueReminderId,
|
|
173
|
+
messages: l,
|
|
174
|
+
onSelect: sn
|
|
175
|
+
}), ln = cn.reset, un = d(() => {
|
|
176
|
+
b.current = [], jt(void 0), xt("create"), Ct(void 0), Tt(void 0), G.current = void 0, y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, T(Ne()), E({}), Mt(!1), P(!1), N.current = {
|
|
170
177
|
lines: !1,
|
|
171
178
|
discount: !1
|
|
172
|
-
},
|
|
173
|
-
}, [
|
|
174
|
-
|
|
175
|
-
let
|
|
176
|
-
...
|
|
177
|
-
type: e
|
|
179
|
+
}, z(), K();
|
|
180
|
+
}, [z, K]), dn = d((e = "invoice", { customerId: t = "" } = {}) => {
|
|
181
|
+
Xt(), Qt(), K();
|
|
182
|
+
let n = {
|
|
183
|
+
...Ne(),
|
|
184
|
+
type: e,
|
|
185
|
+
customerId: t
|
|
178
186
|
};
|
|
179
|
-
|
|
187
|
+
ln(Ue(n)), b.current = [], y.current = void 0, g.current = "draft", _.current = !1, v.current = !1, G.current = void 0, jt(void 0), xt("create"), Ct(void 0), Tt(void 0), T(n), E({}), z(), Mt(!1), P(!1), N.current = {
|
|
180
188
|
lines: !1,
|
|
181
189
|
discount: !1
|
|
182
|
-
},
|
|
190
|
+
}, S(!0);
|
|
183
191
|
}, [
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
z,
|
|
193
|
+
Xt,
|
|
194
|
+
Qt,
|
|
187
195
|
K,
|
|
188
|
-
|
|
189
|
-
]),
|
|
196
|
+
ln
|
|
197
|
+
]), fn = d((e, { highlightForIssue: t = !1 } = {}) => {
|
|
190
198
|
if (e.type === "credit_note") return;
|
|
191
|
-
|
|
192
|
-
let n =
|
|
193
|
-
|
|
199
|
+
Xt(), Qt(), K();
|
|
200
|
+
let n = Re(e, O);
|
|
201
|
+
ln(Ue(n)), b.current = e.line_items, bt.current = e.currency, y.current = void 0, g.current = t ? "issue" : "draft", _.current = !1, v.current = t, G.current = void 0, jt(void 0), xt("edit"), Ct(e.id), Tt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), T(n), E({}), Mt(!1), P(!1), N.current = {
|
|
194
202
|
lines: !1,
|
|
195
203
|
discount: !1
|
|
196
|
-
},
|
|
204
|
+
}, z(), S(!0);
|
|
197
205
|
}, [
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
z,
|
|
207
|
+
Xt,
|
|
208
|
+
Qt,
|
|
201
209
|
K,
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
ln,
|
|
211
|
+
O
|
|
204
212
|
]);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
let t =
|
|
213
|
+
f(() => {
|
|
214
|
+
O?.length && T((e) => {
|
|
215
|
+
let t = oe(e.lineItems, O);
|
|
208
216
|
return t === e.lineItems ? e : {
|
|
209
217
|
...e,
|
|
210
218
|
lineItems: t
|
|
211
219
|
};
|
|
212
220
|
});
|
|
213
|
-
}, [
|
|
214
|
-
let
|
|
215
|
-
|
|
216
|
-
}, [
|
|
221
|
+
}, [O]);
|
|
222
|
+
let pn = R.isUploading, mn = d(() => {
|
|
223
|
+
pn || (B(), S(!1), E({}));
|
|
224
|
+
}, [B, pn]), hn = d((e) => {
|
|
217
225
|
let t = { ...e };
|
|
218
|
-
t.taxRate !== void 0 && (t.taxRate =
|
|
226
|
+
t.taxRate !== void 0 && (t.taxRate = ce(t.taxRate), M.current = !0), t.type !== void 0 && t.type !== "invoice" && B(), t.type !== void 0 && (g.current = "draft"), t.discount !== void 0 && A && (j.current = !0), t.discountType !== void 0 && (j.current = !0), t.currency !== void 0 && (Nt.current = !0), T((e) => {
|
|
219
227
|
let n = {
|
|
220
|
-
...e,
|
|
228
|
+
...t.customerId === void 0 ? e : st(e, t.customerId),
|
|
221
229
|
...t
|
|
222
230
|
};
|
|
223
|
-
return t.discount !== void 0 && (n.discount =
|
|
231
|
+
return t.discount !== void 0 && (n.discount = Oe(t.discount, n.discountType, n.currency)), n.currency !== e.currency && (n.lineItems = e.lineItems.map((t) => ({
|
|
224
232
|
...t,
|
|
225
|
-
price:
|
|
226
|
-
}))), (n.currency !== e.currency || n.discountType !== e.discountType) && (n.discount =
|
|
233
|
+
price: te(t.price, e.currency, n.currency)
|
|
234
|
+
}))), (n.currency !== e.currency || n.discountType !== e.discountType) && (n.discount = Te({
|
|
227
235
|
value: n.discount,
|
|
228
236
|
type: n.discountType,
|
|
229
237
|
currency: n.currency
|
|
230
238
|
})), n;
|
|
231
239
|
});
|
|
232
|
-
}, [
|
|
233
|
-
|
|
240
|
+
}, [B, A]), gn = d(() => P(!0), []), _n = d(() => {
|
|
241
|
+
P(!1), j.current = !0, T((e) => ({
|
|
234
242
|
...e,
|
|
235
|
-
discount:
|
|
243
|
+
discount: Te({
|
|
236
244
|
value: e.discount,
|
|
237
245
|
type: e.discountType,
|
|
238
246
|
currency: e.currency
|
|
239
247
|
})
|
|
240
248
|
}));
|
|
241
|
-
}, []),
|
|
242
|
-
|
|
249
|
+
}, []), vn = d(() => {
|
|
250
|
+
M.current = !0, T((e) => {
|
|
243
251
|
let t = c(e.taxRate);
|
|
244
252
|
return t === e.taxRate ? e : {
|
|
245
253
|
...e,
|
|
246
254
|
taxRate: t
|
|
247
255
|
};
|
|
248
256
|
});
|
|
249
|
-
}, []), J =
|
|
250
|
-
t && (
|
|
257
|
+
}, []), J = d((e, { validate: t }) => {
|
|
258
|
+
t && (Nt.current = !0), T((t) => ({
|
|
251
259
|
...t,
|
|
252
260
|
lineItems: e(t.lineItems)
|
|
253
261
|
}));
|
|
254
262
|
}, []);
|
|
255
|
-
|
|
256
|
-
let e =
|
|
257
|
-
if (!e && !t && !
|
|
258
|
-
|
|
259
|
-
let n =
|
|
260
|
-
currency:
|
|
261
|
-
messages:
|
|
263
|
+
f(() => {
|
|
264
|
+
let e = Nt.current, t = j.current;
|
|
265
|
+
if (!e && !t && !M.current) return;
|
|
266
|
+
Nt.current = !1, j.current = !1, M.current = !1, e && (N.current.lines = !0), t && (N.current.discount = !0);
|
|
267
|
+
let n = _.current || U > 0, r = e ? pe(w.lineItems, {
|
|
268
|
+
currency: w.currency,
|
|
269
|
+
messages: l,
|
|
262
270
|
requireComplete: n
|
|
263
271
|
}) : void 0;
|
|
264
|
-
|
|
272
|
+
E((t) => {
|
|
265
273
|
let i = { ...t };
|
|
266
|
-
return
|
|
274
|
+
return N.current.lines && (i.lineItems = e ? r : t.lineItems, i.lineItemsSummary = de(i.lineItems, Me(w, l), n && w.lineItems.length === 0 ? l.lineItemsRequired : void 0)), N.current.discount && (i.discount = je(w, l)), i;
|
|
267
275
|
});
|
|
268
276
|
}, [
|
|
269
277
|
U,
|
|
270
|
-
|
|
271
|
-
|
|
278
|
+
l,
|
|
279
|
+
w
|
|
272
280
|
]);
|
|
273
|
-
let
|
|
274
|
-
let { unit: n, ...r } = t, i =
|
|
275
|
-
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (
|
|
281
|
+
let yn = d((e, t) => {
|
|
282
|
+
let { unit: n, ...r } = t, i = se(r);
|
|
283
|
+
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (M.current = !0), J((t) => t.map((t) => t.id === e ? {
|
|
276
284
|
...t,
|
|
277
285
|
...i
|
|
278
|
-
} : t), { validate:
|
|
279
|
-
}, [J,
|
|
286
|
+
} : t), { validate: A });
|
|
287
|
+
}, [J, A]), bn = d((e, t) => {
|
|
280
288
|
J((n) => n.map((n) => n.id === e ? {
|
|
281
289
|
...n,
|
|
282
|
-
...
|
|
290
|
+
...ie({
|
|
283
291
|
product: t,
|
|
284
|
-
currency:
|
|
285
|
-
unitNamesById:
|
|
292
|
+
currency: w.currency,
|
|
293
|
+
unitNamesById: k
|
|
286
294
|
})
|
|
287
295
|
} : n), { validate: !0 });
|
|
288
296
|
}, [
|
|
289
297
|
J,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
]),
|
|
298
|
+
k,
|
|
299
|
+
w.currency
|
|
300
|
+
]), xn = d((e, t) => {
|
|
293
301
|
t && J((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
|
|
294
302
|
...n,
|
|
295
303
|
...t.patch
|
|
296
304
|
} : n), { validate: !0 });
|
|
297
|
-
}, [J]),
|
|
298
|
-
let n =
|
|
299
|
-
n &&
|
|
305
|
+
}, [J]), Sn = d((e, t) => {
|
|
306
|
+
let n = w.lineItems.find((t) => t.id === e);
|
|
307
|
+
n && xn(e, s({
|
|
300
308
|
lineItem: n,
|
|
301
309
|
field: t,
|
|
302
|
-
rowCount:
|
|
303
|
-
currency:
|
|
310
|
+
rowCount: w.lineItems.length,
|
|
311
|
+
currency: w.currency
|
|
304
312
|
}));
|
|
305
313
|
}, [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
]),
|
|
310
|
-
let n =
|
|
311
|
-
n &&
|
|
314
|
+
xn,
|
|
315
|
+
w.currency,
|
|
316
|
+
w.lineItems
|
|
317
|
+
]), Cn = d((e, t) => {
|
|
318
|
+
let n = w.lineItems.find((t) => t.id === e);
|
|
319
|
+
n && xn(e, le({
|
|
312
320
|
lineItem: n,
|
|
313
321
|
step: t,
|
|
314
|
-
rowCount:
|
|
322
|
+
rowCount: w.lineItems.length
|
|
315
323
|
}));
|
|
316
|
-
}, [
|
|
317
|
-
let e =
|
|
318
|
-
|
|
324
|
+
}, [xn, w.lineItems]), wn = d(() => {
|
|
325
|
+
let e = ne(w.currency);
|
|
326
|
+
jt(e.id), T((t) => ({
|
|
319
327
|
...t,
|
|
320
328
|
lineItems: [...t.lineItems, e]
|
|
321
329
|
}));
|
|
322
|
-
}, [
|
|
330
|
+
}, [w.currency]), Tn = d((e) => {
|
|
323
331
|
J((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
|
|
324
|
-
}, [J]), Y =
|
|
325
|
-
...
|
|
332
|
+
}, [J]), Y = d((e, t) => e.type === "invoice" && (t === "issue" || we(e) && U === 0), [U]), En = d((e, t) => ({
|
|
333
|
+
...Ve({
|
|
326
334
|
values: e,
|
|
327
|
-
billingAddressId:
|
|
328
|
-
messages:
|
|
335
|
+
billingAddressId: F,
|
|
336
|
+
messages: l,
|
|
329
337
|
willIssue: t,
|
|
330
338
|
hasStartedRecurrence: U > 0
|
|
331
339
|
}),
|
|
332
|
-
...e.type === "invoice" &&
|
|
340
|
+
...e.type === "invoice" && u(e) ? Ce({
|
|
333
341
|
fields: e,
|
|
334
342
|
issuedCount: U,
|
|
335
|
-
messages:
|
|
343
|
+
messages: l
|
|
336
344
|
}) : {}
|
|
337
345
|
}), [
|
|
338
|
-
|
|
346
|
+
F,
|
|
339
347
|
U,
|
|
340
|
-
|
|
341
|
-
]),
|
|
348
|
+
l
|
|
349
|
+
]), Dn = d(() => {
|
|
342
350
|
requestAnimationFrame(() => {
|
|
343
|
-
let e =
|
|
351
|
+
let e = yt.current, t = e?.querySelector("[aria-invalid=\"true\"], [data-invalid=\"true\"]");
|
|
344
352
|
if (!e || !t) return;
|
|
345
353
|
let n = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop;
|
|
346
354
|
e.scrollTo({
|
|
@@ -348,37 +356,37 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
|
|
|
348
356
|
behavior: "smooth"
|
|
349
357
|
});
|
|
350
358
|
});
|
|
351
|
-
}, []), X =
|
|
352
|
-
|
|
359
|
+
}, []), X = d((e, t) => {
|
|
360
|
+
E(e), Mt(!0), _.current = t, N.current = {
|
|
353
361
|
lines: !0,
|
|
354
362
|
discount: !0
|
|
355
|
-
},
|
|
356
|
-
}, [
|
|
357
|
-
|
|
358
|
-
if (!
|
|
359
|
-
|
|
360
|
-
let e = Y(
|
|
361
|
-
X(
|
|
363
|
+
}, Dn();
|
|
364
|
+
}, [Dn]), On = !wt || w.frequency !== "once" || $t.isError;
|
|
365
|
+
f(() => {
|
|
366
|
+
if (!x || !v.current || I || W || !On) return;
|
|
367
|
+
v.current = !1;
|
|
368
|
+
let e = Y(w, "issue");
|
|
369
|
+
X(En(w, e), e);
|
|
362
370
|
}, [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
371
|
+
I,
|
|
372
|
+
x,
|
|
373
|
+
On,
|
|
366
374
|
W,
|
|
367
375
|
X,
|
|
368
|
-
|
|
369
|
-
|
|
376
|
+
En,
|
|
377
|
+
w,
|
|
370
378
|
Y
|
|
371
379
|
]);
|
|
372
|
-
let
|
|
373
|
-
values:
|
|
374
|
-
billingAddressId:
|
|
380
|
+
let kn = m({
|
|
381
|
+
values: w,
|
|
382
|
+
billingAddressId: F
|
|
375
383
|
});
|
|
376
|
-
|
|
377
|
-
let e =
|
|
378
|
-
if (
|
|
379
|
-
values:
|
|
380
|
-
billingAddressId:
|
|
381
|
-
}, !
|
|
384
|
+
f(() => {
|
|
385
|
+
let e = kn.current;
|
|
386
|
+
if (kn.current = {
|
|
387
|
+
values: w,
|
|
388
|
+
billingAddressId: F
|
|
389
|
+
}, !A) return;
|
|
382
390
|
let t = [
|
|
383
391
|
"customerId",
|
|
384
392
|
"paymentTermsId",
|
|
@@ -386,261 +394,265 @@ function _({ messages: _, counterpartMessageLabels: it, embeddedBankName: at, on
|
|
|
386
394
|
"openingNote",
|
|
387
395
|
"closingNote",
|
|
388
396
|
"taxRate"
|
|
389
|
-
].filter((t) => e.values[t] !==
|
|
397
|
+
].filter((t) => e.values[t] !== w[t] || t === "customerId" && e.billingAddressId !== F || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== w.paymentTermsCustomDate);
|
|
390
398
|
if (!t.length) return;
|
|
391
|
-
let n =
|
|
392
|
-
values:
|
|
393
|
-
billingAddressId:
|
|
394
|
-
messages:
|
|
395
|
-
willIssue:
|
|
399
|
+
let n = Ve({
|
|
400
|
+
values: w,
|
|
401
|
+
billingAddressId: F,
|
|
402
|
+
messages: l,
|
|
403
|
+
willIssue: _.current
|
|
396
404
|
});
|
|
397
|
-
|
|
405
|
+
E((e) => {
|
|
398
406
|
let r = { ...e };
|
|
399
407
|
return t.forEach((e) => {
|
|
400
408
|
n[e] ? r[e] = n[e] : delete r[e];
|
|
401
409
|
}), r;
|
|
402
410
|
});
|
|
403
411
|
}, [
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
412
|
+
F,
|
|
413
|
+
l,
|
|
414
|
+
A,
|
|
415
|
+
w
|
|
408
416
|
]);
|
|
409
|
-
let
|
|
410
|
-
if (
|
|
411
|
-
if (
|
|
412
|
-
e.error(
|
|
417
|
+
let An = d(async (t) => {
|
|
418
|
+
if (g.current = t, W) return;
|
|
419
|
+
if (pn) {
|
|
420
|
+
e.error(l.attachmentsUploading);
|
|
413
421
|
return;
|
|
414
422
|
}
|
|
415
|
-
if (
|
|
416
|
-
e.error(
|
|
423
|
+
if (D.isLoading || I) {
|
|
424
|
+
e.error(l.lineItemsLoading);
|
|
417
425
|
return;
|
|
418
426
|
}
|
|
419
|
-
let n =
|
|
420
|
-
...
|
|
427
|
+
let n = ue(w.lineItems), i = n.length === w.lineItems.length ? w : {
|
|
428
|
+
...w,
|
|
421
429
|
lineItems: n
|
|
422
430
|
};
|
|
423
|
-
i !==
|
|
424
|
-
let a = i.type === "invoice" &&
|
|
425
|
-
if (o && (
|
|
426
|
-
e.error(
|
|
431
|
+
i !== w && T(i);
|
|
432
|
+
let a = i.type === "invoice" && u(i), o = Y(i, t);
|
|
433
|
+
if (o && (Ht || V.isLoading)) {
|
|
434
|
+
e.error(l.issueChecksLoading);
|
|
427
435
|
return;
|
|
428
436
|
}
|
|
429
437
|
if (o && !V.canAddAccount && !i.bankAccountId && !V.hasAccounts) {
|
|
430
|
-
e.error(
|
|
438
|
+
e.error(l.issueBankAccountUnavailable);
|
|
431
439
|
return;
|
|
432
440
|
}
|
|
433
|
-
let
|
|
434
|
-
if (
|
|
435
|
-
X(
|
|
441
|
+
let ee = En(i, o);
|
|
442
|
+
if (Pe(ee)) {
|
|
443
|
+
X(ee, o);
|
|
436
444
|
return;
|
|
437
445
|
}
|
|
438
|
-
if (
|
|
439
|
-
e.error(
|
|
446
|
+
if (E({}), o && L.isTaxIdMissing) {
|
|
447
|
+
e.error(l.issueTaxIdRequired);
|
|
440
448
|
return;
|
|
441
449
|
}
|
|
442
450
|
if (o && (i.paymentReminderId || i.overdueReminderId)) {
|
|
443
|
-
let t =
|
|
451
|
+
let t = He(L.counterpart, l);
|
|
444
452
|
if (t) {
|
|
445
453
|
e.error(t);
|
|
446
454
|
return;
|
|
447
455
|
}
|
|
448
456
|
}
|
|
449
|
-
let
|
|
457
|
+
let s = C === "edit" ? St : y.current, c, te, ne = {};
|
|
450
458
|
try {
|
|
451
|
-
if (
|
|
452
|
-
let e =
|
|
459
|
+
if (s) {
|
|
460
|
+
let e = Ie({
|
|
453
461
|
values: i,
|
|
454
|
-
originalLineItems:
|
|
455
|
-
originalCurrency:
|
|
456
|
-
unitNamesById:
|
|
457
|
-
units:
|
|
462
|
+
originalLineItems: b.current,
|
|
463
|
+
originalCurrency: bt.current,
|
|
464
|
+
unitNamesById: k,
|
|
465
|
+
units: O
|
|
458
466
|
});
|
|
459
|
-
|
|
467
|
+
ne = Be({
|
|
460
468
|
values: i,
|
|
461
|
-
originalLineItems:
|
|
469
|
+
originalLineItems: b.current,
|
|
462
470
|
changes: e
|
|
463
471
|
});
|
|
464
|
-
let t = await
|
|
465
|
-
path: { receivable_id:
|
|
466
|
-
body:
|
|
472
|
+
let t = await ft.mutateAsync({
|
|
473
|
+
path: { receivable_id: s },
|
|
474
|
+
body: Le({
|
|
467
475
|
values: i,
|
|
468
|
-
billingAddressId:
|
|
476
|
+
billingAddressId: F,
|
|
477
|
+
shippingAddressId: Vt,
|
|
469
478
|
lineItemChanges: e
|
|
470
479
|
})
|
|
471
480
|
});
|
|
472
|
-
|
|
481
|
+
Wt(), c = s, te = t?.type ?? i.type, a && t && (b.current = t.line_items, bt.current = t.currency, i = {
|
|
473
482
|
...i,
|
|
474
|
-
lineItems:
|
|
475
|
-
},
|
|
483
|
+
lineItems: ae(i.lineItems, t.line_items)
|
|
484
|
+
}, T(i));
|
|
476
485
|
} else {
|
|
477
|
-
|
|
478
|
-
let e = await
|
|
486
|
+
ne = Be({ values: i });
|
|
487
|
+
let e = await dt.mutateAsync({ body: Fe({
|
|
479
488
|
values: i,
|
|
480
|
-
billingAddressId:
|
|
481
|
-
|
|
489
|
+
billingAddressId: F,
|
|
490
|
+
shippingAddressId: Vt,
|
|
491
|
+
unitNamesById: k
|
|
482
492
|
}) });
|
|
483
493
|
if (!e?.id) {
|
|
484
|
-
|
|
494
|
+
S(!1), un();
|
|
485
495
|
return;
|
|
486
496
|
}
|
|
487
|
-
|
|
497
|
+
c = e.id, te = e.type, a && (y.current = e.id, b.current = e.line_items, bt.current = e.currency, i = {
|
|
488
498
|
...i,
|
|
489
|
-
lineItems:
|
|
490
|
-
},
|
|
499
|
+
lineItems: ae(i.lineItems, e.line_items)
|
|
500
|
+
}, T(i));
|
|
491
501
|
}
|
|
492
502
|
} catch (t) {
|
|
493
|
-
let n =
|
|
503
|
+
let n = Ze[i.type], r = $e(t, {
|
|
494
504
|
irrelevantVariants: n,
|
|
495
|
-
messages:
|
|
505
|
+
messages: l
|
|
496
506
|
});
|
|
497
|
-
e.error((
|
|
498
|
-
let { errors: a, listError:
|
|
507
|
+
e.error((s ? l.updateFailed : l.createFailed).replace("{errorMessage}", r));
|
|
508
|
+
let { errors: a, listError: ee } = Qe(et(t, n), ne), c = de(a.lineItems, void 0, ee);
|
|
499
509
|
X({
|
|
500
510
|
...a,
|
|
501
|
-
...
|
|
511
|
+
...c ? { lineItemsSummary: c } : {}
|
|
502
512
|
}, o);
|
|
503
513
|
return;
|
|
504
514
|
}
|
|
505
|
-
let
|
|
515
|
+
let re = a ? "recurrence" : "draft";
|
|
506
516
|
if (a) try {
|
|
507
|
-
H ? await
|
|
517
|
+
H ? await mt.mutateAsync({
|
|
508
518
|
path: { recurrence_id: H.id },
|
|
509
|
-
body:
|
|
510
|
-
}) : await
|
|
519
|
+
body: be(i, { lockSchedule: en })
|
|
520
|
+
}) : await pt.mutateAsync({ body: ye(i, c) });
|
|
511
521
|
} catch (t) {
|
|
512
|
-
e.error(
|
|
522
|
+
e.error($e(t, { messages: l }));
|
|
513
523
|
return;
|
|
514
524
|
}
|
|
515
525
|
else if (o) try {
|
|
516
|
-
await
|
|
526
|
+
await ht.mutateAsync({ path: { receivable_id: c } }), re = "issue";
|
|
517
527
|
} catch {
|
|
518
|
-
e.error(
|
|
528
|
+
e.error(l.issueFailedAfterSave);
|
|
519
529
|
}
|
|
520
|
-
let
|
|
521
|
-
|
|
522
|
-
mode:
|
|
530
|
+
let ie = C === "create";
|
|
531
|
+
S(!1), un(), ie && ut?.(c, te, {
|
|
532
|
+
mode: re,
|
|
523
533
|
counterpartId: i.customerId,
|
|
524
|
-
inlineItems:
|
|
525
|
-
hasCustomerEmail: !!(
|
|
534
|
+
inlineItems: ve(i.lineItems, i.currency),
|
|
535
|
+
hasCustomerEmail: !!(L.counterpart && r(L.counterpart).trim())
|
|
526
536
|
});
|
|
527
537
|
}, [
|
|
528
538
|
V.canAddAccount,
|
|
529
539
|
V.hasAccounts,
|
|
530
540
|
V.isLoading,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
st,
|
|
534
|
-
lt,
|
|
535
|
-
vt,
|
|
536
|
-
H,
|
|
537
|
-
cn,
|
|
538
|
-
It,
|
|
541
|
+
F,
|
|
542
|
+
Wt,
|
|
539
543
|
dt,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
pt,
|
|
545
|
+
St,
|
|
546
|
+
H,
|
|
547
|
+
I,
|
|
548
|
+
pn,
|
|
549
|
+
Ht,
|
|
550
|
+
ht,
|
|
551
|
+
en,
|
|
552
|
+
l,
|
|
553
|
+
C,
|
|
554
|
+
ut,
|
|
555
|
+
L.counterpart,
|
|
556
|
+
L.isTaxIdMissing,
|
|
546
557
|
W,
|
|
547
|
-
|
|
558
|
+
un,
|
|
559
|
+
Vt,
|
|
548
560
|
X,
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
561
|
+
O,
|
|
562
|
+
k,
|
|
563
|
+
D.isLoading,
|
|
564
|
+
ft,
|
|
565
|
+
mt,
|
|
566
|
+
En,
|
|
567
|
+
w,
|
|
556
568
|
Y
|
|
557
|
-
]), Z =
|
|
558
|
-
if (!
|
|
559
|
-
|
|
569
|
+
]), Z = d(async (e = g.current) => {
|
|
570
|
+
if (!gt.current) {
|
|
571
|
+
gt.current = !0, vt(e);
|
|
560
572
|
try {
|
|
561
|
-
await
|
|
573
|
+
await An(e);
|
|
562
574
|
} finally {
|
|
563
|
-
|
|
575
|
+
gt.current = !1, vt(void 0);
|
|
564
576
|
}
|
|
565
577
|
}
|
|
566
|
-
}, [
|
|
567
|
-
...
|
|
568
|
-
discount:
|
|
569
|
-
lineItems:
|
|
570
|
-
}), [
|
|
571
|
-
|
|
572
|
-
}, []),
|
|
573
|
-
|
|
574
|
-
}, [$]),
|
|
575
|
-
values:
|
|
576
|
-
totals:
|
|
577
|
-
billingAddress:
|
|
578
|
-
unitNamesById:
|
|
579
|
-
messages:
|
|
580
|
-
enabled:
|
|
578
|
+
}, [An]), jn = p(() => ({
|
|
579
|
+
...w,
|
|
580
|
+
discount: Pt ? w.discount : Ee(De(w.discount, w.discountType, w.currency), w.discountType, w.currency),
|
|
581
|
+
lineItems: w.lineItems.map(fe)
|
|
582
|
+
}), [Pt, w]), Mn = p(() => ee(w.lineItems), [w.lineItems]), Nn = p(() => Ae(w), [w]), Q = w.type === "invoice", Pn = Q && u(w), Fn = q || D.isLoading || I || R.isUploading || W, In = C === "edit" ? l.updateDraftButton : l.saveDraftButton, Ln = Pn ? H ? l.recurrenceUpdateButton : l.recurrenceActivateButton : Q ? l.issueButton : In, $ = Q && !Pn ? "issue" : "draft", Rn = d(() => Z("draft"), [Z]), zn = d(() => Z($), [$, Z]), Bn = d(() => Z(), [Z]), Vn = d(() => {
|
|
583
|
+
g.current = "draft";
|
|
584
|
+
}, []), Hn = d(() => {
|
|
585
|
+
g.current = $;
|
|
586
|
+
}, [$]), Un = p(() => ke(Nn, w.currency), [Nn, w.currency]), Wn = ot({
|
|
587
|
+
values: w,
|
|
588
|
+
totals: Nn,
|
|
589
|
+
billingAddress: Bt,
|
|
590
|
+
unitNamesById: k,
|
|
591
|
+
messages: l,
|
|
592
|
+
enabled: x
|
|
581
593
|
});
|
|
582
594
|
return {
|
|
583
|
-
open:
|
|
584
|
-
setOpen:
|
|
585
|
-
mode:
|
|
586
|
-
values:
|
|
587
|
-
sheetValues:
|
|
588
|
-
errors:
|
|
589
|
-
setValues:
|
|
590
|
-
updateValues:
|
|
591
|
-
commitTaxRate:
|
|
592
|
-
focusDiscount:
|
|
593
|
-
commitDiscount:
|
|
594
|
-
updateLineItem:
|
|
595
|
-
selectProduct:
|
|
596
|
-
commitLineItem:
|
|
597
|
-
stepLineItem:
|
|
598
|
-
addLineItem:
|
|
599
|
-
removeLineItem:
|
|
600
|
-
attachmentsView:
|
|
601
|
-
attachmentsUploading:
|
|
602
|
-
draftButtonLabel: Q && !
|
|
603
|
-
draftDisabled:
|
|
604
|
-
draftLoading: q &&
|
|
605
|
-
primaryButtonLabel:
|
|
606
|
-
primaryLoading: q &&
|
|
607
|
-
primaryDisabled:
|
|
608
|
-
scrollContainerRef:
|
|
609
|
-
selectAttachmentFiles:
|
|
610
|
-
setAttachmentIncludeInEmail:
|
|
611
|
-
removeAttachment:
|
|
612
|
-
autoFocusLineItemId:
|
|
613
|
-
lineItemUnitOptions:
|
|
614
|
-
lineItemsLoading:
|
|
615
|
-
lineItemControls:
|
|
616
|
-
totals:
|
|
617
|
-
preview:
|
|
618
|
-
totalsView:
|
|
619
|
-
currencySymbol:
|
|
595
|
+
open: x,
|
|
596
|
+
setOpen: S,
|
|
597
|
+
mode: C,
|
|
598
|
+
values: w,
|
|
599
|
+
sheetValues: jn,
|
|
600
|
+
errors: Et,
|
|
601
|
+
setValues: T,
|
|
602
|
+
updateValues: hn,
|
|
603
|
+
commitTaxRate: vn,
|
|
604
|
+
focusDiscount: gn,
|
|
605
|
+
commitDiscount: _n,
|
|
606
|
+
updateLineItem: yn,
|
|
607
|
+
selectProduct: bn,
|
|
608
|
+
commitLineItem: Sn,
|
|
609
|
+
stepLineItem: Cn,
|
|
610
|
+
addLineItem: wn,
|
|
611
|
+
removeLineItem: Tn,
|
|
612
|
+
attachmentsView: Gt,
|
|
613
|
+
attachmentsUploading: R.isUploading,
|
|
614
|
+
draftButtonLabel: Q && !Pn ? In : void 0,
|
|
615
|
+
draftDisabled: Fn,
|
|
616
|
+
draftLoading: q && _t === "draft",
|
|
617
|
+
primaryButtonLabel: Ln,
|
|
618
|
+
primaryLoading: q && _t === $,
|
|
619
|
+
primaryDisabled: Fn || V.isLoading && Y(w, $) || Q && (Ht || !Pn && L.isCounterpartLoading),
|
|
620
|
+
scrollContainerRef: yt,
|
|
621
|
+
selectAttachmentFiles: R.selectFiles,
|
|
622
|
+
setAttachmentIncludeInEmail: R.setIncludeInEmail,
|
|
623
|
+
removeAttachment: R.remove,
|
|
624
|
+
autoFocusLineItemId: At,
|
|
625
|
+
lineItemUnitOptions: kt.unitOptions,
|
|
626
|
+
lineItemsLoading: D.isLoading,
|
|
627
|
+
lineItemControls: Mn,
|
|
628
|
+
totals: Nn,
|
|
629
|
+
preview: Wn,
|
|
630
|
+
totalsView: Un,
|
|
631
|
+
currencySymbol: re(w.currency),
|
|
620
632
|
isSubmitting: q,
|
|
621
|
-
currencyOptions:
|
|
622
|
-
paymentTerms:
|
|
623
|
-
showBillingSection:
|
|
624
|
-
recurrence:
|
|
625
|
-
showRecurrenceSection:
|
|
633
|
+
currencyOptions: he(w.currency),
|
|
634
|
+
paymentTerms: Yt,
|
|
635
|
+
showBillingSection: w.type === "invoice" || C === "edit",
|
|
636
|
+
recurrence: on,
|
|
637
|
+
showRecurrenceSection: w.type === "invoice",
|
|
626
638
|
recurrenceLoading: W,
|
|
627
|
-
showDueDateField:
|
|
628
|
-
openCreate:
|
|
629
|
-
openEdit:
|
|
630
|
-
close:
|
|
631
|
-
submit:
|
|
632
|
-
submitDraft:
|
|
633
|
-
submitPrimary:
|
|
634
|
-
selectDraftMode:
|
|
635
|
-
selectPrimaryMode:
|
|
636
|
-
units:
|
|
637
|
-
counterpartView:
|
|
638
|
-
counterpartForm:
|
|
639
|
-
stateOptions:
|
|
640
|
-
openCounterpartCreate:
|
|
639
|
+
showDueDateField: w.type === "quote",
|
|
640
|
+
openCreate: dn,
|
|
641
|
+
openEdit: fn,
|
|
642
|
+
close: mn,
|
|
643
|
+
submit: Bn,
|
|
644
|
+
submitDraft: Rn,
|
|
645
|
+
submitPrimary: zn,
|
|
646
|
+
selectDraftMode: Vn,
|
|
647
|
+
selectPrimaryMode: Hn,
|
|
648
|
+
units: kt,
|
|
649
|
+
counterpartView: Dt,
|
|
650
|
+
counterpartForm: qt,
|
|
651
|
+
stateOptions: Ft,
|
|
652
|
+
openCounterpartCreate: qt.openCreate,
|
|
641
653
|
bankAccount: V,
|
|
642
|
-
reminders:
|
|
654
|
+
reminders: cn
|
|
643
655
|
};
|
|
644
656
|
}
|
|
645
657
|
//#endregion
|
|
646
|
-
export {
|
|
658
|
+
export { ct as useReceivableForm };
|