@unimaze/billing 0.3.4 → 0.4.1-sjova.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.js +15 -12
- package/lib/common/components/attachments/index.js +12 -11
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +1 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +25 -15
- package/lib/common/components/base-information/index.js +106 -45
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +2 -2
- package/lib/common/components/billing-lines/BillingCalculations.js +40 -7
- package/lib/common/components/billing-lines/BillingTaxSummary.js +33 -5
- package/lib/common/components/billing-lines/index.d.ts +10 -1
- package/lib/common/components/billing-lines/index.js +74 -41
- package/lib/common/components/customer/index.d.ts +1 -1
- package/lib/common/components/customer/index.js +5 -11
- package/lib/common/components/editable-cell/index.d.ts +7 -3
- package/lib/common/components/editable-cell/index.js +131 -8
- package/lib/common/components/form-item/index.d.ts +5 -2
- package/lib/common/components/form-item/index.js +28 -8
- package/lib/common/components/payment-method/index.d.ts +6 -2
- package/lib/common/components/payment-method/index.js +44 -62
- package/lib/common/components/payment-method/paymentMethodForConversion.js +2 -11
- package/lib/common/components/supplier/index.js +18 -35
- package/lib/common/consts/formLayout.d.ts +30 -0
- package/lib/common/consts/formLayout.js +9 -0
- package/lib/common/consts/validationRules.d.ts +2 -2
- package/lib/common/consts/validationRules.js +11 -8
- package/lib/common/types/AppConfiguration.d.ts +1 -1
- package/lib/common/types/BillingLineMetadataOverride.d.ts +5 -3
- package/lib/common/types/CommonProps.d.ts +1 -1
- package/lib/common/types/ReceiverRequirements.js +1 -1
- package/lib/create-invoice/IntlLoader.js +49 -0
- package/lib/create-invoice/index.d.ts +7 -10
- package/lib/create-invoice/index.js +108 -70
- package/lib/translations/locales/is.json +67 -4
- package/lib/translations/locales.d.ts +64 -1
- package/lib/utils/BillingLineUtility.d.ts +2 -2
- package/lib/utils/BillingLineUtility.js +2 -2
- package/lib/utils/ConversionUtility.js +15 -4
- package/lib/utils/FileUploadUtility.d.ts +7 -0
- package/lib/utils/FileUploadUtility.js +26 -0
- package/lib/utils/FormatingUtility.d.ts +2 -0
- package/lib/utils/FormatingUtility.js +6 -0
- package/lib/utils/IntlUtility.d.ts +4 -0
- package/lib/utils/IntlUtility.js +54 -0
- package/package.json +3 -9
- package/lib/common/types/Configuration.d.ts +0 -14
- package/lib/common/types/Configuration.js +0 -2
- package/lib/example/src/index.d.ts +0 -1
- package/lib/src/common/components/attachments/Attachment.d.ts +0 -18
- package/lib/src/common/components/attachments/index.d.ts +0 -6
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -17
- package/lib/src/common/components/base-information/index.d.ts +0 -11
- package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
- package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
- package/lib/src/common/components/billing-lines/NewBillingLines.d.ts +0 -10
- package/lib/src/common/components/billing-lines/index.d.ts +0 -19
- package/lib/src/common/components/component-container/Content.d.ts +0 -7
- package/lib/src/common/components/component-container/Header.d.ts +0 -9
- package/lib/src/common/components/component-container/index.d.ts +0 -11
- package/lib/src/common/components/customer/index.d.ts +0 -16
- package/lib/src/common/components/delivery-location/index.d.ts +0 -6
- package/lib/src/common/components/editable-cell/index.d.ts +0 -11
- package/lib/src/common/components/editable-row/index.d.ts +0 -5
- package/lib/src/common/components/form-item/index.d.ts +0 -23
- package/lib/src/common/components/index.d.ts +0 -10
- package/lib/src/common/components/locale-intl/index.d.ts +0 -10
- package/lib/src/common/components/payment-method/index.d.ts +0 -6
- package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +0 -9
- package/lib/src/common/components/supplier/index.d.ts +0 -10
- package/lib/src/common/consts/formLayout.d.ts +0 -44
- package/lib/src/common/consts/validationRules.d.ts +0 -6
- package/lib/src/common/types/ReceiverRequirements.d.ts +0 -81
- package/lib/src/translations/locales.d.ts +0 -78
- package/lib/src/utils/ApiUtility.d.ts +0 -21
- package/lib/src/utils/BillingLineUtility.d.ts +0 -10
- package/lib/src/utils/ConversionUtility.d.ts +0 -8
- package/lib/src/utils/RequirementsUtility.d.ts +0 -5
- package/lib/src/utils/index.d.ts +0 -2
- /package/lib/{src/create-invoice/index.d.ts → create-invoice/IntlLoader.d.ts} +0 -0
|
@@ -57,6 +57,14 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
57
57
|
id: "attachment_labels_File",
|
|
58
58
|
defaultMessage: "File",
|
|
59
59
|
},
|
|
60
|
+
attachment_labels_uploadFileMsg: {
|
|
61
|
+
id: "attachment_labels_uploadFileMsg",
|
|
62
|
+
defaultMessage: "Click or drag file to this area to upload",
|
|
63
|
+
},
|
|
64
|
+
attachment_labels_descriptionErrorMsg: {
|
|
65
|
+
id: "attachment_labels_descriptionErrorMsg",
|
|
66
|
+
defaultMessage: "Description must not match to another file description",
|
|
67
|
+
},
|
|
60
68
|
});
|
|
61
69
|
var Attachment = /** @class */ (function (_super) {
|
|
62
70
|
__extends(Attachment, _super);
|
|
@@ -89,18 +97,15 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
89
97
|
return ["file1", "file2"];
|
|
90
98
|
}
|
|
91
99
|
};
|
|
100
|
+
var attachmentLabelsDescriptionErrorMsg = this.props.intl.formatMessage(translationMessages.attachment_labels_descriptionErrorMsg);
|
|
92
101
|
return (React.createElement(React.Fragment, null,
|
|
93
|
-
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.
|
|
94
|
-
// this.props.intl.formatMessage(translationMessages.attachment_labels_File)
|
|
95
|
-
label: "Skrá", name: ["attachments", "" + fieldName, "file"], valuePropName: "fileList", getValueFromEvent: this.normFile }),
|
|
102
|
+
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemVerticalLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_File), name: ["attachments", "" + fieldName, "file"], valuePropName: "fileList", getValueFromEvent: this.normFile }),
|
|
96
103
|
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + fieldName, multiple: false, onRemove: this.handleRemoveFile, beforeUpload: function () { return false; } },
|
|
97
|
-
React.createElement("p", null,
|
|
98
|
-
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.
|
|
99
|
-
// this.props.intl.formatMessage(translationMessages.attachment_labels_Description)
|
|
100
|
-
label: "Lýsing", name: ["attachments", "" + fieldName, "description"], rules: [
|
|
104
|
+
React.createElement("p", null, this.props.intl.formatMessage(translationMessages.attachment_labels_uploadFileMsg)))),
|
|
105
|
+
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemVerticalLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_Description), name: ["attachments", "" + fieldName, "description"], rules: [
|
|
101
106
|
{
|
|
102
107
|
required: this.state.file.length > 0,
|
|
103
|
-
message:
|
|
108
|
+
message: this.props.intl.formatMessage(translationMessages.attachment_labels_Description_requiredMessage),
|
|
104
109
|
},
|
|
105
110
|
function (_a) {
|
|
106
111
|
var getFieldValue = _a.getFieldValue;
|
|
@@ -109,8 +114,7 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
109
114
|
if (!value || getFieldValue(["attachments", returnOtherFieldNames(fieldName)[0], "description"]) !== value) {
|
|
110
115
|
return Promise.resolve();
|
|
111
116
|
}
|
|
112
|
-
|
|
113
|
-
return Promise.reject('Lýsing má ekki samsvara annarri skráalýsing');
|
|
117
|
+
return Promise.reject(attachmentLabelsDescriptionErrorMsg);
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
},
|
|
@@ -121,8 +125,7 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
121
125
|
if (!value || getFieldValue(["attachments", returnOtherFieldNames(fieldName)[1], "description"]) !== value) {
|
|
122
126
|
return Promise.resolve();
|
|
123
127
|
}
|
|
124
|
-
|
|
125
|
-
return Promise.reject('Lýsing má ekki samsvara annarri skráalýsing');
|
|
128
|
+
return Promise.reject(attachmentLabelsDescriptionErrorMsg);
|
|
126
129
|
}
|
|
127
130
|
});
|
|
128
131
|
},
|
|
@@ -18,26 +18,27 @@ var antd_1 = require("antd");
|
|
|
18
18
|
var icons_1 = require("@ant-design/icons");
|
|
19
19
|
var translationMessages = react_intl_1.defineMessages({
|
|
20
20
|
attachment_title: {
|
|
21
|
-
id: "
|
|
21
|
+
id: "attachment_title",
|
|
22
22
|
defaultMessage: "Attachments",
|
|
23
23
|
},
|
|
24
|
+
attachment_tooltip_title: {
|
|
25
|
+
id: "attachment_tooltip_title",
|
|
26
|
+
defaultMessage: "The maximum size is ??MB. Enclosed documents can be a copy of the original invoice, or timesheets for example." // "Hámarks stærð er ??MB. Fylgigögn reiknings geta verið afrit af upprunalega reikningnum eða fylgigögn, svo sem tímaskýrslur",
|
|
27
|
+
},
|
|
24
28
|
});
|
|
25
29
|
var AttachmentsGroup = function (props) {
|
|
26
|
-
var attachmentLabelNode = (React.createElement(antd_1.Tooltip
|
|
27
|
-
// props.intl.formatMessage(translationMessages.attachment_title)}
|
|
28
|
-
, {
|
|
29
|
-
// props.intl.formatMessage(translationMessages.attachment_title)}
|
|
30
|
-
title: "Hámarks stærð er ??MB. Fylgigögn reiknings geta verið afrit af upprunalega reikningnum eða fylgigögn, svo sem tímaskýrslur", placement: "right" },
|
|
30
|
+
var attachmentLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.attachment_tooltip_title), placement: "right" },
|
|
31
31
|
React.createElement("span", null,
|
|
32
|
-
|
|
32
|
+
props.intl.formatMessage(translationMessages.attachment_title),
|
|
33
|
+
" ",
|
|
33
34
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
34
35
|
return (React.createElement(components_1.ComponentContainer, { title: attachmentLabelNode },
|
|
35
|
-
React.createElement(antd_1.Row,
|
|
36
|
-
React.createElement(antd_1.Col, { span:
|
|
36
|
+
React.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
37
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
37
38
|
React.createElement(Attachment_1.default, { key: "attachment1", fieldName: "file1" })),
|
|
38
|
-
React.createElement(antd_1.Col, { span:
|
|
39
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
39
40
|
React.createElement(Attachment_1.default, { key: "attachment2", fieldName: "file2" })),
|
|
40
|
-
React.createElement(antd_1.Col, { span:
|
|
41
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
41
42
|
React.createElement(Attachment_1.default, { key: "attachment3", fieldName: "file3" })))));
|
|
42
43
|
};
|
|
43
44
|
var AttachmentGroupIntl = react_intl_1.injectIntl(AttachmentsGroup);
|
|
@@ -6,6 +6,7 @@ interface FieldData {
|
|
|
6
6
|
key: number;
|
|
7
7
|
fieldKey: number;
|
|
8
8
|
}
|
|
9
|
+
export declare const translationMessages: ReactIntl.Messages<"referenceIdentifiers_labels_addButton" | "referenceIdentifiers_labels_referenceIdentifier" | "referenceIdentifiers_labels_referenceIdentifier_title" | "referenceIdentifiers_labels_carNumber" | "referenceIdentifiers_labels_identifier" | "referenceIdentifiers_labels_propertyNumber">;
|
|
9
10
|
interface Props extends InjectedIntlProps {
|
|
10
11
|
fields: FieldData[];
|
|
11
12
|
add: (defaultValue?: StoreValue) => void;
|
|
@@ -19,7 +19,7 @@ var react_intl_1 = require("react-intl");
|
|
|
19
19
|
var antd_1 = require("antd");
|
|
20
20
|
var icons_1 = require("@ant-design/icons");
|
|
21
21
|
var formLayout_1 = require("../../consts/formLayout");
|
|
22
|
-
|
|
22
|
+
exports.translationMessages = react_intl_1.defineMessages({
|
|
23
23
|
referenceIdentifiers_labels_addButton: {
|
|
24
24
|
id: "referenceIdentifiers_labels_addButton",
|
|
25
25
|
defaultMessage: "Add reference identifier",
|
|
@@ -28,24 +28,37 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
28
28
|
id: "referenceIdentifiers_labels_referenceIdentifier",
|
|
29
29
|
defaultMessage: "Reference identifier",
|
|
30
30
|
},
|
|
31
|
+
referenceIdentifiers_labels_referenceIdentifier_title: {
|
|
32
|
+
id: "referenceIdentifiers_labels_referenceIdentifier_title",
|
|
33
|
+
defaultMessage: "Number related to the claim in question (Vehicle registration number, real estate number or kennitala)" // "Númer er á við tjónið sem um ræðir (bílnúmer, fasteignanúmer eða kennitala)",
|
|
34
|
+
},
|
|
35
|
+
referenceIdentifiers_labels_carNumber: {
|
|
36
|
+
id: "referenceIdentifiers_labels_carNumber",
|
|
37
|
+
defaultMessage: "Vehicle registration number" // "Bílnúmer",
|
|
38
|
+
},
|
|
39
|
+
referenceIdentifiers_labels_identifier: {
|
|
40
|
+
id: "referenceIdentifiers_labels_identifier",
|
|
41
|
+
defaultMessage: "Kennitala" // "Kennitala",
|
|
42
|
+
},
|
|
43
|
+
referenceIdentifiers_labels_propertyNumber: {
|
|
44
|
+
id: "referenceIdentifiers_labels_propertyNumber",
|
|
45
|
+
defaultMessage: "Real estate number" // "Fasteignanúmer",
|
|
46
|
+
},
|
|
31
47
|
});
|
|
32
48
|
var ReferenceIdentifiers = function (props) {
|
|
33
|
-
var referenceIdentifierLabelNode = (react_1.default.createElement(antd_1.Tooltip
|
|
34
|
-
// props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_referenceIdentifier)
|
|
35
|
-
, {
|
|
36
|
-
// props.intl.formatMessage(translationMessages.referenceIdentifiers_labels_referenceIdentifier)
|
|
37
|
-
title: "Númer er á við tjónið sem um ræðir (bílnúmer, fasteignanúmer eða kennitala)", placement: "right" },
|
|
49
|
+
var referenceIdentifierLabelNode = (react_1.default.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier_title), placement: "right" },
|
|
38
50
|
react_1.default.createElement("span", null,
|
|
39
|
-
|
|
51
|
+
props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier),
|
|
52
|
+
" ",
|
|
40
53
|
react_1.default.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
41
54
|
return (react_1.default.createElement("div", null,
|
|
42
55
|
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 ? referenceIdentifierLabelNode : "" }),
|
|
43
56
|
react_1.default.createElement(antd_1.Space, { key: field.key, style: { display: "flex", marginBottom: 0 }, align: "start" },
|
|
44
57
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"], fieldKey: [field.fieldKey, "code"], rules: [{ required: true }] }),
|
|
45
|
-
react_1.default.createElement(antd_1.Select, { labelInValue: true, style: { width: "
|
|
46
|
-
react_1.default.createElement(antd_1.Select.Option, { value: "AKY" },
|
|
47
|
-
react_1.default.createElement(antd_1.Select.Option, { value: "ARR" },
|
|
48
|
-
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" },
|
|
58
|
+
react_1.default.createElement(antd_1.Select, { labelInValue: true, style: { width: "100px" } },
|
|
59
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "AKY" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_carNumber)),
|
|
60
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "ARR" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_identifier)),
|
|
61
|
+
react_1.default.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_propertyNumber)))),
|
|
49
62
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "value"], fieldKey: [field.fieldKey, "value"], rules: [{ required: true }] }),
|
|
50
63
|
react_1.default.createElement(antd_1.Input, null)),
|
|
51
64
|
react_1.default.createElement(icons_1.MinusCircleOutlined, { onClick: function () {
|
|
@@ -54,9 +67,6 @@ var ReferenceIdentifiers = function (props) {
|
|
|
54
67
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, (props.fields.length === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { label: props.fields.length === 0 ? referenceIdentifierLabelNode : "" }),
|
|
55
68
|
react_1.default.createElement(antd_1.Button, { type: "dashed", onClick: function () {
|
|
56
69
|
props.add();
|
|
57
|
-
}, style: { width: "100%" } },
|
|
58
|
-
react_1.default.createElement(icons_1.PlusOutlined, null),
|
|
59
|
-
" ",
|
|
60
|
-
"Bætið við tilvísunarnúmeri"))));
|
|
70
|
+
}, style: { width: "100%" }, icon: react_1.default.createElement(icons_1.PlusOutlined, null) }, props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_addButton)))));
|
|
61
71
|
};
|
|
62
72
|
exports.default = react_intl_1.injectIntl(ReferenceIdentifiers);
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
14
|
if (mod && mod.__esModule) return mod;
|
|
4
15
|
var result = {};
|
|
@@ -17,8 +28,9 @@ var antd_1 = require("antd");
|
|
|
17
28
|
var form_item_1 = __importDefault(require("../form-item"));
|
|
18
29
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
19
30
|
var react_intl_1 = require("react-intl");
|
|
20
|
-
var ReferenceIdentifiers_1 =
|
|
31
|
+
var ReferenceIdentifiers_1 = require("./ReferenceIdentifiers");
|
|
21
32
|
var icons_1 = require("@ant-design/icons");
|
|
33
|
+
var formLayout_1 = require("../../consts/formLayout");
|
|
22
34
|
var translationMessages = react_intl_1.defineMessages({
|
|
23
35
|
baseInformation_title: {
|
|
24
36
|
id: "baseInformation_title",
|
|
@@ -32,14 +44,26 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
32
44
|
id: "baseInformation_issueDate",
|
|
33
45
|
defaultMessage: "Issue date"
|
|
34
46
|
},
|
|
47
|
+
baseInformation_issueDate_title: {
|
|
48
|
+
id: "baseInformation_issueDate_title",
|
|
49
|
+
defaultMessage: "The issue date controls on which settlement period the transfer is registered" // "Útgáfudagsetning stjórnar á hvaða uppgjörstímabili færslan skráist"
|
|
50
|
+
},
|
|
35
51
|
baseInformation_dueDate: {
|
|
36
52
|
id: "baseInformation_dueDate",
|
|
37
53
|
defaultMessage: "Due date"
|
|
38
54
|
},
|
|
55
|
+
baseInformation_dueDate_title: {
|
|
56
|
+
id: "baseInformation_dueDate_title",
|
|
57
|
+
defaultMessage: "Grace date should be the same as due date" // "Eindagi skal vera sá sami og gjalddagi"
|
|
58
|
+
},
|
|
39
59
|
baseInformation_orderReference_documentNo: {
|
|
40
60
|
id: "baseInformation_orderReference_documentNo",
|
|
41
61
|
defaultMessage: "Order no"
|
|
42
62
|
},
|
|
63
|
+
baseInformation_orderReference_documentNo_title: {
|
|
64
|
+
id: "baseInformation_orderReference_documentNo_title",
|
|
65
|
+
defaultMessage: "Buyer reference can be as an example; an employee number, a code for a department or team, a claim number. If customer has not specified a reference, then the name of person who requested or ordered the services can be specified here."
|
|
66
|
+
},
|
|
43
67
|
baseInformation_notes: {
|
|
44
68
|
id: "baseInformation_notes",
|
|
45
69
|
defaultMessage: "Notes"
|
|
@@ -47,39 +71,70 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
47
71
|
baseInformation_currencyCode: {
|
|
48
72
|
id: "baseInformation_currencyCode",
|
|
49
73
|
defaultMessage: "Currency"
|
|
50
|
-
}
|
|
74
|
+
},
|
|
75
|
+
baseInformation_dueDateErrorMsg: {
|
|
76
|
+
id: "baseInformation_dueDateErrorMsg",
|
|
77
|
+
defaultMessage: "Due date must be after the issue date"
|
|
78
|
+
},
|
|
79
|
+
baseInformation_currency_ISK: {
|
|
80
|
+
id: "baseInformation_currency_ISK",
|
|
81
|
+
defaultMessage: "Icelandic krona (ISK)"
|
|
82
|
+
},
|
|
83
|
+
baseInformation_currency_DKK: {
|
|
84
|
+
id: "baseInformation_currency_DKK",
|
|
85
|
+
defaultMessage: "Danish krona (DKK)"
|
|
86
|
+
},
|
|
87
|
+
baseInformation_currency_NOK: {
|
|
88
|
+
id: "baseInformation_currency_NOK",
|
|
89
|
+
defaultMessage: "Norwegian krona (NOK)"
|
|
90
|
+
},
|
|
91
|
+
baseInformation_currency_SEK: {
|
|
92
|
+
id: "baseInformation_currency_SEK",
|
|
93
|
+
defaultMessage: "Swedish krona (SEK)"
|
|
94
|
+
},
|
|
95
|
+
baseInformation_currency_EUR: {
|
|
96
|
+
id: "baseInformation_currency_EUR",
|
|
97
|
+
defaultMessage: "Euro (EUR)"
|
|
98
|
+
},
|
|
99
|
+
baseInformation_currency_USD: {
|
|
100
|
+
id: "baseInformation_currency_USD",
|
|
101
|
+
defaultMessage: "US dollar (USD)"
|
|
102
|
+
},
|
|
103
|
+
baseInformation_currency_GBP: {
|
|
104
|
+
id: "baseInformation_currency_GBP",
|
|
105
|
+
defaultMessage: "British pound (GBP)"
|
|
106
|
+
},
|
|
51
107
|
});
|
|
52
108
|
var BaseInformation = function (props) {
|
|
53
109
|
var getCurrencies = function (recRequirements) {
|
|
54
110
|
var currencies = [
|
|
55
111
|
{
|
|
56
112
|
key: "ISK",
|
|
57
|
-
|
|
58
|
-
label: "Íslensk króna (ISK)"
|
|
113
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_ISK)
|
|
59
114
|
},
|
|
60
115
|
{
|
|
61
116
|
key: "DKK",
|
|
62
|
-
label:
|
|
117
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_DKK)
|
|
63
118
|
},
|
|
64
119
|
{
|
|
65
120
|
key: "NOK",
|
|
66
|
-
label:
|
|
121
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_NOK)
|
|
67
122
|
},
|
|
68
123
|
{
|
|
69
124
|
key: "SEK",
|
|
70
|
-
label:
|
|
125
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_SEK)
|
|
71
126
|
},
|
|
72
127
|
{
|
|
73
128
|
key: "EUR",
|
|
74
|
-
label:
|
|
129
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_EUR)
|
|
75
130
|
},
|
|
76
131
|
{
|
|
77
132
|
key: "USD",
|
|
78
|
-
label:
|
|
133
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_USD)
|
|
79
134
|
},
|
|
80
135
|
{
|
|
81
136
|
key: "GBP",
|
|
82
|
-
label:
|
|
137
|
+
label: props.intl.formatMessage(translationMessages.baseInformation_currency_GBP)
|
|
83
138
|
},
|
|
84
139
|
];
|
|
85
140
|
if (recRequirements.currencyCode && recRequirements.currencyCode.values && recRequirements.currencyCode.values.length > 0) {
|
|
@@ -104,39 +159,31 @@ var BaseInformation = function (props) {
|
|
|
104
159
|
});
|
|
105
160
|
}
|
|
106
161
|
};
|
|
107
|
-
var dueDateLabelNode = (React.createElement(antd_1.Tooltip
|
|
108
|
-
// props.intl.formatMessage(translationMessages.baseInformation_dueDate)
|
|
109
|
-
, {
|
|
110
|
-
// props.intl.formatMessage(translationMessages.baseInformation_dueDate)
|
|
111
|
-
title: "Eindagi skal vera sá sami og gjalddagi", placement: "right" },
|
|
162
|
+
var dueDateLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.baseInformation_dueDate_title), placement: "right" },
|
|
112
163
|
React.createElement("span", null,
|
|
113
|
-
|
|
164
|
+
props.intl.formatMessage(translationMessages.baseInformation_dueDate),
|
|
114
165
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
115
|
-
var issueDateLabelNode = (React.createElement(antd_1.Tooltip
|
|
116
|
-
// props.intl.formatMessage(translationMessages.baseInformation_issueDate)
|
|
117
|
-
, {
|
|
118
|
-
// props.intl.formatMessage(translationMessages.baseInformation_issueDate)
|
|
119
|
-
title: "Útgáfudagsetning stjórnar á hvaða uppgjörstímabili færslan skráist", placement: "right" },
|
|
166
|
+
var issueDateLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.baseInformation_issueDate_title), placement: "right" },
|
|
120
167
|
React.createElement("span", null,
|
|
121
|
-
|
|
168
|
+
props.intl.formatMessage(translationMessages.baseInformation_issueDate),
|
|
122
169
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
170
|
+
var referenceIdentifierLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(ReferenceIdentifiers_1.translationMessages.referenceIdentifiers_labels_referenceIdentifier_title), placement: "right" },
|
|
171
|
+
React.createElement("span", null,
|
|
172
|
+
props.intl.formatMessage(ReferenceIdentifiers_1.translationMessages.referenceIdentifiers_labels_referenceIdentifier),
|
|
173
|
+
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
174
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.baseInformation_title) },
|
|
126
175
|
React.createElement(form_item_1.default
|
|
127
176
|
// // receiverRequirements={receiverRequirementsObject}
|
|
128
177
|
, {
|
|
129
178
|
// // receiverRequirements={receiverRequirementsObject}
|
|
130
|
-
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo,
|
|
131
|
-
// props.intl.formatMessage(translationMessages.baseInformation_invoiceNo)
|
|
132
|
-
defaultLabel: "Reikningsnr.", defaultIsRequired: true, fieldName: ["invoice", "invoiceNo"] },
|
|
179
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.invoiceNo, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_invoiceNo), defaultIsRequired: true, fieldName: ["invoice", "invoiceNo"] },
|
|
133
180
|
React.createElement(antd_1.Input, null)),
|
|
134
181
|
React.createElement(form_item_1.default
|
|
135
182
|
// // receiverRequirements={receiverRequirementsObject}
|
|
136
183
|
, {
|
|
137
184
|
// // receiverRequirements={receiverRequirementsObject}
|
|
138
185
|
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.issueDate, defaultLabel: issueDateLabelNode, defaultIsRequired: true, fieldName: ["invoice", "issueDate"] },
|
|
139
|
-
React.createElement(antd_1.DatePicker,
|
|
186
|
+
React.createElement(antd_1.DatePicker, { style: { width: "100%" }, format: "DD.MM.YYYY" })),
|
|
140
187
|
React.createElement(form_item_1.default
|
|
141
188
|
// // receiverRequirements={receiverRequirementsObject}
|
|
142
189
|
, {
|
|
@@ -149,40 +196,54 @@ var BaseInformation = function (props) {
|
|
|
149
196
|
}
|
|
150
197
|
var issueDate = props.form.getFieldValue(["invoice", "issueDate"]);
|
|
151
198
|
value < issueDate
|
|
152
|
-
? callback(
|
|
199
|
+
? callback(props.intl.formatMessage(translationMessages.baseInformation_dueDateErrorMsg))
|
|
153
200
|
: callback();
|
|
154
201
|
}),
|
|
155
202
|
},
|
|
156
203
|
] },
|
|
157
|
-
React.createElement(antd_1.DatePicker, { onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(["invoice", "issueDate"])); }) })),
|
|
204
|
+
React.createElement(antd_1.DatePicker, { style: { width: "100%" }, format: "DD.MM.YYYY", onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(["invoice", "issueDate"])); }) })),
|
|
158
205
|
React.createElement(form_item_1.default
|
|
159
206
|
// // receiverRequirements={receiverRequirementsObject}
|
|
160
207
|
, {
|
|
161
208
|
// // receiverRequirements={receiverRequirementsObject}
|
|
162
|
-
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference,
|
|
163
|
-
// props.intl.formatMessage(translationMessages.baseInformation_orderReference_documentNo)
|
|
164
|
-
defaultLabel: "Pöntunarnr", defaultIsRequired: true, fieldName: ["invoice", "buyerReference"] },
|
|
209
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReference_documentNo), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReference_documentNo_title), defaultIsRequired: true, fieldName: ["invoice", "buyerReference"] },
|
|
165
210
|
React.createElement(antd_1.Input, null)),
|
|
211
|
+
React.createElement(antd_1.Form.Item, __assign({ key: "referenceIdentifier-0" }, formLayout_1.formItemLayout, { label: referenceIdentifierLabelNode, rules: [
|
|
212
|
+
{
|
|
213
|
+
required: true,
|
|
214
|
+
message: "Það þarf að fylla út í þennan reit",
|
|
215
|
+
}
|
|
216
|
+
] }),
|
|
217
|
+
React.createElement(antd_1.Space, { key: "referenceIdentifiers-0.key", style: { display: "flex", marginBottom: 0 }, align: "start" },
|
|
218
|
+
React.createElement(antd_1.Form.Item, { name: ["invoice", "referenceIdentifiers", "0", "code"], fieldKey: ["invoice", "referenceIdentifiers", "0", "code"], rules: [
|
|
219
|
+
{
|
|
220
|
+
required: true,
|
|
221
|
+
message: "Það þarf að fylla út í þennan reit",
|
|
222
|
+
}
|
|
223
|
+
] },
|
|
224
|
+
React.createElement(antd_1.Select, { labelInValue: true, style: { width: "100px" } },
|
|
225
|
+
React.createElement(antd_1.Select.Option, { value: "AKY" }, props.intl.formatMessage(ReferenceIdentifiers_1.translationMessages.referenceIdentifiers_labels_carNumber)),
|
|
226
|
+
React.createElement(antd_1.Select.Option, { value: "ARR" }, props.intl.formatMessage(ReferenceIdentifiers_1.translationMessages.referenceIdentifiers_labels_identifier)),
|
|
227
|
+
React.createElement(antd_1.Select.Option, { value: "LOC" }, props.intl.formatMessage(ReferenceIdentifiers_1.translationMessages.referenceIdentifiers_labels_propertyNumber)))),
|
|
228
|
+
React.createElement(antd_1.Form.Item, { name: ["invoice", "referenceIdentifiers", "0", "value"], fieldKey: ["invoice", "referenceIdentifiers", "0", "value"], rules: [
|
|
229
|
+
{
|
|
230
|
+
required: true,
|
|
231
|
+
message: "Það þarf að fylla út í þennan reit",
|
|
232
|
+
}
|
|
233
|
+
] },
|
|
234
|
+
React.createElement(antd_1.Input, null)))),
|
|
166
235
|
React.createElement(form_item_1.default
|
|
167
236
|
// receiverRequirements={receiverRequirementsObject}
|
|
168
237
|
, {
|
|
169
238
|
// receiverRequirements={receiverRequirementsObject}
|
|
170
|
-
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes,
|
|
171
|
-
// props.intl.formatMessage(translationMessages.baseInformation_notes)
|
|
172
|
-
defaultLabel: "Athugasemdir", defaultIsRequired: false, fieldName: ["invoice", "notes"] },
|
|
239
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"] },
|
|
173
240
|
React.createElement(antd_1.Input.TextArea, null)),
|
|
174
241
|
React.createElement(form_item_1.default
|
|
175
242
|
// receiverRequirements={receiverRequirementsObject}
|
|
176
243
|
, {
|
|
177
244
|
// receiverRequirements={receiverRequirementsObject}
|
|
178
|
-
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode,
|
|
179
|
-
|
|
180
|
-
defaultLabel: "Gjaldmiðill", defaultIsRequired: true, fieldName: ["invoice", "currencyCode"] },
|
|
181
|
-
React.createElement(antd_1.Select, { defaultActiveFirstOption: true }, getCurrencies(ReceiverRequirements_1.receiverRequirementsObject))),
|
|
182
|
-
React.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
183
|
-
var add = _a.add, remove = _a.remove;
|
|
184
|
-
return (React.createElement(ReferenceIdentifiers_1.default, { fields: fields, add: add, remove: remove }));
|
|
185
|
-
})));
|
|
245
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_currencyCode), defaultIsRequired: true, fieldName: ["invoice", "currencyCode"] },
|
|
246
|
+
React.createElement(antd_1.Select, { defaultActiveFirstOption: true }, getCurrencies(ReceiverRequirements_1.receiverRequirementsObject)))));
|
|
186
247
|
};
|
|
187
248
|
var BaseInformationIntl = react_intl_1.injectIntl(BaseInformation);
|
|
188
249
|
exports.default = BaseInformationIntl;
|
|
@@ -3,9 +3,9 @@ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOver
|
|
|
3
3
|
import { InjectedIntlProps } from "react-intl";
|
|
4
4
|
interface Props extends InjectedIntlProps {
|
|
5
5
|
billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
|
|
6
|
-
|
|
6
|
+
currencyCode: string;
|
|
7
7
|
}
|
|
8
|
-
declare const _default: React.ComponentClass<Pick<Props, "
|
|
8
|
+
declare const _default: React.ComponentClass<Pick<Props, "currencyCode" | "billingLinesMetadata">, any> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
@@ -8,6 +8,7 @@ var antd_1 = require("antd");
|
|
|
8
8
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
9
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
10
10
|
var react_intl_1 = require("react-intl");
|
|
11
|
+
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
11
12
|
var translationMessages = react_intl_1.defineMessages({
|
|
12
13
|
billingCalculations_labels_TaxAmountWithoutVat: {
|
|
13
14
|
id: "billingCalculations_labels_TaxAmountWithoutVat",
|
|
@@ -21,6 +22,14 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
21
22
|
id: "billingCalculations_labels_TotalAmountWithVat",
|
|
22
23
|
defaultMessage: "Total amount with VAT",
|
|
23
24
|
},
|
|
25
|
+
billingCalculations_labels_AmountPayable: {
|
|
26
|
+
id: "billingCalculations_labels_AmountPayable",
|
|
27
|
+
defaultMessage: "Amount payable",
|
|
28
|
+
},
|
|
29
|
+
billingCalculations_labels_RoundingAmount: {
|
|
30
|
+
id: "billingCalculations_labels_RoundingAmount",
|
|
31
|
+
defaultMessage: "Rounding amount",
|
|
32
|
+
},
|
|
24
33
|
});
|
|
25
34
|
var BillingCalculations = function (props) {
|
|
26
35
|
var billingLinesMetadata = props.billingLinesMetadata;
|
|
@@ -28,36 +37,60 @@ var BillingCalculations = function (props) {
|
|
|
28
37
|
totalTaxableAmount: 0,
|
|
29
38
|
totalTaxAmount: 0,
|
|
30
39
|
totalTaxInclusiveAmount: 0,
|
|
40
|
+
roundingAmount: 0,
|
|
31
41
|
};
|
|
32
42
|
if (billingLinesMetadata) {
|
|
33
43
|
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
|
|
44
|
+
var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType.value])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
35
45
|
var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
36
46
|
var taxInclusiveAmount = taxableAmount + taxAmount;
|
|
37
47
|
totals = {
|
|
38
48
|
totalTaxAmount: totals.totalTaxAmount + taxAmount,
|
|
39
49
|
totalTaxableAmount: totals.totalTaxableAmount + taxableAmount,
|
|
40
50
|
totalTaxInclusiveAmount: totals.totalTaxInclusiveAmount + taxInclusiveAmount,
|
|
51
|
+
roundingAmount: Math.abs(totals.totalTaxInclusiveAmount + taxInclusiveAmount - Math.round(totals.totalTaxInclusiveAmount + taxInclusiveAmount))
|
|
41
52
|
};
|
|
42
53
|
});
|
|
43
54
|
}
|
|
44
55
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
56
|
react_1.default.createElement(antd_1.Row, null,
|
|
46
57
|
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
47
|
-
|
|
58
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TaxAmountWithoutVat),
|
|
48
59
|
":"),
|
|
49
|
-
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
60
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(totals.totalTaxableAmount, props.intl, { style: "decimal" }))),
|
|
50
61
|
react_1.default.createElement(antd_1.Row, null,
|
|
51
62
|
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
52
|
-
|
|
63
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalVatAmount),
|
|
53
64
|
":"),
|
|
54
|
-
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
65
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(totals.totalTaxAmount, props.intl, { style: "decimal" }))),
|
|
66
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
67
|
+
react_1.default.createElement(antd_1.Col, { span: 12, offset: 12 },
|
|
68
|
+
react_1.default.createElement("hr", null))),
|
|
69
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
70
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
71
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } },
|
|
72
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_TotalAmountWithVat),
|
|
73
|
+
":")),
|
|
74
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
75
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(totals.totalTaxInclusiveAmount, props.intl, { style: "decimal" })))),
|
|
76
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
77
|
+
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
78
|
+
react_1.default.createElement("span", null,
|
|
79
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_RoundingAmount),
|
|
80
|
+
":")),
|
|
81
|
+
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
82
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(totals.roundingAmount, props.intl, { style: "decimal" })))),
|
|
83
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
84
|
+
react_1.default.createElement(antd_1.Col, { span: 12, offset: 12 },
|
|
85
|
+
react_1.default.createElement("hr", null))),
|
|
55
86
|
react_1.default.createElement(antd_1.Row, null,
|
|
56
87
|
react_1.default.createElement(antd_1.Col, { span: 18, style: { textAlign: "right" } },
|
|
57
88
|
react_1.default.createElement("span", { style: { fontWeight: 600 } },
|
|
58
|
-
|
|
89
|
+
props.intl.formatMessage(translationMessages.billingCalculations_labels_AmountPayable),
|
|
59
90
|
":")),
|
|
60
91
|
react_1.default.createElement(antd_1.Col, { span: 6, style: { textAlign: "right" } },
|
|
61
|
-
react_1.default.createElement("span", { style: { fontWeight: 600 } },
|
|
92
|
+
react_1.default.createElement("span", { style: { fontWeight: 600 } }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(Math.round(totals.totalTaxInclusiveAmount), props.intl, {
|
|
93
|
+
style: "decimal"
|
|
94
|
+
}))))));
|
|
62
95
|
};
|
|
63
96
|
exports.default = react_intl_1.injectIntl(BillingCalculations);
|
|
@@ -8,6 +8,8 @@ var antd_1 = require("antd");
|
|
|
8
8
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
9
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
10
10
|
var react_intl_1 = require("react-intl");
|
|
11
|
+
var editable_cell_1 = require("../editable-cell");
|
|
12
|
+
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
11
13
|
var translationMessages = react_intl_1.defineMessages({
|
|
12
14
|
billingTaxSummary_taxOverview: {
|
|
13
15
|
id: "billingTaxSummary_taxOverview",
|
|
@@ -21,14 +23,34 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
21
23
|
id: "billingTaxSummary_taxAmount",
|
|
22
24
|
defaultMessage: "Tax"
|
|
23
25
|
},
|
|
26
|
+
billingTaxSummary_taxCategoryType_labels_StandardRated: {
|
|
27
|
+
id: "billingTaxSummary_taxCategoryType_labels_StandardRated",
|
|
28
|
+
defaultMessage: "Standard rated",
|
|
29
|
+
},
|
|
30
|
+
billingTaxSummary_taxCategoryType_labels_ReducedRated: {
|
|
31
|
+
id: "billingTaxSummary_taxCategoryType_labels_ReducedRated",
|
|
32
|
+
defaultMessage: "Reduced rated",
|
|
33
|
+
},
|
|
34
|
+
billingTaxSummary_taxCategoryType_labels_ZeroRated: {
|
|
35
|
+
id: "billingTaxSummary_taxCategoryType_labels_ZeroRated",
|
|
36
|
+
defaultMessage: "Zero rated",
|
|
37
|
+
},
|
|
38
|
+
billingTaxSummary_taxCategoryType_labels_Exempt: {
|
|
39
|
+
id: "billingTaxSummary_taxCategoryType_labels_Exempt",
|
|
40
|
+
defaultMessage: "Exempt",
|
|
41
|
+
},
|
|
24
42
|
});
|
|
25
43
|
var BillingTaxSummary = function (props) {
|
|
26
44
|
var dataSource = props.billingLines
|
|
27
45
|
? props.billingLines.map(function (billingLine) {
|
|
46
|
+
var taxCategoryType = api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType.value];
|
|
47
|
+
var translationString = "taxCategoryType_labels_" + taxCategoryType;
|
|
48
|
+
var messageDescriptor = editable_cell_1.commonTranslationMessages[translationString];
|
|
49
|
+
var taxCategoryTypeTranslated = props.intl.formatMessage(messageDescriptor);
|
|
28
50
|
return {
|
|
29
|
-
taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(
|
|
51
|
+
taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(taxCategoryType, taxCategoryTypeTranslated),
|
|
30
52
|
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]))
|
|
53
|
+
taxAmount: BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType.value]))
|
|
32
54
|
};
|
|
33
55
|
})
|
|
34
56
|
: [];
|
|
@@ -49,16 +71,22 @@ var BillingTaxSummary = function (props) {
|
|
|
49
71
|
// console.log(result);
|
|
50
72
|
var columns = [
|
|
51
73
|
{
|
|
52
|
-
title:
|
|
74
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxOverview),
|
|
53
75
|
dataIndex: "taxOverview",
|
|
54
76
|
},
|
|
55
77
|
{
|
|
56
|
-
title:
|
|
78
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxableAmount),
|
|
57
79
|
dataIndex: "taxableAmount",
|
|
80
|
+
render: function (value, record) {
|
|
81
|
+
return IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(record.taxableAmount, props.intl, { style: "decimal" });
|
|
82
|
+
}
|
|
58
83
|
},
|
|
59
84
|
{
|
|
60
|
-
title:
|
|
85
|
+
title: props.intl.formatMessage(translationMessages.billingTaxSummary_taxAmount),
|
|
61
86
|
dataIndex: "taxAmount",
|
|
87
|
+
render: function (value, record) {
|
|
88
|
+
return IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(record.taxAmount, props.intl, { style: "decimal" });
|
|
89
|
+
}
|
|
62
90
|
},
|
|
63
91
|
];
|
|
64
92
|
return (react_1.default.createElement(antd_1.Table, { style: { minHeight: "170px" },
|