@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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
formInstance: FormInstance;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance">, any> & {
|
|
8
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
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 formLayout_1 = require("../../consts/formLayout");
|
|
21
|
+
var icons_1 = require("@ant-design/icons");
|
|
22
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
23
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
24
|
+
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
25
|
+
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
26
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
27
|
+
billingLines_labels_addButton: {
|
|
28
|
+
id: "billingLines_labels_addButton",
|
|
29
|
+
defaultMessage: "Add new line",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
var BillingLines = function (props) {
|
|
33
|
+
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "invoiceLines"] }, function (fields, _a) {
|
|
34
|
+
var add = _a.add, remove = _a.remove;
|
|
35
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
36
|
+
fields.map(function (field, index) {
|
|
37
|
+
var taxCatType = null;
|
|
38
|
+
return (react_1.default.createElement(antd_1.Row, { gutter: 16, justify: "space-between", align: "bottom", key: index.toString() },
|
|
39
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
40
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.itemNo"], defaultIsRequired: false, fieldName: [field.name, "itemNo"], defaultLabel: "Item no", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("itemNo"))),
|
|
41
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
42
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.name"], defaultIsRequired: true, fieldName: [field.name, "name"], defaultLabel: "Name", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("name"))),
|
|
43
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
44
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], defaultIsRequired: true, fieldName: [field.name, "quantity"], defaultLabel: "Quantity", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("quantity"))),
|
|
45
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
46
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], defaultIsRequired: true, fieldName: [field.name, "unitOfMeasure", "unit"], defaultLabel: "Unit of measure", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("unitOfMeasure"))),
|
|
47
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
48
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], defaultIsRequired: true, fieldName: [field.name, "unitPriceAmount"], defaultLabel: "Unit price amount", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("unitPriceAmount"))),
|
|
49
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
50
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxCategoryType"], defaultIsRequired: true, fieldName: [field.name, "taxCategoryType"], defaultLabel: "Tax category", verticalLabels: true, onlyLabelOnFirstInList: true, index: index },
|
|
51
|
+
react_1.default.createElement(antd_1.Select, { onChange: function (value) {
|
|
52
|
+
// console.log("valueChanged", value);
|
|
53
|
+
taxCatType = value;
|
|
54
|
+
} }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
55
|
+
return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
|
|
56
|
+
})))),
|
|
57
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
58
|
+
react_1.default.createElement("span", null, taxCatType && BillingLineUtility_1.calculateTaxPercentage(taxCatType))),
|
|
59
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
60
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], defaultIsRequired: true, fieldName: [field.name, "discountValue"], defaultLabel: "Discount value", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("discountValue"))),
|
|
61
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
62
|
+
react_1.default.createElement(form_item_1.default, { receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxableAmount"], defaultIsRequired: true, fieldName: [field.name, "taxableAmount"], defaultLabel: "Amount", verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("taxableAmount"))),
|
|
63
|
+
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
64
|
+
react_1.default.createElement(icons_1.MinusCircleOutlined, { style: { marginBottom: "22px" }, onClick: function () {
|
|
65
|
+
remove(field.name);
|
|
66
|
+
} }))));
|
|
67
|
+
}),
|
|
68
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.fullWidthInput),
|
|
69
|
+
react_1.default.createElement(antd_1.Button, { type: "dashed", onClick: function () {
|
|
70
|
+
add();
|
|
71
|
+
}, style: { width: "100%" } },
|
|
72
|
+
react_1.default.createElement(icons_1.PlusOutlined, null),
|
|
73
|
+
" ",
|
|
74
|
+
props.intl.formatMessage(translationMessages.billingLines_labels_addButton)))));
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
exports.default = react_intl_1.injectIntl(BillingLines);
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
3
|
import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
|
|
4
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
5
|
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
5
6
|
import { FormInstance } from "antd/es/form";
|
|
6
|
-
|
|
7
|
-
interface EditableColumnProps<T> extends ColumnType<T> {
|
|
8
|
-
editable?: boolean;
|
|
9
|
-
}
|
|
10
|
-
interface Props {
|
|
7
|
+
interface Props extends InjectedIntlProps {
|
|
11
8
|
formInstance: FormInstance;
|
|
12
9
|
setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
|
|
13
|
-
}
|
|
14
|
-
interface States {
|
|
15
10
|
dataSource: BillingLineMetadataOverride[];
|
|
16
|
-
editableIndex: number;
|
|
17
|
-
}
|
|
18
|
-
declare class BillingLines extends React.Component<Props, States> {
|
|
19
|
-
columns: EditableColumnProps<BillingLineMetadataOverride>[];
|
|
20
|
-
constructor(props: Props);
|
|
21
|
-
renderCurrencyColumn: (text: string) => string;
|
|
22
11
|
handleDelete: (index: number) => void;
|
|
23
12
|
handleAdd: () => void;
|
|
24
13
|
handleSave: (row: BillingLineMetadataOverride, formInstance: FormInstance) => void;
|
|
25
|
-
|
|
14
|
+
editableIndex: number;
|
|
26
15
|
}
|
|
27
|
-
|
|
16
|
+
declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "dataSource" | "formInstance" | "setBillingLineMetadata" | "handleDelete" | "handleAdd" | "handleSave" | "editableIndex">, any> & {
|
|
17
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
18
|
+
};
|
|
19
|
+
export default BillingLinesIntl;
|
|
@@ -30,107 +30,148 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
result["default"] = mod;
|
|
31
31
|
return result;
|
|
32
32
|
};
|
|
33
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
+
};
|
|
33
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
37
|
var React = __importStar(require("react"));
|
|
35
38
|
var components_1 = require("../../components");
|
|
36
39
|
var icons_1 = require("@ant-design/icons");
|
|
37
40
|
require("@ant-design/compatible/assets/index.css");
|
|
38
41
|
var antd_1 = require("antd");
|
|
39
|
-
var
|
|
42
|
+
var react_intl_1 = require("react-intl");
|
|
43
|
+
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
44
|
+
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
45
|
+
var BillingCalculations_1 = __importDefault(require("./BillingCalculations"));
|
|
46
|
+
var BillingTaxSummary_1 = __importDefault(require("./BillingTaxSummary"));
|
|
47
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
48
|
+
billingLines_title: {
|
|
49
|
+
id: "billingLines_title",
|
|
50
|
+
defaultMessage: "Document lines",
|
|
51
|
+
},
|
|
52
|
+
billingLines_itemNo: {
|
|
53
|
+
id: "billingLines_itemNo",
|
|
54
|
+
defaultMessage: "Item no",
|
|
55
|
+
},
|
|
56
|
+
billingLines_name: {
|
|
57
|
+
id: "billingLines_itemNo",
|
|
58
|
+
defaultMessage: "Name"
|
|
59
|
+
},
|
|
60
|
+
billingLines_quantity: {
|
|
61
|
+
id: "billingLines_quantity",
|
|
62
|
+
defaultMessage: "Quantity"
|
|
63
|
+
},
|
|
64
|
+
billingLines_unitOfMeasure: {
|
|
65
|
+
id: "billingLines_unitOfMeasure",
|
|
66
|
+
defaultMessage: "Unit of measure"
|
|
67
|
+
},
|
|
68
|
+
billingLines_unitPriceAmount: {
|
|
69
|
+
id: "billingLines_unitPriceAmount",
|
|
70
|
+
defaultMessage: "Unit price amount"
|
|
71
|
+
},
|
|
72
|
+
billingLines_taxCategoryType: {
|
|
73
|
+
id: "billingLines_taxCategoryType",
|
|
74
|
+
defaultMessage: "Tax category"
|
|
75
|
+
},
|
|
76
|
+
billingLines_taxCategoryPercentage: {
|
|
77
|
+
id: "billingLines_taxCategoryPercentage",
|
|
78
|
+
defaultMessage: "Tax percentage"
|
|
79
|
+
},
|
|
80
|
+
billingLines_discount: {
|
|
81
|
+
id: "billingLines_discount",
|
|
82
|
+
defaultMessage: "Discount"
|
|
83
|
+
},
|
|
84
|
+
billingLines_lineAmount: {
|
|
85
|
+
id: "billingLines_lineAmount",
|
|
86
|
+
defaultMessage: "Amount"
|
|
87
|
+
},
|
|
88
|
+
billingLines_taxAmount: {
|
|
89
|
+
id: "billingLines_taxAmount",
|
|
90
|
+
defaultMessage: "Tax inclusive amount"
|
|
91
|
+
},
|
|
92
|
+
billingLines_button_addRow: {
|
|
93
|
+
id: "billingLines_button_addRow",
|
|
94
|
+
defaultMessage: "Add a row"
|
|
95
|
+
},
|
|
96
|
+
});
|
|
40
97
|
var BillingLines = /** @class */ (function (_super) {
|
|
41
98
|
__extends(BillingLines, _super);
|
|
42
99
|
function BillingLines(props) {
|
|
43
100
|
var _this = _super.call(this, props) || this;
|
|
44
101
|
_this.renderCurrencyColumn = function (text) {
|
|
45
|
-
var currency = _this.props.formInstance.getFieldValue("
|
|
102
|
+
var currency = _this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) ? _this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) : "";
|
|
46
103
|
return text + " " + currency;
|
|
47
104
|
};
|
|
48
|
-
_this.handleDelete = function (index) {
|
|
49
|
-
var newDataSource = _this.state.dataSource.slice();
|
|
50
|
-
newDataSource.splice(index, 1);
|
|
51
|
-
_this.setState(function (prevState) { return (__assign({}, prevState, { dataSource: newDataSource })); });
|
|
52
|
-
};
|
|
53
|
-
_this.handleAdd = function () {
|
|
54
|
-
var dataSource = _this.state.dataSource;
|
|
55
|
-
var newData = {
|
|
56
|
-
key: _this.state.editableIndex,
|
|
57
|
-
itemNo: "Item No.",
|
|
58
|
-
quantity: 0,
|
|
59
|
-
taxAmount: 0,
|
|
60
|
-
name: "New Item",
|
|
61
|
-
unitOfMeasure: models_1.UnitOfMeasureMetadataUnitEnum.Piece,
|
|
62
|
-
unitPriceAmount: 0,
|
|
63
|
-
taxCategoryType: models_1.BillingLineMetadataTaxCategoryTypeEnum.StandardRated,
|
|
64
|
-
discountValue: "0",
|
|
65
|
-
taxableAmount: 0,
|
|
66
|
-
taxPercentage: null
|
|
67
|
-
};
|
|
68
|
-
_this.setState(__assign({}, _this.state, { dataSource: dataSource.concat([newData]), editableIndex: _this.state.editableIndex + 1 }));
|
|
69
|
-
};
|
|
70
|
-
_this.handleSave = function (row, formInstance) {
|
|
71
|
-
var newData = _this.state.dataSource.slice();
|
|
72
|
-
var index = newData.findIndex(function (i) {
|
|
73
|
-
return row.key === i.key;
|
|
74
|
-
});
|
|
75
|
-
var item = newData[index];
|
|
76
|
-
newData.splice(index, 1, __assign({}, item, row));
|
|
77
|
-
var billingLineMetadata = newData.map(function (current) {
|
|
78
|
-
return __assign({}, current, { unitOfMeasure: {
|
|
79
|
-
unit: current.unitOfMeasure,
|
|
80
|
-
} });
|
|
81
|
-
});
|
|
82
|
-
_this.setState(__assign({}, _this.state, { dataSource: newData }));
|
|
83
|
-
_this.props.setBillingLineMetadata(formInstance, billingLineMetadata);
|
|
84
|
-
};
|
|
85
|
-
_this.state = {
|
|
86
|
-
dataSource: [],
|
|
87
|
-
editableIndex: 0,
|
|
88
|
-
};
|
|
89
105
|
_this.columns = [
|
|
90
106
|
{
|
|
91
|
-
title:
|
|
107
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_itemNo),
|
|
92
108
|
dataIndex: 'itemNo',
|
|
93
109
|
editable: true,
|
|
94
110
|
},
|
|
95
111
|
{
|
|
96
|
-
title:
|
|
112
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_name),
|
|
97
113
|
dataIndex: 'name',
|
|
98
114
|
editable: true,
|
|
99
115
|
},
|
|
100
116
|
{
|
|
101
|
-
title:
|
|
117
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_quantity),
|
|
102
118
|
dataIndex: 'quantity',
|
|
103
119
|
editable: true,
|
|
120
|
+
align: "right",
|
|
104
121
|
},
|
|
105
122
|
{
|
|
106
|
-
title:
|
|
123
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure),
|
|
107
124
|
dataIndex: 'unitOfMeasure',
|
|
108
125
|
editable: true,
|
|
109
126
|
},
|
|
110
127
|
{
|
|
111
|
-
title:
|
|
128
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_unitPriceAmount),
|
|
112
129
|
dataIndex: 'unitPriceAmount',
|
|
113
130
|
editable: true,
|
|
131
|
+
align: "right",
|
|
114
132
|
},
|
|
115
133
|
{
|
|
116
|
-
title:
|
|
134
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryType),
|
|
117
135
|
dataIndex: 'taxCategoryType',
|
|
118
136
|
editable: true,
|
|
119
137
|
},
|
|
120
138
|
{
|
|
121
|
-
title:
|
|
139
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryPercentage),
|
|
140
|
+
dataIndex: 'taxCategoryPercentage',
|
|
141
|
+
editable: false,
|
|
142
|
+
align: "right",
|
|
143
|
+
render: (function (text, record) {
|
|
144
|
+
var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[record.taxCategoryType]); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
145
|
+
return React.createElement("span", null,
|
|
146
|
+
taxPercentage,
|
|
147
|
+
"%");
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_discount),
|
|
122
152
|
dataIndex: 'discountValue',
|
|
123
153
|
editable: true,
|
|
154
|
+
align: "right",
|
|
124
155
|
},
|
|
125
156
|
{
|
|
126
|
-
title:
|
|
157
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_lineAmount),
|
|
127
158
|
dataIndex: 'taxableAmount',
|
|
159
|
+
editable: false,
|
|
160
|
+
align: "right",
|
|
161
|
+
render: function (text, record) {
|
|
162
|
+
return (React.createElement("span", null, BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount).toFixed(2)));
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
title: _this.props.intl.formatMessage(translationMessages.billingLines_taxAmount),
|
|
167
|
+
dataIndex: 'taxInclusiveAmount',
|
|
168
|
+
editable: false,
|
|
169
|
+
align: "right",
|
|
128
170
|
render: function (text, record) {
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return (React.createElement("span", null, lineAmount));
|
|
171
|
+
var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[record.taxCategoryType])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
172
|
+
var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount);
|
|
173
|
+
var taxInclusiveAmount = taxableAmount + taxAmount;
|
|
174
|
+
return (React.createElement("span", null, taxInclusiveAmount.toFixed(2)));
|
|
134
175
|
}
|
|
135
176
|
},
|
|
136
177
|
{
|
|
@@ -138,16 +179,80 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
138
179
|
render: function (text, record, index) {
|
|
139
180
|
return React.createElement(React.Fragment, null,
|
|
140
181
|
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
141
|
-
_this.handleDelete(index);
|
|
182
|
+
_this.props.handleDelete(index);
|
|
142
183
|
} }));
|
|
143
184
|
}
|
|
144
185
|
}
|
|
145
186
|
];
|
|
146
187
|
return _this;
|
|
147
188
|
}
|
|
189
|
+
// handleDelete = (index: number) => {
|
|
190
|
+
// const newDataSource = [...this.state.dataSource];
|
|
191
|
+
// newDataSource.splice(index, 1);
|
|
192
|
+
//
|
|
193
|
+
// this.setState((prevState: States) => ({
|
|
194
|
+
// ...prevState,
|
|
195
|
+
// dataSource: newDataSource,
|
|
196
|
+
// }))
|
|
197
|
+
// };
|
|
198
|
+
//
|
|
199
|
+
// handleAdd = () => {
|
|
200
|
+
// const {dataSource} = this.state;
|
|
201
|
+
// const newData: BillingLineMetadataOverride = {
|
|
202
|
+
// key: this.state.editableIndex,
|
|
203
|
+
// itemNo: "Item No.",// (dataSource.length > 0 ? Number(dataSource[dataSource.length-1].itemNo) + 1 : 1).toString(),
|
|
204
|
+
// quantity: 0,
|
|
205
|
+
// taxAmount: 0,
|
|
206
|
+
// name: `New Item`,
|
|
207
|
+
// unitOfMeasure: UnitOfMeasureMetadataUnitEnum.Piece,
|
|
208
|
+
// unitPriceAmount: 0,
|
|
209
|
+
// taxCategoryType: BillingLineMetadataTaxCategoryTypeEnum.StandardRated,
|
|
210
|
+
// discountValue: "0",
|
|
211
|
+
// taxableAmount: 0,
|
|
212
|
+
// taxPercentage: null
|
|
213
|
+
// };
|
|
214
|
+
// this.setState(
|
|
215
|
+
// {
|
|
216
|
+
// ...this.state,
|
|
217
|
+
// dataSource: [...dataSource, newData],
|
|
218
|
+
// editableIndex: this.state.editableIndex + 1,
|
|
219
|
+
// }
|
|
220
|
+
// )
|
|
221
|
+
// };
|
|
222
|
+
//
|
|
223
|
+
//
|
|
224
|
+
// handleSave = (row: BillingLineMetadataOverride, formInstance: FormInstance) => {
|
|
225
|
+
// const newData = [...this.state.dataSource];
|
|
226
|
+
// const index = newData.findIndex((i) => {
|
|
227
|
+
// return row.key === i.key;
|
|
228
|
+
// });
|
|
229
|
+
//
|
|
230
|
+
// const item = newData[index];
|
|
231
|
+
// newData.splice(index, 1, {
|
|
232
|
+
// ...item,
|
|
233
|
+
// ...row,
|
|
234
|
+
// });
|
|
235
|
+
//
|
|
236
|
+
// const billingLineMetadata = newData.map<BillingLineMetadata>(current => {
|
|
237
|
+
// return {
|
|
238
|
+
// ...current,
|
|
239
|
+
// unitOfMeasure: {
|
|
240
|
+
// unit: current.unitOfMeasure,
|
|
241
|
+
// }
|
|
242
|
+
// }
|
|
243
|
+
// });
|
|
244
|
+
//
|
|
245
|
+
// this.setState({
|
|
246
|
+
// ...this.state,
|
|
247
|
+
// dataSource: newData
|
|
248
|
+
// });
|
|
249
|
+
//
|
|
250
|
+
// this.props.setBillingLineMetadata(formInstance, billingLineMetadata);
|
|
251
|
+
// };
|
|
148
252
|
BillingLines.prototype.render = function () {
|
|
149
253
|
var _this = this;
|
|
150
|
-
|
|
254
|
+
// const dataSource = this.props.formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
255
|
+
var dataSource = this.props.dataSource;
|
|
151
256
|
// console.log(dataSource);
|
|
152
257
|
var components = {
|
|
153
258
|
body: {
|
|
@@ -164,12 +269,18 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
164
269
|
editable: col.editable,
|
|
165
270
|
dataIndex: col.dataIndex,
|
|
166
271
|
title: col.title ? col.title.toString() : "",
|
|
167
|
-
handleSave: function (billingLineMetadataOverrideRecord, rowIndex) { return _this.handleSave(billingLineMetadataOverrideRecord, _this.props.formInstance); },
|
|
272
|
+
handleSave: function (billingLineMetadataOverrideRecord, rowIndex) { return _this.props.handleSave(billingLineMetadataOverrideRecord, _this.props.formInstance); },
|
|
168
273
|
}); } });
|
|
169
274
|
});
|
|
170
|
-
return (React.createElement(components_1.ComponentContainer, { title:
|
|
171
|
-
React.createElement(antd_1.Table, { components: components, dataSource: dataSource, columns: columns, pagination: false, rowKey: (function (record, index) { return index.toString(); }) })
|
|
275
|
+
return (React.createElement(components_1.ComponentContainer, { title: this.props.intl.formatMessage(translationMessages.billingLines_title), action: React.createElement(antd_1.Button, { onClick: this.props.handleAdd, type: "primary", style: { marginBottom: 16 } }, this.props.intl.formatMessage(translationMessages.billingLines_button_addRow)) },
|
|
276
|
+
React.createElement(antd_1.Table, { style: { minHeight: "170px" }, components: components, dataSource: dataSource, columns: columns, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }),
|
|
277
|
+
React.createElement(antd_1.Row, { style: { marginTop: "1em" }, align: "top", justify: "space-between", gutter: [16, 16] },
|
|
278
|
+
React.createElement(antd_1.Col, { span: 16 },
|
|
279
|
+
React.createElement(BillingTaxSummary_1.default, { billingLines: dataSource })),
|
|
280
|
+
React.createElement(antd_1.Col, { span: 8 },
|
|
281
|
+
React.createElement(BillingCalculations_1.default, { billingLinesMetadata: dataSource, renderCurrencyColumn: this.renderCurrencyColumn })))));
|
|
172
282
|
};
|
|
173
283
|
return BillingLines;
|
|
174
284
|
}(React.Component));
|
|
175
|
-
|
|
285
|
+
var BillingLinesIntl = react_intl_1.injectIntl(BillingLines);
|
|
286
|
+
exports.default = BillingLinesIntl;
|
|
@@ -6,15 +6,12 @@ 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
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
var React = __importStar(require("react"));
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var _a = props.
|
|
17
|
-
return (React.createElement(
|
|
11
|
+
var components_1 = require("../../components");
|
|
12
|
+
var Customer = function (props) {
|
|
13
|
+
var _a = props.customer, participantLegalIsoIdentifier = _a.participantLegalIsoIdentifier, participantLegalAddressPostalCode = _a.participantLegalAddressPostalCode, participantLegalAddressCity = _a.participantLegalAddressCity, participantLegalAddressStreet = _a.participantLegalAddressStreet, email = _a.email, name = _a.name, country = _a.country;
|
|
14
|
+
return (React.createElement(components_1.ComponentContainer, { title: "Invoice payer" },
|
|
18
15
|
React.createElement("div", null,
|
|
19
16
|
React.createElement("strong", null, name),
|
|
20
17
|
" (",
|
|
@@ -25,4 +22,4 @@ var Issuer = function (props) {
|
|
|
25
22
|
React.createElement("div", null, country),
|
|
26
23
|
React.createElement("div", null, email)));
|
|
27
24
|
};
|
|
28
|
-
exports.default =
|
|
25
|
+
exports.default = Customer;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default Customer;
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
declare const CustomerIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
|
|
4
|
+
WrappedComponent: React.ComponentType<InjectedIntlProps>;
|
|
5
|
+
};
|
|
6
|
+
export default CustomerIntl;
|
|
@@ -6,20 +6,109 @@ 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");
|
|
15
|
+
var antd_1 = require("antd");
|
|
16
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
17
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
18
|
+
var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
|
|
19
|
+
var react_intl_1 = require("react-intl");
|
|
20
|
+
var translationMessages = react_intl_1.defineMessages({
|
|
21
|
+
customer_title: {
|
|
22
|
+
id: "customer_title",
|
|
23
|
+
defaultMessage: "Customer",
|
|
24
|
+
},
|
|
25
|
+
customer_name: {
|
|
26
|
+
id: "customer_name",
|
|
27
|
+
defaultMessage: "Name",
|
|
28
|
+
},
|
|
29
|
+
customer_identifier: {
|
|
30
|
+
id: "customer_identifier",
|
|
31
|
+
defaultMessage: "Identifier"
|
|
32
|
+
},
|
|
33
|
+
customer_address_streetNameAndNumber: {
|
|
34
|
+
id: "customer_address_streetNameAndNumber",
|
|
35
|
+
defaultMessage: "Address"
|
|
36
|
+
},
|
|
37
|
+
customer_address_zip_postalCode: {
|
|
38
|
+
id: "customer_address_zipPostalCode",
|
|
39
|
+
defaultMessage: "Zip/Postal code"
|
|
40
|
+
},
|
|
41
|
+
customer_address_city: {
|
|
42
|
+
id: "customer_address_city",
|
|
43
|
+
defaultMessage: "City"
|
|
44
|
+
},
|
|
45
|
+
customer_address_countryCode: {
|
|
46
|
+
id: "customer_address_countryCode",
|
|
47
|
+
defaultMessage: "Country code"
|
|
48
|
+
},
|
|
49
|
+
customer_contact_email: {
|
|
50
|
+
id: "customer_contact_email",
|
|
51
|
+
defaultMessage: "E-Mail"
|
|
52
|
+
},
|
|
53
|
+
customer_contact_name: {
|
|
54
|
+
id: "customer_contact_name",
|
|
55
|
+
defaultMessage: "Contact name"
|
|
56
|
+
}
|
|
57
|
+
});
|
|
12
58
|
var Customer = function (props) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
59
|
+
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.customer_title) },
|
|
60
|
+
React.createElement(form_item_1.default
|
|
61
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
62
|
+
, {
|
|
63
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
64
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.name"], defaultLabel: props.intl.formatMessage(translationMessages.customer_name), defaultIsRequired: true, fieldName: ["invoice", "customer", "name"], additionalRules: [
|
|
65
|
+
{
|
|
66
|
+
required: RequirementsUtility_1.getReceiverRequirements(ReceiverRequirements_1.receiverRequirementsObject, ReceiverRequirements_1.AvailableFields["customer.name"]).isRequired,
|
|
67
|
+
message: 'Please input customer name',
|
|
68
|
+
},
|
|
69
|
+
] },
|
|
70
|
+
React.createElement(antd_1.Input, null)),
|
|
71
|
+
React.createElement(form_item_1.default
|
|
72
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
73
|
+
, {
|
|
74
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
75
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.address.streetNameAndNumber"], defaultLabel: props.intl.formatMessage(translationMessages.customer_address_streetNameAndNumber), defaultIsRequired: true, fieldName: ["invoice", "customer", "address", "streetNameAndNumber"] },
|
|
76
|
+
React.createElement(antd_1.Input, null)),
|
|
77
|
+
React.createElement(form_item_1.default
|
|
78
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
79
|
+
, {
|
|
80
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
81
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.address.postalZone"], defaultLabel: props.intl.formatMessage(translationMessages.customer_address_zip_postalCode), defaultIsRequired: false, fieldName: ["invoice", "customer", "address", "postalZone"] },
|
|
82
|
+
React.createElement(antd_1.Input, null)),
|
|
83
|
+
React.createElement(form_item_1.default
|
|
84
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
85
|
+
, {
|
|
86
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
87
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.address.city"], defaultLabel: props.intl.formatMessage(translationMessages.customer_address_city), defaultIsRequired: false, fieldName: ["invoice", "customer", "address", "city"] },
|
|
88
|
+
React.createElement(antd_1.Input, null)),
|
|
89
|
+
React.createElement(form_item_1.default
|
|
90
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
91
|
+
, {
|
|
92
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
93
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.address.countryCode"], defaultLabel: props.intl.formatMessage(translationMessages.customer_address_countryCode), defaultIsRequired: true, fieldName: ["invoice", "customer", "address", "countryCode"] },
|
|
94
|
+
React.createElement(antd_1.Input, { disabled: true })),
|
|
95
|
+
React.createElement(form_item_1.default
|
|
96
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
97
|
+
, {
|
|
98
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
99
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.contact.electronicMail"], defaultLabel: props.intl.formatMessage(translationMessages.customer_contact_email), defaultIsRequired: false, fieldName: ["invoice", "customer", "contact", "electronicMail"], additionalRules: [
|
|
100
|
+
{
|
|
101
|
+
type: 'email',
|
|
102
|
+
message: 'The input is not valid E-mail!',
|
|
103
|
+
}
|
|
104
|
+
] },
|
|
105
|
+
React.createElement(antd_1.Input, null)),
|
|
106
|
+
React.createElement(form_item_1.default
|
|
107
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
108
|
+
, {
|
|
109
|
+
// receiverRequirements={receiverRequirementsObject}
|
|
110
|
+
receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.contact.name"], defaultLabel: props.intl.formatMessage(translationMessages.customer_contact_name), defaultIsRequired: false, fieldName: ["invoice", "customer", "contact", "name"] },
|
|
111
|
+
React.createElement(antd_1.Input, null))));
|
|
24
112
|
};
|
|
25
|
-
|
|
113
|
+
var CustomerIntl = react_intl_1.injectIntl(Customer);
|
|
114
|
+
exports.default = CustomerIntl;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
declare const DeliveryLocationIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
|
|
4
|
+
WrappedComponent: React.ComponentType<InjectedIntlProps>;
|
|
5
|
+
};
|
|
6
|
+
export default DeliveryLocationIntl;
|