@unimaze/billing 0.21.46 → 0.21.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/components/billing-lines/CurrencySelector.d.ts +1 -3
- package/lib/common/components/billing-lines/CurrencySelector.js +45 -8
- package/lib/common/components/billing-lines/NewBillingLines.js +0 -8
- package/lib/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
- package/lib/common/components/billing-lines/NewNewBillingLines.js +36 -0
- package/lib/common/components/billing-lines/SingleBillingLine.js +9 -5
- package/lib/common/components/billing-lines/cwdwdw.d.ts +1 -0
- package/lib/common/components/billing-lines/cwdwdw.js +14 -0
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +0 -0
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +109 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +0 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +110 -0
- package/lib/unimaze-api-clients/src/mapi/api.d.ts +6664 -0
- package/lib/unimaze-api-clients/src/mapi/api.js +4743 -0
- package/lib/unimaze-api-clients/src/mapi/base.d.ts +55 -0
- package/lib/unimaze-api-clients/src/mapi/base.js +84 -0
- package/lib/unimaze-api-clients/src/mapi/configuration.d.ts +63 -0
- package/lib/unimaze-api-clients/src/mapi/configuration.js +28 -0
- package/lib/unimaze-api-clients/src/mapi/index.d.ts +13 -0
- package/lib/unimaze-api-clients/src/mapi/index.js +30 -0
- package/lib/unimaze-api-clients/src/rapi/api.d.ts +5015 -0
- package/lib/unimaze-api-clients/src/rapi/api.js +5582 -0
- package/lib/unimaze-api-clients/src/rapi/base.d.ts +55 -0
- package/lib/unimaze-api-clients/src/rapi/base.js +84 -0
- package/lib/unimaze-api-clients/src/rapi/configuration.d.ts +63 -0
- package/lib/unimaze-api-clients/src/rapi/configuration.js +28 -0
- package/lib/unimaze-api-clients/src/rapi/index.d.ts +13 -0
- package/lib/unimaze-api-clients/src/rapi/index.js +30 -0
- package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +74 -0
- package/lib/unimaze-billing/src/common/components/CommonTranslations.js +78 -0
- package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +20 -0
- package/lib/unimaze-billing/src/common/components/attachments/Attachment.js +164 -0
- package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +21 -0
- package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +206 -0
- package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +27 -0
- package/lib/unimaze-billing/src/common/components/attachments/index.js +214 -0
- package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +17 -0
- package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.js +61 -0
- package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +16 -0
- package/lib/unimaze-billing/src/common/components/base-information/OrderReference.js +58 -0
- package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.js +30 -0
- package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +53 -0
- package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +328 -0
- package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +77 -0
- package/lib/unimaze-billing/src/common/components/base-information/index.js +186 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +151 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +24 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +61 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +13 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +133 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.d.ts +20 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/CurrencySelector.js +17 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/DiscountTypeSelector.js +16 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +134 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +209 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.d.ts +15 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/NewNewBillingLines.js +36 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +19 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +275 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +49 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/index.js +104 -0
- package/lib/unimaze-billing/src/common/components/component-container/Content.d.ts +7 -0
- package/lib/unimaze-billing/src/common/components/component-container/Content.js +13 -0
- package/lib/unimaze-billing/src/common/components/component-container/Header.d.ts +9 -0
- package/lib/unimaze-billing/src/common/components/component-container/Header.js +28 -0
- package/lib/unimaze-billing/src/common/components/component-container/index.d.ts +12 -0
- package/lib/unimaze-billing/src/common/components/component-container/index.js +22 -0
- package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +17 -0
- package/lib/unimaze-billing/src/common/components/customer/CostCenter.js +163 -0
- package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +17 -0
- package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.js +53 -0
- package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.d.ts +7 -0
- package/lib/unimaze-billing/src/common/components/customer/hardCoddedCustomer.js +41 -0
- package/lib/unimaze-billing/src/common/components/customer/index.d.ts +26 -0
- package/lib/unimaze-billing/src/common/components/customer/index.js +166 -0
- package/lib/unimaze-billing/src/common/components/date-picker/index.d.ts +21 -0
- package/lib/unimaze-billing/src/common/components/date-picker/index.js +23 -0
- package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +12 -0
- package/lib/unimaze-billing/src/common/components/delivery-location/index.js +89 -0
- package/lib/unimaze-billing/src/common/components/editable-cell/index.d.ts +0 -0
- package/lib/unimaze-billing/src/common/components/editable-cell/index.js +295 -0
- package/lib/unimaze-billing/src/common/components/editable-row/index.d.ts +5 -0
- package/lib/unimaze-billing/src/common/components/editable-row/index.js +59 -0
- package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +35 -0
- package/lib/unimaze-billing/src/common/components/form-item/index.js +60 -0
- package/lib/unimaze-billing/src/common/components/index.d.ts +18 -0
- package/lib/unimaze-billing/src/common/components/index.js +42 -0
- package/lib/unimaze-billing/src/common/components/input/index.d.ts +23 -0
- package/lib/unimaze-billing/src/common/components/input/index.js +37 -0
- package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +42 -0
- package/lib/unimaze-billing/src/common/components/invoice/index.js +59 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +75 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.js +73 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +104 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.d.ts +12 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +93 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +77 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.js +58 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +52 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +102 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +196 -0
- package/lib/unimaze-billing/src/common/components/locale-intl/index.d.ts +0 -0
- package/lib/unimaze-billing/src/common/components/locale-intl/index.js +51 -0
- package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +76 -0
- package/lib/unimaze-billing/src/common/components/payment-method/index.js +356 -0
- package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.d.ts +8 -0
- package/lib/unimaze-billing/src/common/components/payment-method/paymentMethodForConversion.js +37 -0
- package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
- package/lib/unimaze-billing/src/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
- package/lib/unimaze-billing/src/common/components/submit-confirmation/index.d.ts +8 -0
- package/lib/unimaze-billing/src/common/components/submit-confirmation/index.js +34 -0
- package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +18 -0
- package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.js +159 -0
- package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +94 -0
- package/lib/unimaze-billing/src/common/components/supplier/index.js +334 -0
- package/lib/unimaze-billing/src/common/components/tooltip/index.d.ts +7 -0
- package/lib/unimaze-billing/src/common/components/tooltip/index.js +15 -0
- package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +15 -0
- package/lib/unimaze-billing/src/common/components/welcome-modal/index.js +26 -0
- package/lib/unimaze-billing/src/common/consts/formLayout.d.ts +74 -0
- package/lib/unimaze-billing/src/common/consts/formLayout.js +45 -0
- package/lib/unimaze-billing/src/common/consts/validationRules.d.ts +6 -0
- package/lib/unimaze-billing/src/common/consts/validationRules.js +69 -0
- package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.d.ts +5 -0
- package/lib/unimaze-billing/src/common/enums/DocumentTypeEnum.js +8 -0
- package/lib/unimaze-billing/src/common/enums/index.d.ts +1 -0
- package/lib/unimaze-billing/src/common/enums/index.js +8 -0
- package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +26 -0
- package/lib/unimaze-billing/src/common/types/AppConfiguration.js +2 -0
- package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.d.ts +10 -0
- package/lib/unimaze-billing/src/common/types/BillingLineMetadataOverride.js +2 -0
- package/lib/unimaze-billing/src/common/types/CommonProps.d.ts +33 -0
- package/lib/unimaze-billing/src/common/types/CommonProps.js +2 -0
- package/lib/unimaze-billing/src/common/types/DiscountType.d.ts +1 -0
- package/lib/unimaze-billing/src/common/types/DiscountType.js +2 -0
- package/lib/unimaze-billing/src/common/types/InvoiceFormFields.d.ts +1 -0
- package/lib/unimaze-billing/src/common/types/InvoiceFormFields.js +2 -0
- package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.d.ts +27 -0
- package/lib/unimaze-billing/src/common/types/NewReceiverRequirements.js +2 -0
- package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +83 -0
- package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +393 -0
- package/lib/unimaze-billing/src/common/types/SupplierInfo.d.ts +11 -0
- package/lib/unimaze-billing/src/common/types/SupplierInfo.js +2 -0
- package/lib/unimaze-billing/src/common/types/index.d.ts +1 -0
- package/lib/unimaze-billing/src/common/types/index.js +17 -0
- package/lib/unimaze-billing/src/create-credit-note/index.d.ts +9 -0
- package/lib/unimaze-billing/src/create-credit-note/index.js +62 -0
- package/lib/unimaze-billing/src/create-invoice/IntlLoader.d.ts +11 -0
- package/lib/unimaze-billing/src/create-invoice/IntlLoader.js +116 -0
- package/lib/unimaze-billing/src/create-invoice/index.d.ts +82 -0
- package/lib/unimaze-billing/src/create-invoice/index.js +710 -0
- package/lib/unimaze-billing/src/enums.d.ts +14 -0
- package/lib/unimaze-billing/src/enums.js +18 -0
- package/lib/unimaze-billing/src/index.d.ts +4 -0
- package/lib/unimaze-billing/src/index.js +28 -0
- package/lib/unimaze-billing/src/translations/locales/en.json +183 -0
- package/lib/unimaze-billing/src/translations/locales/is.json +183 -0
- package/lib/unimaze-billing/src/translations/locales.d.ts +369 -0
- package/lib/unimaze-billing/src/translations/locales.js +11 -0
- package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +29 -0
- package/lib/unimaze-billing/src/utils/ApiUtility.js +133 -0
- package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +25 -0
- package/lib/unimaze-billing/src/utils/BillingLineUtility.js +190 -0
- package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +9 -0
- package/lib/unimaze-billing/src/utils/ConversionUtility.js +222 -0
- package/lib/unimaze-billing/src/utils/FileUploadUtility.d.ts +9 -0
- package/lib/unimaze-billing/src/utils/FileUploadUtility.js +45 -0
- package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +6 -0
- package/lib/unimaze-billing/src/utils/IntlUtility.js +78 -0
- package/lib/unimaze-billing/src/utils/LocationUtility.d.ts +1 -0
- package/lib/unimaze-billing/src/utils/LocationUtility.js +81 -0
- package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.d.ts +7 -0
- package/lib/unimaze-billing/src/utils/ReferenceIdentifierUtility.js +26 -0
- package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +21 -0
- package/lib/unimaze-billing/src/utils/RequirementsUtility.js +237 -0
- package/lib/unimaze-billing/src/utils/index.d.ts +2 -0
- package/lib/unimaze-billing/src/utils/index.js +8 -0
- package/lib/utils/RequirementsUtility.d.ts +3 -2
- package/lib/utils/RequirementsUtility.js +12 -2
- package/package.json +1 -1
- package/lib/style/index.css +0 -51
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
referenceIdentifiers_values_validation_message: {
|
|
32
|
+
id: string;
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
interface Props extends WrappedComponentProps {
|
|
37
|
+
receiverRequirements: NewReceiverRequirements;
|
|
38
|
+
formInstance: FormInstance;
|
|
39
|
+
updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
|
|
40
|
+
rapiBaseUrl: string;
|
|
41
|
+
legalIdentifier: string;
|
|
42
|
+
referenceIdentifiersLabelText?: string;
|
|
43
|
+
referenceIdentifiersHelpText?: string;
|
|
44
|
+
referenceIdentifierValidateStatus: ValidateStatus;
|
|
45
|
+
setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
|
|
46
|
+
setReferenceIdentifierIsMandatory: (referenceIdentifierIsMandatory: boolean) => void;
|
|
47
|
+
}
|
|
48
|
+
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
49
|
+
forwardedRef?: React.Ref<any>;
|
|
50
|
+
} & React.RefAttributes<any>> & {
|
|
51
|
+
WrappedComponent: React.ComponentType<Props>;
|
|
52
|
+
};
|
|
53
|
+
export default _default;
|
|
@@ -0,0 +1,328 @@
|
|
|
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 = __importStar(require("../form-item"));
|
|
59
|
+
var __1 = require("..");
|
|
60
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
61
|
+
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
62
|
+
referenceIdentifiers_labels_addButton: {
|
|
63
|
+
id: "referenceIdentifiers_labels_addButton",
|
|
64
|
+
defaultMessage: "Add reference identifier",
|
|
65
|
+
},
|
|
66
|
+
referenceIdentifiers_labels_referenceIdentifier: {
|
|
67
|
+
id: "referenceIdentifiers_labels_referenceIdentifier",
|
|
68
|
+
defaultMessage: "Object identifier",
|
|
69
|
+
},
|
|
70
|
+
referenceIdentifiers_labels_referenceIdentifier_title: {
|
|
71
|
+
id: "referenceIdentifiers_labels_referenceIdentifier_title",
|
|
72
|
+
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)",
|
|
73
|
+
},
|
|
74
|
+
referenceIdentifiers_labels_AKG: {
|
|
75
|
+
id: "referenceIdentifiers_labels_AKG",
|
|
76
|
+
defaultMessage: "Vehicle identification number", // "Bílnúmer",
|
|
77
|
+
},
|
|
78
|
+
referenceIdentifiers_labels_ARR: {
|
|
79
|
+
id: "referenceIdentifiers_labels_ARR",
|
|
80
|
+
defaultMessage: "Kennitala", // "Kennitala",
|
|
81
|
+
},
|
|
82
|
+
referenceIdentifiers_labels_LOC: {
|
|
83
|
+
id: "referenceIdentifiers_labels_LOC",
|
|
84
|
+
defaultMessage: "Real estate number", // "Fasteignanúmer",
|
|
85
|
+
},
|
|
86
|
+
referenceIdentifiers_values_validation_message: {
|
|
87
|
+
id: "referenceIdentifiers_values_validation_message",
|
|
88
|
+
defaultMessage: "This value doesn't exist",
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
var ReferenceIdentifiers = function (props) {
|
|
92
|
+
var _a, _b, _c, _d, _e, _f;
|
|
93
|
+
var _g = (0, react_1.useState)([]), referenceIdentifierValue = _g[0], setReferenceIdentifierValue = _g[1];
|
|
94
|
+
var _h = (0, react_1.useState)(false), loadingReferenceIdentifierValues = _h[0], setLoadingReferenceIdentifierValues = _h[1]; // TODO: change this to boolean[] for handling the list
|
|
95
|
+
var token = antd_1.theme.useToken().token;
|
|
96
|
+
var referenceIdentifiersHelp = props.referenceIdentifiersHelpText
|
|
97
|
+
? props.referenceIdentifiersHelpText
|
|
98
|
+
: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier_title);
|
|
99
|
+
var referenceIdentifiersLabel = props.referenceIdentifiersLabelText
|
|
100
|
+
? props.referenceIdentifiersLabelText
|
|
101
|
+
: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier);
|
|
102
|
+
var referenceIdentifierOptions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(props.receiverRequirements);
|
|
103
|
+
var referenceIdentifiersHelpTextNode = (react_1.default.createElement("div", null,
|
|
104
|
+
react_1.default.createElement("p", null, referenceIdentifiersHelp),
|
|
105
|
+
react_1.default.createElement("ul", null, referenceIdentifierOptions.map(function (x) {
|
|
106
|
+
if (x.properties.hasOwnProperty("handling") && x.properties.handling) {
|
|
107
|
+
var handling = JSON.parse(x.properties.handling);
|
|
108
|
+
if (handling.hasOwnProperty("helpText") && handling.helpText.length > 0) {
|
|
109
|
+
return react_1.default.createElement("li", null, handling.helpText);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}))));
|
|
113
|
+
var getReferenceIdentifier = function (receiverRequirements) {
|
|
114
|
+
var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
|
|
115
|
+
if (options.length > 0) {
|
|
116
|
+
return options.map(function (referenceIdentifierOption) {
|
|
117
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: referenceIdentifierOption.key, value: referenceIdentifierOption.key }, referenceIdentifierOption.properties.label));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
121
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "AKG" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_AKG)),
|
|
122
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "ARR" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_ARR)),
|
|
123
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_LOC))));
|
|
124
|
+
};
|
|
125
|
+
var handleReferenceIdentifierValueSearch = (0, lodash_1.debounce)(function (searchValue, fieldDefinitionWithOriginalKey, receiverRequirements, rapiBaseUrl) {
|
|
126
|
+
if (fieldDefinitionWithOriginalKey.properties.href) {
|
|
127
|
+
// /api/v1/requirements/0196:5504030000/DepartmentLocation/values?textFilter=%7BtextFilter%7D&offset=%7Boffset%7D&limit=%7Blimit%7D
|
|
128
|
+
var searchUrl = rapiBaseUrl +
|
|
129
|
+
fieldDefinitionWithOriginalKey.properties.href
|
|
130
|
+
.replace("%7BtextFilter%7D", encodeURIComponent(searchValue))
|
|
131
|
+
.replace("%7Boffset%7D", "0")
|
|
132
|
+
.replace("%7Blimit%7D", "15");
|
|
133
|
+
setLoadingReferenceIdentifierValues(true);
|
|
134
|
+
axios_1.default
|
|
135
|
+
.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueSearch") })
|
|
136
|
+
.then(function (response) {
|
|
137
|
+
setLoadingReferenceIdentifierValues(false);
|
|
138
|
+
var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
|
|
139
|
+
var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === fieldDefinitionWithOriginalKey.originalKey; });
|
|
140
|
+
var updatedReferenceIdentifier = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: {
|
|
141
|
+
label: updatedFieldDefinitions[index].properties.label,
|
|
142
|
+
href: updatedFieldDefinitions[index].properties.href,
|
|
143
|
+
cardinality: updatedFieldDefinitions[index].properties.cardinality,
|
|
144
|
+
values: response.data.value,
|
|
145
|
+
} });
|
|
146
|
+
updatedFieldDefinitions.splice(index, 1, updatedReferenceIdentifier);
|
|
147
|
+
var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
|
|
148
|
+
props.updateReceiverRequirementsProp(newReceiverRequirements);
|
|
149
|
+
})
|
|
150
|
+
.catch(function (error) {
|
|
151
|
+
setLoadingReferenceIdentifierValues(false);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, 500);
|
|
155
|
+
var handleReferenceIdentifierValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setReferenceIdentifierValidateStatus) {
|
|
156
|
+
if (value.length === 0) {
|
|
157
|
+
setReferenceIdentifierValidateStatus("");
|
|
158
|
+
props.formInstance.resetFields([namePath]);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
var searchUrl = rapiBaseUrl +
|
|
162
|
+
"/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
|
|
163
|
+
setReferenceIdentifierValidateStatus("validating");
|
|
164
|
+
axios_1.default
|
|
165
|
+
.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)("referenceIdentifierValueValidation") })
|
|
166
|
+
.then(function (response) {
|
|
167
|
+
response.data
|
|
168
|
+
? setReferenceIdentifierValidateStatus("success")
|
|
169
|
+
: setReferenceIdentifierValidateStatus("error");
|
|
170
|
+
})
|
|
171
|
+
.catch(function (error) {
|
|
172
|
+
setReferenceIdentifierValidateStatus("error");
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, 500);
|
|
176
|
+
var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field, referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus) {
|
|
177
|
+
var fieldProps = __assign(__assign({}, field), { name: [field.name, "value"], rules: [
|
|
178
|
+
{
|
|
179
|
+
required: !!(value && value.key),
|
|
180
|
+
message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage),
|
|
181
|
+
},
|
|
182
|
+
] });
|
|
183
|
+
if (value && value.key) {
|
|
184
|
+
var options = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierOptions)(receiverRequirements);
|
|
185
|
+
var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
|
|
186
|
+
if (fieldDefinition_1) {
|
|
187
|
+
var fieldHandling = null;
|
|
188
|
+
if (fieldDefinition_1.properties.hasOwnProperty("handling") && fieldDefinition_1.properties.handling) {
|
|
189
|
+
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
190
|
+
}
|
|
191
|
+
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
192
|
+
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true, help: referenceIdentifierValidateStatus === "error" ? props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_values_validation_message) : '' });
|
|
193
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
194
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key), onBlur: function (event) {
|
|
195
|
+
return handleReferenceIdentifierValueValidation(legalIdentifier, fieldDefinition_1.name, event.currentTarget.value, rapiBaseUrl, ["invoice", "referenceIdentifiers", field.name, "value"], setReferenceIdentifierValidateStatus);
|
|
196
|
+
} })));
|
|
197
|
+
}
|
|
198
|
+
if (fieldDefinition_1.properties.hasOwnProperty("values") &&
|
|
199
|
+
fieldDefinition_1.properties.values /*&& fieldDefinition.properties.values.length > 0*/) {
|
|
200
|
+
var selectProps = fieldDefinition_1.properties.hasOwnProperty("href")
|
|
201
|
+
? {
|
|
202
|
+
showSearch: true,
|
|
203
|
+
filterOption: false,
|
|
204
|
+
onSearch: function (searchValue) {
|
|
205
|
+
handleReferenceIdentifierValueSearch(searchValue, fieldDefinition_1, receiverRequirements, rapiBaseUrl);
|
|
206
|
+
},
|
|
207
|
+
loading: loadingReferenceIdentifierValues,
|
|
208
|
+
}
|
|
209
|
+
: {};
|
|
210
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
211
|
+
react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false }, selectProps, { prefix: react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") }), fieldDefinition_1.properties.values.map(function (op) {
|
|
212
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
213
|
+
}))));
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
217
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
222
|
+
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key) })));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
226
|
+
react_1.default.createElement(antd_1.Input, { disabled: true })));
|
|
227
|
+
};
|
|
228
|
+
var referenceIdentifiersDefinitions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions)(props.receiverRequirements);
|
|
229
|
+
var getSingleReferenceIdentifierInput = function () {
|
|
230
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
231
|
+
var fieldHandling = null;
|
|
232
|
+
var fieldDefinition = referenceIdentifiersDefinitions[0];
|
|
233
|
+
var singleReferenceIdentifierLabel = fieldDefinition.properties.label;
|
|
234
|
+
var singleReferenceIdentifiersHelp;
|
|
235
|
+
if (fieldDefinition.properties.hasOwnProperty("handling") && fieldDefinition.properties.handling) {
|
|
236
|
+
fieldHandling = JSON.parse(fieldDefinition.properties.handling);
|
|
237
|
+
singleReferenceIdentifiersHelp = fieldHandling.hasOwnProperty("helpText")
|
|
238
|
+
? fieldHandling.helpText
|
|
239
|
+
: undefined;
|
|
240
|
+
}
|
|
241
|
+
// Condition 1 - If referenceidentifier should not show field values (options to choose from), but we need to validate
|
|
242
|
+
// Test: Always with "Should be validated" checked. Then test both mandatory and optional
|
|
243
|
+
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
244
|
+
props.setReferenceIdentifierIsMandatory((_d = (((_c = (_b = (_a = props.receiverRequirements) === null || _a === void 0 ? void 0 : _a.fieldDefinitions) === null || _b === void 0 ? void 0 : _b[0].properties) === null || _c === void 0 ? void 0 : _c.cardinality) === "1..1")) !== null && _d !== void 0 ? _d : false);
|
|
245
|
+
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"], validateStatus: props.referenceIdentifierValidateStatus, hasFeedback: true },
|
|
246
|
+
react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"], defaultPlaceholder: singleReferenceIdentifierLabel, defaultTooltip: singleReferenceIdentifiersHelp ? singleReferenceIdentifiersHelp : undefined, onChange: function (event) {
|
|
247
|
+
return handleReferenceIdentifierValueValidation(props.legalIdentifier, fieldDefinition.name, event.currentTarget.value, props.rapiBaseUrl, ["invoice", "singleReferenceIdentifier", "value"], props.setReferenceIdentifierValidateStatus);
|
|
248
|
+
} })));
|
|
249
|
+
}
|
|
250
|
+
if (fieldDefinition.properties.hasOwnProperty("values") && fieldDefinition.properties.values) {
|
|
251
|
+
// Condition 2 - If referenceidentifier has field values (options to choose from)
|
|
252
|
+
props.setReferenceIdentifierIsMandatory((_h = (((_g = (_f = (_e = props.receiverRequirements) === null || _e === void 0 ? void 0 : _e.fieldDefinitions) === null || _f === void 0 ? void 0 : _f[0].properties) === null || _g === void 0 ? void 0 : _g.cardinality) === "1..1")) !== null && _h !== void 0 ? _h : false);
|
|
253
|
+
var selectProps = fieldDefinition.properties.hasOwnProperty("href")
|
|
254
|
+
? {
|
|
255
|
+
showSearch: true,
|
|
256
|
+
filterOption: false,
|
|
257
|
+
onSearch: function (searchValue) {
|
|
258
|
+
handleReferenceIdentifierValueSearch(searchValue, __assign(__assign({}, fieldDefinition), { originalKey: fieldDefinition.key }), props.receiverRequirements, props.rapiBaseUrl);
|
|
259
|
+
},
|
|
260
|
+
loading: loadingReferenceIdentifierValues,
|
|
261
|
+
}
|
|
262
|
+
: {};
|
|
263
|
+
var isRequired = function () {
|
|
264
|
+
var _a;
|
|
265
|
+
return ((_a = fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.properties) === null || _a === void 0 ? void 0 : _a.cardinality) === "1..1";
|
|
266
|
+
};
|
|
267
|
+
var selectField = (react_1.default.createElement(antd_1.Select, __assign({ prefix: isRequired() ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, placeholder: singleReferenceIdentifierLabel, popupMatchSelectWidth: false }, selectProps, { suffixIcon: react_1.default.createElement(__1.UmzTooltip, { title: singleReferenceIdentifiersHelp }) }), fieldDefinition.properties.values.map(function (op) {
|
|
268
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
269
|
+
})));
|
|
270
|
+
return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields[fieldDefinition.key], defaultLabel: "", defaultIsRequired: false, fieldName: ["invoice", "singleReferenceIdentifier", "value"], name: ["invoice", "singleReferenceIdentifier", "value"] }, selectField));
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// Condition 3
|
|
274
|
+
props.setReferenceIdentifierIsMandatory((_m = (((_l = (_k = (_j = props.receiverRequirements) === null || _j === void 0 ? void 0 : _j.fieldDefinitions) === null || _k === void 0 ? void 0 : _k[0].properties) === null || _l === void 0 ? void 0 : _l.cardinality) === "1..1")) !== null && _m !== void 0 ? _m : false);
|
|
275
|
+
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"] },
|
|
276
|
+
react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"], defaultPlaceholder: singleReferenceIdentifierLabel })));
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
if (referenceIdentifiersDefinitions.length === 0) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
else if (referenceIdentifiersDefinitions.length === 1) {
|
|
283
|
+
props.formInstance.setFieldsValue({
|
|
284
|
+
invoice: {
|
|
285
|
+
singleReferenceIdentifier: {
|
|
286
|
+
code: referenceIdentifiersDefinitions[0].key.replace("referenceIdentifier.", ""),
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
return getSingleReferenceIdentifierInput();
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
// Many reference identifiers
|
|
294
|
+
props.setReferenceIdentifierIsMandatory((_d = (((_c = (_b = (_a = props.receiverRequirements) === null || _a === void 0 ? void 0 : _a.fieldDefinitions) === null || _b === void 0 ? void 0 : _b[0].properties) === null || _c === void 0 ? void 0 : _c.cardinality) === "1..1")) !== null && _d !== void 0 ? _d : false);
|
|
295
|
+
var isAnyRefRequired = Boolean((_f = (_e = props.receiverRequirements) === null || _e === void 0 ? void 0 : _e.fieldDefinitions) === null || _f === void 0 ? void 0 : _f.find(function (item) { var _a; return ((_a = item.properties) === null || _a === void 0 ? void 0 : _a.cardinality) === "1..1"; }));
|
|
296
|
+
props.setReferenceIdentifierIsMandatory(isAnyRefRequired);
|
|
297
|
+
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
298
|
+
var add = _a.add, remove = _a.remove;
|
|
299
|
+
return fields.map(function (field, index) {
|
|
300
|
+
var _a;
|
|
301
|
+
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 } }),
|
|
302
|
+
react_1.default.createElement(antd_1.Row, { gutter: [16, 0] },
|
|
303
|
+
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
304
|
+
react_1.default.createElement(antd_1.Row, { gutter: 10 },
|
|
305
|
+
react_1.default.createElement(antd_1.Col, { span: index === 0 ? 22 : 24 },
|
|
306
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"] }),
|
|
307
|
+
react_1.default.createElement(antd_1.Select, { labelInValue: true, allowClear: true, style: { width: "100%" }, popupMatchSelectWidth: false, placeholder: referenceIdentifiersLabel, onChange: function (a) {
|
|
308
|
+
var newState = referenceIdentifierValue.slice();
|
|
309
|
+
newState.splice(index, 1, a);
|
|
310
|
+
setReferenceIdentifierValue(newState);
|
|
311
|
+
props.setReferenceIdentifierValidateStatus("");
|
|
312
|
+
props.formInstance.resetFields([
|
|
313
|
+
["invoice", "referenceIdentifiers", index, "value"],
|
|
314
|
+
]);
|
|
315
|
+
} }, getReferenceIdentifier(props.receiverRequirements)))),
|
|
316
|
+
index === 0 && (react_1.default.createElement(antd_1.Col, { span: 2, style: {
|
|
317
|
+
alignContent: "center",
|
|
318
|
+
marginBottom: (_a = token.Form) === null || _a === void 0 ? void 0 : _a.itemMarginBottom,
|
|
319
|
+
} },
|
|
320
|
+
react_1.default.createElement(antd_1.Flex, { align: "center" },
|
|
321
|
+
react_1.default.createElement(__1.UmzTooltip, { title: referenceIdentifiersHelpTextNode })),
|
|
322
|
+
" ")))),
|
|
323
|
+
react_1.default.createElement(antd_1.Col, { span: 12 }, getReferenceIdentifierValueFormItemInput(referenceIdentifierValue[index], props.receiverRequirements, props.rapiBaseUrl, props.legalIdentifier, field, props.referenceIdentifierValidateStatus, props.setReferenceIdentifierValidateStatus)))));
|
|
324
|
+
});
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
exports.default = (0, react_intl_1.injectIntl)(ReferenceIdentifiers);
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
setReferenceIdentifierIsMandatory: (referenceIdentifierIsMandatory: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const translationMessages: {
|
|
23
|
+
baseInformation_title: {
|
|
24
|
+
id: string;
|
|
25
|
+
defaultMessage: string;
|
|
26
|
+
};
|
|
27
|
+
baseInformation_invoiceNo: {
|
|
28
|
+
id: string;
|
|
29
|
+
defaultMessage: string;
|
|
30
|
+
};
|
|
31
|
+
baseInformation_issueDate: {
|
|
32
|
+
id: string;
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
};
|
|
35
|
+
baseInformation_issueDate_title: {
|
|
36
|
+
id: string;
|
|
37
|
+
defaultMessage: string;
|
|
38
|
+
};
|
|
39
|
+
baseInformation_dueDate: {
|
|
40
|
+
id: string;
|
|
41
|
+
defaultMessage: string;
|
|
42
|
+
};
|
|
43
|
+
baseInformation_dueDate_title: {
|
|
44
|
+
id: string;
|
|
45
|
+
defaultMessage: string;
|
|
46
|
+
};
|
|
47
|
+
baseInformation_buyerReferenceLabel: {
|
|
48
|
+
id: string;
|
|
49
|
+
defaultMessage: string;
|
|
50
|
+
};
|
|
51
|
+
baseInformation_buyerReferenceLabel_helpText: {
|
|
52
|
+
id: string;
|
|
53
|
+
defaultMessage: string;
|
|
54
|
+
};
|
|
55
|
+
baseInformation_projectReferenceLabel: {
|
|
56
|
+
id: string;
|
|
57
|
+
defaultMessage: string;
|
|
58
|
+
};
|
|
59
|
+
baseInformation_dueDateErrorMsg: {
|
|
60
|
+
id: string;
|
|
61
|
+
defaultMessage: string;
|
|
62
|
+
};
|
|
63
|
+
baseInformation_objectIdentifier: {
|
|
64
|
+
id: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
};
|
|
67
|
+
baseInformation_projectReference: {
|
|
68
|
+
id: string;
|
|
69
|
+
defaultMessage: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
declare const BaseInformationIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
73
|
+
forwardedRef?: React.Ref<any>;
|
|
74
|
+
} & React.RefAttributes<any>> & {
|
|
75
|
+
WrappedComponent: React.ComponentType<Props>;
|
|
76
|
+
};
|
|
77
|
+
export default BaseInformationIntl;
|
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
baseInformation_objectIdentifier: {
|
|
87
|
+
id: "baseInformation_objectIdentifier",
|
|
88
|
+
defaultMessage: "Object identifier",
|
|
89
|
+
},
|
|
90
|
+
baseInformation_projectReference: {
|
|
91
|
+
id: "baseInformation_projectReference",
|
|
92
|
+
defaultMessage: "Project reference is required",
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
var BaseInformation = function (props) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
var width = (0, react_use_1.useWindowSize)().width;
|
|
98
|
+
var _c = (0, react_1.useState)(false), isMobile = _c[0], setIsMobile = _c[1];
|
|
99
|
+
var _d = (0, react_1.useState)(), dueDateDefaultPickerValue = _d[0], setDueDateDefaultPickerValue = _d[1];
|
|
100
|
+
var formData = props.form.getFieldsValue();
|
|
101
|
+
var token = antd_1.theme.useToken().token;
|
|
102
|
+
(0, react_1.useEffect)(function () {
|
|
103
|
+
if (width < 768) {
|
|
104
|
+
setIsMobile(true);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
setIsMobile(false);
|
|
108
|
+
}
|
|
109
|
+
}, [width]);
|
|
110
|
+
(0, react_1.useEffect)(function () {
|
|
111
|
+
var a = getDueDateLimit(props.form.getFieldValue(["invoice", "issueDate"]), props.dueDateMinimumOffset);
|
|
112
|
+
setDueDateDefaultPickerValue(a);
|
|
113
|
+
}, [props.form.getFieldValue(["invoice", "issueDate"])]);
|
|
114
|
+
var getDueDateLimit = function (issueDate, dueDateMinimumOffset) {
|
|
115
|
+
var dueDateLimit;
|
|
116
|
+
if (issueDate) {
|
|
117
|
+
dueDateLimit = (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days").isAfter(issueDate.startOf("day"))
|
|
118
|
+
? (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days")
|
|
119
|
+
: issueDate.startOf("day");
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
dueDateLimit = (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days");
|
|
123
|
+
}
|
|
124
|
+
return dueDateLimit;
|
|
125
|
+
};
|
|
126
|
+
var disabledDate = function (dueDate, issueDate, dueDateMinimumOffset) {
|
|
127
|
+
var dueDateLimit = getDueDateLimit(issueDate, dueDateMinimumOffset);
|
|
128
|
+
return dueDate < dueDateLimit;
|
|
129
|
+
};
|
|
130
|
+
var checkIfEmpty = function (date) {
|
|
131
|
+
if (!date) {
|
|
132
|
+
props.form.setFieldValue(["invoice", "dueDate"], null);
|
|
133
|
+
props.form.validateFields(["invoice", "dueDate"]);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var onlyOneOption = function (receiverRequirements, fieldName) {
|
|
137
|
+
var a = (0, RequirementsUtility_1.getFieldRequirements)(receiverRequirements, fieldName);
|
|
138
|
+
return !!(a && a.properties && a.properties.values && a.properties.values.length === 1);
|
|
139
|
+
};
|
|
140
|
+
return (React.createElement(antd_1.Flex, { style: {
|
|
141
|
+
backgroundColor: isMobile ? undefined : token.colorInfoBg,
|
|
142
|
+
padding: isMobile ? "0 0 15px 0" : "35px",
|
|
143
|
+
}, justify: "center" },
|
|
144
|
+
React.createElement(antd_1.Flex, { vertical: true, style: { width: "100%", maxWidth: "900px" } },
|
|
145
|
+
React.createElement(antd_1.Row, { gutter: 20 },
|
|
146
|
+
React.createElement(antd_1.Col, { span: 24 },
|
|
147
|
+
React.createElement(antd_1.Typography.Title, { level: 5 }, props.intl.formatMessage(exports.translationMessages.baseInformation_title))),
|
|
148
|
+
React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
|
|
149
|
+
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"] },
|
|
150
|
+
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 }))),
|
|
151
|
+
React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
|
|
152
|
+
React.createElement(antd_1.Row, { gutter: 20 },
|
|
153
|
+
React.createElement(antd_1.Col, { span: 12 },
|
|
154
|
+
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultIsRequired: true, fieldName: ["invoice", "issueDate"] },
|
|
155
|
+
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) }))),
|
|
156
|
+
React.createElement(antd_1.Col, { span: 12 },
|
|
157
|
+
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.dueDate, defaultIsRequired: true, fieldName: ["invoice", "dueDate"], additionalRules: [
|
|
158
|
+
{
|
|
159
|
+
validator: function (rule, value, callback) {
|
|
160
|
+
if (!value) {
|
|
161
|
+
callback();
|
|
162
|
+
}
|
|
163
|
+
var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
|
|
164
|
+
value < issueDate
|
|
165
|
+
? callback(props.intl.formatMessage(exports.translationMessages.baseInformation_dueDateErrorMsg))
|
|
166
|
+
: callback();
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
] },
|
|
170
|
+
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) {
|
|
171
|
+
var currentDate = current;
|
|
172
|
+
var dueDateMinimumOffset = props.dueDateMinimumOffset;
|
|
173
|
+
var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
|
|
174
|
+
return disabledDate(currentDate, issueDate, dueDateMinimumOffset);
|
|
175
|
+
} }))))),
|
|
176
|
+
React.createElement(antd_1.Col, { span: 24 },
|
|
177
|
+
React.createElement(OrderReference_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, dependencies: [["invoice", "buyerReference"]] }),
|
|
178
|
+
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"] },
|
|
179
|
+
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 })),
|
|
180
|
+
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, setReferenceIdentifierIsMandatory: props.setReferenceIdentifierIsMandatory }),
|
|
181
|
+
React.createElement(AccountingCost_1.default, { formInstance: props.form, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier }),
|
|
182
|
+
React.createElement(ProjectReference_1.default, { receiverRequirements: props.receiverRequirements, form: props.form }))),
|
|
183
|
+
React.createElement(antd_1.Checkbox, { checked: props.isSaveFieldValuesSelected, onChange: props.onSaveFieldValuesChange }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages.saveInformation_label)))));
|
|
184
|
+
};
|
|
185
|
+
var BaseInformationIntl = (0, react_intl_1.injectIntl)(BaseInformation);
|
|
186
|
+
exports.default = BaseInformationIntl;
|