@unimaze/billing 0.21.5 → 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/attachments/AttachmentModal.js +5 -2
- 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 +1 -1
- package/lib/common/components/invoice-preview/index.js +2 -1
- package/lib/common/components/supplier/index.js +1 -1
- package/lib/create-invoice/index.js +1 -1
- 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/IntlUtility.d.ts +1 -0
- package/lib/utils/IntlUtility.js +33 -10
- package/package.json +1 -1
|
@@ -115,7 +115,7 @@ var AttachmentModal = function (props) {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
React.useEffect(function () {
|
|
118
|
-
var _isSaveAttachmentsDisabled = props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; });
|
|
118
|
+
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; }) : true;
|
|
119
119
|
setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
|
|
120
120
|
}, [props.attachments]);
|
|
121
121
|
var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
@@ -191,7 +191,10 @@ var AttachmentModal = function (props) {
|
|
|
191
191
|
React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined, style: { width: "100%" } }, attachment.file.name),
|
|
192
192
|
React.createElement(lib_1.Form.Item, { name: ["attachments", "file".concat(index + 1), "file"], initialValue: attachment.file, hidden: true }),
|
|
193
193
|
attachment.file.status === "uploading" ? (React.createElement(icons_1.LoadingOutlined, null)) : (React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
194
|
-
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
194
|
+
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
195
|
+
props.formInstance.setFieldValue(["attachments", "file".concat(index + 1), "description"], "");
|
|
196
|
+
props.onRemove(attachment.file);
|
|
197
|
+
} })))),
|
|
195
198
|
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { rules: [
|
|
196
199
|
{
|
|
197
200
|
required: true,
|
|
@@ -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 () {
|
|
@@ -257,7 +257,7 @@ var SingleBillingLine = function (props) {
|
|
|
257
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
258
|
{
|
|
259
259
|
pattern: /^\d+(\.\d+)?$/,
|
|
260
|
-
message:
|
|
260
|
+
message: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_input_must_be_number_validationMessage),
|
|
261
261
|
},
|
|
262
262
|
], index: index },
|
|
263
263
|
React.createElement(antd_1.Flex, { gap: "middle", align: "center" },
|
|
@@ -356,7 +356,8 @@ var InvoicePreview = function (props) {
|
|
|
356
356
|
react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, getPaymentMeansValue(props.form.getFieldValue(["invoice", "paymentMeans", "type"]))),
|
|
357
357
|
props.form.getFieldValue(["invoice", "paymentMeans", "domesticTransfer"]) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
358
358
|
react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
|
|
359
|
-
|
|
359
|
+
props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_domesticTransfer_accountNo),
|
|
360
|
+
":",
|
|
360
361
|
" ",
|
|
361
362
|
props.form.getFieldValue([
|
|
362
363
|
"invoice",
|
|
@@ -252,7 +252,7 @@ var Supplier = function (props) {
|
|
|
252
252
|
required: true,
|
|
253
253
|
message: props.intl.formatMessage(form_item_2.translationMessages.formItem_required_errorMessage),
|
|
254
254
|
},
|
|
255
|
-
], normalize: formatIdentifierInput, validateTrigger: ["onBlur"] },
|
|
255
|
+
], normalize: formatIdentifierInput, validateTrigger: ["onBlur", "onChange"] },
|
|
256
256
|
React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"], defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.supplier_identifier), defaultIsRequired: true, disabled: isLoadingParticipantInfo, onChange: function (value) {
|
|
257
257
|
return debouncerSearch(props.rapiBaseUrl, props.rapiApiKey, value.target.value);
|
|
258
258
|
} })),
|
|
@@ -253,7 +253,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
253
253
|
someRequiredFieldsEmpty = function () {
|
|
254
254
|
var _a, _b;
|
|
255
255
|
var referenceIdentifierType = form.getFieldValue(["invoice", "referenceIdentifiers"]);
|
|
256
|
-
return
|
|
256
|
+
return ((_a = referenceIdentifierType[0]) === null || _a === void 0 ? void 0 : _a.code) ? !((_b = referenceIdentifierType[0]) === null || _b === void 0 ? void 0 : _b.value) : false;
|
|
257
257
|
};
|
|
258
258
|
return [4 /*yield*/, form.validateFields(fieldPaths, { validateOnly: validateOnly || true })
|
|
259
259
|
.then(function () {
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntlShape } from "react-intl";
|
|
2
2
|
import { FormatNumberOptions } from "react-intl/src/types";
|
|
3
3
|
declare const icelandicNumberLocaleWorkaroundChrome: (value: number, intl: IntlShape, options?: FormatNumberOptions) => string;
|
|
4
|
+
export declare const convertToIcelandicThousandAndDecimalSeparator: (value: string, minimumFractionDigits?: number, maximumFractionDigits?: number) => string;
|
|
4
5
|
declare const returnDecimalSeparatorForLocale: (locale: string | null) => string | undefined;
|
|
5
6
|
export { icelandicNumberLocaleWorkaroundChrome, returnDecimalSeparatorForLocale };
|
package/lib/utils/IntlUtility.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnDecimalSeparatorForLocale = exports.icelandicNumberLocaleWorkaroundChrome = void 0;
|
|
3
|
+
exports.returnDecimalSeparatorForLocale = exports.icelandicNumberLocaleWorkaroundChrome = exports.convertToIcelandicThousandAndDecimalSeparator = void 0;
|
|
4
4
|
var icelandicNumberLocaleWorkaroundChrome = function (value, intl, options) {
|
|
5
5
|
var locale = localStorage.getItem("languageString");
|
|
6
|
+
var cleanedValue = value === null || value === undefined ? 0 : value;
|
|
6
7
|
if (locale) {
|
|
7
8
|
var supportedLocalesArray = Intl.NumberFormat.supportedLocalesOf(locale);
|
|
8
9
|
if (supportedLocalesArray.every(function (x) { return x !== locale; })) {
|
|
@@ -11,39 +12,61 @@ var icelandicNumberLocaleWorkaroundChrome = function (value, intl, options) {
|
|
|
11
12
|
if (options) {
|
|
12
13
|
switch (options.style) {
|
|
13
14
|
case "decimal": {
|
|
14
|
-
|
|
15
|
+
var decimalPart = options.maximumFractionDigits ? options.maximumFractionDigits : options.minimumFractionDigits ? options.minimumFractionDigits : 2;
|
|
16
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(Number(cleanedValue).toFixed(decimalPart), options.minimumFractionDigits, options.maximumFractionDigits);
|
|
15
17
|
}
|
|
16
18
|
case "currency": {
|
|
17
19
|
if (!options.currency) {
|
|
18
20
|
throw new Error("options.currency must be specified if options.style = 'currency'");
|
|
19
21
|
}
|
|
20
|
-
var roundedValue = convertToIcelandicThousandAndDecimalSeparator(Math.round(value).toString());
|
|
22
|
+
var roundedValue = (0, exports.convertToIcelandicThousandAndDecimalSeparator)(Math.round(value).toString());
|
|
21
23
|
var suffix = " ".concat(options.currency);
|
|
22
24
|
return roundedValue + suffix;
|
|
23
25
|
}
|
|
24
26
|
case "percent": {
|
|
25
|
-
var roundedValue = convertToIcelandicThousandAndDecimalSeparator(
|
|
27
|
+
var roundedValue = (0, exports.convertToIcelandicThousandAndDecimalSeparator)(cleanedValue.toString());
|
|
26
28
|
var suffix = " %";
|
|
27
29
|
return roundedValue + suffix;
|
|
28
30
|
}
|
|
29
31
|
case "unit": {
|
|
30
|
-
return convertToIcelandicThousandAndDecimalSeparator(value.toString());
|
|
32
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(value.toString());
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
return convertToIcelandicThousandAndDecimalSeparator(value.toString());
|
|
36
|
+
return (0, exports.convertToIcelandicThousandAndDecimalSeparator)(value.toString());
|
|
35
37
|
default:
|
|
36
|
-
return intl.formatNumber(
|
|
38
|
+
return intl.formatNumber(cleanedValue, options);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
return intl.formatNumber(
|
|
42
|
+
return intl.formatNumber(cleanedValue, options);
|
|
41
43
|
};
|
|
42
44
|
exports.icelandicNumberLocaleWorkaroundChrome = icelandicNumberLocaleWorkaroundChrome;
|
|
43
|
-
var convertToIcelandicThousandAndDecimalSeparator = function (value) {
|
|
45
|
+
var convertToIcelandicThousandAndDecimalSeparator = function (value, minimumFractionDigits, maximumFractionDigits) {
|
|
46
|
+
var _a;
|
|
44
47
|
var parts = value.split(".");
|
|
45
|
-
|
|
48
|
+
if (parts.length === 1)
|
|
49
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
50
|
+
if (maximumFractionDigits === 0) {
|
|
51
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
52
|
+
}
|
|
53
|
+
var decimalPart = parts[1];
|
|
54
|
+
if (minimumFractionDigits) {
|
|
55
|
+
if ((decimalPart === null || decimalPart === void 0 ? void 0 : decimalPart.length) < minimumFractionDigits) {
|
|
56
|
+
var minimumFractionDigitsDifference = minimumFractionDigits - ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.length);
|
|
57
|
+
for (var i = 0; i < minimumFractionDigitsDifference; i++) {
|
|
58
|
+
decimalPart += "0";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (maximumFractionDigits) {
|
|
63
|
+
if ((decimalPart === null || decimalPart === void 0 ? void 0 : decimalPart.length) > maximumFractionDigits) {
|
|
64
|
+
decimalPart = decimalPart.substring(0, maximumFractionDigits);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".") + ",".concat(decimalPart);
|
|
46
68
|
};
|
|
69
|
+
exports.convertToIcelandicThousandAndDecimalSeparator = convertToIcelandicThousandAndDecimalSeparator;
|
|
47
70
|
var returnDecimalSeparatorForLocale = function (locale) {
|
|
48
71
|
switch (locale) {
|
|
49
72
|
case "is":
|