@unimaze/billing 0.1.2-rc.8 → 0.2.0-rc.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.
- package/lib/common/components/attachments/Attachment.d.ts +7 -3
- package/lib/common/components/attachments/Attachment.js +69 -15
- package/lib/common/components/attachments/index.d.ts +5 -2
- package/lib/common/components/attachments/index.js +18 -5
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +54 -0
- package/lib/common/components/base-information/index.d.ts +6 -3
- package/lib/common/components/base-information/index.js +131 -80
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/common/components/billing-lines/BillingCalculations.js +63 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.js +53 -0
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +10 -0
- package/lib/common/components/billing-lines/NewBillingLines.js +77 -0
- package/lib/common/components/billing-lines/index.d.ts +7 -15
- package/lib/common/components/billing-lines/index.js +173 -62
- package/lib/{src/common/components/issuer/index.d.ts → common/components/customer/hardCoddedCustomer.d.ts} +2 -2
- package/lib/common/components/{issuer/index.js → customer/hardCoddedCustomer.js} +5 -8
- package/lib/common/components/customer/index.d.ts +5 -6
- package/lib/common/components/customer/index.js +101 -12
- package/lib/common/components/delivery-location/index.d.ts +5 -2
- package/lib/common/components/delivery-location/index.js +65 -10
- package/lib/common/components/editable-cell/index.js +7 -9
- package/lib/common/components/form-item/index.d.ts +23 -0
- package/lib/common/components/form-item/index.js +44 -0
- 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 +107 -15
- package/lib/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/common/components/payment-method/paymentMethodForConversion.js +44 -0
- package/lib/common/components/supplier/index.d.ts +5 -2
- package/lib/common/components/supplier/index.js +108 -28
- package/lib/common/consts/formLayout.d.ts +44 -0
- package/lib/common/consts/formLayout.js +35 -0
- package/lib/common/consts/validationRules.js +0 -7
- package/lib/common/types/ReceiverRequirements.d.ts +71 -72
- package/lib/common/types/ReceiverRequirements.js +64 -81
- package/lib/create-credit-note/index.js +2 -4
- package/lib/create-invoice/index.js +131 -26
- package/lib/src/common/components/attachments/Attachment.d.ts +7 -3
- package/lib/src/common/components/attachments/index.d.ts +5 -2
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/src/common/components/base-information/index.d.ts +6 -3
- 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/NewBillingLines.d.ts +10 -0
- package/lib/src/common/components/billing-lines/index.d.ts +7 -15
- package/lib/src/common/components/customer/index.d.ts +5 -6
- package/lib/src/common/components/delivery-location/index.d.ts +5 -2
- package/lib/src/common/components/form-item/index.d.ts +23 -0
- package/lib/src/common/components/locale-intl/index.d.ts +10 -0
- package/lib/src/common/components/payment-method/index.d.ts +6 -3
- package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/src/common/components/supplier/index.d.ts +5 -2
- package/lib/src/common/consts/formLayout.d.ts +44 -0
- package/lib/src/common/types/ReceiverRequirements.d.ts +71 -72
- package/lib/src/translations/locales.d.ts +75 -0
- package/lib/src/utils/ApiUtility.d.ts +8 -1
- package/lib/src/utils/BillingLineUtility.d.ts +10 -0
- package/lib/src/utils/ConversionUtility.d.ts +4 -3
- package/lib/src/utils/RequirementsUtility.d.ts +3 -1
- package/lib/src/utils/index.d.ts +1 -1
- package/lib/translations/locales/is.json +71 -0
- package/lib/translations/locales.d.ts +75 -0
- package/lib/translations/locales.js +10 -0
- package/lib/utils/ApiUtility.d.ts +8 -1
- package/lib/utils/ApiUtility.js +17 -1
- package/lib/utils/BillingLineUtility.d.ts +10 -0
- package/lib/utils/BillingLineUtility.js +90 -0
- package/lib/utils/ConversionUtility.d.ts +4 -3
- package/lib/utils/ConversionUtility.js +98 -66
- package/lib/utils/RequirementsUtility.d.ts +3 -1
- package/lib/utils/RequirementsUtility.js +15 -5
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -0
- package/package.json +8 -5
- package/lib/common/components/component-container/style/index.d.ts +0 -1
- package/lib/common/components/component-container/style/index.js +0 -3
- 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 -51
- package/lib/src/common/components/payer/index.d.ts +0 -3
- package/lib/style/index.d.ts +0 -1
- package/lib/style/index.js +0 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
fieldName: "file1" | "file2" | "file3";
|
|
5
6
|
}
|
|
6
7
|
interface States {
|
|
7
8
|
file: any[];
|
|
@@ -12,4 +13,7 @@ declare class Attachment extends React.Component<Props, States> {
|
|
|
12
13
|
normFile: (e: any) => any;
|
|
13
14
|
render(): JSX.Element;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "key" | "ref" | "fieldName">, any> & {
|
|
17
|
+
WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -34,6 +34,31 @@ 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 icons_1 = require("@ant-design/icons");
|
|
39
|
+
var formLayout_1 = require("../../consts/formLayout");
|
|
40
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
41
|
+
attachment_labels_Reference: {
|
|
42
|
+
id: "attachment_labels_Reference",
|
|
43
|
+
defaultMessage: "Reference",
|
|
44
|
+
},
|
|
45
|
+
attachment_labels_Reference_requiredMessage: {
|
|
46
|
+
id: "attachment_labels_Reference_requiredMessage",
|
|
47
|
+
defaultMessage: "Please input the reference",
|
|
48
|
+
},
|
|
49
|
+
attachment_labels_Description: {
|
|
50
|
+
id: "attachment_labels_Description",
|
|
51
|
+
defaultMessage: "Description",
|
|
52
|
+
},
|
|
53
|
+
attachment_labels_Description_requiredMessage: {
|
|
54
|
+
id: "attachment_labels_Description_requiredMessage",
|
|
55
|
+
defaultMessage: "Please input the description",
|
|
56
|
+
},
|
|
57
|
+
attachment_labels_File: {
|
|
58
|
+
id: "attachment_labels_File",
|
|
59
|
+
defaultMessage: "File",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
37
62
|
var Attachment = /** @class */ (function (_super) {
|
|
38
63
|
__extends(Attachment, _super);
|
|
39
64
|
function Attachment(props) {
|
|
@@ -54,24 +79,53 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
54
79
|
return _this;
|
|
55
80
|
}
|
|
56
81
|
Attachment.prototype.render = function () {
|
|
82
|
+
var fieldName = this.props.fieldName;
|
|
83
|
+
var returnOtherFieldNames = function (fn) {
|
|
84
|
+
switch (fn) {
|
|
85
|
+
case "file1":
|
|
86
|
+
return ["file2", "file3"];
|
|
87
|
+
case "file2":
|
|
88
|
+
return ["file1", "file3"];
|
|
89
|
+
case "file3":
|
|
90
|
+
return ["file1", "file2"];
|
|
91
|
+
}
|
|
92
|
+
};
|
|
57
93
|
return (React.createElement(React.Fragment, null,
|
|
58
|
-
React.createElement(antd_1.Form.Item, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
React.createElement(antd_1.Input, null)),
|
|
65
|
-
React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, label: "Description", name: "attachment:" + this.props.fieldName + ":description", rules: [
|
|
94
|
+
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_File), name: ["attachments", "" + fieldName, "file"], valuePropName: "fileList", getValueFromEvent: this.normFile }),
|
|
95
|
+
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + fieldName, multiple: false, onRemove: this.handleRemoveFile, beforeUpload: function () { return false; } },
|
|
96
|
+
React.createElement("p", { className: "ant-upload-drag-icon" },
|
|
97
|
+
React.createElement(icons_1.InboxOutlined, null)),
|
|
98
|
+
React.createElement("p", { style: { padding: "1em" } }, "Click or drag file to this area to upload"))),
|
|
99
|
+
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_Description), name: ["attachments", "" + fieldName, "description"], rules: [
|
|
66
100
|
{
|
|
67
101
|
required: this.state.file.length > 0,
|
|
68
|
-
message:
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
message: this.props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
103
|
+
},
|
|
104
|
+
function (_a) {
|
|
105
|
+
var getFieldValue = _a.getFieldValue;
|
|
106
|
+
return ({
|
|
107
|
+
validator: function (rule, value) {
|
|
108
|
+
if (!value || getFieldValue(["attachments", returnOtherFieldNames(fieldName)[0], "description"]) !== value) {
|
|
109
|
+
return Promise.resolve();
|
|
110
|
+
}
|
|
111
|
+
return Promise.reject('Description must not match to another file description');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
function (_a) {
|
|
116
|
+
var getFieldValue = _a.getFieldValue;
|
|
117
|
+
return ({
|
|
118
|
+
validator: function (rule, value) {
|
|
119
|
+
if (!value || getFieldValue(["attachments", returnOtherFieldNames(fieldName)[1], "description"]) !== value) {
|
|
120
|
+
return Promise.resolve();
|
|
121
|
+
}
|
|
122
|
+
return Promise.reject('Description must not match to another file description');
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
] }),
|
|
127
|
+
React.createElement(antd_1.Input, null))));
|
|
74
128
|
};
|
|
75
129
|
return Attachment;
|
|
76
130
|
}(React.Component));
|
|
77
|
-
exports.default = Attachment;
|
|
131
|
+
exports.default = react_intl_1.injectIntl(React.memo(Attachment));
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
declare const AttachmentGroupIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
|
|
4
|
+
WrappedComponent: React.ComponentType<InjectedIntlProps>;
|
|
5
|
+
};
|
|
6
|
+
export default AttachmentGroupIntl;
|
|
@@ -13,10 +13,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
var React = __importStar(require("react"));
|
|
14
14
|
var components_1 = require("../../components");
|
|
15
15
|
var Attachment_1 = __importDefault(require("./Attachment"));
|
|
16
|
+
var react_intl_1 = require("react-intl");
|
|
17
|
+
var antd_1 = require("antd");
|
|
18
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
19
|
+
attachment_title: {
|
|
20
|
+
id: "attachment.title",
|
|
21
|
+
defaultMessage: "Attachments",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
16
24
|
var AttachmentsGroup = function (props) {
|
|
17
|
-
return (React.createElement(components_1.ComponentContainer, { title:
|
|
18
|
-
React.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.attachment_title) },
|
|
26
|
+
React.createElement(antd_1.Row, null,
|
|
27
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
28
|
+
React.createElement(Attachment_1.default, { key: "attachment1", fieldName: "file1" })),
|
|
29
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
30
|
+
React.createElement(Attachment_1.default, { key: "attachment2", fieldName: "file2" })),
|
|
31
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
32
|
+
React.createElement(Attachment_1.default, { key: "attachment3", fieldName: "file3" })))));
|
|
21
33
|
};
|
|
22
|
-
|
|
34
|
+
var AttachmentGroupIntl = react_intl_1.injectIntl(AttachmentsGroup);
|
|
35
|
+
exports.default = AttachmentGroupIntl;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { StoreValue } from "rc-field-form/lib/interface";
|
|
4
|
+
interface FieldData {
|
|
5
|
+
name: number;
|
|
6
|
+
key: number;
|
|
7
|
+
fieldKey: number;
|
|
8
|
+
}
|
|
9
|
+
interface Props extends InjectedIntlProps {
|
|
10
|
+
fields: FieldData[];
|
|
11
|
+
add: (defaultValue?: StoreValue) => void;
|
|
12
|
+
remove: (index: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.ComponentClass<Pick<Props, "add" | "remove" | "fields">, any> & {
|
|
15
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
18
|
+
var react_intl_1 = require("react-intl");
|
|
19
|
+
var antd_1 = require("antd");
|
|
20
|
+
var icons_1 = require("@ant-design/icons");
|
|
21
|
+
var formLayout_1 = require("../../consts/formLayout");
|
|
22
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
23
|
+
referenceIdentifiers_labels_addButton: {
|
|
24
|
+
id: "referenceIdentifiers_labels_addButton",
|
|
25
|
+
defaultMessage: "Add reference identifier",
|
|
26
|
+
},
|
|
27
|
+
referenceIdentifiers_labels_referenceIdentifier: {
|
|
28
|
+
id: "referenceIdentifiers_labels_referenceIdentifier",
|
|
29
|
+
defaultMessage: "Reference identifier",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
var ReferenceIdentifiers = function (props) {
|
|
33
|
+
return (react_1.default.createElement("div", null,
|
|
34
|
+
props.fields.map(function (field, index) { return (react_1.default.createElement(antd_1.Form.Item, __assign({ key: "referenceIdentifier-" + index }, (index === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { label: index === 0 ? props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_referenceIdentifier) : "" }),
|
|
35
|
+
react_1.default.createElement(antd_1.Space, { key: field.key, style: { display: "flex", marginBottom: 0 }, align: "start" },
|
|
36
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"], fieldKey: [field.fieldKey, "code"], rules: [{ required: true }] }),
|
|
37
|
+
react_1.default.createElement(antd_1.Select, { labelInValue: true, style: { width: "150px" } },
|
|
38
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "AKY" }, "B\u00EDln\u00FAmer"),
|
|
39
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "SSN" }, "Kennitala"),
|
|
40
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, "Fasteignan\u00FAmer"))),
|
|
41
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "value"], fieldKey: [field.fieldKey, "value"], rules: [{ required: true }] }),
|
|
42
|
+
react_1.default.createElement(antd_1.Input, null)),
|
|
43
|
+
react_1.default.createElement(icons_1.MinusCircleOutlined, { onClick: function () {
|
|
44
|
+
props.remove(field.name);
|
|
45
|
+
} })))); }),
|
|
46
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, (props.fields.length === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { label: props.fields.length === 0 ? props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_referenceIdentifier) : "" }),
|
|
47
|
+
react_1.default.createElement(antd_1.Button, { type: "dashed", onClick: function () {
|
|
48
|
+
props.add();
|
|
49
|
+
}, style: { width: "100%" } },
|
|
50
|
+
react_1.default.createElement(icons_1.PlusOutlined, null),
|
|
51
|
+
" ",
|
|
52
|
+
props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_addButton)))));
|
|
53
|
+
};
|
|
54
|
+
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;
|
|
@@ -6,104 +6,155 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
6
6
|
result["default"] = mod;
|
|
7
7
|
return result;
|
|
8
8
|
};
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
var React = __importStar(require("react"));
|
|
11
14
|
var components_1 = require("../../components");
|
|
12
15
|
require("@ant-design/compatible/assets/index.css");
|
|
13
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 ReferenceIdentifiers_1 = __importDefault(require("./ReferenceIdentifiers"));
|
|
21
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
22
|
+
baseInformation_title: {
|
|
23
|
+
id: "baseInformation_title",
|
|
24
|
+
defaultMessage: "Base Information",
|
|
25
|
+
},
|
|
26
|
+
baseInformation_invoiceNo: {
|
|
27
|
+
id: "baseInformation_invoiceNo",
|
|
28
|
+
defaultMessage: "Invoice No",
|
|
29
|
+
},
|
|
30
|
+
baseInformation_issueDate: {
|
|
31
|
+
id: "baseInformation_issueDate",
|
|
32
|
+
defaultMessage: "Issue date"
|
|
33
|
+
},
|
|
34
|
+
baseInformation_dueDate: {
|
|
35
|
+
id: "baseInformation_dueDate",
|
|
36
|
+
defaultMessage: "Due date"
|
|
37
|
+
},
|
|
38
|
+
baseInformation_orderReference_documentNo: {
|
|
39
|
+
id: "baseInformation_orderReference_documentNo",
|
|
40
|
+
defaultMessage: "Order no"
|
|
41
|
+
},
|
|
42
|
+
baseInformation_notes: {
|
|
43
|
+
id: "baseInformation_notes",
|
|
44
|
+
defaultMessage: "Notes"
|
|
45
|
+
},
|
|
46
|
+
baseInformation_currencyCode: {
|
|
47
|
+
id: "baseInformation_currencyCode",
|
|
48
|
+
defaultMessage: "Currency"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
14
51
|
var BaseInformation = function (props) {
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
52
|
+
var getCurrencies = function (recRequirements) {
|
|
53
|
+
var currencies = [
|
|
54
|
+
{
|
|
55
|
+
key: "ISK",
|
|
56
|
+
label: "Icelandic krona (ISK)"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: "DKK",
|
|
60
|
+
label: "Danish krona (DKK)"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: "NOK",
|
|
64
|
+
label: "Norwegian krona (NOK)"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "SEK",
|
|
68
|
+
label: "Swedish krona (SEK)"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "EUR",
|
|
72
|
+
label: "Euro (EUR)"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "USD",
|
|
76
|
+
label: "US dollar (USD)"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: "GBP",
|
|
80
|
+
label: "British pound (GBP)"
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
if (recRequirements.currencyCode && recRequirements.currencyCode.values && recRequirements.currencyCode.values.length > 0) {
|
|
84
|
+
return recRequirements.currencyCode.values.map(function (currency) {
|
|
85
|
+
return React.createElement(antd_1.Select.Option, { value: currency.key, title: currency.label, key: currency.key }, currency.label);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return currencies.map(function (currency) {
|
|
90
|
+
return React.createElement(antd_1.Select.Option, { value: currency.key, title: currency.label, key: currency.key }, currency.label);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
45
94
|
var disabledDate = function (dueDate, issueDate) {
|
|
46
95
|
return dueDate < issueDate;
|
|
47
96
|
};
|
|
48
97
|
var checkIfEmpty = function (date) {
|
|
49
98
|
if (!date) {
|
|
50
|
-
props.form.resetFields(
|
|
51
|
-
props.form.validateFields(
|
|
99
|
+
props.form.resetFields(["invoice", "dueDate"]);
|
|
100
|
+
props.form.validateFields(["invoice", "dueDate"]).then(function (values) {
|
|
52
101
|
// console.log(values);
|
|
53
102
|
});
|
|
54
103
|
}
|
|
55
104
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return (React.createElement(components_1.ComponentContainer, { title: "Base information" },
|
|
65
|
-
React.createElement(antd_1.Form.Item, { label: getDocumentNoLabel(props.documentType), name: props.documentType === "invoice" ? ["invoice", "invoiceNo"] : ["creditNote", "invoiceNo"] },
|
|
105
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.baseInformation_title) },
|
|
106
|
+
React.createElement(form_item_1.default
|
|
107
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
108
|
+
, {
|
|
109
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
110
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_invoiceNo), defaultIsRequired: true, fieldName: ["invoice", "invoiceNo"] },
|
|
66
111
|
React.createElement(antd_1.Input, null)),
|
|
67
|
-
React.createElement(
|
|
112
|
+
React.createElement(form_item_1.default
|
|
113
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
114
|
+
, {
|
|
115
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
116
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_issueDate), defaultIsRequired: true, fieldName: ["invoice", "issueDate"] },
|
|
117
|
+
React.createElement(antd_1.DatePicker, null)),
|
|
118
|
+
React.createElement(form_item_1.default
|
|
119
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
120
|
+
, {
|
|
121
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
122
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.dueDate, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_dueDate), defaultIsRequired: false, fieldName: ["invoice", "dueDate"], additionalRules: [
|
|
68
123
|
{
|
|
69
|
-
|
|
70
|
-
|
|
124
|
+
validator: (function (rule, value, callback) {
|
|
125
|
+
if (!value) {
|
|
126
|
+
callback();
|
|
127
|
+
}
|
|
128
|
+
var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
|
|
129
|
+
value < issueDate
|
|
130
|
+
? callback("Due date must be after the issue date")
|
|
131
|
+
: callback();
|
|
132
|
+
}),
|
|
71
133
|
},
|
|
72
|
-
]
|
|
73
|
-
React.createElement(antd_1.DatePicker,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!value) {
|
|
80
|
-
callback();
|
|
81
|
-
}
|
|
82
|
-
var issueDate = props.form.getFieldValue(props.documentType === "invoice" ? ["invoice", "issueDate"] : ["creditNote", "issueDate"]);
|
|
83
|
-
value < issueDate
|
|
84
|
-
? callback("Due date must be after the issue date")
|
|
85
|
-
: callback();
|
|
86
|
-
}),
|
|
87
|
-
},
|
|
88
|
-
] },
|
|
89
|
-
React.createElement(antd_1.DatePicker, { onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(props.documentType === "invoice" ? ["invoice", "issueDate"] : ["creditNote", "issueDate"])); }) })),
|
|
90
|
-
React.createElement(antd_1.Form.Item, { label: "Last payment date", name: props.documentType === "invoice" ? ["invoice", "lastPaymentDate"] : ["creditNote", "lastPaymentDate"] },
|
|
91
|
-
React.createElement(antd_1.DatePicker, null))),
|
|
92
|
-
props.documentType === "creditNote" &&
|
|
93
|
-
React.createElement(antd_1.Form.Item, { label: "Invoice no", name: props.documentType === "creditNote" ? ["invoice", "invoiceReferenceNo"] : ["creditNote", "invoiceReferenceNo"], rules: [
|
|
94
|
-
{
|
|
95
|
-
required: true,
|
|
96
|
-
message: "Please input the invoice no."
|
|
97
|
-
}
|
|
98
|
-
] },
|
|
99
|
-
React.createElement(antd_1.Input, null)),
|
|
100
|
-
React.createElement(antd_1.Form.Item, { label: "Order no", name: props.documentType === "invoice" ? ["invoice", "orderNo"] : ["creditNote", "orderNo"] },
|
|
134
|
+
] },
|
|
135
|
+
React.createElement(antd_1.DatePicker, { onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(["invoice", "issueDate"])); }) })),
|
|
136
|
+
React.createElement(form_item_1.default
|
|
137
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
138
|
+
, {
|
|
139
|
+
// // receiverRequirements={receiverRequirementsObject}
|
|
140
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReference_documentNo), defaultIsRequired: true, fieldName: ["invoice", "buyerReference"] },
|
|
101
141
|
React.createElement(antd_1.Input, null)),
|
|
102
|
-
React.createElement(
|
|
142
|
+
React.createElement(form_item_1.default
|
|
143
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
144
|
+
, {
|
|
145
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
146
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"] },
|
|
103
147
|
React.createElement(antd_1.Input.TextArea, null)),
|
|
104
|
-
React.createElement(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
148
|
+
React.createElement(form_item_1.default
|
|
149
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
150
|
+
, {
|
|
151
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
152
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_currencyCode), defaultIsRequired: true, fieldName: ["invoice", "currencyCode"] },
|
|
153
|
+
React.createElement(antd_1.Select, { defaultActiveFirstOption: true }, getCurrencies(ReceiverRequirements_1.receiverRequirementsObject))),
|
|
154
|
+
React.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
155
|
+
var add = _a.add, remove = _a.remove;
|
|
156
|
+
return (React.createElement(ReferenceIdentifiers_1.default, { fields: fields, add: add, remove: remove }));
|
|
157
|
+
})));
|
|
108
158
|
};
|
|
109
|
-
|
|
159
|
+
var BaseInformationIntl = react_intl_1.injectIntl(BaseInformation);
|
|
160
|
+
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[] | undefined;
|
|
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,63 @@
|
|
|
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
|
+
if (billingLinesMetadata) {
|
|
33
|
+
billingLinesMetadata.map(function (billingLine) {
|
|
34
|
+
var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
35
|
+
var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
36
|
+
var taxInclusiveAmount = taxableAmount + taxAmount;
|
|
37
|
+
totals = {
|
|
38
|
+
totalTaxAmount: totals.totalTaxAmount + taxAmount,
|
|
39
|
+
totalTaxableAmount: totals.totalTaxableAmount + taxableAmount,
|
|
40
|
+
totalTaxInclusiveAmount: totals.totalTaxInclusiveAmount + taxInclusiveAmount,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
46
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
47
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat),
|
|
48
|
+
":"),
|
|
49
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxableAmount)))),
|
|
50
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
51
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
52
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalVatAmount),
|
|
53
|
+
":"),
|
|
54
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, props.renderCurrencyColumn(Math.round(totals.totalTaxAmount)))),
|
|
55
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
56
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
57
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } },
|
|
58
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat),
|
|
59
|
+
":")),
|
|
60
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
61
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } }, props.renderCurrencyColumn(Math.round(totals.totalTaxInclusiveAmount)))))));
|
|
62
|
+
};
|
|
63
|
+
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[] | undefined;
|
|
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,53 @@
|
|
|
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
|
|
27
|
+
? props.billingLines.map(function (billingLine) {
|
|
28
|
+
return {
|
|
29
|
+
taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(billingLine.taxCategoryType),
|
|
30
|
+
taxableAmount: BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount),
|
|
31
|
+
taxAmount: BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType]))
|
|
32
|
+
};
|
|
33
|
+
})
|
|
34
|
+
: [];
|
|
35
|
+
var columns = [
|
|
36
|
+
{
|
|
37
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxOverview),
|
|
38
|
+
dataIndex: "taxOverview",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxableAmount),
|
|
42
|
+
dataIndex: "taxableAmount",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxAmount),
|
|
46
|
+
dataIndex: "taxAmount",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
return (react_1.default.createElement(antd_1.Table, { style: { minHeight: "170px" },
|
|
50
|
+
// showHeader={false}
|
|
51
|
+
columns: columns, dataSource: dataSource, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }));
|
|
52
|
+
};
|
|
53
|
+
exports.default = react_intl_1.injectIntl(BillingTaxSummary);
|