@unimaze/billing 0.21.33 → 0.21.35
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/lib/common/components/attachments/AttachmentModal.d.ts +1 -0
- package/lib/common/components/attachments/AttachmentModal.js +1 -2
- package/lib/common/components/attachments/index.js +89 -20
- package/lib/common/components/billing-lines/NewBillingLines.js +13 -3
- package/lib/common/components/billing-lines/SingleBillingLine.d.ts +2 -0
- package/lib/common/components/billing-lines/SingleBillingLine.js +25 -17
- package/lib/utils/BillingLineUtility.d.ts +0 -1
- package/lib/utils/BillingLineUtility.js +1 -13
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ interface AttachmentModalProps extends WrappedComponentProps {
|
|
|
12
12
|
formInstance: FormInstance;
|
|
13
13
|
onRemove: (file: UploadFile) => void;
|
|
14
14
|
onSave: () => void;
|
|
15
|
+
onCancel: () => void;
|
|
15
16
|
}
|
|
16
17
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<AttachmentModalProps, "intl"> & {
|
|
17
18
|
forwardedRef?: React.Ref<any>;
|
|
@@ -182,7 +182,7 @@ var AttachmentModal = function (props) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
|
-
return (React.createElement(antd_1.Modal, { open: props.isModalOpen, onCancel:
|
|
185
|
+
return (React.createElement(antd_1.Modal, { open: props.isModalOpen, onCancel: props.onCancel, title: props.intl.formatMessage(translationMessages.attachment_title), footer: React.createElement(antd_1.Button, { disabled: isSaveAttachmentsDisabled, icon: React.createElement(icons_1.CheckCircleOutlined, null), type: "primary", style: { width: "100%" }, size: "large", onClick: function () {
|
|
186
186
|
props.onSave();
|
|
187
187
|
props.setIsModalOpen(false);
|
|
188
188
|
} }, props.intl.formatMessage(translationMessages.attachment_saveButton_title)) },
|
|
@@ -202,7 +202,6 @@ var AttachmentModal = function (props) {
|
|
|
202
202
|
React.createElement(lib_1.Form.Item, { name: ["attachments", "file".concat(index + 1), "file"], initialValue: attachment.file, hidden: true }),
|
|
203
203
|
attachment.file.status === "uploading" ? (React.createElement(icons_1.LoadingOutlined, null)) : (React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
204
204
|
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
205
|
-
props.formInstance.setFieldValue(["attachments", "file".concat(index + 1), "description"], "");
|
|
206
205
|
props.onRemove(attachment.file);
|
|
207
206
|
} })))),
|
|
208
207
|
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { rules: [
|
|
@@ -69,6 +69,8 @@ var icons_1 = require("@ant-design/icons");
|
|
|
69
69
|
var AttachmentModal_1 = __importDefault(require("./AttachmentModal"));
|
|
70
70
|
var react_use_1 = require("react-use");
|
|
71
71
|
var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
|
|
72
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
73
|
+
var react_1 = require("react");
|
|
72
74
|
var translationMessages = (0, react_intl_1.defineMessages)({
|
|
73
75
|
attachment_title: {
|
|
74
76
|
id: "attachment_title",
|
|
@@ -86,13 +88,14 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
86
88
|
var AttachmentsGroup = function (props) {
|
|
87
89
|
var _a = React.useState(false), isModalOpen = _a[0], setIsModalOpen = _a[1];
|
|
88
90
|
var _b = React.useState([]), attachments = _b[0], setAttachments = _b[1];
|
|
89
|
-
var _c =
|
|
90
|
-
var _d = React.useState(false),
|
|
91
|
-
var _e = React.useState(
|
|
92
|
-
var _f = React.useState(
|
|
93
|
-
var _g = React.useState(""),
|
|
91
|
+
var _c = (0, react_1.useState)([]), tempAttachments = _c[0], setTempAttachments = _c[1];
|
|
92
|
+
var _d = React.useState(false), displayAttachments = _d[0], setDisplayAttachments = _d[1];
|
|
93
|
+
var _e = React.useState(false), previewOpen = _e[0], setPreviewOpen = _e[1];
|
|
94
|
+
var _f = React.useState(undefined), previewImage = _f[0], setPreviewImage = _f[1];
|
|
95
|
+
var _g = React.useState(""), previewDescription = _g[0], setPreviewDescription = _g[1];
|
|
96
|
+
var _h = React.useState(""), previewPDFUrl = _h[0], setPreviewPDFUrl = _h[1];
|
|
94
97
|
var width = (0, react_use_1.useWindowSize)().width;
|
|
95
|
-
var
|
|
98
|
+
var _j = React.useState(false), isMobile = _j[0], setIsMobile = _j[1];
|
|
96
99
|
var token = antd_1.theme.useToken().token;
|
|
97
100
|
React.useEffect(function () {
|
|
98
101
|
if (width < 768) {
|
|
@@ -104,9 +107,12 @@ var AttachmentsGroup = function (props) {
|
|
|
104
107
|
}, [width]);
|
|
105
108
|
var removeFile = function (file) {
|
|
106
109
|
var updatedAttachments = attachments.filter(function (attachment) { return attachment.file.uid !== file.uid; });
|
|
110
|
+
setTempAttachments(updatedAttachments);
|
|
107
111
|
setAttachments(updatedAttachments);
|
|
112
|
+
clearFileFields(file);
|
|
108
113
|
};
|
|
109
114
|
var clearFileFields = function (file) {
|
|
115
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
110
116
|
var fileIndex = attachments.findIndex(function (attachment) { return attachment.file.uid === file.uid; });
|
|
111
117
|
if (fileIndex === -1)
|
|
112
118
|
return;
|
|
@@ -169,10 +175,75 @@ var AttachmentsGroup = function (props) {
|
|
|
169
175
|
setPreviewDescription("");
|
|
170
176
|
setPreviewOpen(false);
|
|
171
177
|
};
|
|
178
|
+
var clearAttachmentsInForm = function () {
|
|
179
|
+
props.formInstance.setFields([
|
|
180
|
+
{
|
|
181
|
+
name: ["attachments", "file".concat(1), "file"],
|
|
182
|
+
value: undefined,
|
|
183
|
+
},
|
|
184
|
+
]);
|
|
185
|
+
props.formInstance.setFields([
|
|
186
|
+
{
|
|
187
|
+
name: ["attachments", "file".concat(1), "description"],
|
|
188
|
+
value: undefined,
|
|
189
|
+
},
|
|
190
|
+
]);
|
|
191
|
+
props.formInstance.setFields([
|
|
192
|
+
{
|
|
193
|
+
name: ["attachments", "file".concat(2), "file"],
|
|
194
|
+
value: undefined,
|
|
195
|
+
},
|
|
196
|
+
]);
|
|
197
|
+
props.formInstance.setFields([
|
|
198
|
+
{
|
|
199
|
+
name: ["attachments", "file".concat(2), "description"],
|
|
200
|
+
value: undefined,
|
|
201
|
+
},
|
|
202
|
+
]);
|
|
203
|
+
props.formInstance.setFields([
|
|
204
|
+
{
|
|
205
|
+
name: ["attachments", "file".concat(3), "file"],
|
|
206
|
+
value: undefined,
|
|
207
|
+
},
|
|
208
|
+
]);
|
|
209
|
+
props.formInstance.setFields([
|
|
210
|
+
{
|
|
211
|
+
name: ["attachments", "file".concat(3), "description"],
|
|
212
|
+
value: undefined,
|
|
213
|
+
},
|
|
214
|
+
]);
|
|
215
|
+
};
|
|
216
|
+
var updateFormState = function (attachmentsForForm) {
|
|
217
|
+
clearAttachmentsInForm();
|
|
218
|
+
attachmentsForForm.forEach(function (at, index) {
|
|
219
|
+
props.formInstance.setFields([
|
|
220
|
+
{
|
|
221
|
+
name: ["attachments", "file".concat(index + 1), "file"],
|
|
222
|
+
value: at.file,
|
|
223
|
+
},
|
|
224
|
+
]);
|
|
225
|
+
props.formInstance.setFields([
|
|
226
|
+
{
|
|
227
|
+
name: ["attachments", "file".concat(index + 1), "description"],
|
|
228
|
+
value: at.description,
|
|
229
|
+
},
|
|
230
|
+
]);
|
|
231
|
+
});
|
|
232
|
+
};
|
|
172
233
|
var saveFiles = function () {
|
|
234
|
+
var clonedAttachments = lodash_1.default.cloneDeep(tempAttachments);
|
|
235
|
+
var filteredAttachments = clonedAttachments.filter(function (at) { return at.description; });
|
|
236
|
+
setAttachments(filteredAttachments);
|
|
237
|
+
updateFormState(filteredAttachments);
|
|
238
|
+
setTempAttachments(filteredAttachments);
|
|
173
239
|
setDisplayAttachments(true);
|
|
174
240
|
setIsModalOpen(false);
|
|
175
241
|
};
|
|
242
|
+
var onModalCancel = function () {
|
|
243
|
+
setTempAttachments(attachments);
|
|
244
|
+
updateFormState(attachments);
|
|
245
|
+
setIsModalOpen(false);
|
|
246
|
+
};
|
|
176
247
|
return (React.createElement(antd_1.Flex, { style: {
|
|
177
248
|
backgroundColor: token.colorInfoBg,
|
|
178
249
|
margin: isMobile ? "0 -20px" : 0,
|
|
@@ -191,20 +262,18 @@ var AttachmentsGroup = function (props) {
|
|
|
191
262
|
React.createElement(antd_1.Flex, { vertical: true },
|
|
192
263
|
React.createElement(antd_1.Typography.Text, { disabled: true }, props.intl.formatMessage(translationMessages.attachment_title))),
|
|
193
264
|
React.createElement(antd_1.Divider, { style: { padding: 0, margin: 0 } }),
|
|
194
|
-
attachments.map(function (attachment) { return (React.createElement(
|
|
195
|
-
React.createElement(antd_1.
|
|
196
|
-
React.createElement(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
React.createElement(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
} }))))); }))),
|
|
207
|
-
React.createElement(AttachmentModal_1.default, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, attachments: attachments, setAttachments: setAttachments, uploadSizeLimit: props.uploadSizeLimit, formInstance: props.formInstance, onRemove: removeFile, onSave: saveFiles }),
|
|
265
|
+
attachments.map(function (attachment) { return (React.createElement(antd_1.Flex, { gap: "middle", justify: "space-between" },
|
|
266
|
+
React.createElement(antd_1.Button, { type: "link", onClick: function () { return handlePreview(attachment.file, attachment.description); }, style: { padding: 0 }, size: "small" },
|
|
267
|
+
React.createElement(icons_1.PaperClipOutlined, { style: { fontSize: token.fontSizeIcon } }),
|
|
268
|
+
attachment.file.name),
|
|
269
|
+
React.createElement(antd_1.Flex, { gap: "middle" },
|
|
270
|
+
React.createElement(icons_1.EditOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
|
|
271
|
+
setIsModalOpen(true);
|
|
272
|
+
} }),
|
|
273
|
+
React.createElement(icons_1.DeleteOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
|
|
274
|
+
removeFile(attachment.file);
|
|
275
|
+
} })))); }))),
|
|
276
|
+
React.createElement(AttachmentModal_1.default, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, attachments: tempAttachments, setAttachments: setTempAttachments, uploadSizeLimit: props.uploadSizeLimit, formInstance: props.formInstance, onRemove: removeFile, onSave: saveFiles, onCancel: onModalCancel }),
|
|
208
277
|
React.createElement(antd_1.Modal, { open: previewOpen, onCancel: handleClosePreview, footer: null },
|
|
209
278
|
previewPDFUrl && (React.createElement("iframe", { src: previewPDFUrl, style: { width: "100%", height: "700px", maxHeight: "75vh" } })),
|
|
210
279
|
previewImage && React.createElement(antd_1.Image, { src: previewImage, preview: false }),
|
|
@@ -41,6 +41,7 @@ var react_intl_1 = require("react-intl");
|
|
|
41
41
|
var antd_1 = require("antd");
|
|
42
42
|
var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
|
|
43
43
|
var SingleBillingLine_1 = __importDefault(require("./SingleBillingLine"));
|
|
44
|
+
var enums_1 = require("../../../enums");
|
|
44
45
|
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
45
46
|
billingLines_labels_addButton: {
|
|
46
47
|
id: "billingLines_labels_addButton",
|
|
@@ -173,11 +174,12 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
173
174
|
});
|
|
174
175
|
var BillingLines = function (props) {
|
|
175
176
|
var invoiceLinesForm = antd_1.Form.useForm()[0];
|
|
176
|
-
var _a = (0,
|
|
177
|
+
var _a = react_1.default.useState(), taxCatType = _a[0], setTaxCatType = _a[1];
|
|
178
|
+
var _b = (0, react_1.useState)({
|
|
177
179
|
invoice: {
|
|
178
180
|
invoiceLines: [{}],
|
|
179
181
|
}
|
|
180
|
-
}), formData =
|
|
182
|
+
}), formData = _b[0], setFormData = _b[1];
|
|
181
183
|
(0, react_1.useEffect)(function () {
|
|
182
184
|
if (!props.formInstance.getFieldValue(["invoice", "currencyCode"])) {
|
|
183
185
|
props.formInstance.setFieldsValue({
|
|
@@ -235,11 +237,19 @@ var BillingLines = function (props) {
|
|
|
235
237
|
var updatedList = lines.filter(function (_, index) { return index !== indexToRemove; });
|
|
236
238
|
updateAllForms(updatedList);
|
|
237
239
|
};
|
|
240
|
+
(0, react_1.useEffect)(function () {
|
|
241
|
+
if (props.outsideVatScope) {
|
|
242
|
+
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
|
|
246
|
+
}
|
|
247
|
+
}, [props.outsideVatScope]);
|
|
238
248
|
return (react_1.default.createElement(antd_1.Form, { form: invoiceLinesForm, initialValues: formData },
|
|
239
249
|
react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "invoiceLines"] }, function (fields, _a) {
|
|
240
250
|
var add = _a.add, remove = _a.remove;
|
|
241
251
|
return (react_1.default.createElement(antd_1.Flex, { vertical: true, gap: 20 }, fields.map(function (field, index) {
|
|
242
|
-
return react_1.default.createElement(SingleBillingLine_1.default, { key: "".concat(index + "" + (field === null || field === void 0 ? void 0 : field.key)), fieldName: field.name, index: index, receiverRequirements: props.receiverRequirements, outsideVatScope: props.outsideVatScope, formInstance: invoiceLinesForm, handleAddNewLine: handeAddNewLine, remove: handleRemove });
|
|
252
|
+
return react_1.default.createElement(SingleBillingLine_1.default, { key: "".concat(index + "" + (field === null || field === void 0 ? void 0 : field.key)), fieldName: field.name, index: index, receiverRequirements: props.receiverRequirements, initialTaxCategory: taxCatType, outsideVatScope: props.outsideVatScope, formInstance: invoiceLinesForm, handleAddNewLine: handeAddNewLine, remove: handleRemove });
|
|
243
253
|
})));
|
|
244
254
|
})));
|
|
245
255
|
};
|
|
@@ -2,11 +2,13 @@ import * as React from "react";
|
|
|
2
2
|
import { WrappedComponentProps } from "react-intl";
|
|
3
3
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
4
4
|
import { FormInstance } from "antd/es/form";
|
|
5
|
+
import { AvailableTaxCategoryTypeEnum } from "../../../enums";
|
|
5
6
|
interface Props extends WrappedComponentProps {
|
|
6
7
|
fieldName: any;
|
|
7
8
|
index: number;
|
|
8
9
|
receiverRequirements: NewReceiverRequirements;
|
|
9
10
|
outsideVatScope: boolean;
|
|
11
|
+
initialTaxCategory: AvailableTaxCategoryTypeEnum;
|
|
10
12
|
formInstance: FormInstance;
|
|
11
13
|
handleAddNewLine(index: number): void;
|
|
12
14
|
remove: (index: (number | number[])) => void;
|
|
@@ -96,27 +96,36 @@ var lodash_1 = require("lodash");
|
|
|
96
96
|
var Form_1 = require("antd/es/form/Form");
|
|
97
97
|
var react_use_1 = require("react-use");
|
|
98
98
|
var SingleBillingLine = function (props) {
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
99
100
|
var fieldName = props.fieldName, index = props.index, intl = props.intl;
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
var _h = (0, react_1.useState)(false), isEditing = _h[0], setIsEditing = _h[1];
|
|
101
|
+
var _m = React.useState(false), isMobile = _m[0], setIsMobile = _m[1];
|
|
102
|
+
var _o = React.useState(false), isCurrencyDisabled = _o[0], setIsCurrencyDisabled = _o[1];
|
|
103
|
+
var _p = React.useState(), taxCatType = _p[0], setTaxCatType = _p[1];
|
|
104
|
+
var _q = React.useState("PERCENTAGE"), discountType = _q[0], setDiscountType = _q[1];
|
|
105
|
+
var _r = (0, react_1.useState)(undefined), addNewLinesTooltip = _r[0], setAddNewLinesTooltip = _r[1];
|
|
106
|
+
var _s = React.useState(true), isSaveButtonDisabled = _s[0], setIsSaveButtonDisabled = _s[1];
|
|
107
|
+
var _t = (0, react_1.useState)(false), isEditing = _t[0], setIsEditing = _t[1];
|
|
108
108
|
var invoiceLines = (0, Form_1.useWatch)(["invoice", "invoiceLines"], props.formInstance);
|
|
109
109
|
var width = (0, react_use_1.useWindowSize)().width;
|
|
110
110
|
(0, react_1.useEffect)(function () {
|
|
111
|
-
if (props.
|
|
112
|
-
setTaxCatType(
|
|
113
|
-
(0, BillingLineUtility_1.assignTaxCategoryToAllLines)(props.formInstance, enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
|
|
111
|
+
if (props.initialTaxCategory) {
|
|
112
|
+
setTaxCatType(props.initialTaxCategory);
|
|
114
113
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
}, [props.initialTaxCategory]);
|
|
115
|
+
(0, react_1.useEffect)(function () {
|
|
116
|
+
var _a;
|
|
117
|
+
if (taxCatType) {
|
|
118
|
+
props.formInstance.setFieldsValue({
|
|
119
|
+
invoice: {
|
|
120
|
+
invoiceLines: (_a = {},
|
|
121
|
+
_a[index] = {
|
|
122
|
+
taxCategoryType: taxCatType,
|
|
123
|
+
},
|
|
124
|
+
_a),
|
|
125
|
+
},
|
|
126
|
+
});
|
|
118
127
|
}
|
|
119
|
-
}, [
|
|
128
|
+
}, [taxCatType]);
|
|
120
129
|
(0, react_1.useEffect)(function () {
|
|
121
130
|
if (width < 768) {
|
|
122
131
|
setIsMobile(true);
|
|
@@ -132,7 +141,6 @@ var SingleBillingLine = function (props) {
|
|
|
132
141
|
var currentField = lines[fieldName];
|
|
133
142
|
if (currentField) {
|
|
134
143
|
setIsEditing(currentField.editing);
|
|
135
|
-
setField(currentField);
|
|
136
144
|
}
|
|
137
145
|
if ((lines === null || lines === void 0 ? void 0 : lines.length) === 1) {
|
|
138
146
|
setIsCurrencyDisabled(false);
|
|
@@ -272,6 +280,6 @@ var SingleBillingLine = function (props) {
|
|
|
272
280
|
props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_labels_addButton))))));
|
|
273
281
|
return (React.createElement(React.Fragment, null, isEditing
|
|
274
282
|
? editingRender
|
|
275
|
-
: React.createElement(BillingLinePreview_1.default, { itemNo:
|
|
283
|
+
: React.createElement(BillingLinePreview_1.default, { itemNo: (_a = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _a === void 0 ? void 0 : _a.itemNo, name: (_b = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _b === void 0 ? void 0 : _b.name, discountValue: (_c = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _c === void 0 ? void 0 : _c.discountValue, discountType: (_d = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _d === void 0 ? void 0 : _d.discountType, taxCategoryType: (_e = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _e === void 0 ? void 0 : _e.taxCategoryType, currencyCode: (_f = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _f === void 0 ? void 0 : _f.currencyCode, onEdit: handleOnEdit, quantity: (_g = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _g === void 0 ? void 0 : _g.quantity, taxableAmount: (_h = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _h === void 0 ? void 0 : _h.taxableAmount, unitPriceAmount: (_j = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _j === void 0 ? void 0 : _j.unitPriceAmount, unit: (_k = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _k === void 0 ? void 0 : _k.unitPriceAmount, unitOfMeasure: (_l = props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName]) === null || _l === void 0 ? void 0 : _l.unitOfMeasure, onDelete: handleRemove })));
|
|
276
284
|
};
|
|
277
285
|
exports.default = (0, react_intl_1.injectIntl)(SingleBillingLine);
|
|
@@ -29,5 +29,4 @@ interface TaxDisplay {
|
|
|
29
29
|
export declare const combinedTaxesForLines: (invoiceLines: BillingLineMetadataOverride[]) => TaxDisplay[];
|
|
30
30
|
export declare const getUnitOfMeasureUnitLabel: (unitOfMeasure: any) => string;
|
|
31
31
|
export declare const getDiscountLabel: (discountValue: string, discountType: string, currencyCode: string, discountText: string) => string;
|
|
32
|
-
export declare const assignTaxCategoryToAllLines: (formInstance: FormInstance, taxToAssign: AvailableTaxCategoryTypeEnum) => void;
|
|
33
32
|
export {};
|
|
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
28
|
+
exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
29
29
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
30
30
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
31
31
|
var react_1 = __importDefault(require("react"));
|
|
@@ -220,15 +220,3 @@ var getDiscountLabel = function (discountValue, discountType, currencyCode, disc
|
|
|
220
220
|
return "".concat(discountValue).concat(discountType === "PERCENTAGE" ? "%" : " ".concat(currencyCode), " ").concat(discountText);
|
|
221
221
|
};
|
|
222
222
|
exports.getDiscountLabel = getDiscountLabel;
|
|
223
|
-
var assignTaxCategoryToAllLines = function (formInstance, taxToAssign) {
|
|
224
|
-
var clonedLines = (0, lodash_1.cloneDeep)(formInstance.getFieldValue(["invoice", "invoiceLines"]));
|
|
225
|
-
clonedLines.forEach(function (line) {
|
|
226
|
-
line.taxCategoryType = taxToAssign;
|
|
227
|
-
});
|
|
228
|
-
formInstance.setFieldsValue({
|
|
229
|
-
invoice: {
|
|
230
|
-
invoiceLines: clonedLines,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
exports.assignTaxCategoryToAllLines = assignTaxCategoryToAllLines;
|