@unimaze/billing 0.20.17 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/lib/common/components/CommonTranslations.d.ts +102 -2
  2. package/lib/common/components/CommonTranslations.js +10 -1
  3. package/lib/common/components/attachments/Attachment.d.ts +6 -4
  4. package/lib/common/components/attachments/Attachment.js +26 -10
  5. package/lib/common/components/attachments/AttachmentModal.d.ts +21 -0
  6. package/lib/common/components/attachments/AttachmentModal.js +195 -0
  7. package/lib/common/components/attachments/index.d.ts +13 -17
  8. package/lib/common/components/attachments/index.js +189 -23
  9. package/lib/common/components/base-information/AccountingCost.d.ts +7 -5
  10. package/lib/common/components/base-information/AccountingCost.js +32 -11
  11. package/lib/common/components/base-information/OrderReference.d.ts +6 -4
  12. package/lib/common/components/base-information/OrderReference.js +31 -14
  13. package/lib/common/components/base-information/ProjectReference.d.ts +9 -5
  14. package/lib/common/components/base-information/ProjectReference.js +8 -6
  15. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +32 -5
  16. package/lib/common/components/base-information/ReferenceIdentifiers.js +126 -83
  17. package/lib/common/components/base-information/index.d.ts +51 -5
  18. package/lib/common/components/base-information/index.js +99 -154
  19. package/lib/common/components/billing-lines/BillingCalculations.d.ts +7 -5
  20. package/lib/common/components/billing-lines/BillingCalculations.js +79 -46
  21. package/lib/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
  22. package/lib/common/components/billing-lines/BillingLinePreview.js +41 -0
  23. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +6 -4
  24. package/lib/common/components/billing-lines/BillingTaxSummary.js +39 -13
  25. package/lib/common/components/billing-lines/NewBillingLines.d.ts +120 -4
  26. package/lib/common/components/billing-lines/NewBillingLines.js +396 -72
  27. package/lib/common/components/billing-lines/index.d.ts +33 -6
  28. package/lib/common/components/billing-lines/index.js +71 -244
  29. package/lib/common/components/component-container/Content.d.ts +2 -2
  30. package/lib/common/components/component-container/index.d.ts +1 -0
  31. package/lib/common/components/component-container/index.js +1 -1
  32. package/lib/common/components/customer/CostCenter.d.ts +6 -4
  33. package/lib/common/components/customer/CostCenter.js +25 -9
  34. package/lib/common/components/customer/CustomerContactName.d.ts +6 -4
  35. package/lib/common/components/customer/CustomerContactName.js +24 -8
  36. package/lib/common/components/customer/hardCoddedCustomer.js +19 -3
  37. package/lib/common/components/customer/index.d.ts +11 -5
  38. package/lib/common/components/customer/index.js +97 -42
  39. package/lib/common/components/date-picker/index.d.ts +21 -0
  40. package/lib/common/components/date-picker/index.js +23 -0
  41. package/lib/common/components/delivery-location/index.d.ts +6 -4
  42. package/lib/common/components/delivery-location/index.js +20 -4
  43. package/lib/common/components/editable-cell/index.js +2 -2
  44. package/lib/common/components/editable-row/index.d.ts +1 -1
  45. package/lib/common/components/editable-row/index.js +24 -7
  46. package/lib/common/components/form-item/index.d.ts +13 -6
  47. package/lib/common/components/form-item/index.js +16 -20
  48. package/lib/common/components/index.d.ts +10 -0
  49. package/lib/common/components/index.js +30 -8
  50. package/lib/common/components/input/index.d.ts +23 -0
  51. package/lib/common/components/input/index.js +37 -0
  52. package/lib/common/components/invoice/index.d.ts +40 -0
  53. package/lib/common/components/invoice/index.js +52 -0
  54. package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  55. package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
  56. package/lib/common/components/invoice-preview/index.d.ts +16 -0
  57. package/lib/common/components/invoice-preview/index.js +393 -0
  58. package/lib/common/components/locale-intl/index.d.ts +0 -10
  59. package/lib/common/components/locale-intl/index.js +50 -42
  60. package/lib/common/components/payment-method/index.d.ts +69 -6
  61. package/lib/common/components/payment-method/index.js +145 -57
  62. package/lib/common/components/payment-method/paymentMethodForConversion.js +3 -1
  63. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  64. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  65. package/lib/common/components/submit-confirmation/index.d.ts +8 -0
  66. package/lib/common/components/submit-confirmation/index.js +34 -0
  67. package/lib/common/components/supplier/CityAutofill.d.ts +18 -0
  68. package/lib/common/components/supplier/CityAutofill.js +159 -0
  69. package/lib/common/components/supplier/index.d.ts +79 -5
  70. package/lib/common/components/supplier/index.js +195 -103
  71. package/lib/common/components/tooltip/index.d.ts +7 -0
  72. package/lib/common/components/tooltip/index.js +15 -0
  73. package/lib/common/components/welcome-modal/index.d.ts +15 -0
  74. package/lib/common/components/welcome-modal/index.js +26 -0
  75. package/lib/common/consts/formLayout.js +4 -3
  76. package/lib/common/consts/validationRules.d.ts +1 -1
  77. package/lib/common/consts/validationRules.js +6 -0
  78. package/lib/common/enums/index.js +5 -1
  79. package/lib/common/style/index.css +18 -0
  80. package/lib/common/types/BillingLineMetadataOverride.d.ts +2 -0
  81. package/lib/common/types/CommonProps.d.ts +15 -1
  82. package/lib/common/types/DiscountType.d.ts +1 -0
  83. package/lib/common/types/DiscountType.js +2 -0
  84. package/lib/common/types/ReceiverRequirements.d.ts +1 -1
  85. package/lib/common/types/ReceiverRequirements.js +1 -0
  86. package/lib/common/types/index.js +15 -0
  87. package/lib/create-invoice/IntlLoader.d.ts +0 -6
  88. package/lib/create-invoice/IntlLoader.js +78 -13
  89. package/lib/create-invoice/index.d.ts +65 -4
  90. package/lib/create-invoice/index.js +437 -181
  91. package/lib/enums.d.ts +2 -3
  92. package/lib/enums.js +1 -0
  93. package/lib/index.js +22 -6
  94. package/lib/translations/locales/en.json +181 -0
  95. package/lib/translations/locales/is.json +135 -116
  96. package/lib/translations/locales.d.ts +360 -161
  97. package/lib/translations/locales.js +3 -2
  98. package/lib/utils/ApiUtility.d.ts +4 -4
  99. package/lib/utils/ApiUtility.js +13 -10
  100. package/lib/utils/BillingLineUtility.d.ts +16 -5
  101. package/lib/utils/BillingLineUtility.js +65 -26
  102. package/lib/utils/ConversionUtility.js +15 -7
  103. package/lib/utils/FileUploadUtility.d.ts +4 -2
  104. package/lib/utils/FileUploadUtility.js +28 -9
  105. package/lib/utils/IntlUtility.d.ts +3 -2
  106. package/lib/utils/IntlUtility.js +2 -1
  107. package/lib/utils/LocationUtility.d.ts +1 -0
  108. package/lib/utils/LocationUtility.js +81 -0
  109. package/lib/utils/ReferenceIdentifierUtility.js +2 -1
  110. package/lib/utils/RequirementsUtility.d.ts +9 -7
  111. package/lib/utils/RequirementsUtility.js +46 -22
  112. package/lib/utils/index.js +4 -3
  113. package/package.json +36 -18
  114. package/lib/style/index.css +0 -51
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { WrappedComponentProps } from "react-intl";
3
+ import { FormInstance } from "antd";
4
+ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
5
+ import { ValidateStatus } from "antd/es/form/FormItem";
6
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
7
+ import { LanguageProp } from "../../types/CommonProps";
8
+ import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
9
+ interface Props extends WrappedComponentProps {
10
+ form: FormInstance;
11
+ receiverRequirements: NewReceiverRequirements;
12
+ documentType: "creditNote" | "invoice";
13
+ updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
14
+ rapiBaseUrl: string;
15
+ legalIdentifier: string;
16
+ referenceIdentifiersLabelText?: string;
17
+ referenceIdentifiersHelpText?: string;
18
+ referenceIdentifierValidateStatus: ValidateStatus;
19
+ chosenCustomer: PartyMetadata;
20
+ setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
21
+ dueDateMinimumOffset: number;
22
+ billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
23
+ outsideVatScope: boolean;
24
+ uploadSizeLimit: number;
25
+ attachmentTooltipText?: {
26
+ is: string;
27
+ en: string;
28
+ };
29
+ languageString: LanguageProp;
30
+ validateFields: (fieldNames: string[][], validateOnly?: boolean | undefined) => void;
31
+ isSaveFieldValuesSelected: boolean;
32
+ onSaveFieldValuesChange: () => void;
33
+ isActiveStep: boolean;
34
+ }
35
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
36
+ forwardedRef?: React.Ref<any> | undefined;
37
+ } & React.RefAttributes<any>> & {
38
+ WrappedComponent: React.ComponentType<Props>;
39
+ };
40
+ export default _default;
@@ -0,0 +1,52 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ var react_1 = __importStar(require("react"));
27
+ var react_intl_1 = require("react-intl");
28
+ var __1 = require("..");
29
+ var lodash_1 = require("lodash");
30
+ var Invoice = function (props) {
31
+ var fieldPaths = [
32
+ ["invoice", "invoiceNo"],
33
+ ["invoice", "issueDate"],
34
+ ["invoice", "dueDate"],
35
+ ["invoice", "buyerReference"],
36
+ ["invoice", "orderReference", "documentNo"],
37
+ ["invoice", "accountingCost"],
38
+ ["invoice", "documentReferences", "project", "documentNo"],
39
+ ["invoice", "invoiceLines"]
40
+ ];
41
+ var debouncedValidateFields = (0, lodash_1.debounce)(props.validateFields, 500);
42
+ (0, react_1.useEffect)(function () {
43
+ if (!props.isActiveStep)
44
+ return;
45
+ debouncedValidateFields(fieldPaths, true);
46
+ }, [props.isActiveStep, JSON.stringify(props.form.getFieldsValue(fieldPaths))]);
47
+ return (react_1.default.createElement(react_1.default.Fragment, null,
48
+ react_1.default.createElement(__1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: props.form, documentType: "invoice", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.chosenCustomer.identifier, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifierValidateStatus: props.referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus: props.setReferenceIdentifierValidateStatus, dueDateMinimumOffset: props.dueDateMinimumOffset, isSaveFieldValuesSelected: props.isSaveFieldValuesSelected, onSaveFieldValuesChange: props.onSaveFieldValuesChange }),
49
+ react_1.default.createElement(__1.BillingLines, { formInstance: props.form, billingLinesMetadata: props.billingLinesMetadata, receiverRequirements: props.receiverRequirements, outsideVatScope: props.outsideVatScope }),
50
+ react_1.default.createElement(__1.Attachments, { formInstance: props.form, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, languageString: props.languageString })));
51
+ };
52
+ exports.default = (0, react_intl_1.injectIntl)(Invoice);
@@ -0,0 +1,12 @@
1
+ import { FormInstance } from "antd";
2
+ import React from "react";
3
+ import { WrappedComponentProps } from "react-intl";
4
+ interface Props extends WrappedComponentProps {
5
+ form: FormInstance;
6
+ }
7
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
8
+ forwardedRef?: React.Ref<any> | undefined;
9
+ } & React.RefAttributes<any>> & {
10
+ WrappedComponent: React.ComponentType<Props>;
11
+ };
12
+ export default _default;
@@ -0,0 +1,105 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var antd_1 = require("antd");
18
+ var react_1 = __importDefault(require("react"));
19
+ var react_intl_1 = require("react-intl");
20
+ var colors_1 = require("@ant-design/colors");
21
+ var react_intl_2 = require("react-intl");
22
+ var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
23
+ var supplier_1 = require("../supplier");
24
+ var IntlUtility_1 = require("../../../utils/IntlUtility");
25
+ var translationMessages = (0, react_intl_2.defineMessages)({
26
+ invoicePreview_headerTitle: {
27
+ id: "invoicePreview.headerTitle",
28
+ defaultMessage: "Invoice",
29
+ },
30
+ });
31
+ var WrappedInvoicePreviewHeader = function (props) {
32
+ return (react_1.default.createElement(antd_1.ConfigProvider, { theme: {
33
+ token: {
34
+ colorText: "white",
35
+ colorTextDescription: colors_1.grey[2],
36
+ fontSizeHeading5: 16,
37
+ fontSizeLG: 20,
38
+ fontSizeXL: 30,
39
+ fontSize: 12,
40
+ fontSizeSM: 10,
41
+ fontWeightStrong: 700,
42
+ },
43
+ components: {
44
+ Layout: {
45
+ headerBg: colors_1.grey[7],
46
+ headerPadding: "35px",
47
+ headerHeight: 200,
48
+ },
49
+ },
50
+ } },
51
+ react_1.default.createElement(InvoicePreviewHeader, __assign({}, props))));
52
+ };
53
+ var InvoicePreviewHeader = function (props) {
54
+ var token = antd_1.theme.useToken().token;
55
+ return (react_1.default.createElement(antd_1.Flex, { justify: "center" },
56
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { width: "100%", maxWidth: "900px" } },
57
+ react_1.default.createElement(antd_1.Layout.Header, { style: { width: "100vw", maxWidth: "900px" } },
58
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
59
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: {
60
+ borderBottom: "1px solid ".concat(colors_1.grey[2]),
61
+ paddingBottom: "5px",
62
+ marginBottom: "10px",
63
+ } },
64
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM } },
65
+ props.intl.formatMessage(translationMessages.invoicePreview_headerTitle),
66
+ ":"),
67
+ react_1.default.createElement(antd_1.Typography.Text, null, props.form.getFieldValue(["invoice", "invoiceNo"]))),
68
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: {
69
+ borderBottom: "1px solid ".concat(colors_1.grey[2]),
70
+ paddingBottom: "5px",
71
+ marginBottom: "10px",
72
+ } },
73
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM } },
74
+ props.intl.formatMessage(supplier_1.translationMessages.supplier_title),
75
+ ":"),
76
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading5, fontWeight: 500 } }, props.form.getFieldValue(["invoice", "supplier", "name"]))),
77
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
78
+ react_1.default.createElement(antd_1.Typography.Text, null,
79
+ props.form.getFieldValue(["invoice", "currencyCode"]),
80
+ react_1.default.createElement(antd_1.Typography.Text, { strong: true, style: {
81
+ fontSize: token.fontSizeLG,
82
+ } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.getTotals)(props.form.getFieldValue(["invoice", "invoiceLines"]))
83
+ .totalTaxInclusiveAmount, props.intl)))),
84
+ react_1.default.createElement(antd_1.Flex, { vertical: true, align: "flex-end" },
85
+ props.form.getFieldValue(["invoice", "singleReferenceIdentifier"]) &&
86
+ props.form.getFieldValue(["invoice", "singleReferenceIdentifier"]).code &&
87
+ props.form.getFieldValue(["invoice", "singleReferenceIdentifier"]).value && (react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
88
+ props.form.getFieldValue(["invoice", "singleReferenceIdentifier"]).code,
89
+ ":",
90
+ " ",
91
+ props.form.getFieldValue(["invoice", "singleReferenceIdentifier"]).value)),
92
+ props.form.getFieldValue(["invoice", "referenceIdentifiers"]) &&
93
+ props.form
94
+ .getFieldValue(["invoice", "referenceIdentifiers"])
95
+ .map(function (referenceIdentifier, index) {
96
+ var _a, _b;
97
+ if (referenceIdentifier.code && referenceIdentifier.value) {
98
+ return (react_1.default.createElement(antd_1.Typography.Text, { key: index, style: { fontSize: token.fontSizeSM } },
99
+ ((_a = referenceIdentifier === null || referenceIdentifier === void 0 ? void 0 : referenceIdentifier.code) === null || _a === void 0 ? void 0 : _a.label) || ((_b = referenceIdentifier === null || referenceIdentifier === void 0 ? void 0 : referenceIdentifier.code) === null || _b === void 0 ? void 0 : _b.key),
100
+ ": ", referenceIdentifier === null || referenceIdentifier === void 0 ? void 0 :
101
+ referenceIdentifier.value));
102
+ }
103
+ })))))));
104
+ };
105
+ exports.default = (0, react_intl_1.injectIntl)(WrappedInvoicePreviewHeader);
@@ -0,0 +1,16 @@
1
+ import { WrappedComponentProps } from "react-intl";
2
+ import React from "react";
3
+ import { FormInstance } from "antd";
4
+ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
5
+ import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
6
+ interface Props extends WrappedComponentProps {
7
+ recieverRequirements: NewReceiverRequirements;
8
+ form: FormInstance;
9
+ chosenCustomer: PartyMetadata;
10
+ }
11
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
12
+ forwardedRef?: React.Ref<any> | undefined;
13
+ } & React.RefAttributes<any>> & {
14
+ WrappedComponent: React.ComponentType<Props>;
15
+ };
16
+ export default _default;
@@ -0,0 +1,393 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var react_intl_1 = require("react-intl");
7
+ var react_1 = __importDefault(require("react"));
8
+ var antd_1 = require("antd");
9
+ var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
10
+ var enums_1 = require("../../../enums");
11
+ var icons_1 = require("@ant-design/icons");
12
+ var colors_1 = require("@ant-design/colors");
13
+ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
14
+ var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
15
+ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
16
+ var payment_method_1 = require("../payment-method");
17
+ var IntlUtility_1 = require("../../../utils/IntlUtility");
18
+ var translationMessages = (0, react_intl_1.defineMessages)({
19
+ customer_title: {
20
+ id: "customer_title",
21
+ defaultMessage: "Customer",
22
+ },
23
+ customer_address_streetNameAndNumber: {
24
+ id: "customer_address_streetNameAndNumber",
25
+ defaultMessage: "Address",
26
+ },
27
+ customer_identifier: {
28
+ id: "customer_identifier",
29
+ defaultMessage: "Identifier",
30
+ },
31
+ baseInformation_costCenter: {
32
+ id: "baseInformation_costCenter",
33
+ defaultMessage: "Cost center",
34
+ },
35
+ baseInformation_issueDate: {
36
+ id: "baseInformation_issueDate",
37
+ defaultMessage: "Issue date",
38
+ },
39
+ baseInformation_dueDate: {
40
+ id: "baseInformation_dueDate",
41
+ defaultMessage: "Due date",
42
+ },
43
+ baseInformation_notes: {
44
+ id: "baseInformation_notes",
45
+ defaultMessage: "Notes",
46
+ },
47
+ supplier_title: {
48
+ id: "supplier_title",
49
+ defaultMessage: "Supplier",
50
+ },
51
+ supplier_identifier: {
52
+ id: "supplier_identifier",
53
+ defaultMessage: "Supplier identifier",
54
+ },
55
+ supplier_address_streetNameAndNumber: {
56
+ id: "supplier_address_streetNameAndNumber",
57
+ defaultMessage: "Address",
58
+ },
59
+ supplier_contact_phoneNumber: {
60
+ id: "supplier_contact_phoneNumber",
61
+ defaultMessage: "Phone number",
62
+ },
63
+ billingCalculations_labels_TaxAmountWithoutVat: {
64
+ id: "billingCalculations_labels_TaxAmountWithoutVat",
65
+ defaultMessage: "Total amount without VAT",
66
+ },
67
+ billingCalculations_labels_AmountPayable: {
68
+ id: "billingCalculations_labels_AmountPayable",
69
+ defaultMessage: "Amount payable",
70
+ },
71
+ billingCalculations_labels_TotalAmountWithVat: {
72
+ id: "billingCalculations_labels_TotalAmountWithVat",
73
+ defaultMessage: "Total amount with VAT",
74
+ },
75
+ billingLines_discount: {
76
+ id: "billingLines_discount",
77
+ defaultMessage: "Discount",
78
+ },
79
+ billingLines_total: {
80
+ id: "billingLines_total",
81
+ defaultMessage: "Total",
82
+ },
83
+ invoicePreview_billingLinesTitle: {
84
+ id: "invoicePreview_billingLinesTitle",
85
+ defaultMessage: "Invoice lines",
86
+ },
87
+ invoicePreview_attachmentsTitle: {
88
+ id: "invoicePreview_attachmentsTitle",
89
+ defaultMessage: "Attachments",
90
+ },
91
+ invoicePreview_paymentInfoTitle: {
92
+ id: "invoicePreview_paymentInfoTitle",
93
+ defaultMessage: "Payment information",
94
+ },
95
+ });
96
+ var InvoicePreview = function (props) {
97
+ var _a, _b, _c, _d, _e, _f;
98
+ var defaultPaymentMethods = [
99
+ {
100
+ key: mapi_1.PaymentMeansType.NotSpecified,
101
+ name: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_methods_undefined),
102
+ },
103
+ {
104
+ key: mapi_1.PaymentMeansType.MutuallyAgreed,
105
+ name: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_methods_mutuallyAgreed),
106
+ },
107
+ {
108
+ key: mapi_1.PaymentMeansType.DomesticTransfer,
109
+ name: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_methods_domesticTransfer),
110
+ },
111
+ {
112
+ key: mapi_1.PaymentMeansType.DomesticClaim,
113
+ name: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_methods_domesticClaim),
114
+ },
115
+ ];
116
+ var token = antd_1.theme.useToken().token;
117
+ var getPaymentMeansValue = function (paymentMeansType) {
118
+ var paymentMeansTypes = (0, RequirementsUtility_1.getFieldRequirements)(props.recieverRequirements, ReceiverRequirements_1.AvailableFields["paymentMeans.type"]);
119
+ if (paymentMeansTypes &&
120
+ paymentMeansTypes.hasOwnProperty("properties") &&
121
+ paymentMeansTypes.properties.hasOwnProperty("values") &&
122
+ paymentMeansTypes.properties.values) {
123
+ var paymentMeansValue = paymentMeansTypes.properties.values.find(function (value) { return value.key === paymentMeansType; });
124
+ return paymentMeansValue === null || paymentMeansValue === void 0 ? void 0 : paymentMeansValue.name;
125
+ }
126
+ else {
127
+ var paymentMeansValue = defaultPaymentMethods.find(function (value) { return value.key === paymentMeansType; });
128
+ return paymentMeansValue === null || paymentMeansValue === void 0 ? void 0 : paymentMeansValue.name;
129
+ }
130
+ };
131
+ var formValueFile1 = props.form.getFieldValue(["attachments", "file1", "file"]);
132
+ var formValueFile2 = props.form.getFieldValue(["attachments", "file2", "file"]);
133
+ var formValueFile3 = props.form.getFieldValue(["attachments", "file3", "file"]);
134
+ return (react_1.default.createElement(antd_1.Flex, { justify: "center" },
135
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { width: "100%", maxWidth: "900px" } },
136
+ react_1.default.createElement(antd_1.Row, { gutter: [20, 20] },
137
+ react_1.default.createElement(antd_1.Col, { span: 24 },
138
+ react_1.default.createElement(antd_1.Card, { bordered: false, style: { backgroundColor: "#F5F5F5" }, title: react_1.default.createElement(antd_1.Row, { gutter: 20 },
139
+ react_1.default.createElement(antd_1.Col, { span: 12 },
140
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "flex-end", style: { fontWeight: 400 } },
141
+ react_1.default.createElement(antd_1.Typography.Text, null, props.intl.formatMessage(translationMessages.baseInformation_issueDate)),
142
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM } }, (_a = props.form
143
+ .getFieldValue(["invoice", "issueDate"])) === null || _a === void 0 ? void 0 : _a.format("DD.MM.YYYY")))),
144
+ react_1.default.createElement(antd_1.Col, { span: 12, style: { borderLeft: "1px solid ".concat(colors_1.grey[0]) } },
145
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "flex-end", style: { fontWeight: 400 } },
146
+ react_1.default.createElement(antd_1.Typography.Text, null, props.intl.formatMessage(translationMessages.baseInformation_dueDate)),
147
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM } }, (_b = props.form.getFieldValue(["invoice", "dueDate"])) === null || _b === void 0 ? void 0 : _b.format("DD.MM.YYYY"))))) },
148
+ react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "small" },
149
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4, fontWeight: 500 } },
150
+ props.intl.formatMessage(translationMessages.customer_title),
151
+ ":"),
152
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, props.chosenCustomer.name),
153
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
154
+ props.intl.formatMessage(translationMessages.customer_identifier),
155
+ ":",
156
+ " ",
157
+ props.chosenCustomer.identifier),
158
+ ((_c = props.chosenCustomer.address) === null || _c === void 0 ? void 0 : _c.streetNameAndNumber) &&
159
+ ((_d = props.chosenCustomer.address) === null || _d === void 0 ? void 0 : _d.postalZone) &&
160
+ ((_e = props.chosenCustomer.address) === null || _e === void 0 ? void 0 : _e.city) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
161
+ props.intl.formatMessage(translationMessages.customer_address_streetNameAndNumber),
162
+ ": ",
163
+ props.chosenCustomer.address.streetNameAndNumber,
164
+ ",",
165
+ " ",
166
+ props.chosenCustomer.address.postalZone,
167
+ " ",
168
+ props.chosenCustomer.address.city)),
169
+ props.form.getFieldValue(["invoice", "customer", "locationIdentifier"]) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
170
+ props.intl.formatMessage(translationMessages.baseInformation_costCenter),
171
+ ":",
172
+ " ",
173
+ props.form.getFieldValue(["invoice", "customer", "locationIdentifier"]))),
174
+ react_1.default.createElement(antd_1.Col, { span: 8, style: { padding: 0 } },
175
+ react_1.default.createElement("hr", null)),
176
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4, fontWeight: 500 } },
177
+ props.intl.formatMessage(translationMessages.supplier_title),
178
+ ":"),
179
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, props.form.getFieldValue(["invoice", "supplier", "name"])),
180
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
181
+ props.intl.formatMessage(translationMessages.supplier_identifier),
182
+ ":",
183
+ " ",
184
+ props.form.getFieldValue(["invoice", "supplier", "identifier"])),
185
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
186
+ props.intl.formatMessage(translationMessages.supplier_address_streetNameAndNumber),
187
+ ":",
188
+ " ",
189
+ props.form.getFieldValue([
190
+ "invoice",
191
+ "supplier",
192
+ "address",
193
+ "streetNameAndNumber",
194
+ ]),
195
+ ", ",
196
+ props.form.getFieldValue(["invoice", "supplier", "address", "postalZone"]),
197
+ " ",
198
+ props.form.getFieldValue(["invoice", "supplier", "address", "city"])),
199
+ props.form.getFieldValue(["invoice", "supplier", "contact", "telephone"]) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
200
+ props.intl.formatMessage(translationMessages.supplier_contact_phoneNumber),
201
+ ":",
202
+ props.form.getFieldValue(["invoice", "supplier", "contact", "telephone"]))),
203
+ props.form.getFieldValue(["invoice", "supplier", "contact", "electronicMail"]) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, props.form.getFieldValue(["invoice", "supplier", "contact", "electronicMail"])))))),
204
+ react_1.default.createElement(antd_1.Col, { span: 24 },
205
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { padding: "0 24px" }, gap: "middle" },
206
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4 } },
207
+ props.intl.formatMessage(translationMessages.invoicePreview_billingLinesTitle),
208
+ ":"),
209
+ ((_f = props.form.getFieldValue(["invoice", "invoiceLines"])) === null || _f === void 0 ? void 0 : _f.length) > 0 &&
210
+ props.form
211
+ .getFieldValue(["invoice", "invoiceLines"])
212
+ .map(function (line, index) {
213
+ var _a, _b;
214
+ var taxPercentage = (0, BillingLineUtility_1.calculateTaxPercentage)(enums_1.AvailableTaxCategoryTypeEnum[line.taxCategoryType]);
215
+ return (react_1.default.createElement(antd_1.Flex, { key: index, vertical: true, gap: "small" },
216
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
217
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, line.name),
218
+ react_1.default.createElement(antd_1.Flex, { style: {
219
+ backgroundColor: "#F5F5F5",
220
+ margin: "0 -24px",
221
+ padding: "0 24px",
222
+ } },
223
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
224
+ line.quantity,
225
+ " ", (_a = line.unitOfMeasure) === null || _a === void 0 ? void 0 :
226
+ _a.unit,
227
+ " -",
228
+ " ",
229
+ (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(line.unitPriceAmount, props.intl),
230
+ " ",
231
+ line.currencyCode,
232
+ " / ", (_b = line.unitOfMeasure) === null || _b === void 0 ? void 0 :
233
+ _b.unit))),
234
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "center" },
235
+ react_1.default.createElement(antd_1.Typography.Text, null,
236
+ taxPercentage,
237
+ "% VAT"),
238
+ react_1.default.createElement(antd_1.Typography.Text, null,
239
+ (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.calculateTaxAmount)(line.taxableAmount, taxPercentage), props.intl),
240
+ " ",
241
+ line.currencyCode)),
242
+ line.discountValue && (react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "center" },
243
+ react_1.default.createElement(antd_1.Typography.Text, null,
244
+ line.discountValue,
245
+ "%",
246
+ " ",
247
+ props.intl.formatMessage(translationMessages.billingLines_discount)),
248
+ react_1.default.createElement(antd_1.Typography.Text, null,
249
+ (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.calculateDiscountAmount)(line.discountValue, line.quantity, line.unitPriceAmount), props.intl),
250
+ " ",
251
+ line.currencyCode))),
252
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
253
+ react_1.default.createElement(antd_1.Col, { span: 24, style: { padding: 0 } },
254
+ react_1.default.createElement("hr", null)),
255
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "center" },
256
+ react_1.default.createElement(antd_1.Typography.Text, null, props.intl.formatMessage(translationMessages.billingLines_total)),
257
+ react_1.default.createElement(antd_1.Typography.Text, null,
258
+ (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(line.taxableAmount, props.intl),
259
+ " ",
260
+ line.currencyCode)))));
261
+ }))),
262
+ react_1.default.createElement(antd_1.Col, { span: 24 },
263
+ react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "small" },
264
+ react_1.default.createElement(antd_1.Card, { bordered: false, style: { backgroundColor: "#F5F5F5" }, size: "small" },
265
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { padding: "0 12px" } },
266
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between" },
267
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat)),
268
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
269
+ props.form.getFieldValue(["invoice", "currencyCode"]),
270
+ " ",
271
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.getTotals)(props.form.getFieldValue(["invoice", "invoiceLines"]))
272
+ .totalTaxableAmount, props.intl)))),
273
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between" },
274
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat)),
275
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
276
+ props.form.getFieldValue(["invoice", "currencyCode"]),
277
+ " ",
278
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.getTotals)(props.form.getFieldValue(["invoice", "invoiceLines"]))
279
+ .totalTaxInclusiveAmount, props.intl)))))),
280
+ react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "center", style: { padding: "0 24px" } },
281
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } },
282
+ props.intl.formatMessage(translationMessages.billingCalculations_labels_AmountPayable),
283
+ ":"),
284
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4 } },
285
+ props.form.getFieldValue(["invoice", "currencyCode"]),
286
+ " ",
287
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeXL } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.getTotals)(props.form.getFieldValue(["invoice", "invoiceLines"]))
288
+ .totalTaxInclusiveAmount, props.intl)))))),
289
+ props.form.getFieldValue(["invoice", "notes"]) && (react_1.default.createElement(antd_1.Col, { span: 24 },
290
+ react_1.default.createElement(antd_1.Card, { bordered: false, size: "small", style: { backgroundColor: "#F5F5F5" } },
291
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { padding: "0 12px" } },
292
+ react_1.default.createElement(antd_1.Typography.Text, { disabled: true },
293
+ props.intl.formatMessage(translationMessages.baseInformation_notes),
294
+ ":"),
295
+ react_1.default.createElement(antd_1.Typography.Text, null, props.form.getFieldValue(["invoice", "notes"])))))),
296
+ (formValueFile1 ||
297
+ formValueFile2 ||
298
+ formValueFile3) && (react_1.default.createElement(antd_1.Col, { span: 24 },
299
+ react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "small" },
300
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4 } }, props.intl.formatMessage(translationMessages.invoicePreview_attachmentsTitle)),
301
+ formValueFile1 && (react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "flex-start" },
302
+ react_1.default.createElement(icons_1.PaperClipOutlined, { style: { fontSize: "18px" } }),
303
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
304
+ react_1.default.createElement(antd_1.Typography.Text, { style: { textDecoration: "underline" } }, formValueFile1.name),
305
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontWeight: 300 } }, props.form.getFieldValue([
306
+ "attachments",
307
+ "file1",
308
+ "description",
309
+ ]))))),
310
+ formValueFile2 && (react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "flex-start" },
311
+ react_1.default.createElement(icons_1.PaperClipOutlined, { style: { fontSize: "18px" } }),
312
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
313
+ react_1.default.createElement(antd_1.Typography.Text, { style: { textDecoration: "underline" } }, formValueFile2.name),
314
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontWeight: 300 } }, props.form.getFieldValue([
315
+ "attachments",
316
+ "file2",
317
+ "description",
318
+ ]))))),
319
+ formValueFile3 && (react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "flex-start" },
320
+ react_1.default.createElement(icons_1.PaperClipOutlined, { style: { fontSize: "18px" } }),
321
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
322
+ react_1.default.createElement(antd_1.Typography.Text, { style: { textDecoration: "underline" } }, formValueFile3.name),
323
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontWeight: 300 } }, props.form.getFieldValue([
324
+ "attachments",
325
+ "file3",
326
+ "description",
327
+ ])))))))),
328
+ react_1.default.createElement(antd_1.Col, { span: 24 },
329
+ react_1.default.createElement(antd_1.Card, { bordered: false, style: { backgroundColor: "#F5F5F5" }, size: "small" },
330
+ react_1.default.createElement(antd_1.Flex, { vertical: true, style: { padding: "0 12px" }, gap: "small" },
331
+ react_1.default.createElement(antd_1.Typography.Text, { style: { fontWeight: 700 } }, props.intl.formatMessage(translationMessages.invoicePreview_paymentInfoTitle)),
332
+ react_1.default.createElement(antd_1.Flex, { vertical: true },
333
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
334
+ props.form.getFieldValue(["invoice", "supplier", "name"]),
335
+ " Kt:",
336
+ " ",
337
+ props.form.getFieldValue(["invoice", "supplier", "identifier"])),
338
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" }, getPaymentMeansValue(props.form.getFieldValue(["invoice", "paymentMeans", "type"]))),
339
+ props.form.getFieldValue(["invoice", "paymentMeans", "domesticTransfer"]) && (react_1.default.createElement(react_1.default.Fragment, null,
340
+ react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
341
+ "Reikningsn\u00FAmer:",
342
+ " ",
343
+ props.form.getFieldValue([
344
+ "invoice",
345
+ "paymentMeans",
346
+ "domesticTransfer",
347
+ "bankNumber",
348
+ ]),
349
+ "-",
350
+ props.form.getFieldValue([
351
+ "invoice",
352
+ "paymentMeans",
353
+ "domesticTransfer",
354
+ "accountTypeNumber",
355
+ ]),
356
+ "-",
357
+ props.form.getFieldValue([
358
+ "invoice",
359
+ "paymentMeans",
360
+ "domesticTransfer",
361
+ "accountNumber",
362
+ ])),
363
+ props.form.getFieldValue([
364
+ "invoice",
365
+ "paymentMeans",
366
+ "domesticTransfer",
367
+ "paymentIdentifier",
368
+ ]) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
369
+ props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_labels_domesticTransfer_paymentReference),
370
+ ":",
371
+ " ",
372
+ props.form.getFieldValue([
373
+ "invoice",
374
+ "paymentMeans",
375
+ "domesticTransfer",
376
+ "paymentIdentifier",
377
+ ]))))),
378
+ props.form.getFieldValue(["invoice", "paymentMeans", "domesticClaim"]) && (react_1.default.createElement(antd_1.Typography.Text, { type: "secondary" },
379
+ props.form.getFieldValue([
380
+ "invoice",
381
+ "paymentMeans",
382
+ "domesticClaim",
383
+ "bankNumber",
384
+ ]),
385
+ "-66-",
386
+ props.form.getFieldValue([
387
+ "invoice",
388
+ "paymentMeans",
389
+ "domesticClaim",
390
+ "accountNumber",
391
+ ])))))))))));
392
+ };
393
+ exports.default = (0, react_intl_1.injectIntl)(InvoicePreview);
@@ -1,10 +0,0 @@
1
- import * as React from "react";
2
- import "moment/locale/is";
3
- import "moment/locale/sr";
4
- interface IHotSwappingIntlProviderOwnProps {
5
- initialLocale: string;
6
- initialMessages: any;
7
- languageString?: string;
8
- }
9
- declare const HotIntlProvider: React.FC<IHotSwappingIntlProviderOwnProps>;
10
- export default HotIntlProvider;