@unimaze/billing 0.21.2 → 0.21.4
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/CommonTranslations.d.ts +1 -29
- package/lib/common/components/CommonTranslations.js +4 -32
- package/lib/common/components/attachments/Attachment.d.ts +1 -1
- package/lib/common/components/attachments/AttachmentModal.d.ts +1 -1
- package/lib/common/components/attachments/index.d.ts +1 -1
- package/lib/common/components/base-information/AccountingCost.d.ts +1 -1
- package/lib/common/components/base-information/OrderReference.d.ts +1 -1
- package/lib/common/components/base-information/ProjectReference.d.ts +1 -1
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +2 -1
- package/lib/common/components/base-information/ReferenceIdentifiers.js +29 -11
- package/lib/common/components/base-information/index.d.ts +10 -1
- package/lib/common/components/base-information/index.js +9 -1
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +1 -1
- package/lib/common/components/billing-lines/BillingCalculations.js +5 -1
- package/lib/common/components/billing-lines/BillingLinePreview.d.ts +2 -1
- package/lib/common/components/billing-lines/BillingLinePreview.js +4 -2
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +1 -1
- package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -1
- package/lib/common/components/billing-lines/CurrencySelector.d.ts +20 -0
- package/lib/common/components/billing-lines/CurrencySelector.js +17 -0
- package/lib/common/components/billing-lines/DiscountTypeSelector.d.ts +10 -0
- package/lib/common/components/billing-lines/DiscountTypeSelector.js +16 -0
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -1
- package/lib/common/components/billing-lines/NewBillingLines.js +37 -327
- 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.d.ts +19 -0
- package/lib/common/components/billing-lines/SingleBillingLine.js +262 -0
- package/lib/common/components/billing-lines/UnitOfMeasureSelector.d.ts +14 -0
- package/lib/common/components/billing-lines/UnitOfMeasureSelector.js +15 -0
- 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/billing-lines/index.d.ts +3 -6
- package/lib/common/components/billing-lines/index.js +1 -1
- package/lib/common/components/customer/CostCenter.d.ts +1 -1
- package/lib/common/components/customer/CustomerContactName.d.ts +1 -1
- package/lib/common/components/customer/index.d.ts +1 -1
- package/lib/common/components/customer/index.js +6 -4
- package/lib/common/components/delivery-location/index.d.ts +1 -1
- package/lib/common/components/form-item/index.d.ts +1 -1
- package/lib/common/components/input/index.d.ts +1 -1
- package/lib/common/components/invoice/index.d.ts +3 -1
- package/lib/common/components/invoice/index.js +21 -14
- package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +1 -1
- package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +7 -8
- package/lib/common/components/invoice-preview/index.d.ts +1 -1
- package/lib/common/components/invoice-preview/index.js +8 -2
- package/lib/common/components/payment-method/index.d.ts +1 -1
- package/lib/common/components/payment-method/index.js +22 -7
- package/lib/common/components/supplier/CityAutofill.d.ts +1 -1
- package/lib/common/components/supplier/index.d.ts +1 -1
- package/lib/common/components/welcome-modal/index.d.ts +1 -1
- package/lib/common/types/ReceiverRequirements.d.ts +2 -0
- package/lib/common/types/ReceiverRequirements.js +2 -0
- package/lib/create-invoice/index.d.ts +9 -1
- package/lib/create-invoice/index.js +88 -61
- package/lib/enums.d.ts +3 -0
- package/lib/translations/locales/en.json +7 -10
- package/lib/translations/locales/is.json +5 -8
- package/lib/translations/locales.d.ts +10 -16
- 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 +102 -0
- package/lib/unimaze-billing/src/common/components/CommonTranslations.js +106 -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 +203 -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 +48 -0
- package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +306 -0
- package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +68 -0
- package/lib/unimaze-billing/src/common/components/base-information/index.js +178 -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 +153 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +41 -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 +134 -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 +129 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +495 -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 +14 -0
- package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +199 -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 +52 -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 +168 -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 +40 -0
- package/lib/unimaze-billing/src/common/components/invoice/index.js +52 -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 +105 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +16 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +405 -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 +23 -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 +81 -0
- package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +391 -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 +74 -0
- package/lib/unimaze-billing/src/create-invoice/index.js +680 -0
- package/lib/unimaze-billing/src/enums.d.ts +11 -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 +23 -0
- package/lib/unimaze-billing/src/utils/ApiUtility.js +115 -0
- package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +22 -0
- package/lib/unimaze-billing/src/utils/BillingLineUtility.js +158 -0
- package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +9 -0
- package/lib/unimaze-billing/src/utils/ConversionUtility.js +223 -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 +5 -0
- package/lib/unimaze-billing/src/utils/IntlUtility.js +55 -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 +19 -0
- package/lib/unimaze-billing/src/utils/RequirementsUtility.js +189 -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/ApiUtility.d.ts +9 -3
- package/lib/utils/ApiUtility.js +30 -2
- package/lib/utils/BillingLineUtility.d.ts +3 -0
- package/lib/utils/BillingLineUtility.js +45 -2
- package/lib/utils/RequirementsUtility.d.ts +4 -1
- package/lib/utils/RequirementsUtility.js +56 -1
- package/package.json +2 -2
|
@@ -0,0 +1,189 @@
|
|
|
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.paymentMeansTypeFieldHasValues = exports.getRequiredTooltipMessage = exports.getInput = exports.debouncedHandleSearchValues = exports.handleValueValidation = exports.getFieldIsRequired = exports.getFieldPlaceholderOverride = exports.getFieldLabelTooltipOverride = exports.getFieldLabelOverride = exports.getFieldRequirements = void 0;
|
|
27
|
+
var react_1 = __importDefault(require("react"));
|
|
28
|
+
var lodash_1 = require("lodash");
|
|
29
|
+
var axios_1 = __importDefault(require("axios"));
|
|
30
|
+
var ApiUtility_1 = require("./ApiUtility");
|
|
31
|
+
var antd_1 = require("antd");
|
|
32
|
+
// export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
|
|
33
|
+
// return recRequirements[key]!;
|
|
34
|
+
// };
|
|
35
|
+
//
|
|
36
|
+
// export const getReceiverRequirementsIsRequired = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean): boolean => {
|
|
37
|
+
// if (recRequirements.hasOwnProperty(key)) {
|
|
38
|
+
// const recRequirement = recRequirements[key];
|
|
39
|
+
// if (recRequirement) {
|
|
40
|
+
// return recRequirement.isRequired
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
// return defaultIsRequired;
|
|
44
|
+
// };
|
|
45
|
+
//
|
|
46
|
+
// export const getReceiverRequirementsLabelWithDefault = (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode): React.ReactNode => {
|
|
47
|
+
// if (recRequirements.hasOwnProperty(key)) {
|
|
48
|
+
// const recRequirement = recRequirements[key];
|
|
49
|
+
// if (recRequirement && recRequirement.label) {
|
|
50
|
+
// return recRequirement.label
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// return defaultLabel;
|
|
54
|
+
// };
|
|
55
|
+
var getFieldRequirements = function (receiverRequirements, key) {
|
|
56
|
+
return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
|
|
57
|
+
};
|
|
58
|
+
exports.getFieldRequirements = getFieldRequirements;
|
|
59
|
+
var getFieldLabelOverride = function (receiverRequirements, key, defaultLabel) {
|
|
60
|
+
var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
|
|
61
|
+
return fieldRequirement && fieldRequirement.properties.hasOwnProperty("label") ? fieldRequirement.properties.label : defaultLabel;
|
|
62
|
+
};
|
|
63
|
+
exports.getFieldLabelOverride = getFieldLabelOverride;
|
|
64
|
+
var getFieldLabelTooltipOverride = function (receiverRequirements, key, defaultLabelTooltip) {
|
|
65
|
+
var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
|
|
66
|
+
if (fieldRequirement && fieldRequirement.properties.hasOwnProperty("handling")) {
|
|
67
|
+
if (fieldRequirement.properties.handling) {
|
|
68
|
+
var handling = JSON.parse(fieldRequirement.properties.handling);
|
|
69
|
+
return handling.helpText ? handling.helpText : defaultLabelTooltip;
|
|
70
|
+
}
|
|
71
|
+
else
|
|
72
|
+
return defaultLabelTooltip;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return defaultLabelTooltip;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.getFieldLabelTooltipOverride = getFieldLabelTooltipOverride;
|
|
79
|
+
var getFieldPlaceholderOverride = function (fieldRequirement, defaultPlaceholder) {
|
|
80
|
+
if (fieldRequirement.properties.handling) {
|
|
81
|
+
var handling = JSON.parse(fieldRequirement.properties.handling);
|
|
82
|
+
return handling.placeholder ? handling.placeholder : defaultPlaceholder;
|
|
83
|
+
}
|
|
84
|
+
return defaultPlaceholder ? defaultPlaceholder : "";
|
|
85
|
+
};
|
|
86
|
+
exports.getFieldPlaceholderOverride = getFieldPlaceholderOverride;
|
|
87
|
+
var getFieldIsRequired = function (receiverRequirements, key, defaultIsRequired) {
|
|
88
|
+
var fieldRequirement = (0, exports.getFieldRequirements)(receiverRequirements, key);
|
|
89
|
+
var fieldCardinality = fieldRequirement && fieldRequirement.properties.hasOwnProperty("cardinality") && fieldRequirement.properties.cardinality;
|
|
90
|
+
return fieldCardinality ? cardinalityToRequired(fieldCardinality) || defaultIsRequired : defaultIsRequired;
|
|
91
|
+
};
|
|
92
|
+
exports.getFieldIsRequired = getFieldIsRequired;
|
|
93
|
+
var cardinalityToRequired = function (cardinality) {
|
|
94
|
+
switch (cardinality) {
|
|
95
|
+
case "0..0":
|
|
96
|
+
case "0..1":
|
|
97
|
+
return false;
|
|
98
|
+
case "1..1":
|
|
99
|
+
return true;
|
|
100
|
+
default:
|
|
101
|
+
throw new Error("Cardinality \"".concat(cardinality, "\" is not supported"));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.handleValueValidation = (0, lodash_1.debounce)(function (isoNumber, fieldName, value, rapiBaseUrl, namePath, setValidationStatus, formInstance, callName) {
|
|
105
|
+
if (value.length === 0) {
|
|
106
|
+
setValidationStatus("");
|
|
107
|
+
formInstance.resetFields([namePath]);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
var searchUrl = rapiBaseUrl + "/api/v1/requirements/".concat(isoNumber, "/").concat(fieldName, "/values/validate?value=").concat(encodeURIComponent(value));
|
|
111
|
+
setValidationStatus("validating");
|
|
112
|
+
axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
|
|
113
|
+
.then(function (response) {
|
|
114
|
+
response.data ? setValidationStatus("success") : setValidationStatus("error");
|
|
115
|
+
})
|
|
116
|
+
.catch(function () {
|
|
117
|
+
setValidationStatus("error");
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}, 500);
|
|
121
|
+
var handleValueSearch = function (searchValue, fieldDefinition, setLoadingValues, loadingValues, receiverRequirements, updateReceiverRequirementsProp, callName, rapiBaseUrl, overwrittenFieldDefinitionKey) {
|
|
122
|
+
if (fieldDefinition.properties.href) {
|
|
123
|
+
var searchUrl = rapiBaseUrl + fieldDefinition.properties.href.replace("%7BtextFilter%7D", encodeURIComponent(searchValue)).replace("%7Boffset%7D", "0").replace("%7Blimit%7D", "15");
|
|
124
|
+
if (!loadingValues) {
|
|
125
|
+
setLoadingValues(true);
|
|
126
|
+
}
|
|
127
|
+
axios_1.default.get(searchUrl, { cancelToken: (0, ApiUtility_1.getCancelToken)(callName) })
|
|
128
|
+
.then(function (response) {
|
|
129
|
+
setLoadingValues(false);
|
|
130
|
+
var updatedFieldDefinitions = __spreadArray([], receiverRequirements.fieldDefinitions, true);
|
|
131
|
+
var key = overwrittenFieldDefinitionKey ? overwrittenFieldDefinitionKey : fieldDefinition.key;
|
|
132
|
+
var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === key; });
|
|
133
|
+
var updatedFieldDefinition = __assign(__assign({}, updatedFieldDefinitions[index]), { properties: __assign(__assign({}, updatedFieldDefinitions[index].properties), { values: response.data.value }) });
|
|
134
|
+
updatedFieldDefinitions.splice(index, 1, updatedFieldDefinition);
|
|
135
|
+
var newReceiverRequirements = __assign(__assign({}, receiverRequirements), { fieldDefinitions: updatedFieldDefinitions });
|
|
136
|
+
updateReceiverRequirementsProp(newReceiverRequirements);
|
|
137
|
+
})
|
|
138
|
+
.catch(function (error) {
|
|
139
|
+
setLoadingValues(false);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
exports.debouncedHandleSearchValues = (0, lodash_1.debounce)(handleValueSearch, 500);
|
|
144
|
+
var getInput = function (fieldDefinition, namePath, validationCallName, legalIdentifier, formInstance, rapiBaseUrl, receiverRequirements, updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setHandlingValidationStatus, defaultPlaceholder, allowClearSelect) {
|
|
145
|
+
var handling = null;
|
|
146
|
+
if (fieldDefinition.properties.handling) {
|
|
147
|
+
handling = JSON.parse(fieldDefinition.properties.handling);
|
|
148
|
+
}
|
|
149
|
+
var placeholder = (0, exports.getFieldLabelOverride)(receiverRequirements, fieldDefinition.key, defaultPlaceholder);
|
|
150
|
+
if (handling && handling.shouldBeValidated) {
|
|
151
|
+
return (react_1.default.createElement(antd_1.Input, { onBlur: function (event) {
|
|
152
|
+
(0, exports.handleValueValidation)(legalIdentifier, fieldDefinition.name, event.currentTarget.value, rapiBaseUrl, namePath, setHandlingValidationStatus, formInstance, validationCallName);
|
|
153
|
+
}, placeholder: placeholder }));
|
|
154
|
+
}
|
|
155
|
+
else if (fieldDefinition.properties.values) {
|
|
156
|
+
var selectProps = fieldDefinition.properties.hasOwnProperty("href")
|
|
157
|
+
? {
|
|
158
|
+
showSearch: true,
|
|
159
|
+
filterOption: false,
|
|
160
|
+
onSearch: function (searchValue) {
|
|
161
|
+
(0, exports.debouncedHandleSearchValues)(searchValue, fieldDefinition, setLoadingAccountingCostValues, loadingAccountingCostValues, receiverRequirements, updateReceiverRequirementsProp, "getAccountingCOstValues", rapiBaseUrl);
|
|
162
|
+
},
|
|
163
|
+
loading: loadingAccountingCostValues,
|
|
164
|
+
}
|
|
165
|
+
: {};
|
|
166
|
+
return (react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false, allowClear: allowClearSelect }, selectProps, { placeholder: placeholder }), fieldDefinition.properties.values.map(function (op) {
|
|
167
|
+
return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
|
|
168
|
+
})));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
return (react_1.default.createElement(antd_1.Input, { allowClear: allowClearSelect, placeholder: placeholder }));
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
exports.getInput = getInput;
|
|
175
|
+
var getRequiredTooltipMessage = function (title, fieldNames) {
|
|
176
|
+
return (react_1.default.createElement("div", null,
|
|
177
|
+
react_1.default.createElement(antd_1.Row, null, title),
|
|
178
|
+
react_1.default.createElement(antd_1.Row, { wrap: false },
|
|
179
|
+
react_1.default.createElement("div", { className: "flex_direction_column", style: { minWidth: "100px" } },
|
|
180
|
+
react_1.default.createElement("ul", { style: { paddingLeft: "20px" } }, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.map(function (fieldName) { return react_1.default.createElement("li", null, fieldName); }))))));
|
|
181
|
+
};
|
|
182
|
+
exports.getRequiredTooltipMessage = getRequiredTooltipMessage;
|
|
183
|
+
var paymentMeansTypeFieldHasValues = function (paymentMeansTypeFieldDefinition) {
|
|
184
|
+
return paymentMeansTypeFieldDefinition &&
|
|
185
|
+
paymentMeansTypeFieldDefinition.hasOwnProperty("properties") &&
|
|
186
|
+
paymentMeansTypeFieldDefinition.properties.hasOwnProperty("values") &&
|
|
187
|
+
paymentMeansTypeFieldDefinition.properties.values !== undefined;
|
|
188
|
+
};
|
|
189
|
+
exports.paymentMeansTypeFieldHasValues = paymentMeansTypeFieldHasValues;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.submitDocument = exports.submitInvoice = exports.convertToInvoiceMetadataInput = void 0;
|
|
4
|
+
var ConversionUtility_1 = require("./ConversionUtility");
|
|
5
|
+
Object.defineProperty(exports, "convertToInvoiceMetadataInput", { enumerable: true, get: function () { return ConversionUtility_1.convertToInvoiceMetadataInput; } }); /*, convertToCreditNoteMetadataInput*/
|
|
6
|
+
var ApiUtility_1 = require("./ApiUtility");
|
|
7
|
+
Object.defineProperty(exports, "submitInvoice", { enumerable: true, get: function () { return ApiUtility_1.submitInvoice; } });
|
|
8
|
+
Object.defineProperty(exports, "submitDocument", { enumerable: true, get: function () { return ApiUtility_1.submitDocument; } });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { MessageOutput } from "@unimaze/api-clients/lib/mapi";
|
|
1
|
+
import { ImportDocumentValidationData, MessageOutput } from "@unimaze/api-clients/lib/mapi";
|
|
2
2
|
import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi/api";
|
|
3
3
|
import { AxiosPromise, CancelToken } from "axios";
|
|
4
4
|
import { LanguageProp } from "../common/types/CommonProps";
|
|
5
|
+
import { UploadFile } from "antd/es/upload/interface";
|
|
6
|
+
import { IntlShape } from "react-intl";
|
|
5
7
|
interface CreateSubmitInvoice {
|
|
6
8
|
messageId: string;
|
|
7
9
|
more: boolean;
|
|
@@ -18,6 +20,10 @@ interface AttachDocument {
|
|
|
18
20
|
}
|
|
19
21
|
declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string) => AxiosPromise<MessageOutput>;
|
|
20
22
|
declare const submitDocumentFetch: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey: string) => Promise<Response>;
|
|
21
|
-
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey: string, callName?: string, language?: LanguageProp) => AxiosPromise<MessageOutput>;
|
|
23
|
+
declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey: string, callName?: string, language?: LanguageProp) => AxiosPromise<MessageOutput | ImportDocumentValidationData[]>;
|
|
22
24
|
export declare const getCancelToken: (callName: string, showMessage?: boolean) => CancelToken;
|
|
23
|
-
|
|
25
|
+
declare const submitAttachmentIfAnyLeft: (_messageId: string, _attachments: {
|
|
26
|
+
description: string;
|
|
27
|
+
file: UploadFile;
|
|
28
|
+
}[], _mapiBaseUrl: string, _chosenCustomerApiKey: string, intl: IntlShape) => void;
|
|
29
|
+
export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument, submitDocumentFetch, submitAttachmentIfAnyLeft };
|
package/lib/utils/ApiUtility.js
CHANGED
|
@@ -14,10 +14,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.submitDocumentFetch = exports.submitDocument = exports.submitInvoice = exports.getCancelToken = void 0;
|
|
17
|
+
exports.submitAttachmentIfAnyLeft = exports.submitDocumentFetch = exports.submitDocument = exports.submitInvoice = exports.getCancelToken = void 0;
|
|
18
18
|
var api_clients_1 = require("@unimaze/api-clients");
|
|
19
19
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
20
20
|
var axios_1 = __importDefault(require("axios"));
|
|
21
|
+
var antd_1 = require("antd");
|
|
22
|
+
var create_invoice_1 = require("../create-invoice");
|
|
21
23
|
var initialiseTransactionApi = function (mapiBaseUrl) {
|
|
22
24
|
var apiConfig = {
|
|
23
25
|
basePath: mapiBaseUrl,
|
|
@@ -76,7 +78,7 @@ exports.submitDocumentFetch = submitDocumentFetch;
|
|
|
76
78
|
var submitInvoice = function (createSubmitInvoice, mapiBaseUrl, apiKey, callName, language) {
|
|
77
79
|
var transactionApi = initialiseTransactionApi(mapiBaseUrl);
|
|
78
80
|
var messageId = createSubmitInvoice.messageId, more = createSubmitInvoice.more, conversationIdentifier = createSubmitInvoice.conversationIdentifier, processingMode = createSubmitInvoice.processingMode, services = createSubmitInvoice.services, invoiceMetadataInput = createSubmitInvoice.invoiceMetadataInput;
|
|
79
|
-
return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, invoiceMetadataInput, createOptions(apiKey, callName, language));
|
|
81
|
+
return transactionApi.createSubmitInvoice(messageId, more, conversationIdentifier, processingMode, services, undefined, invoiceMetadataInput, createOptions(apiKey, callName, language));
|
|
80
82
|
};
|
|
81
83
|
exports.submitInvoice = submitInvoice;
|
|
82
84
|
var createOptions = function (apiKey, callName, language) {
|
|
@@ -103,3 +105,29 @@ var getCancelToken = function (callName, showMessage) {
|
|
|
103
105
|
return window[callName].token;
|
|
104
106
|
};
|
|
105
107
|
exports.getCancelToken = getCancelToken;
|
|
108
|
+
var submitAttachmentIfAnyLeft = function (_messageId, _attachments, _mapiBaseUrl, _chosenCustomerApiKey, intl) {
|
|
109
|
+
if (_attachments && _attachments.length > 0) {
|
|
110
|
+
var nextFileArray = _attachments.splice(0, 1);
|
|
111
|
+
var nextFile = nextFileArray[0].file.originFileObj;
|
|
112
|
+
var nextFileDescription_1 = nextFileArray[0].description;
|
|
113
|
+
if (!nextFile)
|
|
114
|
+
throw new Error("NextFile is empty");
|
|
115
|
+
var createAttachDocument = {
|
|
116
|
+
messageId: _messageId,
|
|
117
|
+
contentType: nextFile.type,
|
|
118
|
+
more: _attachments.length > 0,
|
|
119
|
+
name: nextFileDescription_1, // nextFile.name,
|
|
120
|
+
};
|
|
121
|
+
submitDocumentFetch(nextFile, createAttachDocument, _mapiBaseUrl, _chosenCustomerApiKey)
|
|
122
|
+
.then(function (submitDocumentResponse) {
|
|
123
|
+
antd_1.message.success(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_successfullyUploadedAttachmentMsg, { attachment: nextFileDescription_1 }));
|
|
124
|
+
submitAttachmentIfAnyLeft(_messageId, _attachments, _mapiBaseUrl, _chosenCustomerApiKey, intl);
|
|
125
|
+
})
|
|
126
|
+
.catch(function (documentSendingErrorMessage) {
|
|
127
|
+
antd_1.message.error("".concat(intl.formatMessage(create_invoice_1.translationMessages.createInvoice_ErrorUploadedAttachmentMsg, {
|
|
128
|
+
attachment: nextFileDescription_1,
|
|
129
|
+
}), " - ").concat(documentSendingErrorMessage.message));
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
exports.submitAttachmentIfAnyLeft = submitAttachmentIfAnyLeft;
|
|
@@ -5,6 +5,7 @@ import { BillingLineMetadataOverride } from "../common/types/BillingLineMetadata
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { IntlShape } from "react-intl";
|
|
7
7
|
import { DiscountType } from "../common/types/DiscountType";
|
|
8
|
+
import { AvailableTaxCategoryTypeEnum } from "../enums";
|
|
8
9
|
export interface Totals {
|
|
9
10
|
totalTaxableAmount: number;
|
|
10
11
|
totalTaxAmount: number;
|
|
@@ -20,3 +21,5 @@ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEn
|
|
|
20
21
|
export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum | undefined, taxCategoryTypeTranslated: string) => string;
|
|
21
22
|
export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean) => React.ReactChild;
|
|
22
23
|
export declare const getTotals: (invoiceLines: BillingLineMetadataOverride[]) => Totals;
|
|
24
|
+
export declare const getTaxCategoryDisabled: (taxCategoryType: AvailableTaxCategoryTypeEnum, outsideVatScope: boolean) => boolean;
|
|
25
|
+
export declare const getFieldNames: (keys: string[], intl: IntlShape) => string[];
|
|
@@ -25,12 +25,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
28
|
+
exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
29
29
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
30
30
|
var react_1 = __importDefault(require("react"));
|
|
31
31
|
var antd_1 = require("antd");
|
|
32
32
|
var CommonTranslations_1 = require("../common/components/CommonTranslations");
|
|
33
33
|
var ConversionUtility_1 = require("./ConversionUtility");
|
|
34
|
+
var enums_1 = require("../enums");
|
|
35
|
+
var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
|
|
34
36
|
var billingLinesFieldsMetadata = function (formInstance) {
|
|
35
37
|
var billingLinesMetadata = formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
36
38
|
return billingLinesMetadata.map(function (billingLine) {
|
|
@@ -39,7 +41,19 @@ var billingLinesFieldsMetadata = function (formInstance) {
|
|
|
39
41
|
var taxableAmount = (0, exports.calculateTaxableAmount)(restBillingLines.discountValue, restBillingLines.quantity, restBillingLines.unitPriceAmount, discountType);
|
|
40
42
|
var taxPercentage = (0, exports.calculateTaxPercentage)(restBillingLines.taxCategoryType);
|
|
41
43
|
var taxAmount = (0, exports.calculateTaxAmount)(taxableAmount, taxPercentage);
|
|
42
|
-
var
|
|
44
|
+
var discountValue;
|
|
45
|
+
if (restBillingLines.discountValue) {
|
|
46
|
+
if (discountType === "PERCENTAGE") {
|
|
47
|
+
discountValue = "".concat(restBillingLines.discountValue, "%");
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
discountValue = restBillingLines.discountValue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
discountValue = restBillingLines.discountValue;
|
|
55
|
+
}
|
|
56
|
+
var mappedBillingLine = __assign(__assign({}, restBillingLines), { discountValue: discountValue, taxableAmount: taxableAmount, taxAmount: taxAmount, taxPercentage: taxPercentage });
|
|
43
57
|
if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
|
|
44
58
|
delete mappedBillingLine.discountValue;
|
|
45
59
|
}
|
|
@@ -144,3 +158,32 @@ var getTotals = function (invoiceLines) {
|
|
|
144
158
|
return totals;
|
|
145
159
|
};
|
|
146
160
|
exports.getTotals = getTotals;
|
|
161
|
+
var getTaxCategoryDisabled = function (taxCategoryType, outsideVatScope) {
|
|
162
|
+
switch (taxCategoryType) {
|
|
163
|
+
case enums_1.AvailableTaxCategoryTypeEnum.StandardRated:
|
|
164
|
+
case enums_1.AvailableTaxCategoryTypeEnum.ReducedRated:
|
|
165
|
+
case enums_1.AvailableTaxCategoryTypeEnum.ZeroRated:
|
|
166
|
+
case enums_1.AvailableTaxCategoryTypeEnum.Exempt:
|
|
167
|
+
return outsideVatScope;
|
|
168
|
+
case enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope:
|
|
169
|
+
return !outsideVatScope;
|
|
170
|
+
default:
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
exports.getTaxCategoryDisabled = getTaxCategoryDisabled;
|
|
175
|
+
var getFieldNames = function (keys, intl) {
|
|
176
|
+
return keys === null || keys === void 0 ? void 0 : keys.map(function (key) {
|
|
177
|
+
switch (key) {
|
|
178
|
+
case "name":
|
|
179
|
+
return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_name);
|
|
180
|
+
case "quantity":
|
|
181
|
+
return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity);
|
|
182
|
+
case "unitPriceAmount":
|
|
183
|
+
return intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitPriceAmount);
|
|
184
|
+
default:
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
exports.getFieldNames = getFieldNames;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AvailableFields } from "../common/types/ReceiverRequirements";
|
|
4
|
-
import { FieldDefinition, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
|
|
4
|
+
import { FieldDefinition, FieldValues, NewReceiverRequirements } from "../common/types/NewReceiverRequirements";
|
|
5
5
|
import { FormItemProps, ValidateStatus } from "antd/lib/form/FormItem";
|
|
6
6
|
import { NamePath } from "rc-field-form/es/interface";
|
|
7
7
|
import { FormInstance } from "antd/es/form";
|
|
8
|
+
import { IntlShape } from "react-intl";
|
|
8
9
|
export declare const getFieldRequirements: (receiverRequirements: NewReceiverRequirements, key: AvailableFields) => FieldDefinition | undefined;
|
|
9
10
|
export declare const getFieldLabelOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabel: string) => string | undefined;
|
|
10
11
|
export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabelTooltip: React.ReactNode | string) => React.ReactNode | string | undefined;
|
|
@@ -16,3 +17,5 @@ export declare const handleValueValidation: import("lodash").DebouncedFunc<(isoN
|
|
|
16
17
|
export declare const debouncedHandleSearchValues: import("lodash").DebouncedFunc<(searchValue: string, fieldDefinition: FieldDefinition, setLoadingValues: (loadingValues: boolean) => void, loadingValues: boolean, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void, callName: string, rapiBaseUrl: string, overwrittenFieldDefinitionKey?: string) => void>;
|
|
17
18
|
export declare const getInput: (fieldDefinition: FieldDefinition, namePath: NamePath, validationCallName: string, legalIdentifier: string, formInstance: FormInstance, rapiBaseUrl: string, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void, setAccountingCostFieldProps: (accountingCostFiledProps: FormItemPropsWithoutChildren) => void, accountingCostFieldProps: FormItemPropsWithoutChildren, setLoadingAccountingCostValues: (loadingAccountingCostValues: boolean) => void, loadingAccountingCostValues: boolean, setHandlingValidationStatus: (handlingValidationStatus: ValidateStatus) => void, defaultPlaceholder: string, allowClearSelect?: boolean) => React.ReactNode;
|
|
18
19
|
export declare const getRequiredTooltipMessage: (title: string, fieldNames: string[]) => React.ReactNode;
|
|
20
|
+
export declare const paymentMeansTypeFieldHasValues: (paymentMeansTypeFieldDefinition: FieldDefinition | undefined) => boolean | undefined;
|
|
21
|
+
export declare const getCurrencies: (recRequirements: NewReceiverRequirements, intl: IntlShape) => FieldValues[];
|
|
@@ -23,12 +23,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getRequiredTooltipMessage = exports.getInput = exports.debouncedHandleSearchValues = exports.handleValueValidation = exports.getFieldIsRequired = exports.getFieldPlaceholderOverride = exports.getFieldLabelTooltipOverride = exports.getFieldLabelOverride = exports.getFieldRequirements = void 0;
|
|
26
|
+
exports.getCurrencies = exports.paymentMeansTypeFieldHasValues = exports.getRequiredTooltipMessage = exports.getInput = exports.debouncedHandleSearchValues = exports.handleValueValidation = exports.getFieldIsRequired = exports.getFieldPlaceholderOverride = exports.getFieldLabelTooltipOverride = exports.getFieldLabelOverride = exports.getFieldRequirements = void 0;
|
|
27
27
|
var react_1 = __importDefault(require("react"));
|
|
28
|
+
var ReceiverRequirements_1 = require("../common/types/ReceiverRequirements");
|
|
28
29
|
var lodash_1 = require("lodash");
|
|
29
30
|
var axios_1 = __importDefault(require("axios"));
|
|
30
31
|
var ApiUtility_1 = require("./ApiUtility");
|
|
31
32
|
var antd_1 = require("antd");
|
|
33
|
+
var NewBillingLines_1 = require("../common/components/billing-lines/NewBillingLines");
|
|
32
34
|
// export const getReceiverRequirements = (recRequirements: ReceiverRequirements, key: AvailableFields): FieldRequirement => {
|
|
33
35
|
// return recRequirements[key]!;
|
|
34
36
|
// };
|
|
@@ -53,6 +55,9 @@ var antd_1 = require("antd");
|
|
|
53
55
|
// return defaultLabel;
|
|
54
56
|
// };
|
|
55
57
|
var getFieldRequirements = function (receiverRequirements, key) {
|
|
58
|
+
if (key === ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"]) {
|
|
59
|
+
return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key.startsWith("referenceIdentifier."); }) : undefined;
|
|
60
|
+
}
|
|
56
61
|
return receiverRequirements ? receiverRequirements.fieldDefinitions.find(function (field) { return field.key === key; }) : undefined;
|
|
57
62
|
};
|
|
58
63
|
exports.getFieldRequirements = getFieldRequirements;
|
|
@@ -180,3 +185,53 @@ var getRequiredTooltipMessage = function (title, fieldNames) {
|
|
|
180
185
|
react_1.default.createElement("ul", { style: { paddingLeft: "20px" } }, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.map(function (fieldName) { return react_1.default.createElement("li", null, fieldName); }))))));
|
|
181
186
|
};
|
|
182
187
|
exports.getRequiredTooltipMessage = getRequiredTooltipMessage;
|
|
188
|
+
var paymentMeansTypeFieldHasValues = function (paymentMeansTypeFieldDefinition) {
|
|
189
|
+
return paymentMeansTypeFieldDefinition &&
|
|
190
|
+
paymentMeansTypeFieldDefinition.hasOwnProperty("properties") &&
|
|
191
|
+
paymentMeansTypeFieldDefinition.properties.hasOwnProperty("values") &&
|
|
192
|
+
paymentMeansTypeFieldDefinition.properties.values !== undefined;
|
|
193
|
+
};
|
|
194
|
+
exports.paymentMeansTypeFieldHasValues = paymentMeansTypeFieldHasValues;
|
|
195
|
+
var getCurrencies = function (recRequirements, intl) {
|
|
196
|
+
var currencies = [
|
|
197
|
+
{
|
|
198
|
+
key: "ISK",
|
|
199
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_ISK),
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
key: "DKK",
|
|
203
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_DKK),
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
key: "NOK",
|
|
207
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_NOK),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: "SEK",
|
|
211
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_SEK),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
key: "EUR",
|
|
215
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_EUR),
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "USD",
|
|
219
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_USD),
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
key: "GBP",
|
|
223
|
+
name: intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_currency_GBP),
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
var currencyCodeRequirements = (0, exports.getFieldRequirements)(recRequirements, ReceiverRequirements_1.AvailableFields.currencyCode);
|
|
227
|
+
if (currencyCodeRequirements &&
|
|
228
|
+
currencyCodeRequirements.properties &&
|
|
229
|
+
currencyCodeRequirements.properties.values &&
|
|
230
|
+
currencyCodeRequirements.properties.values.length > 0) {
|
|
231
|
+
return currencyCodeRequirements.properties.values;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
return currencies;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
exports.getCurrencies = getCurrencies;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unimaze/billing",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@ant-design/compatible": "latest",
|
|
12
|
-
"@unimaze/api-clients": "3.
|
|
12
|
+
"@unimaze/api-clients": "3.2.0",
|
|
13
13
|
"antd-mask-input": "^0.1.13",
|
|
14
14
|
"dayjs": "^1.11.10",
|
|
15
15
|
"lodash": "^4.17.21",
|