@unimaze/billing 0.20.17 → 0.21.0

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.
Files changed (114) hide show
  1. package/lib/common/components/CommonTranslations.d.ts +102 -2
  2. package/lib/common/components/CommonTranslations.js +10 -1
  3. package/lib/common/components/attachments/Attachment.d.ts +6 -4
  4. package/lib/common/components/attachments/Attachment.js +26 -10
  5. package/lib/common/components/attachments/AttachmentModal.d.ts +21 -0
  6. package/lib/common/components/attachments/AttachmentModal.js +195 -0
  7. package/lib/common/components/attachments/index.d.ts +13 -17
  8. package/lib/common/components/attachments/index.js +189 -23
  9. package/lib/common/components/base-information/AccountingCost.d.ts +7 -5
  10. package/lib/common/components/base-information/AccountingCost.js +32 -11
  11. package/lib/common/components/base-information/OrderReference.d.ts +6 -4
  12. package/lib/common/components/base-information/OrderReference.js +31 -14
  13. package/lib/common/components/base-information/ProjectReference.d.ts +9 -5
  14. package/lib/common/components/base-information/ProjectReference.js +8 -6
  15. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +32 -5
  16. package/lib/common/components/base-information/ReferenceIdentifiers.js +126 -83
  17. package/lib/common/components/base-information/index.d.ts +51 -5
  18. package/lib/common/components/base-information/index.js +99 -154
  19. package/lib/common/components/billing-lines/BillingCalculations.d.ts +7 -5
  20. package/lib/common/components/billing-lines/BillingCalculations.js +79 -46
  21. package/lib/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
  22. package/lib/common/components/billing-lines/BillingLinePreview.js +41 -0
  23. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +6 -4
  24. package/lib/common/components/billing-lines/BillingTaxSummary.js +39 -13
  25. package/lib/common/components/billing-lines/NewBillingLines.d.ts +120 -4
  26. package/lib/common/components/billing-lines/NewBillingLines.js +396 -72
  27. package/lib/common/components/billing-lines/index.d.ts +33 -6
  28. package/lib/common/components/billing-lines/index.js +71 -244
  29. package/lib/common/components/component-container/Content.d.ts +2 -2
  30. package/lib/common/components/component-container/index.d.ts +1 -0
  31. package/lib/common/components/component-container/index.js +1 -1
  32. package/lib/common/components/customer/CostCenter.d.ts +6 -4
  33. package/lib/common/components/customer/CostCenter.js +25 -9
  34. package/lib/common/components/customer/CustomerContactName.d.ts +6 -4
  35. package/lib/common/components/customer/CustomerContactName.js +24 -8
  36. package/lib/common/components/customer/hardCoddedCustomer.js +19 -3
  37. package/lib/common/components/customer/index.d.ts +11 -5
  38. package/lib/common/components/customer/index.js +97 -42
  39. package/lib/common/components/date-picker/index.d.ts +21 -0
  40. package/lib/common/components/date-picker/index.js +23 -0
  41. package/lib/common/components/delivery-location/index.d.ts +6 -4
  42. package/lib/common/components/delivery-location/index.js +20 -4
  43. package/lib/common/components/editable-cell/index.js +2 -2
  44. package/lib/common/components/editable-row/index.d.ts +1 -1
  45. package/lib/common/components/editable-row/index.js +24 -7
  46. package/lib/common/components/form-item/index.d.ts +13 -6
  47. package/lib/common/components/form-item/index.js +16 -20
  48. package/lib/common/components/index.d.ts +10 -0
  49. package/lib/common/components/index.js +30 -8
  50. package/lib/common/components/input/index.d.ts +23 -0
  51. package/lib/common/components/input/index.js +37 -0
  52. package/lib/common/components/invoice/index.d.ts +40 -0
  53. package/lib/common/components/invoice/index.js +52 -0
  54. package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  55. package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
  56. package/lib/common/components/invoice-preview/index.d.ts +16 -0
  57. package/lib/common/components/invoice-preview/index.js +393 -0
  58. package/lib/common/components/locale-intl/index.d.ts +0 -10
  59. package/lib/common/components/locale-intl/index.js +50 -42
  60. package/lib/common/components/payment-method/index.d.ts +69 -6
  61. package/lib/common/components/payment-method/index.js +145 -57
  62. package/lib/common/components/payment-method/paymentMethodForConversion.js +3 -1
  63. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  64. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  65. package/lib/common/components/submit-confirmation/index.d.ts +8 -0
  66. package/lib/common/components/submit-confirmation/index.js +34 -0
  67. package/lib/common/components/supplier/CityAutofill.d.ts +18 -0
  68. package/lib/common/components/supplier/CityAutofill.js +159 -0
  69. package/lib/common/components/supplier/index.d.ts +79 -5
  70. package/lib/common/components/supplier/index.js +195 -103
  71. package/lib/common/components/tooltip/index.d.ts +7 -0
  72. package/lib/common/components/tooltip/index.js +15 -0
  73. package/lib/common/components/welcome-modal/index.d.ts +15 -0
  74. package/lib/common/components/welcome-modal/index.js +26 -0
  75. package/lib/common/consts/formLayout.js +4 -3
  76. package/lib/common/consts/validationRules.d.ts +1 -1
  77. package/lib/common/consts/validationRules.js +6 -0
  78. package/lib/common/enums/index.js +5 -1
  79. package/lib/common/style/index.css +18 -0
  80. package/lib/common/types/BillingLineMetadataOverride.d.ts +2 -0
  81. package/lib/common/types/CommonProps.d.ts +15 -1
  82. package/lib/common/types/DiscountType.d.ts +1 -0
  83. package/lib/common/types/DiscountType.js +2 -0
  84. package/lib/common/types/ReceiverRequirements.d.ts +1 -1
  85. package/lib/common/types/ReceiverRequirements.js +1 -0
  86. package/lib/common/types/index.js +15 -0
  87. package/lib/create-invoice/IntlLoader.d.ts +0 -6
  88. package/lib/create-invoice/IntlLoader.js +78 -13
  89. package/lib/create-invoice/index.d.ts +65 -4
  90. package/lib/create-invoice/index.js +437 -181
  91. package/lib/enums.d.ts +2 -3
  92. package/lib/enums.js +1 -0
  93. package/lib/index.js +22 -6
  94. package/lib/translations/locales/en.json +181 -0
  95. package/lib/translations/locales/is.json +135 -116
  96. package/lib/translations/locales.d.ts +360 -161
  97. package/lib/translations/locales.js +3 -2
  98. package/lib/utils/ApiUtility.d.ts +4 -4
  99. package/lib/utils/ApiUtility.js +13 -10
  100. package/lib/utils/BillingLineUtility.d.ts +16 -5
  101. package/lib/utils/BillingLineUtility.js +65 -26
  102. package/lib/utils/ConversionUtility.js +15 -7
  103. package/lib/utils/FileUploadUtility.d.ts +4 -2
  104. package/lib/utils/FileUploadUtility.js +28 -9
  105. package/lib/utils/IntlUtility.d.ts +3 -2
  106. package/lib/utils/IntlUtility.js +2 -1
  107. package/lib/utils/LocationUtility.d.ts +1 -0
  108. package/lib/utils/LocationUtility.js +81 -0
  109. package/lib/utils/ReferenceIdentifierUtility.js +2 -1
  110. package/lib/utils/RequirementsUtility.d.ts +9 -7
  111. package/lib/utils/RequirementsUtility.js +46 -22
  112. package/lib/utils/index.js +4 -3
  113. package/package.json +36 -18
  114. package/lib/style/index.css +0 -51
@@ -1,48 +1,214 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
2
18
  var __importStar = (this && this.__importStar) || function (mod) {
3
19
  if (mod && mod.__esModule) return mod;
4
20
  var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
7
23
  return result;
8
24
  };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
9
61
  var __importDefault = (this && this.__importDefault) || function (mod) {
10
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
63
  };
12
64
  Object.defineProperty(exports, "__esModule", { value: true });
13
65
  var React = __importStar(require("react"));
14
- var components_1 = require("../../components");
15
- var Attachment_1 = __importDefault(require("./Attachment"));
16
66
  var react_intl_1 = require("react-intl");
17
67
  var antd_1 = require("antd");
18
68
  var icons_1 = require("@ant-design/icons");
19
- var translationMessages = react_intl_1.defineMessages({
69
+ var AttachmentModal_1 = __importDefault(require("./AttachmentModal"));
70
+ var react_use_1 = require("react-use");
71
+ var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
72
+ var translationMessages = (0, react_intl_1.defineMessages)({
20
73
  attachment_title: {
21
74
  id: "attachment_title",
22
75
  defaultMessage: "Attachments",
23
76
  },
24
77
  attachment_tooltip_title: {
25
78
  id: "attachment_tooltip_title",
26
- defaultMessage: "The maximum size is {uploadSizeLimit}KB. Accepted file formats are JPG, PNG, PDF, CSV, XLSX and ODS.. Enclosed documents can be a copy of the original invoice, or timesheets for example."
79
+ defaultMessage: "The maximum size is {uploadSizeLimit}KB. Accepted file formats are JPG, PNG, PDF, CSV, XLSX and ODS.. Enclosed documents can be a copy of the original invoice, or timesheets for example.",
80
+ },
81
+ attachment_addAttachmentButton_title: {
82
+ id: "attachment_addAttachmentButton_title",
83
+ defaultMessage: "Add attachment",
27
84
  },
28
85
  });
29
86
  var AttachmentsGroup = function (props) {
30
- var tooltipTitle = (props.languageString === "en" || props.languageString === "is") && props.attachmentTooltipText
31
- ? props.attachmentTooltipText[props.languageString]
32
- : props.intl.formatMessage(translationMessages.attachment_tooltip_title, { uploadSizeLimit: props.uploadSizeLimit / 1024 });
33
- var attachmentLabelNode = (React.createElement(antd_1.Tooltip, { title: tooltipTitle, placement: "right" },
34
- React.createElement("span", null,
35
- props.intl.formatMessage(translationMessages.attachment_title),
36
- " ",
37
- React.createElement(icons_1.QuestionCircleOutlined, null))));
38
- return (React.createElement(components_1.ComponentContainer, { title: attachmentLabelNode },
39
- React.createElement(antd_1.Row, { gutter: [16, 16] },
40
- React.createElement(antd_1.Col, { span: 8 },
41
- React.createElement(Attachment_1.default, { key: "attachment1", fieldName: "file1", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit, file: props.file1, setFile: props.setFile1, attachmentFieldValidation: props.attachmentFieldValidation1, setAttachmentFieldValidation: props.setAttachmentFieldValidation1 })),
42
- React.createElement(antd_1.Col, { span: 8 },
43
- React.createElement(Attachment_1.default, { key: "attachment2", fieldName: "file2", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit, file: props.file2, setFile: props.setFile2, attachmentFieldValidation: props.attachmentFieldValidation2, setAttachmentFieldValidation: props.setAttachmentFieldValidation2 })),
44
- React.createElement(antd_1.Col, { span: 8 },
45
- React.createElement(Attachment_1.default, { key: "attachment3", fieldName: "file3", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit, file: props.file3, setFile: props.setFile3, attachmentFieldValidation: props.attachmentFieldValidation3, setAttachmentFieldValidation: props.setAttachmentFieldValidation3 })))));
87
+ var _a = React.useState(false), isModalOpen = _a[0], setIsModalOpen = _a[1];
88
+ var _b = React.useState([]), attachments = _b[0], setAttachments = _b[1];
89
+ var _c = React.useState(false), displayAttachments = _c[0], setDisplayAttachments = _c[1];
90
+ var _d = React.useState(false), previewOpen = _d[0], setPreviewOpen = _d[1];
91
+ var _e = React.useState(undefined), previewImage = _e[0], setPreviewImage = _e[1];
92
+ var _f = React.useState(""), previewDescription = _f[0], setPreviewDescription = _f[1];
93
+ var _g = React.useState(""), previewPDFUrl = _g[0], setPreviewPDFUrl = _g[1];
94
+ var width = (0, react_use_1.useWindowSize)().width;
95
+ var _h = React.useState(false), isMobile = _h[0], setIsMobile = _h[1];
96
+ var token = antd_1.theme.useToken().token;
97
+ React.useEffect(function () {
98
+ if (width < 768) {
99
+ setIsMobile(true);
100
+ }
101
+ else {
102
+ setIsMobile(false);
103
+ }
104
+ }, [width]);
105
+ var removeFile = function (file) {
106
+ var updatedAttachments = attachments.filter(function (attachment) { return attachment.file.uid !== file.uid; });
107
+ setAttachments(updatedAttachments);
108
+ };
109
+ var clearFileFields = function (file) {
110
+ var fileIndex = attachments.findIndex(function (attachment) { return attachment.file.uid === file.uid; });
111
+ if (fileIndex === -1)
112
+ return;
113
+ props.formInstance.setFields([
114
+ {
115
+ name: ["attachments", "file".concat(fileIndex + 1), "file"],
116
+ value: undefined,
117
+ },
118
+ ]);
119
+ props.formInstance.setFields([
120
+ {
121
+ name: ["attachments", "file".concat(fileIndex + 1), "description"],
122
+ value: undefined,
123
+ },
124
+ ]);
125
+ };
126
+ var handlePreview = function (file, description) { return __awaiter(void 0, void 0, void 0, function () {
127
+ var reader, _a;
128
+ return __generator(this, function (_b) {
129
+ switch (_b.label) {
130
+ case 0:
131
+ if (!file.originFileObj)
132
+ return [2 /*return*/];
133
+ if (!(file.type === "application/pdf")) return [3 /*break*/, 1];
134
+ reader = new FileReader();
135
+ reader.onload = function (e) {
136
+ var blob = file.originFileObj ? new Blob([file.originFileObj], { type: "application/pdf" }) : null;
137
+ if (blob) {
138
+ var url = URL.createObjectURL(blob);
139
+ setPreviewPDFUrl(url);
140
+ }
141
+ };
142
+ reader.readAsArrayBuffer(file.originFileObj);
143
+ return [3 /*break*/, 4];
144
+ case 1:
145
+ if (!(!file.url && !file.preview)) return [3 /*break*/, 3];
146
+ _a = file;
147
+ return [4 /*yield*/, (0, FileUploadUtility_1.getBase64)(file.originFileObj)];
148
+ case 2:
149
+ _a.preview = (_b.sent());
150
+ _b.label = 3;
151
+ case 3:
152
+ setPreviewImage(file.url || file.preview);
153
+ _b.label = 4;
154
+ case 4:
155
+ setPreviewDescription(description);
156
+ setPreviewOpen(true);
157
+ return [2 /*return*/];
158
+ }
159
+ });
160
+ }); };
161
+ var handleClosePreview = function () {
162
+ if (previewPDFUrl) {
163
+ URL.revokeObjectURL(previewPDFUrl);
164
+ setPreviewPDFUrl("");
165
+ }
166
+ if (previewImage) {
167
+ setPreviewImage("");
168
+ }
169
+ setPreviewDescription("");
170
+ setPreviewOpen(false);
171
+ };
172
+ var saveFiles = function () {
173
+ setDisplayAttachments(true);
174
+ setIsModalOpen(false);
175
+ };
176
+ return (React.createElement(antd_1.Flex, { style: {
177
+ backgroundColor: token.colorInfoBg,
178
+ margin: isMobile ? "0 -20px" : 0,
179
+ width: isMobile ? "100vw" : "100%",
180
+ padding: isMobile ? "20px" : "35px 0",
181
+ }, justify: "center" },
182
+ React.createElement(antd_1.Flex, { vertical: true, style: { width: "100%", maxWidth: "900px" }, gap: "small" },
183
+ React.createElement(antd_1.Typography.Title, { level: 5, style: { margin: 0 } }, props.intl.formatMessage(translationMessages.attachment_title)),
184
+ React.createElement(antd_1.Typography.Text, { type: "secondary" }, (props.languageString === "en" || props.languageString === "is") && props.attachmentTooltipText
185
+ ? props.attachmentTooltipText[props.languageString]
186
+ : props.intl.formatMessage(translationMessages.attachment_tooltip_title, {
187
+ uploadSizeLimit: props.uploadSizeLimit / 1024,
188
+ })),
189
+ React.createElement(antd_1.Button, { size: "large", style: { width: "100%" }, onClick: function () { return setIsModalOpen(true); }, icon: React.createElement(icons_1.PaperClipOutlined, null) }, props.intl.formatMessage(translationMessages.attachment_addAttachmentButton_title)),
190
+ displayAttachments && attachments.length > 0 && (React.createElement(antd_1.Flex, { vertical: true, gap: "small" },
191
+ React.createElement(antd_1.Flex, { vertical: true },
192
+ React.createElement(antd_1.Typography.Text, { disabled: true }, props.intl.formatMessage(translationMessages.attachment_title))),
193
+ React.createElement(antd_1.Divider, { style: { padding: 0, margin: 0 } }),
194
+ attachments.map(function (attachment) { return (React.createElement(React.Fragment, null,
195
+ React.createElement(antd_1.Flex, { gap: "middle", justify: "space-between" },
196
+ React.createElement(antd_1.Button, { type: "link", onClick: function () { return handlePreview(attachment.file, attachment.description); }, style: { padding: 0 }, size: "small" },
197
+ React.createElement(icons_1.PaperClipOutlined, { style: { fontSize: token.fontSizeIcon } }),
198
+ attachment.file.name),
199
+ React.createElement(antd_1.Flex, { gap: "middle" },
200
+ React.createElement(icons_1.EditOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
201
+ setIsModalOpen(true);
202
+ } }),
203
+ React.createElement(icons_1.DeleteOutlined, { style: { fontSize: token.fontSizeHeading4 }, onClick: function () {
204
+ removeFile(attachment.file);
205
+ clearFileFields(attachment.file);
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 }),
208
+ React.createElement(antd_1.Modal, { open: previewOpen, onCancel: handleClosePreview, footer: null },
209
+ previewPDFUrl && (React.createElement("iframe", { src: previewPDFUrl, style: { width: "100%", height: "700px", maxHeight: "75vh" } })),
210
+ previewImage && React.createElement(antd_1.Image, { src: previewImage, preview: false }),
211
+ React.createElement(antd_1.Typography.Text, null, previewDescription)))));
46
212
  };
47
- var AttachmentGroupIntl = react_intl_1.injectIntl(AttachmentsGroup);
213
+ var AttachmentGroupIntl = (0, react_intl_1.injectIntl)(AttachmentsGroup);
48
214
  exports.default = AttachmentGroupIntl;
@@ -1,15 +1,17 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
3
3
  import { FormInstance } from "antd/es/form";
4
- import { InjectedIntlProps } from "react-intl";
5
- interface Props extends InjectedIntlProps {
4
+ import { WrappedComponentProps } from "react-intl";
5
+ interface Props extends WrappedComponentProps {
6
6
  receiverRequirements: NewReceiverRequirements;
7
7
  updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void;
8
8
  formInstance: FormInstance;
9
9
  rapiBaseUrl: string;
10
10
  legalIdentifier: string;
11
11
  }
12
- declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier">, any> & {
13
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
12
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
13
+ forwardedRef?: React.Ref<any> | undefined;
14
+ } & React.RefAttributes<any>> & {
15
+ WrappedComponent: React.ComponentType<Props>;
14
16
  };
15
17
  export default _default;
@@ -1,9 +1,25 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
2
18
  var __importStar = (this && this.__importStar) || function (mod) {
3
19
  if (mod && mod.__esModule) return mod;
4
20
  var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
7
23
  return result;
8
24
  };
9
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
@@ -15,26 +31,31 @@ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
15
31
  var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
16
32
  var form_item_1 = __importDefault(require("../form-item"));
17
33
  var react_intl_1 = require("react-intl");
18
- var translationMessages = react_intl_1.defineMessages({
34
+ var tooltip_1 = __importDefault(require("../tooltip"));
35
+ var antd_1 = require("antd");
36
+ var translationMessages = (0, react_intl_1.defineMessages)({
19
37
  baseInformation_accountingCostLabel: {
20
38
  id: "baseInformation_accountingCostLabel",
21
- defaultMessage: "Accounting cost"
39
+ defaultMessage: "Accounting cost",
22
40
  },
23
41
  baseInformation_accountingCostLabel_helpText: {
24
42
  id: "baseInformation_accountingCostLabel_helpText",
25
- defaultMessage: "Accounting cost is a code provided by the buyer, either via phone or e-mail or taken directly from the an order associated with the invoice"
43
+ defaultMessage: "Accounting cost is a code provided by the buyer, either via phone or e-mail or taken directly from the an order associated with the invoice",
26
44
  },
27
45
  });
28
46
  var AccountingCost = function (props) {
29
- var _a = react_1.useState(""), accountingCostHandlingValidationStatus = _a[0], setAccountingCostHandlingValidationStatus = _a[1];
30
- var _b = react_1.useState({}), accountingCostFieldProps = _b[0], setAccountingCostFieldProps = _b[1];
31
- var _c = react_1.useState(false), loadingAccountingCostValues = _c[0], setLoadingAccountingCostValues = _c[1];
32
- var accountingCostFieldDefinition = RequirementsUtility_1.getFieldRequirements(props.receiverRequirements, ReceiverRequirements_1.AvailableFields.accountingCost);
47
+ var _a = (0, react_1.useState)(""), accountingCostHandlingValidationStatus = _a[0], setAccountingCostHandlingValidationStatus = _a[1];
48
+ var _b = (0, react_1.useState)({}), accountingCostFieldProps = _b[0], setAccountingCostFieldProps = _b[1];
49
+ var _c = (0, react_1.useState)(false), loadingAccountingCostValues = _c[0], setLoadingAccountingCostValues = _c[1];
50
+ var accountingCostFieldDefinition = (0, RequirementsUtility_1.getFieldRequirements)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields.accountingCost);
33
51
  if (accountingCostFieldDefinition) {
34
- return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.accountingCost, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_accountingCostLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_accountingCostLabel_helpText), defaultIsRequired: false, fieldName: ["invoice", "accountingCost"], validateStatus: accountingCostHandlingValidationStatus, hasFeedback: true }, RequirementsUtility_1.getInput(accountingCostFieldDefinition, ["invoice", "accountingCost"], "handleAccountingCostValidation", props.legalIdentifier, props.formInstance, props.rapiBaseUrl, props.receiverRequirements, props.updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setAccountingCostHandlingValidationStatus)));
52
+ return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.accountingCost, defaultIsRequired: false, fieldName: ["invoice", "accountingCost"], validateStatus: accountingCostHandlingValidationStatus, hasFeedback: true },
53
+ react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "center" },
54
+ (0, RequirementsUtility_1.getInput)(accountingCostFieldDefinition, ["invoice", "accountingCost"], "handleAccountingCostValidation", props.legalIdentifier, props.formInstance, props.rapiBaseUrl, props.receiverRequirements, props.updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setAccountingCostHandlingValidationStatus, props.intl.formatMessage(translationMessages.baseInformation_accountingCostLabel)),
55
+ react_1.default.createElement(tooltip_1.default, { title: props.intl.formatMessage(translationMessages.baseInformation_accountingCostLabel_helpText) }))));
35
56
  }
36
57
  else {
37
58
  return null;
38
59
  }
39
60
  };
40
- exports.default = react_intl_1.injectIntl(AccountingCost);
61
+ exports.default = (0, react_intl_1.injectIntl)(AccountingCost);
@@ -1,14 +1,16 @@
1
1
  import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
2
2
  import * as React from "react";
3
- import { InjectedIntlProps } from "react-intl";
3
+ import { WrappedComponentProps } from "react-intl";
4
4
  import { FormInstance } from "antd/es/form";
5
5
  import { NamePath } from "rc-field-form/lib/interface";
6
- interface Props extends InjectedIntlProps {
6
+ interface Props extends WrappedComponentProps {
7
7
  receiverRequirements: NewReceiverRequirements;
8
8
  formInstance: FormInstance;
9
9
  dependencies: NamePath[];
10
10
  }
11
- declare const _default: React.ComponentClass<Pick<Props, "dependencies" | "formInstance" | "receiverRequirements">, any> & {
12
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
11
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
12
+ forwardedRef?: React.Ref<any> | undefined;
13
+ } & React.RefAttributes<any>> & {
14
+ WrappedComponent: React.ComponentType<Props>;
13
15
  };
14
16
  export default _default;
@@ -1,41 +1,58 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
5
18
  var __importStar = (this && this.__importStar) || function (mod) {
6
19
  if (mod && mod.__esModule) return mod;
7
20
  var result = {};
8
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
9
- result["default"] = mod;
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
10
23
  return result;
11
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
12
28
  Object.defineProperty(exports, "__esModule", { value: true });
13
29
  var form_item_1 = __importDefault(require("../form-item"));
14
30
  var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
15
- var antd_1 = require("antd");
16
31
  var React = __importStar(require("react"));
17
32
  var react_intl_1 = require("react-intl");
18
- var translationMessages = react_intl_1.defineMessages({
33
+ var __1 = require("..");
34
+ var translationMessages = (0, react_intl_1.defineMessages)({
19
35
  baseInformation_orderReferenceLabel: {
20
36
  id: "baseInformation_orderReferenceLabel",
21
- defaultMessage: "Order number"
37
+ defaultMessage: "Order number",
22
38
  },
23
39
  baseInformation_orderReferenceLabel_helpText: {
24
40
  id: "baseInformation_orderReferenceLabel_helpText",
25
- defaultMessage: "Only use a reference to an actual order here. If no order exists, the buyer reference must be specified."
41
+ defaultMessage: "Only use a reference to an actual order here. If no order exists, the buyer reference must be specified.",
26
42
  },
27
43
  });
28
44
  var getOrderReferenceFieldDefinitions = function (receiverRequirements) {
29
- return receiverRequirements && receiverRequirements.fieldDefinitions.find(function (fieldRequirement) { return fieldRequirement.key === "orderReference.documentNo"; });
45
+ return (receiverRequirements &&
46
+ receiverRequirements.fieldDefinitions.find(function (fieldRequirement) { return fieldRequirement.key === "orderReference.documentNo"; }));
30
47
  };
31
48
  var OrderReference = function (props) {
32
49
  if (getOrderReferenceFieldDefinitions(props.receiverRequirements)) {
33
- var required = !(props.formInstance.getFieldValue(["invoice", "buyerReference"]));
34
- return React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: props.dependencies, receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel_helpText), defaultIsRequired: required, fieldName: ["invoice", "orderReference", "documentNo"] },
35
- React.createElement(antd_1.Input, null));
50
+ var required = !props.formInstance.getFieldValue(["invoice", "buyerReference"]);
51
+ return (React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: props.dependencies, receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel_helpText), defaultIsRequired: required, fieldName: ["invoice", "orderReference", "documentNo"] },
52
+ React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultIsRequired: required, defaultPlaceholder: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel), defaultTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel_helpText) })));
36
53
  }
37
54
  else {
38
55
  return null;
39
56
  }
40
57
  };
41
- exports.default = react_intl_1.injectIntl(OrderReference);
58
+ exports.default = (0, react_intl_1.injectIntl)(OrderReference);
@@ -1,10 +1,14 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
3
- import { InjectedIntlProps } from "react-intl";
4
- interface Props extends InjectedIntlProps {
3
+ import { WrappedComponentProps } from "react-intl";
4
+ import { FormInstance } from "antd";
5
+ interface Props extends WrappedComponentProps {
5
6
  receiverRequirements: NewReceiverRequirements;
7
+ form: FormInstance;
6
8
  }
7
- declare const _default: React.ComponentClass<Pick<Props, "receiverRequirements">, any> & {
8
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
10
+ forwardedRef?: React.Ref<any> | undefined;
11
+ } & React.RefAttributes<any>> & {
12
+ WrappedComponent: React.ComponentType<Props>;
9
13
  };
10
14
  export default _default;
@@ -8,21 +8,23 @@ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
8
8
  var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
9
9
  var form_item_1 = __importDefault(require("../form-item"));
10
10
  var react_intl_1 = require("react-intl");
11
- var antd_1 = require("antd");
12
- var translationMessages = react_intl_1.defineMessages({
11
+ var __1 = require("..");
12
+ var translationMessages = (0, react_intl_1.defineMessages)({
13
13
  baseInformation_projectReferenceLabel: {
14
14
  id: "baseInformation_projectReferenceLabel",
15
- defaultMessage: "Project reference"
15
+ defaultMessage: "Project reference",
16
16
  },
17
17
  });
18
18
  var ProjectReference = function (props) {
19
- var projectReferenceFieldDefinition = RequirementsUtility_1.getFieldRequirements(props.receiverRequirements, ReceiverRequirements_1.AvailableFields['documentReferences.project.documentNo']);
19
+ var _a, _b, _c;
20
+ var projectReferenceFieldDefinition = (0, RequirementsUtility_1.getFieldRequirements)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["documentReferences.project.documentNo"]);
21
+ var formData = props.form.getFieldsValue();
20
22
  if (projectReferenceFieldDefinition) {
21
23
  return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["documentReferences.project.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_projectReferenceLabel), defaultIsRequired: false, fieldName: ["invoice", "documentReferences", "project", "documentNo"] },
22
- react_1.default.createElement(antd_1.Input, null)));
24
+ react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["documentReferences.project.documentNo"], defaultPlaceholder: props.intl.formatMessage(translationMessages.baseInformation_projectReferenceLabel), defaultValue: (_c = (_b = (_a = formData.invoice) === null || _a === void 0 ? void 0 : _a.documentReferences) === null || _b === void 0 ? void 0 : _b.project) === null || _c === void 0 ? void 0 : _c.documentNo })));
23
25
  }
24
26
  else {
25
27
  return null;
26
28
  }
27
29
  };
28
- exports.default = react_intl_1.injectIntl(ProjectReference);
30
+ exports.default = (0, react_intl_1.injectIntl)(ProjectReference);
@@ -1,10 +1,35 @@
1
1
  import React from "react";
2
- import { InjectedIntlProps } from "react-intl";
2
+ import { WrappedComponentProps } from "react-intl";
3
3
  import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
4
4
  import { FormInstance } from "antd/es/form";
5
5
  import { ValidateStatus } from "antd/lib/form/FormItem";
6
- export declare const translationMessages: ReactIntl.Messages<"referenceIdentifiers_labels_addButton" | "referenceIdentifiers_labels_referenceIdentifier" | "referenceIdentifiers_labels_referenceIdentifier_title" | "referenceIdentifiers_labels_AKG" | "referenceIdentifiers_labels_ARR" | "referenceIdentifiers_labels_LOC">;
7
- interface Props extends InjectedIntlProps {
6
+ export declare const translationMessages: {
7
+ referenceIdentifiers_labels_addButton: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ };
11
+ referenceIdentifiers_labels_referenceIdentifier: {
12
+ id: string;
13
+ defaultMessage: string;
14
+ };
15
+ referenceIdentifiers_labels_referenceIdentifier_title: {
16
+ id: string;
17
+ defaultMessage: string;
18
+ };
19
+ referenceIdentifiers_labels_AKG: {
20
+ id: string;
21
+ defaultMessage: string;
22
+ };
23
+ referenceIdentifiers_labels_ARR: {
24
+ id: string;
25
+ defaultMessage: string;
26
+ };
27
+ referenceIdentifiers_labels_LOC: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ };
31
+ };
32
+ interface Props extends WrappedComponentProps {
8
33
  receiverRequirements: NewReceiverRequirements;
9
34
  formInstance: FormInstance;
10
35
  updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
@@ -15,7 +40,9 @@ interface Props extends InjectedIntlProps {
15
40
  referenceIdentifierValidateStatus: ValidateStatus;
16
41
  setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
17
42
  }
18
- declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier" | "referenceIdentifiersLabelText" | "referenceIdentifiersHelpText" | "referenceIdentifierValidateStatus" | "setReferenceIdentifierValidateStatus">, any> & {
19
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
43
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
44
+ forwardedRef?: React.Ref<any> | undefined;
45
+ } & React.RefAttributes<any>> & {
46
+ WrappedComponent: React.ComponentType<Props>;
20
47
  };
21
48
  export default _default;