@unimaze/billing 0.21.6 → 0.21.7
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/base-information/ReferenceIdentifiers.d.ts +4 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +5 -1
- package/lib/common/components/billing-lines/BillingCalculations.js +3 -2
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +4 -0
- package/lib/common/components/billing-lines/NewBillingLines.js +4 -0
- package/lib/common/components/billing-lines/SingleBillingLine.js +7 -2
- package/lib/translations/locales/en.json +2 -0
- package/lib/translations/locales/is.json +2 -0
- package/lib/translations/locales.d.ts +4 -0
- package/lib/utils/BillingLineUtility.d.ts +1 -1
- package/lib/utils/BillingLineUtility.js +4 -3
- package/package.json +1 -1
|
@@ -28,6 +28,10 @@ export declare const translationMessages: {
|
|
|
28
28
|
id: string;
|
|
29
29
|
defaultMessage: string;
|
|
30
30
|
};
|
|
31
|
+
referenceIdentifiers_values_validation_message: {
|
|
32
|
+
id: string;
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
};
|
|
31
35
|
};
|
|
32
36
|
interface Props extends WrappedComponentProps {
|
|
33
37
|
receiverRequirements: NewReceiverRequirements;
|
|
@@ -83,6 +83,10 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
83
83
|
id: "referenceIdentifiers_labels_LOC",
|
|
84
84
|
defaultMessage: "Real estate number", // "Fasteignanúmer",
|
|
85
85
|
},
|
|
86
|
+
referenceIdentifiers_values_validation_message: {
|
|
87
|
+
id: "referenceIdentifiers_values_validation_message",
|
|
88
|
+
defaultMessage: "This value doesn't exist",
|
|
89
|
+
},
|
|
86
90
|
});
|
|
87
91
|
var ReferenceIdentifiers = function (props) {
|
|
88
92
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -185,7 +189,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
185
189
|
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
186
190
|
}
|
|
187
191
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
188
|
-
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true });
|
|
192
|
+
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true, help: referenceIdentifierValidateStatus === "error" ? props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_values_validation_message) : '' });
|
|
189
193
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
190
194
|
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key), onBlur: function (event) {
|
|
191
195
|
return handleReferenceIdentifierValueValidation(legalIdentifier, fieldDefinition_1.name, event.currentTarget.value, rapiBaseUrl, ["invoice", "referenceIdentifiers", field.name, "value"], setReferenceIdentifierValidateStatus);
|
|
@@ -57,9 +57,10 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
57
57
|
});
|
|
58
58
|
;
|
|
59
59
|
var BillingCalculations = function (props) {
|
|
60
|
-
var _a = (0, react_1.useState)(
|
|
60
|
+
var _a = (0, react_1.useState)([]), invoiceLines = _a[0], setInvoiceLines = _a[1];
|
|
61
61
|
(0, react_1.useEffect)(function () {
|
|
62
|
-
|
|
62
|
+
var savedLines = props.formInstance.getFieldValue(["invoice", "invoiceLines"]).filter(function (line) { return line.editing === false; });
|
|
63
|
+
setInvoiceLines(savedLines);
|
|
63
64
|
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"])]);
|
|
64
65
|
var totals = {
|
|
65
66
|
totalTaxableAmount: 0,
|
|
@@ -115,6 +115,10 @@ export declare const translationMessages: {
|
|
|
115
115
|
id: string;
|
|
116
116
|
defaultMessage: string;
|
|
117
117
|
};
|
|
118
|
+
billingLines_input_must_be_number_validationMessage: {
|
|
119
|
+
id: string;
|
|
120
|
+
defaultMessage: string;
|
|
121
|
+
};
|
|
118
122
|
};
|
|
119
123
|
interface Props extends WrappedComponentProps {
|
|
120
124
|
receiverRequirements: NewReceiverRequirements;
|
|
@@ -155,6 +155,10 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
155
155
|
id: "billingLines_currency_GBP_short",
|
|
156
156
|
defaultMessage: "GBP",
|
|
157
157
|
},
|
|
158
|
+
billingLines_input_must_be_number_validationMessage: {
|
|
159
|
+
id: "billingLines_input_must_be_number_validationMessage",
|
|
160
|
+
defaultMessage: "Input must be a number",
|
|
161
|
+
},
|
|
158
162
|
});
|
|
159
163
|
var BillingLines = function (props) {
|
|
160
164
|
(0, react_1.useEffect)(function () {
|
|
@@ -254,9 +254,14 @@ var SingleBillingLine = function (props) {
|
|
|
254
254
|
" ",
|
|
255
255
|
React.createElement(tooltip_1.default, { title: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_taxCategoryType_title) })))),
|
|
256
256
|
React.createElement(antd_1.Col, { span: 12 },
|
|
257
|
-
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], defaultIsRequired: false, fieldName: [fieldName, "discountValue"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount), verticalLabels: true, onlyLabelOnFirstInList: true, defaultLabelTooltip: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount_helpText),
|
|
257
|
+
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], defaultIsRequired: false, fieldName: [fieldName, "discountValue"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount), verticalLabels: true, onlyLabelOnFirstInList: true, defaultLabelTooltip: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount_helpText), rules: [
|
|
258
|
+
{
|
|
259
|
+
pattern: /^\d+(\.\d+)?$/,
|
|
260
|
+
message: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_input_must_be_number_validationMessage),
|
|
261
|
+
},
|
|
262
|
+
], index: index },
|
|
258
263
|
React.createElement(antd_1.Flex, { gap: "middle", align: "center" },
|
|
259
|
-
(0, BillingLineUtility_1.getCorrectInputNode)("discountValue", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], false), React.createElement(DiscountTypeSelector_1.default, { fieldName: fieldName, initialValue: discountType, onSelect: discountTypeSelectorOnSelectHandle, formInstance: props.formInstance })),
|
|
264
|
+
(0, BillingLineUtility_1.getCorrectInputNode)("discountValue", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], false), React.createElement(DiscountTypeSelector_1.default, { fieldName: fieldName, initialValue: discountType, onSelect: discountTypeSelectorOnSelectHandle, formInstance: props.formInstance }), false, props.formInstance.getFieldValue(["invoice", "invoiceLines"])[fieldName].discountValue),
|
|
260
265
|
React.createElement(tooltip_1.default, { title: (0, RequirementsUtility_1.getFieldLabelTooltipOverride)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount_helpText)) }))))),
|
|
261
266
|
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.fullWidthInput),
|
|
262
267
|
React.createElement(antd_1.Tooltip, { title: addNewLinesTooltip },
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"billingLines_currency_USD_short": "USD",
|
|
57
57
|
"billingLines_discount": "Discount",
|
|
58
58
|
"billingLines_discount_helpText": "Discount can be represented as an amount or a percentage indicated with a percentage sign (%)",
|
|
59
|
+
"billingLines_input_must_be_number_validationMessage": "Input must be a number",
|
|
59
60
|
"billingLines_itemNo": "Item no",
|
|
60
61
|
"billingLines_labels_addButton": "Save line",
|
|
61
62
|
"billingLines_lineAmount": "Amount",
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
"referenceIdentifiers_labels_addButton": "Add reference identifier",
|
|
139
140
|
"referenceIdentifiers_labels_referenceIdentifier": "Object identifier",
|
|
140
141
|
"referenceIdentifiers_labels_referenceIdentifier_title": "An identifier for an object on which the invoice is based, given by the seller. It may be a subscription number, telephone number, meter point, vehicle, person etc., as applicable.",
|
|
142
|
+
"referenceIdentifiers_values_validation_message": "This value doesn't exist",
|
|
141
143
|
"saveInformation_label": "Save information",
|
|
142
144
|
"submitConfirmation_footer_text": "If any questions arise, please contact us at",
|
|
143
145
|
"submitConfirmation_text": "The invoice has been sent to the customer.",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"billingLines_currency_USD_short": "USD",
|
|
57
57
|
"billingLines_discount": "Afsláttur",
|
|
58
58
|
"billingLines_discount_helpText": "Afslátt má setja fram sem upphæð eða sem hlutfall með því að bæta við prósentutákni (%)",
|
|
59
|
+
"billingLines_input_must_be_number_validationMessage": "Inntak verður að vera tala",
|
|
59
60
|
"billingLines_itemNo": "Vörunr.",
|
|
60
61
|
"billingLines_labels_addButton": "Bæta við línu",
|
|
61
62
|
"billingLines_lineAmount": "Upphæð",
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
"referenceIdentifiers_labels_addButton": "Bætið við tilvísunarnúmeri",
|
|
139
140
|
"referenceIdentifiers_labels_referenceIdentifier": "Viðfang",
|
|
140
141
|
"referenceIdentifiers_labels_referenceIdentifier_title": "Tilvísun í viðfang sem tengt er reikningi, gefið upp af seljanda. Gæti verið áskriftarnúmer, símanúmer, mælistaður, ökutæki, einstaklingur o.fl. eftir því sem við á.",
|
|
142
|
+
"referenceIdentifiers_values_validation_message": "Þetta gildi er ekki til",
|
|
141
143
|
"saveInformation_label": "Vista upplýsingar",
|
|
142
144
|
"submitConfirmation_footer_text": "If any questions arise, please contact us at",
|
|
143
145
|
"submitConfirmation_text": "The invoice has been sent to the customer.",
|
|
@@ -57,6 +57,7 @@ declare const _default: {
|
|
|
57
57
|
billingLines_currency_USD_short: string;
|
|
58
58
|
billingLines_discount: string;
|
|
59
59
|
billingLines_discount_helpText: string;
|
|
60
|
+
billingLines_input_must_be_number_validationMessage: string;
|
|
60
61
|
billingLines_itemNo: string;
|
|
61
62
|
billingLines_labels_addButton: string;
|
|
62
63
|
billingLines_lineAmount: string;
|
|
@@ -139,6 +140,7 @@ declare const _default: {
|
|
|
139
140
|
referenceIdentifiers_labels_addButton: string;
|
|
140
141
|
referenceIdentifiers_labels_referenceIdentifier: string;
|
|
141
142
|
referenceIdentifiers_labels_referenceIdentifier_title: string;
|
|
143
|
+
referenceIdentifiers_values_validation_message: string;
|
|
142
144
|
saveInformation_label: string;
|
|
143
145
|
submitConfirmation_footer_text: string;
|
|
144
146
|
submitConfirmation_text: string;
|
|
@@ -237,6 +239,7 @@ declare const _default: {
|
|
|
237
239
|
billingLines_currency_USD_short: string;
|
|
238
240
|
billingLines_discount: string;
|
|
239
241
|
billingLines_discount_helpText: string;
|
|
242
|
+
billingLines_input_must_be_number_validationMessage: string;
|
|
240
243
|
billingLines_itemNo: string;
|
|
241
244
|
billingLines_labels_addButton: string;
|
|
242
245
|
billingLines_lineAmount: string;
|
|
@@ -319,6 +322,7 @@ declare const _default: {
|
|
|
319
322
|
referenceIdentifiers_labels_addButton: string;
|
|
320
323
|
referenceIdentifiers_labels_referenceIdentifier: string;
|
|
321
324
|
referenceIdentifiers_labels_referenceIdentifier_title: string;
|
|
325
|
+
referenceIdentifiers_values_validation_message: string;
|
|
322
326
|
saveInformation_label: string;
|
|
323
327
|
submitConfirmation_footer_text: string;
|
|
324
328
|
submitConfirmation_text: string;
|
|
@@ -19,7 +19,7 @@ export declare const calculateTaxableAmount: (discountValue: string | null | und
|
|
|
19
19
|
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
20
20
|
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum | undefined) => number;
|
|
21
21
|
export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum | undefined, taxCategoryTypeTranslated: string) => string;
|
|
22
|
-
export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean) => React.ReactChild;
|
|
22
|
+
export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean, value?: any) => React.ReactChild;
|
|
23
23
|
export declare const getTotals: (invoiceLines: BillingLineMetadataOverride[]) => Totals;
|
|
24
24
|
export declare const getTaxCategoryDisabled: (taxCategoryType: AvailableTaxCategoryTypeEnum, outsideVatScope: boolean) => boolean;
|
|
25
25
|
export declare const getFieldNames: (keys: string[], intl: IntlShape) => string[];
|
|
@@ -33,6 +33,7 @@ var CommonTranslations_1 = require("../common/components/CommonTranslations");
|
|
|
33
33
|
var ConversionUtility_1 = require("./ConversionUtility");
|
|
34
34
|
var enums_1 = require("../enums");
|
|
35
35
|
var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
|
|
36
|
+
var lodash_1 = require("lodash");
|
|
36
37
|
var billingLinesFieldsMetadata = function (formInstance) {
|
|
37
38
|
var billingLinesMetadata = formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
38
39
|
return billingLinesMetadata.map(function (billingLine) {
|
|
@@ -72,7 +73,7 @@ var calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount,
|
|
|
72
73
|
if (!quantity || !unitPriceAmount) {
|
|
73
74
|
return 0;
|
|
74
75
|
}
|
|
75
|
-
if (discountValue) {
|
|
76
|
+
if ((0, lodash_1.isNaN)(discountValue)) {
|
|
76
77
|
if (discountType === "PERCENTAGE") {
|
|
77
78
|
return quantity * unitPriceAmount * ((100 - parseFloat(discountValue)) / 100);
|
|
78
79
|
}
|
|
@@ -110,12 +111,12 @@ var generateTaxCategoryLabel = function (taxCategoryType, taxCategoryTypeTransla
|
|
|
110
111
|
return taxCategoryType ? "".concat(taxCategoryTypeTranslated, " (").concat((0, exports.calculateTaxPercentage)(taxCategoryType), "%)") : "";
|
|
111
112
|
};
|
|
112
113
|
exports.generateTaxCategoryLabel = generateTaxCategoryLabel;
|
|
113
|
-
var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonAfter, mobile) {
|
|
114
|
+
var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonAfter, mobile, value) {
|
|
114
115
|
switch (dataIdx) {
|
|
115
116
|
case "quantity":
|
|
116
117
|
case "unitPriceAmount":
|
|
117
118
|
case "discountValue":
|
|
118
|
-
return (react_1.default.createElement(antd_1.InputNumber, { prefix: required ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, step: 1, style: { width: "100%" }, placeholder: placeholder, addonAfter: addonAfter }));
|
|
119
|
+
return (react_1.default.createElement(antd_1.InputNumber, { prefix: required ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, step: 1, style: { width: "100%" }, placeholder: placeholder, addonAfter: addonAfter, value: value }));
|
|
119
120
|
case "unitOfMeasure":
|
|
120
121
|
return (react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, placeholder: placeholder, style: { width: mobile ? 64 : "auto" } }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
|
|
121
122
|
if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|