@unimaze/billing 0.21.3 → 0.21.5

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 (230) hide show
  1. package/lib/common/components/CommonTranslations.d.ts +1 -29
  2. package/lib/common/components/CommonTranslations.js +4 -32
  3. package/lib/common/components/attachments/Attachment.d.ts +1 -1
  4. package/lib/common/components/attachments/AttachmentModal.d.ts +1 -1
  5. package/lib/common/components/attachments/index.d.ts +1 -1
  6. package/lib/common/components/base-information/AccountingCost.d.ts +1 -1
  7. package/lib/common/components/base-information/OrderReference.d.ts +1 -1
  8. package/lib/common/components/base-information/ProjectReference.d.ts +1 -1
  9. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +2 -1
  10. package/lib/common/components/base-information/ReferenceIdentifiers.js +29 -11
  11. package/lib/common/components/base-information/index.d.ts +10 -1
  12. package/lib/common/components/base-information/index.js +9 -1
  13. package/lib/common/components/billing-lines/BillingCalculations.d.ts +1 -1
  14. package/lib/common/components/billing-lines/BillingLinePreview.d.ts +2 -1
  15. package/lib/common/components/billing-lines/BillingLinePreview.js +4 -2
  16. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +1 -1
  17. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -1
  18. package/lib/common/components/billing-lines/CurrencySelector.d.ts +20 -0
  19. package/lib/common/components/billing-lines/CurrencySelector.js +17 -0
  20. package/lib/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
  21. package/lib/common/components/billing-lines/DiscountTypeSelector.js +16 -0
  22. package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -1
  23. package/lib/common/components/billing-lines/NewBillingLines.js +37 -327
  24. package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  25. package/lib/common/components/billing-lines/NewNewBillingLines.js +36 -0
  26. package/lib/common/components/billing-lines/SingleBillingLine.d.ts +19 -0
  27. package/lib/common/components/billing-lines/SingleBillingLine.js +275 -0
  28. package/lib/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
  29. package/lib/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
  30. package/lib/common/components/billing-lines/cwdwdw.d.ts +1 -0
  31. package/lib/common/components/billing-lines/cwdwdw.js +14 -0
  32. package/lib/common/components/billing-lines/index.d.ts +3 -6
  33. package/lib/common/components/billing-lines/index.js +1 -1
  34. package/lib/common/components/customer/CostCenter.d.ts +1 -1
  35. package/lib/common/components/customer/CustomerContactName.d.ts +1 -1
  36. package/lib/common/components/customer/index.d.ts +1 -1
  37. package/lib/common/components/customer/index.js +6 -4
  38. package/lib/common/components/delivery-location/index.d.ts +1 -1
  39. package/lib/common/components/form-item/index.d.ts +1 -1
  40. package/lib/common/components/input/index.d.ts +1 -1
  41. package/lib/common/components/invoice/index.d.ts +3 -1
  42. package/lib/common/components/invoice/index.js +21 -14
  43. package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +1 -1
  44. package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +7 -8
  45. package/lib/common/components/invoice-preview/index.d.ts +1 -1
  46. package/lib/common/components/invoice-preview/index.js +8 -2
  47. package/lib/common/components/payment-method/index.d.ts +1 -1
  48. package/lib/common/components/payment-method/index.js +22 -7
  49. package/lib/common/components/supplier/CityAutofill.d.ts +1 -1
  50. package/lib/common/components/supplier/index.d.ts +1 -1
  51. package/lib/common/components/welcome-modal/index.d.ts +1 -1
  52. package/lib/common/types/ReceiverRequirements.d.ts +2 -0
  53. package/lib/common/types/ReceiverRequirements.js +2 -0
  54. package/lib/create-invoice/index.d.ts +9 -1
  55. package/lib/create-invoice/index.js +87 -60
  56. package/lib/enums.d.ts +3 -0
  57. package/lib/translations/locales/en.json +7 -10
  58. package/lib/translations/locales/is.json +5 -8
  59. package/lib/translations/locales.d.ts +10 -16
  60. package/lib/unimaze-api-clients/src/mapi/api.d.ts +6664 -0
  61. package/lib/unimaze-api-clients/src/mapi/api.js +4743 -0
  62. package/lib/unimaze-api-clients/src/mapi/base.d.ts +55 -0
  63. package/lib/unimaze-api-clients/src/mapi/base.js +84 -0
  64. package/lib/unimaze-api-clients/src/mapi/configuration.d.ts +63 -0
  65. package/lib/unimaze-api-clients/src/mapi/configuration.js +28 -0
  66. package/lib/unimaze-api-clients/src/mapi/index.d.ts +13 -0
  67. package/lib/unimaze-api-clients/src/mapi/index.js +30 -0
  68. package/lib/unimaze-api-clients/src/rapi/api.d.ts +5015 -0
  69. package/lib/unimaze-api-clients/src/rapi/api.js +5582 -0
  70. package/lib/unimaze-api-clients/src/rapi/base.d.ts +55 -0
  71. package/lib/unimaze-api-clients/src/rapi/base.js +84 -0
  72. package/lib/unimaze-api-clients/src/rapi/configuration.d.ts +63 -0
  73. package/lib/unimaze-api-clients/src/rapi/configuration.js +28 -0
  74. package/lib/unimaze-api-clients/src/rapi/index.d.ts +13 -0
  75. package/lib/unimaze-api-clients/src/rapi/index.js +30 -0
  76. package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +102 -0
  77. package/lib/unimaze-billing/src/common/components/CommonTranslations.js +106 -0
  78. package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +20 -0
  79. package/lib/unimaze-billing/src/common/components/attachments/Attachment.js +164 -0
  80. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +21 -0
  81. package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +203 -0
  82. package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +27 -0
  83. package/lib/unimaze-billing/src/common/components/attachments/index.js +214 -0
  84. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +17 -0
  85. package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.js +61 -0
  86. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +16 -0
  87. package/lib/unimaze-billing/src/common/components/base-information/OrderReference.js +58 -0
  88. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +14 -0
  89. package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.js +30 -0
  90. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +48 -0
  91. package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +306 -0
  92. package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +68 -0
  93. package/lib/unimaze-billing/src/common/components/base-information/index.js +178 -0
  94. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +14 -0
  95. package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +153 -0
  96. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
  97. package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +41 -0
  98. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +13 -0
  99. package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +134 -0
  100. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.d.ts +20 -0
  101. package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.js +17 -0
  102. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
  103. package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.js +16 -0
  104. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +129 -0
  105. package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +495 -0
  106. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
  107. package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.js +36 -0
  108. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +14 -0
  109. package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +199 -0
  110. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
  111. package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
  112. package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +52 -0
  113. package/lib/unimaze-billing/src/common/components/billing-lines/index.js +104 -0
  114. package/lib/unimaze-billing/src/common/components/component-container/Content.d.ts +7 -0
  115. package/lib/unimaze-billing/src/common/components/component-container/Content.js +13 -0
  116. package/lib/unimaze-billing/src/common/components/component-container/Header.d.ts +9 -0
  117. package/lib/unimaze-billing/src/common/components/component-container/Header.js +28 -0
  118. package/lib/unimaze-billing/src/common/components/component-container/index.d.ts +12 -0
  119. package/lib/unimaze-billing/src/common/components/component-container/index.js +22 -0
  120. package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +17 -0
  121. package/lib/unimaze-billing/src/common/components/customer/CostCenter.js +163 -0
  122. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +17 -0
  123. package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.js +53 -0
  124. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.d.ts +7 -0
  125. package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.js +41 -0
  126. package/lib/unimaze-billing/src/common/components/customer/index.d.ts +26 -0
  127. package/lib/unimaze-billing/src/common/components/customer/index.js +168 -0
  128. package/lib/unimaze-billing/src/common/components/date-picker/index.d.ts +21 -0
  129. package/lib/unimaze-billing/src/common/components/date-picker/index.js +23 -0
  130. package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +12 -0
  131. package/lib/unimaze-billing/src/common/components/delivery-location/index.js +89 -0
  132. package/lib/unimaze-billing/src/common/components/editable-cell/index.d.ts +0 -0
  133. package/lib/unimaze-billing/src/common/components/editable-cell/index.js +295 -0
  134. package/lib/unimaze-billing/src/common/components/editable-row/index.d.ts +5 -0
  135. package/lib/unimaze-billing/src/common/components/editable-row/index.js +59 -0
  136. package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +35 -0
  137. package/lib/unimaze-billing/src/common/components/form-item/index.js +60 -0
  138. package/lib/unimaze-billing/src/common/components/index.d.ts +18 -0
  139. package/lib/unimaze-billing/src/common/components/index.js +42 -0
  140. package/lib/unimaze-billing/src/common/components/input/index.d.ts +23 -0
  141. package/lib/unimaze-billing/src/common/components/input/index.js +37 -0
  142. package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +40 -0
  143. package/lib/unimaze-billing/src/common/components/invoice/index.js +52 -0
  144. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  145. package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
  146. package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +16 -0
  147. package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +405 -0
  148. package/lib/unimaze-billing/src/common/components/locale-intl/index.d.ts +0 -0
  149. package/lib/unimaze-billing/src/common/components/locale-intl/index.js +51 -0
  150. package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +76 -0
  151. package/lib/unimaze-billing/src/common/components/payment-method/index.js +356 -0
  152. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.d.ts +8 -0
  153. package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.js +37 -0
  154. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  155. package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  156. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.d.ts +8 -0
  157. package/lib/unimaze-billing/src/common/components/submit-confirmation/index.js +34 -0
  158. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +18 -0
  159. package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.js +159 -0
  160. package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +94 -0
  161. package/lib/unimaze-billing/src/common/components/supplier/index.js +334 -0
  162. package/lib/unimaze-billing/src/common/components/tooltip/index.d.ts +7 -0
  163. package/lib/unimaze-billing/src/common/components/tooltip/index.js +15 -0
  164. package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +15 -0
  165. package/lib/unimaze-billing/src/common/components/welcome-modal/index.js +26 -0
  166. package/lib/unimaze-billing/src/common/consts/formLayout.d.ts +74 -0
  167. package/lib/unimaze-billing/src/common/consts/formLayout.js +45 -0
  168. package/lib/unimaze-billing/src/common/consts/validationRules.d.ts +6 -0
  169. package/lib/unimaze-billing/src/common/consts/validationRules.js +69 -0
  170. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.d.ts +5 -0
  171. package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.js +8 -0
  172. package/lib/unimaze-billing/src/common/enums/index.d.ts +1 -0
  173. package/lib/unimaze-billing/src/common/enums/index.js +8 -0
  174. package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +23 -0
  175. package/lib/unimaze-billing/src/common/types/AppConfiguration.js +2 -0
  176. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.d.ts +10 -0
  177. package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.js +2 -0
  178. package/lib/unimaze-billing/src/common/types/CommonProps.d.ts +33 -0
  179. package/lib/unimaze-billing/src/common/types/CommonProps.js +2 -0
  180. package/lib/unimaze-billing/src/common/types/DiscountType.d.ts +1 -0
  181. package/lib/unimaze-billing/src/common/types/DiscountType.js +2 -0
  182. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.d.ts +1 -0
  183. package/lib/unimaze-billing/src/common/types/InvoiceFormFields.js +2 -0
  184. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.d.ts +27 -0
  185. package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.js +2 -0
  186. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +81 -0
  187. package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +391 -0
  188. package/lib/unimaze-billing/src/common/types/SupplierInfo.d.ts +11 -0
  189. package/lib/unimaze-billing/src/common/types/SupplierInfo.js +2 -0
  190. package/lib/unimaze-billing/src/common/types/index.d.ts +1 -0
  191. package/lib/unimaze-billing/src/common/types/index.js +17 -0
  192. package/lib/unimaze-billing/src/create-credit-note/index.d.ts +9 -0
  193. package/lib/unimaze-billing/src/create-credit-note/index.js +62 -0
  194. package/lib/unimaze-billing/src/create-invoice/IntlLoader.d.ts +11 -0
  195. package/lib/unimaze-billing/src/create-invoice/IntlLoader.js +116 -0
  196. package/lib/unimaze-billing/src/create-invoice/index.d.ts +74 -0
  197. package/lib/unimaze-billing/src/create-invoice/index.js +680 -0
  198. package/lib/unimaze-billing/src/enums.d.ts +11 -0
  199. package/lib/unimaze-billing/src/enums.js +18 -0
  200. package/lib/unimaze-billing/src/index.d.ts +4 -0
  201. package/lib/unimaze-billing/src/index.js +28 -0
  202. package/lib/unimaze-billing/src/translations/locales/en.json +183 -0
  203. package/lib/unimaze-billing/src/translations/locales/is.json +183 -0
  204. package/lib/unimaze-billing/src/translations/locales.d.ts +369 -0
  205. package/lib/unimaze-billing/src/translations/locales.js +11 -0
  206. package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +23 -0
  207. package/lib/unimaze-billing/src/utils/ApiUtility.js +115 -0
  208. package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +22 -0
  209. package/lib/unimaze-billing/src/utils/BillingLineUtility.js +158 -0
  210. package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +9 -0
  211. package/lib/unimaze-billing/src/utils/ConversionUtility.js +223 -0
  212. package/lib/unimaze-billing/src/utils/FileUploadUtility.d.ts +9 -0
  213. package/lib/unimaze-billing/src/utils/FileUploadUtility.js +45 -0
  214. package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +5 -0
  215. package/lib/unimaze-billing/src/utils/IntlUtility.js +55 -0
  216. package/lib/unimaze-billing/src/utils/LocationUtility.d.ts +1 -0
  217. package/lib/unimaze-billing/src/utils/LocationUtility.js +81 -0
  218. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.d.ts +7 -0
  219. package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.js +26 -0
  220. package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +19 -0
  221. package/lib/unimaze-billing/src/utils/RequirementsUtility.js +189 -0
  222. package/lib/unimaze-billing/src/utils/index.d.ts +2 -0
  223. package/lib/unimaze-billing/src/utils/index.js +8 -0
  224. package/lib/utils/ApiUtility.d.ts +9 -3
  225. package/lib/utils/ApiUtility.js +30 -2
  226. package/lib/utils/BillingLineUtility.d.ts +4 -1
  227. package/lib/utils/BillingLineUtility.js +36 -4
  228. package/lib/utils/RequirementsUtility.d.ts +4 -1
  229. package/lib/utils/RequirementsUtility.js +56 -1
  230. package/package.json +2 -2
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var react_1 = __importDefault(require("react"));
7
+ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
8
+ var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
9
+ var form_item_1 = __importDefault(require("../form-item"));
10
+ var react_intl_1 = require("react-intl");
11
+ var __1 = require("..");
12
+ var translationMessages = (0, react_intl_1.defineMessages)({
13
+ baseInformation_projectReferenceLabel: {
14
+ id: "baseInformation_projectReferenceLabel",
15
+ defaultMessage: "Project reference",
16
+ },
17
+ });
18
+ var ProjectReference = function (props) {
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();
22
+ if (projectReferenceFieldDefinition) {
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"] },
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 })));
25
+ }
26
+ else {
27
+ return null;
28
+ }
29
+ };
30
+ exports.default = (0, react_intl_1.injectIntl)(ProjectReference);
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import { WrappedComponentProps } from "react-intl";
3
+ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
4
+ import { FormInstance } from "antd/es/form";
5
+ import { ValidateStatus } from "antd/lib/form/FormItem";
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 {
33
+ receiverRequirements: NewReceiverRequirements;
34
+ formInstance: FormInstance;
35
+ updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
36
+ rapiBaseUrl: string;
37
+ legalIdentifier: string;
38
+ referenceIdentifiersLabelText?: string;
39
+ referenceIdentifiersHelpText?: string;
40
+ referenceIdentifierValidateStatus: ValidateStatus;
41
+ setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
42
+ }
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>;
47
+ };
48
+ export default _default;
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
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
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var 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);
34
+ return result;
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
+ };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.translationMessages = void 0;
50
+ var react_1 = __importStar(require("react"));
51
+ var react_intl_1 = require("react-intl");
52
+ var antd_1 = require("antd");
53
+ var formLayout_1 = require("../../consts/formLayout");
54
+ var ReferenceIdentifierUtility_1 = require("../../../utils/ReferenceIdentifierUtility");
55
+ var axios_1 = __importDefault(require("axios"));
56
+ var ApiUtility_1 = require("../../../utils/ApiUtility");
57
+ var lodash_1 = require("lodash");
58
+ var form_item_1 = require("../form-item");
59
+ var __1 = require("..");
60
+ exports.translationMessages = (0, react_intl_1.defineMessages)({
61
+ referenceIdentifiers_labels_addButton: {
62
+ id: "referenceIdentifiers_labels_addButton",
63
+ defaultMessage: "Add reference identifier",
64
+ },
65
+ referenceIdentifiers_labels_referenceIdentifier: {
66
+ id: "referenceIdentifiers_labels_referenceIdentifier",
67
+ defaultMessage: "Object identifier",
68
+ },
69
+ referenceIdentifiers_labels_referenceIdentifier_title: {
70
+ id: "referenceIdentifiers_labels_referenceIdentifier_title",
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)",
72
+ },
73
+ referenceIdentifiers_labels_AKG: {
74
+ id: "referenceIdentifiers_labels_AKG",
75
+ defaultMessage: "Vehicle identification number", // "Bílnúmer",
76
+ },
77
+ referenceIdentifiers_labels_ARR: {
78
+ id: "referenceIdentifiers_labels_ARR",
79
+ defaultMessage: "Kennitala", // "Kennitala",
80
+ },
81
+ referenceIdentifiers_labels_LOC: {
82
+ id: "referenceIdentifiers_labels_LOC",
83
+ defaultMessage: "Real estate number", // "Fasteignanúmer",
84
+ },
85
+ });
86
+ var ReferenceIdentifiers = function (props) {
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,
98
+ react_1.default.createElement("p", null, referenceIdentifiersHelp),
99
+ react_1.default.createElement("ul", null, referenceIdentifierOptions.map(function (x) {
100
+ if (x.properties.hasOwnProperty("handling") && x.properties.handling) {
101
+ var handling = JSON.parse(x.properties.handling);
102
+ if (handling.hasOwnProperty("helpText") && handling.helpText.length > 0) {
103
+ return react_1.default.createElement("li", null, handling.helpText);
104
+ }
105
+ }
106
+ }))));
107
+ var getReferenceIdentifier = function (receiverRequirements) {
108
+ var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
109
+ if (options.length > 0) {
110
+ return options.map(function (referenceIdentifierOption) {
111
+ return (react_1.default.createElement(antd_1.Select.Option, { key: referenceIdentifierOption.key, value: referenceIdentifierOption.key }, referenceIdentifierOption.properties.label));
112
+ });
113
+ }
114
+ return (react_1.default.createElement(react_1.default.Fragment, null,
115
+ react_1.default.createElement(antd_1.Select.Option, { value: "AKG" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_AKG)),
116
+ react_1.default.createElement(antd_1.Select.Option, { value: "ARR" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_ARR)),
117
+ react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_LOC))));
118
+ };
119
+ var handleReferenceIdentifierValueSearch = (0, lodash_1.debounce)(function (searchValue, fieldDefinitionWithOriginalKey, receiverRequirements, rapiBaseUrl) {
120
+ if (fieldDefinitionWithOriginalKey.properties.href) {
121
+ // /api/v1/requirements/0196:5504030000/DepartmentLocation/values?textFilter=%7BtextFilter%7D&offset=%7Boffset%7D&limit=%7Blimit%7D
122
+ var searchUrl = rapiBaseUrl +
123
+ fieldDefinitionWithOriginalKey.properties.href
124
+ .replace("%7BtextFilter%7D", encodeURIComponent(searchValue))
125
+ .replace("%7Boffset%7D", "0")
126
+ .replace("%7Blimit%7D", "15");
127
+ setLoadingReferenceIdentifierValues(true);
128
+ axios_1.default
129
+ .get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueSearch") })
130
+ .then(function (response) {
131
+ setLoadingReferenceIdentifierValues(false);
132
+ var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
133
+ var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === fieldDefinitionWithOriginalKey.originalKey; });
134
+ var updatedReferenceIdentifier = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: {
135
+ label: updatedFieldDefinitions[index].properties.label,
136
+ href: updatedFieldDefinitions[index].properties.href,
137
+ cardinality: updatedFieldDefinitions[index].properties.cardinality,
138
+ values: response.data.value,
139
+ } });
140
+ updatedFieldDefinitions.splice(index, 1, updatedReferenceIdentifier);
141
+ var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
142
+ props.updateReceiverRequirementsProp(newReceiverRequirements);
143
+ })
144
+ .catch(function (error) {
145
+ setLoadingReferenceIdentifierValues(false);
146
+ });
147
+ }
148
+ }, 500);
149
+ var handleReferenceIdentifierValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setReferenceIdentifierValidateStatus) {
150
+ if (value.length === 0) {
151
+ setReferenceIdentifierValidateStatus("");
152
+ props.formInstance.resetFields([namePath]);
153
+ }
154
+ else {
155
+ var searchUrl = rapiBaseUrl +
156
+ "/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
157
+ setReferenceIdentifierValidateStatus("validating");
158
+ axios_1.default
159
+ .get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueValidation") })
160
+ .then(function (response) {
161
+ response.data
162
+ ? setReferenceIdentifierValidateStatus("success")
163
+ : setReferenceIdentifierValidateStatus("error");
164
+ })
165
+ .catch(function (error) {
166
+ setReferenceIdentifierValidateStatus("error");
167
+ });
168
+ }
169
+ }, 500);
170
+ var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field, referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus) {
171
+ var fieldProps = __assign(__assign({}, field), { name: [field.name, "value"], rules: [
172
+ {
173
+ required: !!(value && value.key),
174
+ message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage),
175
+ },
176
+ ] });
177
+ if (value && value.key) {
178
+ var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
179
+ var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
180
+ if (fieldDefinition_1) {
181
+ var fieldHandling = null;
182
+ if (fieldDefinition_1.properties.hasOwnProperty("handling") && fieldDefinition_1.properties.handling) {
183
+ fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
184
+ }
185
+ if (fieldHandling && fieldHandling.shouldBeValidated) {
186
+ fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true });
187
+ return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
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
+ } })));
191
+ }
192
+ if (fieldDefinition_1.properties.hasOwnProperty("values") &&
193
+ fieldDefinition_1.properties.values /*&& fieldDefinition.properties.values.length > 0*/) {
194
+ var selectProps = fieldDefinition_1.properties.hasOwnProperty("href")
195
+ ? {
196
+ showSearch: true,
197
+ filterOption: false,
198
+ onSearch: function (searchValue) {
199
+ handleReferenceIdentifierValueSearch(searchValue, fieldDefinition_1, receiverRequirements, rapiBaseUrl);
200
+ },
201
+ loading: loadingReferenceIdentifierValues,
202
+ }
203
+ : {};
204
+ return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
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));
207
+ }))));
208
+ }
209
+ else {
210
+ return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
211
+ react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
212
+ }
213
+ }
214
+ else {
215
+ return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
216
+ react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
217
+ }
218
+ }
219
+ return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
220
+ react_1.default.createElement(antd_1.Input, { disabled: true })));
221
+ };
222
+ var referenceIdentifiersDefinitions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions)(props.receiverRequirements);
223
+ var getSingleReferenceIdentifierInput = function () {
224
+ var fieldHandling = null;
225
+ var fieldDefinition = referenceIdentifiersDefinitions[0];
226
+ var singleReferenceIdentifierLabel = fieldDefinition.properties.label;
227
+ var singleReferenceIdentifiersHelp;
228
+ if (fieldDefinition.properties.hasOwnProperty("handling") && fieldDefinition.properties.handling) {
229
+ fieldHandling = JSON.parse(fieldDefinition.properties.handling);
230
+ singleReferenceIdentifiersHelp = fieldHandling.hasOwnProperty("helpText")
231
+ ? fieldHandling.helpText
232
+ : undefined;
233
+ }
234
+ if (fieldHandling && fieldHandling.shouldBeValidated) {
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
+ } })));
239
+ }
240
+ if (fieldDefinition.properties.hasOwnProperty("values") && fieldDefinition.properties.values) {
241
+ var selectProps = fieldDefinition.properties.hasOwnProperty("href")
242
+ ? {
243
+ showSearch: true,
244
+ filterOption: false,
245
+ onSearch: function (searchValue) {
246
+ handleReferenceIdentifierValueSearch(searchValue, __assign(__assign({}, fieldDefinition), { originalKey: fieldDefinition.key }), props.receiverRequirements, props.rapiBaseUrl);
247
+ },
248
+ loading: loadingReferenceIdentifierValues,
249
+ }
250
+ : {};
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));
254
+ }))));
255
+ }
256
+ else {
257
+ return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"] },
258
+ react_1.default.createElement(__1.UmzInput, { defaultPlaceholder: singleReferenceIdentifierLabel })));
259
+ }
260
+ };
261
+ if (referenceIdentifiersDefinitions.length === 0) {
262
+ return null;
263
+ }
264
+ else if (referenceIdentifiersDefinitions.length === 1) {
265
+ props.formInstance.setFieldsValue({
266
+ invoice: {
267
+ singleReferenceIdentifier: {
268
+ code: referenceIdentifiersDefinitions[0].key.replace("referenceIdentifier.", ""),
269
+ },
270
+ },
271
+ });
272
+ return getSingleReferenceIdentifierInput();
273
+ }
274
+ else {
275
+ return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
276
+ var add = _a.add, remove = _a.remove;
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 } }),
280
+ react_1.default.createElement(antd_1.Row, { gutter: [16, 0] },
281
+ react_1.default.createElement(antd_1.Col, { span: 12 },
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
+ " ")))),
301
+ react_1.default.createElement(antd_1.Col, { span: 12 }, getReferenceIdentifierValueFormItemInput(referenceIdentifierValue[index], props.receiverRequirements, props.rapiBaseUrl, props.legalIdentifier, field, props.referenceIdentifierValidateStatus, props.setReferenceIdentifierValidateStatus)))));
302
+ });
303
+ }));
304
+ }
305
+ };
306
+ exports.default = (0, react_intl_1.injectIntl)(ReferenceIdentifiers);
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+ import { FormInstance } from "antd/es/form";
3
+ import { WrappedComponentProps } from "react-intl";
4
+ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
5
+ import { ValidateStatus } from "antd/lib/form/FormItem";
6
+ interface Props extends WrappedComponentProps {
7
+ receiverRequirements: NewReceiverRequirements;
8
+ form: FormInstance;
9
+ documentType: "creditNote" | "invoice";
10
+ updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
11
+ rapiBaseUrl: string;
12
+ legalIdentifier: string;
13
+ referenceIdentifiersLabelText?: string;
14
+ referenceIdentifiersHelpText?: string;
15
+ referenceIdentifierValidateStatus: ValidateStatus;
16
+ setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
17
+ dueDateMinimumOffset: number;
18
+ isSaveFieldValuesSelected: boolean;
19
+ onSaveFieldValuesChange: () => void;
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>;
67
+ };
68
+ export default BaseInformationIntl;
@@ -0,0 +1,178 @@
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
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
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);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.translationMessages = void 0;
30
+ var React = __importStar(require("react"));
31
+ var antd_1 = require("antd");
32
+ var dayjs_1 = __importDefault(require("dayjs"));
33
+ var form_item_1 = __importDefault(require("../form-item"));
34
+ var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
35
+ var react_intl_1 = require("react-intl");
36
+ var ReferenceIdentifiers_1 = __importDefault(require("./ReferenceIdentifiers"));
37
+ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
38
+ var OrderReference_1 = __importDefault(require("./OrderReference"));
39
+ var AccountingCost_1 = __importDefault(require("./AccountingCost"));
40
+ var react_1 = require("react");
41
+ var ProjectReference_1 = __importDefault(require("./ProjectReference"));
42
+ var __1 = require("..");
43
+ var react_use_1 = require("react-use");
44
+ var CommonTranslations_1 = require("../CommonTranslations");
45
+ exports.translationMessages = (0, react_intl_1.defineMessages)({
46
+ baseInformation_title: {
47
+ id: "baseInformation_title",
48
+ defaultMessage: "Base Information",
49
+ },
50
+ baseInformation_invoiceNo: {
51
+ id: "baseInformation_invoiceNo",
52
+ defaultMessage: "Invoice no.",
53
+ },
54
+ baseInformation_issueDate: {
55
+ id: "baseInformation_issueDate",
56
+ defaultMessage: "Issue date",
57
+ },
58
+ baseInformation_issueDate_title: {
59
+ id: "baseInformation_issueDate_title",
60
+ defaultMessage: "The issue date controls on which settlement period the transfer is registered", // "Útgáfudagsetning stjórnar á hvaða uppgjörstímabili færslan skráist"
61
+ },
62
+ baseInformation_dueDate: {
63
+ id: "baseInformation_dueDate",
64
+ defaultMessage: "Due date",
65
+ },
66
+ baseInformation_dueDate_title: {
67
+ id: "baseInformation_dueDate_title",
68
+ defaultMessage: "Grace date should be the same as due date", // "Eindagi skal vera sá sami og gjalddagi"
69
+ },
70
+ baseInformation_buyerReferenceLabel: {
71
+ id: "baseInformation_buyerReferenceLabel",
72
+ defaultMessage: "Buyer reference",
73
+ },
74
+ baseInformation_buyerReferenceLabel_helpText: {
75
+ id: "baseInformation_buyerReferenceLabel_helpText",
76
+ defaultMessage: 'A reference the buyer has requested to be assigned to the invoice, often called "your reference". Used by the buyer for internal routing. If buyer has not specifically requested it, the name of the person who ordered or requested the products or services can be used. Must be used when order number is not specified.',
77
+ },
78
+ baseInformation_projectReferenceLabel: {
79
+ id: "baseInformation_projectReferenceLabel",
80
+ defaultMessage: "Project reference",
81
+ },
82
+ baseInformation_dueDateErrorMsg: {
83
+ id: "baseInformation_dueDateErrorMsg",
84
+ defaultMessage: "Due date must be after the issue date",
85
+ },
86
+ });
87
+ var BaseInformation = function (props) {
88
+ var _a, _b;
89
+ var width = (0, react_use_1.useWindowSize)().width;
90
+ var _c = (0, react_1.useState)(false), isMobile = _c[0], setIsMobile = _c[1];
91
+ var _d = (0, react_1.useState)(), dueDateDefaultPickerValue = _d[0], setDueDateDefaultPickerValue = _d[1];
92
+ var formData = props.form.getFieldsValue();
93
+ var token = antd_1.theme.useToken().token;
94
+ (0, react_1.useEffect)(function () {
95
+ if (width < 768) {
96
+ setIsMobile(true);
97
+ }
98
+ else {
99
+ setIsMobile(false);
100
+ }
101
+ }, [width]);
102
+ (0, react_1.useEffect)(function () {
103
+ var a = getDueDateLimit(props.form.getFieldValue(["invoice", "issueDate"]), props.dueDateMinimumOffset);
104
+ setDueDateDefaultPickerValue(a);
105
+ }, [props.form.getFieldValue(["invoice", "issueDate"])]);
106
+ var getDueDateLimit = function (issueDate, dueDateMinimumOffset) {
107
+ var dueDateLimit;
108
+ if (issueDate) {
109
+ dueDateLimit = (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days").isAfter(issueDate.startOf("day"))
110
+ ? (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days")
111
+ : issueDate.startOf("day");
112
+ }
113
+ else {
114
+ dueDateLimit = (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days");
115
+ }
116
+ return dueDateLimit;
117
+ };
118
+ var disabledDate = function (dueDate, issueDate, dueDateMinimumOffset) {
119
+ var dueDateLimit = getDueDateLimit(issueDate, dueDateMinimumOffset);
120
+ return dueDate < dueDateLimit;
121
+ };
122
+ var checkIfEmpty = function (date) {
123
+ if (!date) {
124
+ props.form.resetFields(["invoice", "dueDate"]);
125
+ props.form.validateFields(["invoice", "dueDate"]);
126
+ }
127
+ };
128
+ var onlyOneOption = function (receiverRequirements, fieldName) {
129
+ var a = (0, RequirementsUtility_1.getFieldRequirements)(receiverRequirements, fieldName);
130
+ return !!(a && a.properties && a.properties.values && a.properties.values.length === 1);
131
+ };
132
+ return (React.createElement(antd_1.Flex, { style: {
133
+ backgroundColor: isMobile ? undefined : token.colorInfoBg,
134
+ padding: isMobile ? "0 0 15px 0" : "35px",
135
+ }, justify: "center" },
136
+ React.createElement(antd_1.Flex, { vertical: true, style: { width: "100%", maxWidth: "900px" } },
137
+ React.createElement(antd_1.Row, { gutter: 20 },
138
+ React.createElement(antd_1.Col, { span: 24 },
139
+ React.createElement(antd_1.Typography.Title, { level: 5 }, props.intl.formatMessage(exports.translationMessages.baseInformation_title))),
140
+ React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
141
+ React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo, defaultLabel: props.intl.formatMessage(exports.translationMessages.baseInformation_invoiceNo), defaultIsRequired: true, fieldName: ["invoice", "invoiceNo"] },
142
+ React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo, defaultIsRequired: true, defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.baseInformation_invoiceNo), defaultValue: (_a = formData.invoice) === null || _a === void 0 ? void 0 : _a.invoiceNo }))),
143
+ React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
144
+ React.createElement(antd_1.Row, { gutter: 20 },
145
+ React.createElement(antd_1.Col, { span: 12 },
146
+ React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultIsRequired: true, fieldName: ["invoice", "issueDate"] },
147
+ React.createElement(__1.UmzDatePicker, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.baseInformation_issueDate), defaultIsRequired: true, defaultValue: (0, dayjs_1.default)(), format: "DD.MM.YYYY", style: { width: "100%" }, defaultTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_issueDate_title) }))),
148
+ React.createElement(antd_1.Col, { span: 12 },
149
+ React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.dueDate, defaultIsRequired: true, fieldName: ["invoice", "dueDate"], additionalRules: [
150
+ {
151
+ validator: function (rule, value, callback) {
152
+ if (!value) {
153
+ callback();
154
+ }
155
+ var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
156
+ value < issueDate
157
+ ? callback(props.intl.formatMessage(exports.translationMessages.baseInformation_dueDateErrorMsg))
158
+ : callback();
159
+ },
160
+ },
161
+ ] },
162
+ React.createElement(__1.UmzDatePicker, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.dueDate, defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.baseInformation_dueDate), format: "DD.MM.YYYY", style: { width: "100%" }, defaultTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_dueDate_title), defaultIsRequired: true, defaultPickerValue: dueDateDefaultPickerValue, onChange: checkIfEmpty, getPopupContainer: function (trigger) { return trigger.parentElement; }, disabledDate: function (current) {
163
+ var currentDate = current;
164
+ var dueDateMinimumOffset = props.dueDateMinimumOffset;
165
+ var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
166
+ return disabledDate(currentDate, issueDate, dueDateMinimumOffset);
167
+ } }))))),
168
+ React.createElement(antd_1.Col, { span: 24 },
169
+ React.createElement(OrderReference_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, dependencies: [["invoice", "buyerReference"]] }),
170
+ React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: [["invoice", "orderReference", "documentNo"]], receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultIsRequired: !props.form.getFieldValue(["invoice", "orderReference", "documentNo"]), fieldName: ["invoice", "buyerReference"] },
171
+ React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultIsRequired: !props.form.getFieldValue(["invoice", "orderReference", "documentNo"]), defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel), defaultTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultValue: (_b = formData.invoice) === null || _b === void 0 ? void 0 : _b.buyerReference })),
172
+ React.createElement(ReferenceIdentifiers_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifierValidateStatus: props.referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus: props.setReferenceIdentifierValidateStatus }),
173
+ React.createElement(AccountingCost_1.default, { formInstance: props.form, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier }),
174
+ React.createElement(ProjectReference_1.default, { receiverRequirements: props.receiverRequirements, form: props.form }))),
175
+ React.createElement(antd_1.Checkbox, { checked: props.isSaveFieldValuesSelected, onChange: props.onSaveFieldValuesChange }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages.saveInformation_label)))));
176
+ };
177
+ var BaseInformationIntl = (0, react_intl_1.injectIntl)(BaseInformation);
178
+ exports.default = BaseInformationIntl;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { WrappedComponentProps } from "react-intl";
3
+ import { FormInstance } from "antd/es/form";
4
+ interface Props extends WrappedComponentProps {
5
+ currencyCode: string;
6
+ formInstance: FormInstance;
7
+ outsideVatScope: boolean;
8
+ }
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>;
13
+ };
14
+ export default _default;