@unimaze/billing 0.1.1 → 0.1.2-rc.10
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/README.md +11 -3
- package/lib/common/components/attachments/Attachment.d.ts +8 -2
- package/lib/common/components/attachments/Attachment.js +33 -8
- package/lib/common/components/attachments/index.d.ts +9 -2
- package/lib/common/components/attachments/index.js +15 -6
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +6 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +40 -0
- package/lib/common/components/base-information/index.d.ts +6 -3
- package/lib/common/components/base-information/index.js +100 -81
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/common/components/billing-lines/BillingCalculations.js +61 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.js +51 -0
- package/lib/common/components/billing-lines/billingLIneFormData.d.ts +7 -0
- package/lib/common/components/billing-lines/billingLIneFormData.js +63 -0
- package/lib/common/components/billing-lines/index.d.ts +9 -23
- package/lib/common/components/billing-lines/index.js +116 -38
- package/lib/common/components/customer/hardCoddedCustomer.d.ts +7 -0
- package/lib/common/components/{issuer/index.js → customer/hardCoddedCustomer.js} +5 -8
- package/lib/common/components/customer/index.d.ts +6 -0
- package/lib/common/components/customer/index.js +93 -0
- package/lib/common/components/delivery-location/index.d.ts +5 -2
- package/lib/common/components/delivery-location/index.js +43 -11
- package/lib/common/components/editable-cell/index.d.ts +1 -1
- package/lib/common/components/editable-cell/index.js +76 -10
- package/lib/common/components/editable-row/index.d.ts +5 -5
- package/lib/common/components/editable-row/index.js +8 -6
- package/lib/common/components/form-item/index.d.ts +21 -0
- package/lib/common/components/form-item/index.js +27 -0
- package/lib/common/components/index.d.ts +10 -5
- package/lib/common/components/index.js +20 -8
- package/lib/common/components/locale-intl/index.d.ts +10 -0
- package/lib/common/components/locale-intl/index.js +45 -0
- package/lib/common/components/payment-method/index.d.ts +6 -3
- package/lib/common/components/payment-method/index.js +67 -27
- package/lib/common/components/supplier/index.d.ts +6 -0
- package/lib/common/components/supplier/index.js +93 -0
- package/lib/common/consts/validationRules.d.ts +2 -3
- package/lib/common/consts/validationRules.js +0 -7
- package/lib/common/enums/index.d.ts +1 -1
- package/lib/common/enums/index.js +2 -4
- package/lib/common/types/BillingLineMetadataOverride.d.ts +1 -0
- package/lib/common/types/ReceiverRequirements.d.ts +81 -0
- package/lib/common/types/ReceiverRequirements.js +379 -0
- package/lib/create-credit-note/index.d.ts +2 -3
- package/lib/create-credit-note/index.js +17 -28
- package/lib/create-invoice/index.d.ts +1 -2
- package/lib/create-invoice/index.js +79 -21
- package/lib/example/src/index.d.ts +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +8 -5
- package/lib/src/common/components/attachments/Attachment.d.ts +21 -0
- package/lib/src/common/components/attachments/index.d.ts +10 -0
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +6 -0
- package/lib/src/common/components/base-information/index.d.ts +12 -0
- package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +7 -0
- package/lib/src/common/components/billing-lines/index.d.ts +13 -0
- package/lib/src/common/components/component-container/Content.d.ts +7 -0
- package/lib/src/common/components/component-container/Header.d.ts +9 -0
- package/lib/src/common/components/component-container/index.d.ts +10 -0
- package/lib/src/common/components/customer/index.d.ts +6 -0
- package/lib/src/common/components/delivery-location/index.d.ts +6 -0
- package/lib/src/common/components/editable-cell/index.d.ts +11 -0
- package/lib/src/common/components/editable-row/index.d.ts +6 -0
- package/lib/src/common/components/form-item/index.d.ts +21 -0
- package/lib/src/common/components/index.d.ts +10 -0
- package/lib/src/common/components/locale-intl/index.d.ts +10 -0
- package/lib/src/common/components/payment-method/index.d.ts +6 -0
- package/lib/src/common/components/supplier/index.d.ts +6 -0
- package/lib/src/common/consts/validationRules.d.ts +6 -0
- package/lib/src/common/types/ReceiverRequirements.d.ts +81 -0
- package/lib/src/create-invoice/index.d.ts +14 -0
- package/lib/src/translations/locales.d.ts +74 -0
- package/lib/src/utils/ApiUtility.d.ts +21 -0
- package/lib/src/utils/BillingLineUtility.d.ts +8 -0
- package/lib/src/utils/ConversionUtility.d.ts +5 -0
- package/lib/src/utils/RequirementsUtility.d.ts +5 -0
- package/lib/src/utils/billingLineFormData.d.ts +7 -0
- package/lib/src/utils/index.d.ts +2 -0
- package/lib/style/index.css +0 -1222
- package/lib/translations/locales/is.json +70 -0
- package/lib/translations/locales.d.ts +74 -0
- package/lib/translations/locales.js +10 -0
- package/lib/utils/ApiUtility.d.ts +21 -0
- package/lib/utils/ApiUtility.js +59 -0
- package/lib/utils/BillingLineUtility.d.ts +8 -0
- package/lib/utils/BillingLineUtility.js +66 -0
- package/lib/utils/ConversionUtility.d.ts +5 -0
- package/lib/utils/ConversionUtility.js +146 -0
- package/lib/utils/RequirementsUtility.d.ts +5 -0
- package/lib/utils/RequirementsUtility.js +23 -0
- package/lib/utils/billingLineFormData.d.ts +7 -0
- package/lib/utils/billingLineFormData.js +63 -0
- package/lib/utils/index.d.ts +2 -5
- package/lib/utils/index.js +5 -162
- package/package.json +13 -8
- package/lib/common/components/issuer/index.d.ts +0 -7
- package/lib/common/components/payer/index.d.ts +0 -3
- package/lib/common/components/payer/index.js +0 -50
package/README.md
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
# README #
|
|
1
|
+
- # README #
|
|
2
|
+
|
|
3
|
+
## Peer dependencies ##
|
|
4
|
+
- "antd": "4.3.3",
|
|
5
|
+
- "axios": "^0.19.2",
|
|
6
|
+
- "react": "16.13.1",
|
|
7
|
+
- "react-dom": "16.13.1",
|
|
8
|
+
- "react-intl": "^2.9.0",
|
|
9
|
+
- "react-intl.macro": "^0.3.7"
|
|
2
10
|
|
|
3
11
|
## Components ##
|
|
4
|
-
### `<CreateInvoice
|
|
12
|
+
### `<CreateInvoice />` ###
|
|
5
13
|
|
|
6
14
|
Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|
|
7
15
|
|
|
8
16
|
|Property |Description |Type |Default |
|
|
9
17
|
|:----------------------|:------------------------------------------------------|:------------------------------------------------------|:----------|
|
|
10
|
-
|
|
|
18
|
+
|customer |Sets the Invoice customer |Object `ProfileOutput` | |
|
|
11
19
|
|language |Sets the language of the component |`en` `is` `pl` `undefined` |`en` |
|
|
12
20
|
|mapiBaseUrl |Url of the MAPI |string | |
|
|
13
21
|
|rapiBaseUrl |Url of the RAPI |string | |
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
|
-
|
|
3
|
+
import { UploadFile } from "antd/lib/upload/interface";
|
|
4
|
+
import { InjectedIntlProps } from "react-intl";
|
|
5
|
+
interface Props extends InjectedIntlProps {
|
|
4
6
|
fieldName: string;
|
|
7
|
+
handleAddFile: (file: UploadFile) => void;
|
|
5
8
|
}
|
|
6
9
|
interface States {
|
|
7
10
|
file: any[];
|
|
@@ -12,4 +15,7 @@ declare class Attachment extends React.Component<Props, States> {
|
|
|
12
15
|
normFile: (e: any) => any;
|
|
13
16
|
render(): JSX.Element;
|
|
14
17
|
}
|
|
15
|
-
|
|
18
|
+
declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "key" | "ref" | "fieldName" | "handleAddFile">, any> & {
|
|
19
|
+
WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -34,6 +34,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
var React = __importStar(require("react"));
|
|
35
35
|
require("@ant-design/compatible/assets/index.css");
|
|
36
36
|
var antd_1 = require("antd");
|
|
37
|
+
var react_intl_1 = require("react-intl");
|
|
38
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
39
|
+
attachment_labels_Reference: {
|
|
40
|
+
id: "attachment_labels_Reference",
|
|
41
|
+
defaultMessage: "Reference",
|
|
42
|
+
},
|
|
43
|
+
attachment_labels_Reference_requiredMessage: {
|
|
44
|
+
id: "attachment_labels_Reference_requiredMessage",
|
|
45
|
+
defaultMessage: "Please input the reference",
|
|
46
|
+
},
|
|
47
|
+
attachment_labels_Description: {
|
|
48
|
+
id: "attachment_labels_Description",
|
|
49
|
+
defaultMessage: "Description",
|
|
50
|
+
},
|
|
51
|
+
attachment_labels_Description_requiredMessage: {
|
|
52
|
+
id: "attachment_labels_Description_requiredMessage",
|
|
53
|
+
defaultMessage: "Please input the description",
|
|
54
|
+
},
|
|
55
|
+
attachment_labels_File: {
|
|
56
|
+
id: "attachment_labels_File",
|
|
57
|
+
defaultMessage: "File",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
37
60
|
var Attachment = /** @class */ (function (_super) {
|
|
38
61
|
__extends(Attachment, _super);
|
|
39
62
|
function Attachment(props) {
|
|
@@ -54,25 +77,27 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
54
77
|
return _this;
|
|
55
78
|
}
|
|
56
79
|
Attachment.prototype.render = function () {
|
|
80
|
+
var _this = this;
|
|
57
81
|
return (React.createElement(React.Fragment, null,
|
|
58
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label:
|
|
82
|
+
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label: this.props.intl.formatMessage(translationMessages.attachment_labels_Reference), name: "attachment:" + this.props.fieldName + ":reference", rules: [
|
|
59
83
|
{
|
|
60
84
|
required: this.state.file.length > 0,
|
|
61
|
-
message:
|
|
85
|
+
message: this.props.intl.formatMessage(translationMessages.attachment_labels_Reference_requiredMessage),
|
|
62
86
|
}
|
|
63
87
|
] },
|
|
64
88
|
React.createElement(antd_1.Input, null)),
|
|
65
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label:
|
|
89
|
+
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label: this.props.intl.formatMessage(translationMessages.attachment_labels_Description), name: "attachment:" + this.props.fieldName + ":description", rules: [
|
|
66
90
|
{
|
|
67
91
|
required: this.state.file.length > 0,
|
|
68
|
-
message:
|
|
92
|
+
message: this.props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
69
93
|
}
|
|
70
94
|
] },
|
|
71
95
|
React.createElement(antd_1.Input, null)),
|
|
72
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label:
|
|
73
|
-
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + this.props.fieldName, multiple: false, onRemove: this.handleRemoveFile })
|
|
74
|
-
|
|
96
|
+
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label: this.props.intl.formatMessage(translationMessages.attachment_labels_File), name: "attachment:" + this.props.fieldName, valuePropName: "fileList", getValueFromEvent: this.normFile },
|
|
97
|
+
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + this.props.fieldName, multiple: false, onRemove: this.handleRemoveFile, beforeUpload: function () { return false; }, onChange: function (info) {
|
|
98
|
+
_this.props.handleAddFile(info.file);
|
|
99
|
+
} }))));
|
|
75
100
|
};
|
|
76
101
|
return Attachment;
|
|
77
102
|
}(React.Component));
|
|
78
|
-
exports.default = Attachment;
|
|
103
|
+
exports.default = react_intl_1.injectIntl(React.memo(Attachment));
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { UploadFile } from "antd/lib/upload/interface";
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
handleAddFile: (file: UploadFile) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const AttachmentGroupIntl: React.ComponentClass<Pick<Props, "handleAddFile">, any> & {
|
|
8
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
|
+
};
|
|
10
|
+
export default AttachmentGroupIntl;
|
|
@@ -11,12 +11,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
var React = __importStar(require("react"));
|
|
14
|
-
var
|
|
14
|
+
var components_1 = require("../../components");
|
|
15
15
|
var Attachment_1 = __importDefault(require("./Attachment"));
|
|
16
|
+
var react_intl_1 = require("react-intl");
|
|
17
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
18
|
+
attachment_title: {
|
|
19
|
+
id: "attachment.title",
|
|
20
|
+
defaultMessage: "Attachments",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
16
23
|
var AttachmentsGroup = function (props) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
React.createElement(Attachment_1.default, { fieldName: "
|
|
20
|
-
React.createElement(Attachment_1.default, { fieldName: "
|
|
24
|
+
var handleAddFile = props.handleAddFile;
|
|
25
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.attachment_title) },
|
|
26
|
+
React.createElement(Attachment_1.default, { handleAddFile: handleAddFile, fieldName: "file1" }),
|
|
27
|
+
React.createElement(Attachment_1.default, { handleAddFile: handleAddFile, fieldName: "file2" }),
|
|
28
|
+
React.createElement(Attachment_1.default, { handleAddFile: handleAddFile, fieldName: "file3" })));
|
|
21
29
|
};
|
|
22
|
-
|
|
30
|
+
var AttachmentGroupIntl = react_intl_1.injectIntl(AttachmentsGroup);
|
|
31
|
+
exports.default = AttachmentGroupIntl;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
var react_1 = __importStar(require("react"));
|
|
14
|
+
var react_intl_1 = require("react-intl");
|
|
15
|
+
var antd_1 = require("antd");
|
|
16
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
17
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
18
|
+
// interface Props extends InjectedIntlProps {
|
|
19
|
+
//
|
|
20
|
+
// }
|
|
21
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
22
|
+
referenceIdentifiers_labels_type: {
|
|
23
|
+
id: "referenceIdentifiers_labels_type",
|
|
24
|
+
defaultMessage: "Reference identifier type",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
var ReferenceIdentifiers = function (props) {
|
|
28
|
+
var _a = react_1.useState(null), referenceIdentifierType = _a[0], setReferenceIdentifierType = _a[1];
|
|
29
|
+
var handleOnChange = function (value, option) {
|
|
30
|
+
// console.log("value", value)
|
|
31
|
+
// console.log("option", option)
|
|
32
|
+
};
|
|
33
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
34
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_type), defaultIsRequired: true, fieldName: "code" },
|
|
35
|
+
react_1.default.createElement(antd_1.Select, { onChange: function (value, option) { return handleOnChange(value, option); } },
|
|
36
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "AKY" }, "B\u00EDln\u00FAmer"),
|
|
37
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "SSN" }, "Kennitala"),
|
|
38
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, "Fasteignan\u00FAmer")))));
|
|
39
|
+
};
|
|
40
|
+
exports.default = react_intl_1.injectIntl(ReferenceIdentifiers);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
3
|
import { FormInstance } from "antd/es/form";
|
|
4
|
-
|
|
4
|
+
import { InjectedIntlProps } from "react-intl";
|
|
5
|
+
interface Props extends InjectedIntlProps {
|
|
5
6
|
form: FormInstance;
|
|
6
7
|
documentType: "creditNote" | "invoice";
|
|
7
8
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
9
|
+
declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "documentType">, any> & {
|
|
10
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
|
+
};
|
|
12
|
+
export default BaseInformationIntl;
|
|
@@ -11,102 +11,121 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
var React = __importStar(require("react"));
|
|
14
|
-
var
|
|
14
|
+
var components_1 = require("../../components");
|
|
15
15
|
require("@ant-design/compatible/assets/index.css");
|
|
16
16
|
var antd_1 = require("antd");
|
|
17
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
18
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
19
|
+
var react_intl_1 = require("react-intl");
|
|
20
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
21
|
+
baseInformation_title: {
|
|
22
|
+
id: "baseInformation_title",
|
|
23
|
+
defaultMessage: "Base Information",
|
|
24
|
+
},
|
|
25
|
+
baseInformation_invoiceNo: {
|
|
26
|
+
id: "baseInformation_invoiceNo",
|
|
27
|
+
defaultMessage: "Invoice No",
|
|
28
|
+
},
|
|
29
|
+
baseInformation_issueDate: {
|
|
30
|
+
id: "baseInformation_issueDate",
|
|
31
|
+
defaultMessage: "Issue date"
|
|
32
|
+
},
|
|
33
|
+
baseInformation_dueDate: {
|
|
34
|
+
id: "baseInformation_dueDate",
|
|
35
|
+
defaultMessage: "Due date"
|
|
36
|
+
},
|
|
37
|
+
baseInformation_orderReference_documentNo: {
|
|
38
|
+
id: "baseInformation_orderReference_documentNo",
|
|
39
|
+
defaultMessage: "Order no"
|
|
40
|
+
},
|
|
41
|
+
baseInformation_notes: {
|
|
42
|
+
id: "baseInformation_notes",
|
|
43
|
+
defaultMessage: "Notes"
|
|
44
|
+
},
|
|
45
|
+
baseInformation_currencyCode: {
|
|
46
|
+
id: "baseInformation_currencyCode",
|
|
47
|
+
defaultMessage: "Currency"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
17
50
|
var BaseInformation = function (props) {
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
var getCurrencies = function (recRequirements) {
|
|
52
|
+
var currencies = [
|
|
53
|
+
{
|
|
54
|
+
key: "ISK",
|
|
55
|
+
label: "Icelandic krona (ISK)"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "DKK",
|
|
59
|
+
label: "Danish krona (DKK)"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "NOK",
|
|
63
|
+
label: "Norwegian krona (NOK)"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "SEK",
|
|
67
|
+
label: "Swedish krona (SEK)"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "EUR",
|
|
71
|
+
label: "Euro (EUR)"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: "USD",
|
|
75
|
+
label: "US dollar (USD)"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "GBP",
|
|
79
|
+
label: "British pound (GBP)"
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
if (recRequirements.currencyCode && recRequirements.currencyCode.values && recRequirements.currencyCode.values.length > 0) {
|
|
83
|
+
return recRequirements.currencyCode.values.map(function (currency) {
|
|
84
|
+
return React.createElement(antd_1.Select.Option, { value: currency.key, title: currency.label, key: currency.key }, currency.label);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return currencies.map(function (currency) {
|
|
89
|
+
return React.createElement(antd_1.Select.Option, { value: currency.key, title: currency.label, key: currency.key }, currency.label);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
48
93
|
var disabledDate = function (dueDate, issueDate) {
|
|
49
94
|
return dueDate < issueDate;
|
|
50
95
|
};
|
|
51
96
|
var checkIfEmpty = function (date) {
|
|
52
97
|
if (!date) {
|
|
53
|
-
props.form.resetFields(["
|
|
54
|
-
props.form.validateFields(["
|
|
98
|
+
props.form.resetFields(["invoice", "dueDate"]);
|
|
99
|
+
props.form.validateFields(["invoice", "dueDate"]).then(function (values) {
|
|
55
100
|
// console.log(values);
|
|
56
101
|
});
|
|
57
102
|
}
|
|
58
103
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
case "creditNote":
|
|
62
|
-
return "Credit note no.";
|
|
63
|
-
case "invoice":
|
|
64
|
-
return "Invoice no.";
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return (React.createElement(component_container_1.default, { title: "Base information" },
|
|
68
|
-
React.createElement(antd_1.Form.Item, { label: getDocumentNoLabel(props.documentType), name: "baseInformation:invoiceNo" },
|
|
104
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.baseInformation_title) },
|
|
105
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_invoiceNo), defaultIsRequired: true, fieldName: ["invoice", "invoiceNo"] },
|
|
69
106
|
React.createElement(antd_1.Input, null)),
|
|
70
|
-
React.createElement(
|
|
107
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_issueDate), defaultIsRequired: true, fieldName: ["invoice", "issueDate"] },
|
|
108
|
+
React.createElement(antd_1.DatePicker, null)),
|
|
109
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.dueDate, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_dueDate), defaultIsRequired: false, fieldName: ["invoice", "dueDate"], additionalRules: [
|
|
71
110
|
{
|
|
72
|
-
|
|
73
|
-
|
|
111
|
+
validator: (function (rule, value, callback) {
|
|
112
|
+
if (!value) {
|
|
113
|
+
callback();
|
|
114
|
+
}
|
|
115
|
+
var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
|
|
116
|
+
value < issueDate
|
|
117
|
+
? callback("Due date must be after the issue date")
|
|
118
|
+
: callback();
|
|
119
|
+
}),
|
|
74
120
|
},
|
|
75
|
-
]
|
|
76
|
-
React.createElement(antd_1.DatePicker,
|
|
77
|
-
props.
|
|
78
|
-
React.createElement(React.Fragment, null,
|
|
79
|
-
React.createElement(antd_1.Form.Item, { label: "Due date", name: "baseInformation:dueDate", rules: [
|
|
80
|
-
{
|
|
81
|
-
validator: (function (rule, value, callback) {
|
|
82
|
-
if (!value) {
|
|
83
|
-
callback();
|
|
84
|
-
}
|
|
85
|
-
var issueDate = props.form.getFieldValue("baseInformation:issueDate");
|
|
86
|
-
value < issueDate
|
|
87
|
-
? callback("Due date must be after the issue date")
|
|
88
|
-
: callback();
|
|
89
|
-
}),
|
|
90
|
-
},
|
|
91
|
-
] },
|
|
92
|
-
React.createElement(antd_1.DatePicker, { onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue("baseInformation:issueDate")); }) })),
|
|
93
|
-
React.createElement(antd_1.Form.Item, { label: "Last payment date", name: "baseInformation:lastPaymentDate" },
|
|
94
|
-
React.createElement(antd_1.DatePicker, null))),
|
|
95
|
-
props.documentType === "creditNote" &&
|
|
96
|
-
React.createElement(antd_1.Form.Item, { label: "Invoice no", name: "baseInformation:invoiceReferenceNo", rules: [
|
|
97
|
-
{
|
|
98
|
-
required: true,
|
|
99
|
-
message: "Please input the invoice no."
|
|
100
|
-
}
|
|
101
|
-
] },
|
|
102
|
-
React.createElement(antd_1.Input, null)),
|
|
103
|
-
React.createElement(antd_1.Form.Item, { label: "Order no", name: "baseInformation:orderNo" },
|
|
121
|
+
] },
|
|
122
|
+
React.createElement(antd_1.DatePicker, { onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(["invoice", "issueDate"])); }) })),
|
|
123
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReference_documentNo), defaultIsRequired: false, fieldName: ["invoice", "orderReference", "documentNo"] },
|
|
104
124
|
React.createElement(antd_1.Input, null)),
|
|
105
|
-
React.createElement(
|
|
125
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"] },
|
|
106
126
|
React.createElement(antd_1.Input.TextArea, null)),
|
|
107
|
-
React.createElement(
|
|
108
|
-
React.createElement(antd_1.Select, { defaultActiveFirstOption: true },
|
|
109
|
-
return React.createElement(antd_1.Select.Option, { value: currency.value, title: currency.display, key: currency.value }, currency.display);
|
|
110
|
-
})))));
|
|
127
|
+
React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_currencyCode), defaultIsRequired: true, fieldName: ["invoice", "currencyCode"] },
|
|
128
|
+
React.createElement(antd_1.Select, { defaultActiveFirstOption: true }, getCurrencies(ReceiverRequirements_1.receiverRequirementsObject)))));
|
|
111
129
|
};
|
|
112
|
-
|
|
130
|
+
var BaseInformationIntl = react_intl_1.injectIntl(BaseInformation);
|
|
131
|
+
exports.default = BaseInformationIntl;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
billingLinesMetadata: BillingLineMetadataOverride[];
|
|
6
|
+
renderCurrencyColumn: (text: string | number) => string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.ComponentClass<Pick<Props, "billingLinesMetadata" | "renderCurrencyColumn">, any> & {
|
|
9
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var antd_1 = require("antd");
|
|
8
|
+
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
|
+
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
10
|
+
var react_intl_1 = require("react-intl");
|
|
11
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
12
|
+
billingCalculations_labels_TaxAmountWithoutVat: {
|
|
13
|
+
id: "billingCalculations_labels_TaxAmountWithoutVat",
|
|
14
|
+
defaultMessage: "Total amount without VAT",
|
|
15
|
+
},
|
|
16
|
+
billingCalculations_labels_TotalVatAmount: {
|
|
17
|
+
id: "billingCalculations_labels_TotalVatAmount",
|
|
18
|
+
defaultMessage: "Total VAT amount",
|
|
19
|
+
},
|
|
20
|
+
billingCalculations_labels_TotalAmountWithVat: {
|
|
21
|
+
id: "billingCalculations_labels_TotalAmountWithVat",
|
|
22
|
+
defaultMessage: "Total amount with VAT",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
var BillingCalculations = function (props) {
|
|
26
|
+
var billingLinesMetadata = props.billingLinesMetadata;
|
|
27
|
+
var totals = {
|
|
28
|
+
totalTaxableAmount: 0,
|
|
29
|
+
totalTaxAmount: 0,
|
|
30
|
+
totalTaxInclusiveAmount: 0,
|
|
31
|
+
};
|
|
32
|
+
billingLinesMetadata.map(function (billingLine) {
|
|
33
|
+
var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
34
|
+
var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
35
|
+
var taxInclusiveAmount = taxableAmount + taxAmount;
|
|
36
|
+
totals = {
|
|
37
|
+
totalTaxAmount: totals.totalTaxAmount + taxAmount,
|
|
38
|
+
totalTaxableAmount: totals.totalTaxableAmount + taxableAmount,
|
|
39
|
+
totalTaxInclusiveAmount: totals.totalTaxInclusiveAmount + taxInclusiveAmount,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
43
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
44
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
45
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat),
|
|
46
|
+
":"),
|
|
47
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxableAmount)))),
|
|
48
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
49
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
50
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalVatAmount),
|
|
51
|
+
":"),
|
|
52
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxAmount)))),
|
|
53
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
54
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
55
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } },
|
|
56
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat),
|
|
57
|
+
":")),
|
|
58
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
59
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } }, props.renderCurrencyColumn(Math.round(totals.totalTaxInclusiveAmount)))))));
|
|
60
|
+
};
|
|
61
|
+
exports.default = react_intl_1.injectIntl(BillingCalculations);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
billingLines: BillingLineMetadataOverride[];
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
|
|
8
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var antd_1 = require("antd");
|
|
8
|
+
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
|
+
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
10
|
+
var react_intl_1 = require("react-intl");
|
|
11
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
12
|
+
billingTaxSummary_taxOverview: {
|
|
13
|
+
id: "billingTaxSummary_taxOverview",
|
|
14
|
+
defaultMessage: "Tax overview"
|
|
15
|
+
},
|
|
16
|
+
billingTaxSummary_taxableAmount: {
|
|
17
|
+
id: "billingTaxSummary_taxableAmount",
|
|
18
|
+
defaultMessage: "Taxable amount"
|
|
19
|
+
},
|
|
20
|
+
billingTaxSummary_taxAmount: {
|
|
21
|
+
id: "billingTaxSummary_taxAmount",
|
|
22
|
+
defaultMessage: "Tax"
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
var BillingTaxSummary = function (props) {
|
|
26
|
+
var dataSource = props.billingLines.map(function (billingLine) {
|
|
27
|
+
return {
|
|
28
|
+
taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(billingLine.taxCategoryType),
|
|
29
|
+
taxableAmount: BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount),
|
|
30
|
+
taxAmount: BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType]))
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
var columns = [
|
|
34
|
+
{
|
|
35
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxOverview),
|
|
36
|
+
dataIndex: "taxOverview",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxableAmount),
|
|
40
|
+
dataIndex: "taxableAmount",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxAmount),
|
|
44
|
+
dataIndex: "taxAmount",
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
return (react_1.default.createElement(antd_1.Table, { style: { minHeight: "170px" },
|
|
48
|
+
// showHeader={false}
|
|
49
|
+
columns: columns, dataSource: dataSource, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }));
|
|
50
|
+
};
|
|
51
|
+
exports.default = react_intl_1.injectIntl(BillingTaxSummary);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
|
|
2
|
+
import { FormInstance } from "antd/es/form";
|
|
3
|
+
import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
|
|
4
|
+
export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
|
|
5
|
+
export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
|
|
6
|
+
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
7
|
+
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
15
|
+
exports.billingLinesFieldsMetadata = function (formInstance) {
|
|
16
|
+
var billingLinesMetadata = formInstance.getFieldValue("billingLinesMetadata");
|
|
17
|
+
return billingLinesMetadata.map(function (billingLine) {
|
|
18
|
+
var taxableAmount = exports.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
19
|
+
var taxPercentage = exports.calculateTaxPercentage(billingLine.taxCategoryType);
|
|
20
|
+
var taxAmount = exports.calculateTaxAmount(taxableAmount, taxPercentage);
|
|
21
|
+
var mappedBillingLine = __assign({}, billingLine, { taxableAmount: taxableAmount,
|
|
22
|
+
taxAmount: taxAmount,
|
|
23
|
+
taxPercentage: taxPercentage });
|
|
24
|
+
if (mappedBillingLine.discountValue === "0" || mappedBillingLine.discountValue === "0%") {
|
|
25
|
+
delete mappedBillingLine.discountValue;
|
|
26
|
+
}
|
|
27
|
+
return mappedBillingLine;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.calculateTaxableAmount = function (discountValue, quantity, unitPriceAmount) {
|
|
31
|
+
if (!quantity || !unitPriceAmount) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
if (discountValue) {
|
|
35
|
+
if (discountValue.endsWith("%")) {
|
|
36
|
+
// (quantity * unitPriceAmount) * ((100 - discountValue) / 100)
|
|
37
|
+
return ((quantity * unitPriceAmount) * ((100 - parseFloat(discountValue)) / 100));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// (quantity * unitPriceAmount) - discountValue
|
|
41
|
+
return ((quantity * unitPriceAmount) - parseFloat(discountValue));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return (quantity * unitPriceAmount);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.calculateTaxAmount = function (taxableAmount, taxPercentage) {
|
|
49
|
+
// taxableAmount * (taxPercentage / 100)
|
|
50
|
+
return (taxableAmount * (taxPercentage / 100));
|
|
51
|
+
};
|
|
52
|
+
exports.calculateTaxPercentage = function (taxCategoryType) {
|
|
53
|
+
// inferred from the taxCategoryType? what is the mapping? ZeroRated/Exempt = 0, StandardRated = 24, ReducedRate = 11
|
|
54
|
+
switch (taxCategoryType) {
|
|
55
|
+
case api_1.TaxCategoryTypeEnum.StandardRated:
|
|
56
|
+
return 24;
|
|
57
|
+
case api_1.TaxCategoryTypeEnum.ReducedRated:
|
|
58
|
+
return 11;
|
|
59
|
+
case api_1.TaxCategoryTypeEnum.ZeroRated:
|
|
60
|
+
case api_1.TaxCategoryTypeEnum.Exempt:
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
};
|