@unimaze/billing 0.20.17 → 0.21.1
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 +2 -2
- package/lib/common/components/CommonTranslations.d.ts +102 -2
- package/lib/common/components/CommonTranslations.js +10 -1
- package/lib/common/components/attachments/Attachment.d.ts +6 -4
- package/lib/common/components/attachments/Attachment.js +26 -10
- package/lib/common/components/attachments/AttachmentModal.d.ts +21 -0
- package/lib/common/components/attachments/AttachmentModal.js +203 -0
- package/lib/common/components/attachments/index.d.ts +13 -17
- package/lib/common/components/attachments/index.js +189 -23
- package/lib/common/components/base-information/AccountingCost.d.ts +7 -5
- package/lib/common/components/base-information/AccountingCost.js +32 -11
- package/lib/common/components/base-information/OrderReference.d.ts +6 -4
- package/lib/common/components/base-information/OrderReference.js +31 -14
- package/lib/common/components/base-information/ProjectReference.d.ts +9 -5
- package/lib/common/components/base-information/ProjectReference.js +8 -6
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +32 -5
- package/lib/common/components/base-information/ReferenceIdentifiers.js +126 -83
- package/lib/common/components/base-information/index.d.ts +51 -5
- package/lib/common/components/base-information/index.js +99 -154
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +7 -5
- package/lib/common/components/billing-lines/BillingCalculations.js +79 -46
- package/lib/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
- package/lib/common/components/billing-lines/BillingLinePreview.js +41 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +6 -4
- package/lib/common/components/billing-lines/BillingTaxSummary.js +39 -13
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +120 -4
- package/lib/common/components/billing-lines/NewBillingLines.js +396 -72
- package/lib/common/components/billing-lines/index.d.ts +33 -6
- package/lib/common/components/billing-lines/index.js +71 -244
- package/lib/common/components/component-container/Content.d.ts +2 -2
- package/lib/common/components/component-container/index.d.ts +1 -0
- package/lib/common/components/component-container/index.js +1 -1
- package/lib/common/components/customer/CostCenter.d.ts +6 -4
- package/lib/common/components/customer/CostCenter.js +25 -9
- package/lib/common/components/customer/CustomerContactName.d.ts +6 -4
- package/lib/common/components/customer/CustomerContactName.js +24 -8
- package/lib/common/components/customer/hardCoddedCustomer.js +19 -3
- package/lib/common/components/customer/index.d.ts +11 -5
- package/lib/common/components/customer/index.js +97 -42
- package/lib/common/components/date-picker/index.d.ts +21 -0
- package/lib/common/components/date-picker/index.js +23 -0
- package/lib/common/components/delivery-location/index.d.ts +6 -4
- package/lib/common/components/delivery-location/index.js +20 -4
- package/lib/common/components/editable-cell/index.js +2 -2
- package/lib/common/components/editable-row/index.d.ts +1 -1
- package/lib/common/components/editable-row/index.js +24 -7
- package/lib/common/components/form-item/index.d.ts +13 -6
- package/lib/common/components/form-item/index.js +16 -20
- package/lib/common/components/index.d.ts +10 -0
- package/lib/common/components/index.js +30 -8
- package/lib/common/components/input/index.d.ts +23 -0
- package/lib/common/components/input/index.js +37 -0
- package/lib/common/components/invoice/index.d.ts +40 -0
- package/lib/common/components/invoice/index.js +52 -0
- package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
- package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
- package/lib/common/components/invoice-preview/index.d.ts +16 -0
- package/lib/common/components/invoice-preview/index.js +393 -0
- package/lib/common/components/locale-intl/index.d.ts +0 -10
- package/lib/common/components/locale-intl/index.js +50 -42
- package/lib/common/components/payment-method/index.d.ts +69 -6
- package/lib/common/components/payment-method/index.js +145 -57
- package/lib/common/components/payment-method/paymentMethodForConversion.js +3 -1
- package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
- package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
- package/lib/common/components/submit-confirmation/index.d.ts +8 -0
- package/lib/common/components/submit-confirmation/index.js +34 -0
- package/lib/common/components/supplier/CityAutofill.d.ts +18 -0
- package/lib/common/components/supplier/CityAutofill.js +159 -0
- package/lib/common/components/supplier/index.d.ts +83 -5
- package/lib/common/components/supplier/index.js +200 -104
- package/lib/common/components/tooltip/index.d.ts +7 -0
- package/lib/common/components/tooltip/index.js +15 -0
- package/lib/common/components/welcome-modal/index.d.ts +15 -0
- package/lib/common/components/welcome-modal/index.js +26 -0
- package/lib/common/consts/formLayout.js +4 -3
- package/lib/common/consts/validationRules.d.ts +1 -1
- package/lib/common/consts/validationRules.js +6 -0
- package/lib/common/enums/index.js +5 -1
- package/lib/common/style/index.css +18 -0
- package/lib/common/types/BillingLineMetadataOverride.d.ts +2 -0
- package/lib/common/types/CommonProps.d.ts +15 -1
- package/lib/common/types/DiscountType.d.ts +1 -0
- package/lib/common/types/DiscountType.js +2 -0
- package/lib/common/types/ReceiverRequirements.d.ts +1 -1
- package/lib/common/types/ReceiverRequirements.js +1 -0
- package/lib/common/types/index.js +15 -0
- package/lib/create-invoice/IntlLoader.d.ts +0 -6
- package/lib/create-invoice/IntlLoader.js +78 -13
- package/lib/create-invoice/index.d.ts +65 -4
- package/lib/create-invoice/index.js +437 -181
- package/lib/enums.d.ts +2 -3
- package/lib/enums.js +1 -0
- package/lib/index.js +22 -6
- package/lib/translations/locales/en.json +182 -0
- package/lib/translations/locales/is.json +136 -116
- package/lib/translations/locales.d.ts +362 -161
- package/lib/translations/locales.js +3 -2
- package/lib/utils/ApiUtility.d.ts +4 -4
- package/lib/utils/ApiUtility.js +13 -10
- package/lib/utils/BillingLineUtility.d.ts +16 -5
- package/lib/utils/BillingLineUtility.js +65 -26
- package/lib/utils/ConversionUtility.js +15 -7
- package/lib/utils/FileUploadUtility.d.ts +4 -2
- package/lib/utils/FileUploadUtility.js +28 -9
- package/lib/utils/IntlUtility.d.ts +3 -2
- package/lib/utils/IntlUtility.js +2 -1
- package/lib/utils/LocationUtility.d.ts +1 -0
- package/lib/utils/LocationUtility.js +81 -0
- package/lib/utils/ReferenceIdentifierUtility.js +2 -1
- package/lib/utils/RequirementsUtility.d.ts +9 -7
- package/lib/utils/RequirementsUtility.js +46 -22
- package/lib/utils/index.js +4 -3
- package/package.json +36 -18
- package/lib/style/index.css +0 -51
|
@@ -10,28 +10,54 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
13
29
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14
30
|
if (mod && mod.__esModule) return mod;
|
|
15
31
|
var result = {};
|
|
16
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result
|
|
17
|
-
result
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
18
34
|
return result;
|
|
19
35
|
};
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
|
+
};
|
|
20
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
47
|
};
|
|
23
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.translationMessages = void 0;
|
|
24
50
|
var react_1 = __importStar(require("react"));
|
|
25
51
|
var react_intl_1 = require("react-intl");
|
|
26
52
|
var antd_1 = require("antd");
|
|
27
|
-
var icons_1 = require("@ant-design/icons");
|
|
28
53
|
var formLayout_1 = require("../../consts/formLayout");
|
|
29
54
|
var ReferenceIdentifierUtility_1 = require("../../../utils/ReferenceIdentifierUtility");
|
|
30
55
|
var axios_1 = __importDefault(require("axios"));
|
|
31
56
|
var ApiUtility_1 = require("../../../utils/ApiUtility");
|
|
32
57
|
var lodash_1 = require("lodash");
|
|
33
58
|
var form_item_1 = require("../form-item");
|
|
34
|
-
|
|
59
|
+
var __1 = require("..");
|
|
60
|
+
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
35
61
|
referenceIdentifiers_labels_addButton: {
|
|
36
62
|
id: "referenceIdentifiers_labels_addButton",
|
|
37
63
|
defaultMessage: "Add reference identifier",
|
|
@@ -42,28 +68,33 @@ exports.translationMessages = react_intl_1.defineMessages({
|
|
|
42
68
|
},
|
|
43
69
|
referenceIdentifiers_labels_referenceIdentifier_title: {
|
|
44
70
|
id: "referenceIdentifiers_labels_referenceIdentifier_title",
|
|
45
|
-
defaultMessage: "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.",
|
|
71
|
+
defaultMessage: "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.", // "Number related to the claim in question (Vehicle registration number, real estate number or kennitala)" // "Númer er á við tjónið sem um ræðir (bílnúmer, fasteignanúmer eða kennitala)",
|
|
46
72
|
},
|
|
47
73
|
referenceIdentifiers_labels_AKG: {
|
|
48
74
|
id: "referenceIdentifiers_labels_AKG",
|
|
49
|
-
defaultMessage: "Vehicle identification number" // "Bílnúmer",
|
|
75
|
+
defaultMessage: "Vehicle identification number", // "Bílnúmer",
|
|
50
76
|
},
|
|
51
77
|
referenceIdentifiers_labels_ARR: {
|
|
52
78
|
id: "referenceIdentifiers_labels_ARR",
|
|
53
|
-
defaultMessage: "Kennitala" // "Kennitala",
|
|
79
|
+
defaultMessage: "Kennitala", // "Kennitala",
|
|
54
80
|
},
|
|
55
81
|
referenceIdentifiers_labels_LOC: {
|
|
56
82
|
id: "referenceIdentifiers_labels_LOC",
|
|
57
|
-
defaultMessage: "Real estate number" // "Fasteignanúmer",
|
|
83
|
+
defaultMessage: "Real estate number", // "Fasteignanúmer",
|
|
58
84
|
},
|
|
59
85
|
});
|
|
60
86
|
var ReferenceIdentifiers = function (props) {
|
|
61
|
-
var _a = react_1.useState([]), referenceIdentifierValue = _a[0], setReferenceIdentifierValue = _a[1];
|
|
62
|
-
var _b = react_1.useState(false), loadingReferenceIdentifierValues = _b[0], setLoadingReferenceIdentifierValues = _b[1]; // TODO: change this to boolean[] for handling the list
|
|
63
|
-
var
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
var _a = (0, react_1.useState)([]), referenceIdentifierValue = _a[0], setReferenceIdentifierValue = _a[1];
|
|
88
|
+
var _b = (0, react_1.useState)(false), loadingReferenceIdentifierValues = _b[0], setLoadingReferenceIdentifierValues = _b[1]; // TODO: change this to boolean[] for handling the list
|
|
89
|
+
var token = antd_1.theme.useToken().token;
|
|
90
|
+
var referenceIdentifiersHelp = props.referenceIdentifiersHelpText
|
|
91
|
+
? props.referenceIdentifiersHelpText
|
|
92
|
+
: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier_title);
|
|
93
|
+
var referenceIdentifiersLabel = props.referenceIdentifiersLabelText
|
|
94
|
+
? props.referenceIdentifiersLabelText
|
|
95
|
+
: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier);
|
|
96
|
+
var referenceIdentifierOptions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(props.receiverRequirements);
|
|
97
|
+
var referenceIdentifiersHelpTextNode = (react_1.default.createElement("div", null,
|
|
67
98
|
react_1.default.createElement("p", null, referenceIdentifiersHelp),
|
|
68
99
|
react_1.default.createElement("ul", null, referenceIdentifierOptions.map(function (x) {
|
|
69
100
|
if (x.properties.hasOwnProperty("handling") && x.properties.handling) {
|
|
@@ -72,42 +103,42 @@ var ReferenceIdentifiers = function (props) {
|
|
|
72
103
|
return react_1.default.createElement("li", null, handling.helpText);
|
|
73
104
|
}
|
|
74
105
|
}
|
|
75
|
-
})));
|
|
76
|
-
var referenceIdentifierLabelNode = (react_1.default.createElement(antd_1.Tooltip, { title: referenceIdentifiersHelpTextNode, placement: "right" },
|
|
77
|
-
react_1.default.createElement("span", null,
|
|
78
|
-
referenceIdentifiersLabel,
|
|
79
|
-
"\u00A0",
|
|
80
|
-
react_1.default.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
106
|
+
}))));
|
|
81
107
|
var getReferenceIdentifier = function (receiverRequirements) {
|
|
82
|
-
var options = ReferenceIdentifierUtility_1.getReferenceIdentifierOptions(receiverRequirements);
|
|
108
|
+
var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
|
|
83
109
|
if (options.length > 0) {
|
|
84
110
|
return options.map(function (referenceIdentifierOption) {
|
|
85
|
-
return react_1.default.createElement(antd_1.Select.Option, { key: referenceIdentifierOption.key, value: referenceIdentifierOption.key }, referenceIdentifierOption.properties.label);
|
|
111
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: referenceIdentifierOption.key, value: referenceIdentifierOption.key }, referenceIdentifierOption.properties.label));
|
|
86
112
|
});
|
|
87
113
|
}
|
|
88
|
-
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
114
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
115
|
react_1.default.createElement(antd_1.Select.Option, { value: "AKG" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_AKG)),
|
|
90
116
|
react_1.default.createElement(antd_1.Select.Option, { value: "ARR" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_ARR)),
|
|
91
|
-
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_LOC)));
|
|
117
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_LOC))));
|
|
92
118
|
};
|
|
93
|
-
var handleReferenceIdentifierValueSearch = lodash_1.debounce(function (searchValue, fieldDefinitionWithOriginalKey, receiverRequirements, rapiBaseUrl) {
|
|
119
|
+
var handleReferenceIdentifierValueSearch = (0, lodash_1.debounce)(function (searchValue, fieldDefinitionWithOriginalKey, receiverRequirements, rapiBaseUrl) {
|
|
94
120
|
if (fieldDefinitionWithOriginalKey.properties.href) {
|
|
95
121
|
// /api/v1/requirements/0196:5504030000/DepartmentLocation/values?textFilter=%7BtextFilter%7D&offset=%7Boffset%7D&limit=%7Blimit%7D
|
|
96
|
-
var searchUrl = rapiBaseUrl +
|
|
122
|
+
var searchUrl = rapiBaseUrl +
|
|
123
|
+
fieldDefinitionWithOriginalKey.properties.href
|
|
124
|
+
.replace("%7BtextFilter%7D", encodeURIComponent(searchValue))
|
|
125
|
+
.replace("%7Boffset%7D", "0")
|
|
126
|
+
.replace("%7Blimit%7D", "15");
|
|
97
127
|
setLoadingReferenceIdentifierValues(true);
|
|
98
|
-
axios_1.default
|
|
128
|
+
axios_1.default
|
|
129
|
+
.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueSearch") })
|
|
99
130
|
.then(function (response) {
|
|
100
131
|
setLoadingReferenceIdentifierValues(false);
|
|
101
|
-
var updatedFieldDefinitions = receiverRequirements.fieldDefinitions
|
|
132
|
+
var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
|
|
102
133
|
var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === fieldDefinitionWithOriginalKey.originalKey; });
|
|
103
|
-
var updatedReferenceIdentifier = __assign({}, updatedFieldDefinitions[index], { properties: {
|
|
134
|
+
var updatedReferenceIdentifier = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: {
|
|
104
135
|
label: updatedFieldDefinitions[index].properties.label,
|
|
105
136
|
href: updatedFieldDefinitions[index].properties.href,
|
|
106
137
|
cardinality: updatedFieldDefinitions[index].properties.cardinality,
|
|
107
|
-
values: response.data.value
|
|
138
|
+
values: response.data.value,
|
|
108
139
|
} });
|
|
109
140
|
updatedFieldDefinitions.splice(index, 1, updatedReferenceIdentifier);
|
|
110
|
-
var newReceiverRequirements = __assign({}, receiverRequirements, { fieldDefinitions: updatedFieldDefinitions });
|
|
141
|
+
var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
|
|
111
142
|
props.updateReceiverRequirementsProp(newReceiverRequirements);
|
|
112
143
|
})
|
|
113
144
|
.catch(function (error) {
|
|
@@ -115,17 +146,21 @@ var ReferenceIdentifiers = function (props) {
|
|
|
115
146
|
});
|
|
116
147
|
}
|
|
117
148
|
}, 500);
|
|
118
|
-
var handleReferenceIdentifierValueValidation = lodash_1.debounce(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setReferenceIdentifierValidateStatus) {
|
|
149
|
+
var handleReferenceIdentifierValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setReferenceIdentifierValidateStatus) {
|
|
119
150
|
if (value.length === 0) {
|
|
120
151
|
setReferenceIdentifierValidateStatus("");
|
|
121
152
|
props.formInstance.resetFields([namePath]);
|
|
122
153
|
}
|
|
123
154
|
else {
|
|
124
|
-
var searchUrl = rapiBaseUrl +
|
|
155
|
+
var searchUrl = rapiBaseUrl +
|
|
156
|
+
"/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
|
|
125
157
|
setReferenceIdentifierValidateStatus("validating");
|
|
126
|
-
axios_1.default
|
|
158
|
+
axios_1.default
|
|
159
|
+
.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueValidation") })
|
|
127
160
|
.then(function (response) {
|
|
128
|
-
response.data
|
|
161
|
+
response.data
|
|
162
|
+
? setReferenceIdentifierValidateStatus("success")
|
|
163
|
+
: setReferenceIdentifierValidateStatus("error");
|
|
129
164
|
})
|
|
130
165
|
.catch(function (error) {
|
|
131
166
|
setReferenceIdentifierValidateStatus("error");
|
|
@@ -133,16 +168,14 @@ var ReferenceIdentifiers = function (props) {
|
|
|
133
168
|
}
|
|
134
169
|
}, 500);
|
|
135
170
|
var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field, referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus) {
|
|
136
|
-
var fieldProps = __assign({}, field, { name: [field.name, "value"],
|
|
137
|
-
// fieldKey: [field.fieldKey, "value"],
|
|
138
|
-
rules: [
|
|
171
|
+
var fieldProps = __assign(__assign({}, field), { name: [field.name, "value"], rules: [
|
|
139
172
|
{
|
|
140
173
|
required: !!(value && value.key),
|
|
141
|
-
message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage)
|
|
142
|
-
}
|
|
174
|
+
message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage),
|
|
175
|
+
},
|
|
143
176
|
] });
|
|
144
177
|
if (value && value.key) {
|
|
145
|
-
var options = ReferenceIdentifierUtility_1.getReferenceIdentifierOptions(receiverRequirements);
|
|
178
|
+
var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
|
|
146
179
|
var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
|
|
147
180
|
if (fieldDefinition_1) {
|
|
148
181
|
var fieldHandling = null;
|
|
@@ -150,11 +183,14 @@ var ReferenceIdentifiers = function (props) {
|
|
|
150
183
|
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
151
184
|
}
|
|
152
185
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
153
|
-
fieldProps = __assign({}, fieldProps, { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true });
|
|
186
|
+
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true });
|
|
154
187
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
155
|
-
react_1.default.createElement(
|
|
188
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key), onBlur: function (event) {
|
|
189
|
+
return handleReferenceIdentifierValueValidation(legalIdentifier, fieldDefinition_1.name, event.currentTarget.value, rapiBaseUrl, ["invoice", "referenceIdentifiers", field.name, "value"], setReferenceIdentifierValidateStatus);
|
|
190
|
+
} })));
|
|
156
191
|
}
|
|
157
|
-
if (fieldDefinition_1.properties.hasOwnProperty("values") &&
|
|
192
|
+
if (fieldDefinition_1.properties.hasOwnProperty("values") &&
|
|
193
|
+
fieldDefinition_1.properties.values /*&& fieldDefinition.properties.values.length > 0*/) {
|
|
158
194
|
var selectProps = fieldDefinition_1.properties.hasOwnProperty("href")
|
|
159
195
|
? {
|
|
160
196
|
showSearch: true,
|
|
@@ -166,24 +202,24 @@ var ReferenceIdentifiers = function (props) {
|
|
|
166
202
|
}
|
|
167
203
|
: {};
|
|
168
204
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
169
|
-
react_1.default.createElement(antd_1.Select, __assign({
|
|
170
|
-
return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
|
|
205
|
+
react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false }, selectProps), fieldDefinition_1.properties.values.map(function (op) {
|
|
206
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
171
207
|
}))));
|
|
172
208
|
}
|
|
173
209
|
else {
|
|
174
210
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
175
|
-
react_1.default.createElement(
|
|
211
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
|
|
176
212
|
}
|
|
177
213
|
}
|
|
178
214
|
else {
|
|
179
215
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
180
|
-
react_1.default.createElement(
|
|
216
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
|
|
181
217
|
}
|
|
182
218
|
}
|
|
183
219
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
184
220
|
react_1.default.createElement(antd_1.Input, { disabled: true })));
|
|
185
221
|
};
|
|
186
|
-
var referenceIdentifiersDefinitions = ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions(props.receiverRequirements);
|
|
222
|
+
var referenceIdentifiersDefinitions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions)(props.receiverRequirements);
|
|
187
223
|
var getSingleReferenceIdentifierInput = function () {
|
|
188
224
|
var fieldHandling = null;
|
|
189
225
|
var fieldDefinition = referenceIdentifiersDefinitions[0];
|
|
@@ -191,18 +227,15 @@ var ReferenceIdentifiers = function (props) {
|
|
|
191
227
|
var singleReferenceIdentifiersHelp;
|
|
192
228
|
if (fieldDefinition.properties.hasOwnProperty("handling") && fieldDefinition.properties.handling) {
|
|
193
229
|
fieldHandling = JSON.parse(fieldDefinition.properties.handling);
|
|
194
|
-
singleReferenceIdentifiersHelp = fieldHandling.hasOwnProperty("helpText")
|
|
230
|
+
singleReferenceIdentifiersHelp = fieldHandling.hasOwnProperty("helpText")
|
|
231
|
+
? fieldHandling.helpText
|
|
232
|
+
: undefined;
|
|
195
233
|
}
|
|
196
|
-
var singleReferenceIdentifierLabelNode = singleReferenceIdentifiersHelp
|
|
197
|
-
? (react_1.default.createElement(antd_1.Tooltip, { title: singleReferenceIdentifiersHelp, placement: "right" },
|
|
198
|
-
react_1.default.createElement("span", null,
|
|
199
|
-
singleReferenceIdentifierLabel,
|
|
200
|
-
"\u00A0",
|
|
201
|
-
react_1.default.createElement(icons_1.QuestionCircleOutlined, null))))
|
|
202
|
-
: singleReferenceIdentifierLabel;
|
|
203
234
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
204
|
-
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"],
|
|
205
|
-
react_1.default.createElement(
|
|
235
|
+
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"], validateStatus: props.referenceIdentifierValidateStatus, hasFeedback: true },
|
|
236
|
+
react_1.default.createElement(__1.UmzInput, { defaultPlaceholder: singleReferenceIdentifierLabel, defaultTooltip: singleReferenceIdentifiersHelp ? singleReferenceIdentifiersHelp : undefined, onBlur: function (event) {
|
|
237
|
+
return handleReferenceIdentifierValueValidation(props.legalIdentifier, fieldDefinition.name, event.currentTarget.value, props.rapiBaseUrl, ["invoice", "singleReferenceIdentifier", "value"], props.setReferenceIdentifierValidateStatus);
|
|
238
|
+
} })));
|
|
206
239
|
}
|
|
207
240
|
if (fieldDefinition.properties.hasOwnProperty("values") && fieldDefinition.properties.values) {
|
|
208
241
|
var selectProps = fieldDefinition.properties.hasOwnProperty("href")
|
|
@@ -210,19 +243,19 @@ var ReferenceIdentifiers = function (props) {
|
|
|
210
243
|
showSearch: true,
|
|
211
244
|
filterOption: false,
|
|
212
245
|
onSearch: function (searchValue) {
|
|
213
|
-
handleReferenceIdentifierValueSearch(searchValue, __assign({}, fieldDefinition, { originalKey: fieldDefinition.key }), props.receiverRequirements, props.rapiBaseUrl);
|
|
246
|
+
handleReferenceIdentifierValueSearch(searchValue, __assign(__assign({}, fieldDefinition), { originalKey: fieldDefinition.key }), props.receiverRequirements, props.rapiBaseUrl);
|
|
214
247
|
},
|
|
215
248
|
loading: loadingReferenceIdentifierValues,
|
|
216
249
|
}
|
|
217
250
|
: {};
|
|
218
|
-
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"]
|
|
219
|
-
react_1.default.createElement(antd_1.Select, __assign({
|
|
220
|
-
return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
|
|
251
|
+
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"] },
|
|
252
|
+
react_1.default.createElement(antd_1.Select, __assign({ placeholder: singleReferenceIdentifierLabel, popupMatchSelectWidth: false }, selectProps), fieldDefinition.properties.values.map(function (op) {
|
|
253
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
221
254
|
}))));
|
|
222
255
|
}
|
|
223
256
|
else {
|
|
224
|
-
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"]
|
|
225
|
-
react_1.default.createElement(
|
|
257
|
+
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"] },
|
|
258
|
+
react_1.default.createElement(__1.UmzInput, { defaultPlaceholder: singleReferenceIdentifierLabel })));
|
|
226
259
|
}
|
|
227
260
|
};
|
|
228
261
|
if (referenceIdentifiersDefinitions.length === 0) {
|
|
@@ -232,32 +265,42 @@ var ReferenceIdentifiers = function (props) {
|
|
|
232
265
|
props.formInstance.setFieldsValue({
|
|
233
266
|
invoice: {
|
|
234
267
|
singleReferenceIdentifier: {
|
|
235
|
-
code: referenceIdentifiersDefinitions[0].key.replace("referenceIdentifier.", "")
|
|
236
|
-
}
|
|
237
|
-
}
|
|
268
|
+
code: referenceIdentifiersDefinitions[0].key.replace("referenceIdentifier.", ""),
|
|
269
|
+
},
|
|
270
|
+
},
|
|
238
271
|
});
|
|
239
|
-
return
|
|
272
|
+
return getSingleReferenceIdentifierInput();
|
|
240
273
|
}
|
|
241
274
|
else {
|
|
242
275
|
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
243
276
|
var add = _a.add, remove = _a.remove;
|
|
244
|
-
return
|
|
245
|
-
|
|
277
|
+
return fields.map(function (field, index) {
|
|
278
|
+
var _a;
|
|
279
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({ key: "referenceIdentifier-".concat(index) }, (index === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { style: { marginBottom: 0 } }),
|
|
246
280
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 0] },
|
|
247
281
|
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
248
|
-
react_1.default.createElement(antd_1.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
282
|
+
react_1.default.createElement(antd_1.Row, { gutter: 10 },
|
|
283
|
+
react_1.default.createElement(antd_1.Col, { span: index === 0 ? 22 : 24 },
|
|
284
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"], rules: [{ required: false }] }),
|
|
285
|
+
react_1.default.createElement(antd_1.Select, { labelInValue: true, allowClear: true, style: { width: "100%" }, popupMatchSelectWidth: false, placeholder: referenceIdentifiersLabel, onChange: function (a) {
|
|
286
|
+
var newState = referenceIdentifierValue.slice();
|
|
287
|
+
newState.splice(index, 1, a);
|
|
288
|
+
setReferenceIdentifierValue(newState);
|
|
289
|
+
props.setReferenceIdentifierValidateStatus("");
|
|
290
|
+
props.formInstance.resetFields([
|
|
291
|
+
["invoice", "referenceIdentifiers", index, "value"],
|
|
292
|
+
]);
|
|
293
|
+
} }, getReferenceIdentifier(props.receiverRequirements)))),
|
|
294
|
+
index === 0 && (react_1.default.createElement(antd_1.Col, { span: 2, style: {
|
|
295
|
+
alignContent: "center",
|
|
296
|
+
marginBottom: (_a = token.Form) === null || _a === void 0 ? void 0 : _a.itemMarginBottom,
|
|
297
|
+
} },
|
|
298
|
+
react_1.default.createElement(antd_1.Flex, { align: "center" },
|
|
299
|
+
react_1.default.createElement(__1.UmzTooltip, { title: referenceIdentifiersHelpTextNode })),
|
|
300
|
+
" ")))),
|
|
258
301
|
react_1.default.createElement(antd_1.Col, { span: 12 }, getReferenceIdentifierValueFormItemInput(referenceIdentifierValue[index], props.receiverRequirements, props.rapiBaseUrl, props.legalIdentifier, field, props.referenceIdentifierValidateStatus, props.setReferenceIdentifierValidateStatus)))));
|
|
259
|
-
})
|
|
302
|
+
});
|
|
260
303
|
}));
|
|
261
304
|
}
|
|
262
305
|
};
|
|
263
|
-
exports.default = react_intl_1.injectIntl(ReferenceIdentifiers);
|
|
306
|
+
exports.default = (0, react_intl_1.injectIntl)(ReferenceIdentifiers);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { FormInstance } from "antd/es/form";
|
|
3
|
-
import {
|
|
3
|
+
import { WrappedComponentProps } from "react-intl";
|
|
4
4
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
5
5
|
import { ValidateStatus } from "antd/lib/form/FormItem";
|
|
6
|
-
interface Props extends
|
|
6
|
+
interface Props extends WrappedComponentProps {
|
|
7
7
|
receiverRequirements: NewReceiverRequirements;
|
|
8
8
|
form: FormInstance;
|
|
9
9
|
documentType: "creditNote" | "invoice";
|
|
@@ -15,8 +15,54 @@ interface Props extends InjectedIntlProps {
|
|
|
15
15
|
referenceIdentifierValidateStatus: ValidateStatus;
|
|
16
16
|
setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
|
|
17
17
|
dueDateMinimumOffset: number;
|
|
18
|
+
isSaveFieldValuesSelected: boolean;
|
|
19
|
+
onSaveFieldValuesChange: () => void;
|
|
18
20
|
}
|
|
19
|
-
declare const
|
|
20
|
-
|
|
21
|
+
export declare const translationMessages: {
|
|
22
|
+
baseInformation_title: {
|
|
23
|
+
id: string;
|
|
24
|
+
defaultMessage: string;
|
|
25
|
+
};
|
|
26
|
+
baseInformation_invoiceNo: {
|
|
27
|
+
id: string;
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
};
|
|
30
|
+
baseInformation_issueDate: {
|
|
31
|
+
id: string;
|
|
32
|
+
defaultMessage: string;
|
|
33
|
+
};
|
|
34
|
+
baseInformation_issueDate_title: {
|
|
35
|
+
id: string;
|
|
36
|
+
defaultMessage: string;
|
|
37
|
+
};
|
|
38
|
+
baseInformation_dueDate: {
|
|
39
|
+
id: string;
|
|
40
|
+
defaultMessage: string;
|
|
41
|
+
};
|
|
42
|
+
baseInformation_dueDate_title: {
|
|
43
|
+
id: string;
|
|
44
|
+
defaultMessage: string;
|
|
45
|
+
};
|
|
46
|
+
baseInformation_buyerReferenceLabel: {
|
|
47
|
+
id: string;
|
|
48
|
+
defaultMessage: string;
|
|
49
|
+
};
|
|
50
|
+
baseInformation_buyerReferenceLabel_helpText: {
|
|
51
|
+
id: string;
|
|
52
|
+
defaultMessage: string;
|
|
53
|
+
};
|
|
54
|
+
baseInformation_projectReferenceLabel: {
|
|
55
|
+
id: string;
|
|
56
|
+
defaultMessage: string;
|
|
57
|
+
};
|
|
58
|
+
baseInformation_dueDateErrorMsg: {
|
|
59
|
+
id: string;
|
|
60
|
+
defaultMessage: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
declare const BaseInformationIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
64
|
+
forwardedRef?: React.Ref<any> | undefined;
|
|
65
|
+
} & React.RefAttributes<any>> & {
|
|
66
|
+
WrappedComponent: React.ComponentType<Props>;
|
|
21
67
|
};
|
|
22
68
|
export default BaseInformationIntl;
|