@unimaze/billing 0.21.10 → 0.21.12
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/billing-lines/BillingCalculations.d.ts +1 -0
- package/lib/common/components/billing-lines/BillingCalculations.js +1 -1
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -0
- package/lib/common/components/billing-lines/NewBillingLines.js +1 -0
- package/lib/common/components/billing-lines/index.js +4 -2
- package/lib/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +1 -1
- package/lib/utils/BillingLineUtility.js +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ interface Props extends WrappedComponentProps {
|
|
|
5
5
|
currencyCode: string;
|
|
6
6
|
formInstance: FormInstance;
|
|
7
7
|
outsideVatScope: boolean;
|
|
8
|
+
newLineSaved: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
10
11
|
forwardedRef?: React.Ref<any>;
|
|
@@ -61,7 +61,7 @@ var BillingCalculations = function (props) {
|
|
|
61
61
|
(0, react_1.useEffect)(function () {
|
|
62
62
|
var savedLines = props.formInstance.getFieldValue(["invoice", "invoiceLines"]).filter(function (line) { return line.editing === false; });
|
|
63
63
|
setInvoiceLines(savedLines);
|
|
64
|
-
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"])]);
|
|
64
|
+
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"]), props.newLineSaved]);
|
|
65
65
|
var totals = {
|
|
66
66
|
totalTaxableAmount: 0,
|
|
67
67
|
totalTaxAmount: 0,
|
|
@@ -125,6 +125,8 @@ interface Props extends WrappedComponentProps {
|
|
|
125
125
|
formInstance: FormInstance;
|
|
126
126
|
outsideVatScope: boolean;
|
|
127
127
|
validateFields: (fieldNames: string[][], validateOnly?: boolean | undefined) => void;
|
|
128
|
+
newLineSaved: boolean;
|
|
129
|
+
setNewLineSaved: (isSaved: boolean) => void;
|
|
128
130
|
}
|
|
129
131
|
declare const BillingLinesWithIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
130
132
|
forwardedRef?: React.Ref<any>;
|
|
@@ -196,6 +196,7 @@ var BillingLines = function (props) {
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
props.formInstance.setFieldValue(["invoice", "invoiceLines"], lines);
|
|
199
|
+
props.setNewLineSaved(!props.newLineSaved);
|
|
199
200
|
props.validateFields(invoice_1.fieldPaths, true);
|
|
200
201
|
};
|
|
201
202
|
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "invoiceLines"] }, function (fields, _a) {
|
|
@@ -36,6 +36,7 @@ var BillingCalculations_1 = __importDefault(require("./BillingCalculations"));
|
|
|
36
36
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
37
37
|
var react_use_1 = require("react-use");
|
|
38
38
|
var tooltip_1 = __importDefault(require("../tooltip"));
|
|
39
|
+
var react_1 = require("react");
|
|
39
40
|
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
40
41
|
billingLines_title: {
|
|
41
42
|
id: "billingLines_title",
|
|
@@ -69,6 +70,7 @@ var BillingLines = function (props) {
|
|
|
69
70
|
var width = (0, react_use_1.useWindowSize)().width;
|
|
70
71
|
var _b = React.useState(false), isMobile = _b[0], setIsMobile = _b[1];
|
|
71
72
|
var token = antd_1.theme.useToken().token;
|
|
73
|
+
var _c = (0, react_1.useState)(false), newLineSaved = _c[0], setNewLineSaved = _c[1];
|
|
72
74
|
React.useEffect(function () {
|
|
73
75
|
if (width < 768) {
|
|
74
76
|
setIsMobile(true);
|
|
@@ -94,9 +96,9 @@ var BillingLines = function (props) {
|
|
|
94
96
|
React.createElement(antd_1.Typography.Title, { level: 5 }, props.intl.formatMessage(exports.translationMessages.billingLines_title)),
|
|
95
97
|
React.createElement(antd_1.Flex, { style: { marginBottom: (_a = token.Typography) === null || _a === void 0 ? void 0 : _a.titleMarginBottom } },
|
|
96
98
|
React.createElement(tooltip_1.default, { title: props.intl.formatMessage(exports.translationMessages.billingLines_tooltip_title) }))),
|
|
97
|
-
React.createElement(NewBillingLines_1.default, { formInstance: props.formInstance, receiverRequirements: props.receiverRequirements, outsideVatScope: props.outsideVatScope, validateFields: props.validateFields })),
|
|
99
|
+
React.createElement(NewBillingLines_1.default, { formInstance: props.formInstance, receiverRequirements: props.receiverRequirements, outsideVatScope: props.outsideVatScope, validateFields: props.validateFields, newLineSaved: newLineSaved, setNewLineSaved: setNewLineSaved })),
|
|
98
100
|
React.createElement(antd_1.Flex, { gap: "middle", vertical: true },
|
|
99
|
-
React.createElement(BillingCalculations_1.default, { currencyCode: currencyCode, formInstance: props.formInstance, outsideVatScope: props.outsideVatScope }),
|
|
101
|
+
React.createElement(BillingCalculations_1.default, { currencyCode: currencyCode, formInstance: props.formInstance, outsideVatScope: props.outsideVatScope, newLineSaved: newLineSaved }),
|
|
100
102
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(exports.translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"], style: { marginBottom: 0 } },
|
|
101
103
|
React.createElement(antd_1.Input.TextArea, { placeholder: props.intl.formatMessage(exports.translationMessages.baseInformation_notes) }))))));
|
|
102
104
|
};
|
|
@@ -73,7 +73,7 @@ var InvoicePreviewInvoiceLines = function (props) {
|
|
|
73
73
|
line.discountValue && (react_1.default.createElement(antd_1.Flex, { justify: "space-between", style: { width: "80%" }, align: "center" },
|
|
74
74
|
react_1.default.createElement(antd_1.Typography.Text, null, "".concat(line.discountValue).concat(line.discountType === "PERCENTAGE" ? "%" : " ".concat(line.currencyCode)),
|
|
75
75
|
" ",
|
|
76
|
-
props.intl.formatMessage(index_1.translationMessages.
|
|
76
|
+
props.intl.formatMessage(index_1.translationMessages.invoicePreview_lineDiscount)),
|
|
77
77
|
react_1.default.createElement(antd_1.Typography.Text, null,
|
|
78
78
|
"-",
|
|
79
79
|
(0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(calculatedDiscountValue, props.intl),
|
|
@@ -74,7 +74,7 @@ var calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount,
|
|
|
74
74
|
return 0;
|
|
75
75
|
}
|
|
76
76
|
var _discountValue = (0, lodash_1.toNumber)(discountValue);
|
|
77
|
-
if ((0, lodash_1.isNumber)(_discountValue)) {
|
|
77
|
+
if (_discountValue && (0, lodash_1.isNumber)(_discountValue)) {
|
|
78
78
|
if (discountType === "PERCENTAGE") {
|
|
79
79
|
return quantity * unitPriceAmount * ((100 - _discountValue) / 100);
|
|
80
80
|
}
|