@unimaze/billing 0.11.3 → 0.12.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/base-information/OrderReference.d.ts +12 -0
- package/lib/common/components/base-information/OrderReference.js +41 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +1 -10
- package/lib/common/components/base-information/ReferenceIdentifiers.js +78 -16
- package/lib/common/components/base-information/index.js +26 -36
- package/lib/common/components/billing-lines/BillingCalculations.js +11 -9
- package/lib/common/components/billing-lines/BillingTaxSummary.js +5 -4
- package/lib/common/components/billing-lines/NewBillingLines.js +91 -16
- package/lib/common/components/billing-lines/index.d.ts +6 -10
- package/lib/common/components/billing-lines/index.js +188 -195
- package/lib/common/components/form-item/index.d.ts +1 -1
- package/lib/common/components/form-item/index.js +1 -1
- package/lib/common/components/supplier/index.d.ts +1 -3
- package/lib/common/components/supplier/index.js +16 -5
- package/lib/common/types/BillingLineMetadataOverride.d.ts +3 -2
- package/lib/create-invoice/index.js +122 -69
- package/lib/style/index.css +4 -0
- package/lib/translations/locales/is.json +4 -2
- package/lib/translations/locales.d.ts +2 -0
- package/lib/utils/BillingLineUtility.d.ts +2 -2
- package/lib/utils/BillingLineUtility.js +5 -3
- package/lib/utils/ConversionUtility.d.ts +1 -1
- package/lib/utils/ConversionUtility.js +3 -2
- package/lib/utils/ReferenceIdentifierUtility.d.ts +2 -1
- package/lib/utils/ReferenceIdentifierUtility.js +1 -0
- package/lib/utils/RequirementsUtility.js +1 -1
- package/package.json +1 -1
|
@@ -12,17 +12,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
14
|
})();
|
|
15
|
-
var __assign = (this && this.__assign) || function () {
|
|
16
|
-
__assign = Object.assign || function(t) {
|
|
17
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
-
s = arguments[i];
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
25
|
-
};
|
|
26
15
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
27
16
|
if (mod && mod.__esModule) return mod;
|
|
28
17
|
var result = {};
|
|
@@ -40,13 +29,10 @@ var icons_1 = require("@ant-design/icons");
|
|
|
40
29
|
// import '@ant-design/compatible/assets/index.css';
|
|
41
30
|
var antd_1 = require("antd");
|
|
42
31
|
var react_intl_1 = require("react-intl");
|
|
43
|
-
|
|
44
|
-
var
|
|
32
|
+
// import {defineMessages} from "react-intl.macro"
|
|
33
|
+
var NewBillingLines_1 = __importDefault(require("./NewBillingLines"));
|
|
45
34
|
var BillingCalculations_1 = __importDefault(require("./BillingCalculations"));
|
|
46
35
|
var BillingTaxSummary_1 = __importDefault(require("./BillingTaxSummary"));
|
|
47
|
-
var formLayout_1 = require("../../consts/formLayout");
|
|
48
|
-
var editable_cell_1 = require("../editable-cell");
|
|
49
|
-
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
50
36
|
exports.translationMessages = react_intl_1.defineMessages({
|
|
51
37
|
billingLines_title: {
|
|
52
38
|
id: "billingLines_title",
|
|
@@ -57,50 +43,50 @@ exports.translationMessages = react_intl_1.defineMessages({
|
|
|
57
43
|
defaultMessage: "Item number, Name, Quantity, Unit of measure, Unit price amount Tax category and Discount need to be defined here.\n" + "VAT is automatically applied.\n" +
|
|
58
44
|
"Click \"Add a row\" to add a new line",
|
|
59
45
|
},
|
|
60
|
-
billingLines_itemNo: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
billingLines_name: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
billingLines_quantity: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
billingLines_unitOfMeasure: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
billingLines_unitPriceAmount: {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
billingLines_taxCategoryType: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
billingLines_taxCategoryType_title: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
billingLines_taxCategoryPercentage: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
billingLines_discount: {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
billingLines_lineAmount: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
billingLines_taxAmount: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
46
|
+
// billingLines_itemNo: {
|
|
47
|
+
// id: "billingLines_itemNo",
|
|
48
|
+
// defaultMessage: "Item no",
|
|
49
|
+
// },
|
|
50
|
+
// billingLines_name: {
|
|
51
|
+
// id: "billingLines_name",
|
|
52
|
+
// defaultMessage: "Name"
|
|
53
|
+
// },
|
|
54
|
+
// billingLines_quantity: {
|
|
55
|
+
// id: "billingLines_quantity",
|
|
56
|
+
// defaultMessage: "Quantity"
|
|
57
|
+
// },
|
|
58
|
+
// billingLines_unitOfMeasure: {
|
|
59
|
+
// id: "billingLines_unitOfMeasure",
|
|
60
|
+
// defaultMessage: "Unit of measure"
|
|
61
|
+
// },
|
|
62
|
+
// billingLines_unitPriceAmount: {
|
|
63
|
+
// id: "billingLines_unitPriceAmount",
|
|
64
|
+
// defaultMessage: "Unit price amount"
|
|
65
|
+
// },
|
|
66
|
+
// billingLines_taxCategoryType: {
|
|
67
|
+
// id: "billingLines_taxCategoryType",
|
|
68
|
+
// defaultMessage: "Tax category"
|
|
69
|
+
// },
|
|
70
|
+
// billingLines_taxCategoryType_title: {
|
|
71
|
+
// id: "billingLines_taxCategoryType_title",
|
|
72
|
+
// defaultMessage: "A product can not contain VAT unless a VAT number is present" // Ekki er hægt að leggja virðisauka á vöru nema gefa upp VSK númer
|
|
73
|
+
// },
|
|
74
|
+
// billingLines_taxCategoryPercentage: {
|
|
75
|
+
// id: "billingLines_taxCategoryPercentage",
|
|
76
|
+
// defaultMessage: "Tax percentage"
|
|
77
|
+
// },
|
|
78
|
+
// billingLines_discount: {
|
|
79
|
+
// id: "billingLines_discount",
|
|
80
|
+
// defaultMessage: "Discount"
|
|
81
|
+
// },
|
|
82
|
+
// billingLines_lineAmount: {
|
|
83
|
+
// id: "billingLines_lineAmount",
|
|
84
|
+
// defaultMessage: "Amount"
|
|
85
|
+
// },
|
|
86
|
+
// billingLines_taxAmount: {
|
|
87
|
+
// id: "billingLines_taxAmount",
|
|
88
|
+
// defaultMessage: "Tax inclusive amount"
|
|
89
|
+
// },
|
|
104
90
|
billingLines_button_addRow: {
|
|
105
91
|
id: "billingLines_button_addRow",
|
|
106
92
|
defaultMessage: "Add a row"
|
|
@@ -116,159 +102,166 @@ exports.translationMessages = react_intl_1.defineMessages({
|
|
|
116
102
|
});
|
|
117
103
|
var BillingLines = /** @class */ (function (_super) {
|
|
118
104
|
__extends(BillingLines, _super);
|
|
105
|
+
// columns: EditableColumnProps<BillingLineMetadataOverride>[];
|
|
119
106
|
function BillingLines(props) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return
|
|
107
|
+
return _super.call(this, props) || this;
|
|
108
|
+
// this.columns = [
|
|
109
|
+
// {
|
|
110
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_itemNo),
|
|
111
|
+
// dataIndex: 'itemNo',
|
|
112
|
+
// editable: true,
|
|
113
|
+
// width: "12em",
|
|
114
|
+
// },
|
|
115
|
+
// {
|
|
116
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_name),
|
|
117
|
+
// dataIndex: 'name',
|
|
118
|
+
// editable: true,
|
|
119
|
+
// },
|
|
120
|
+
// {
|
|
121
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_quantity),
|
|
122
|
+
// dataIndex: 'quantity',
|
|
123
|
+
// editable: true,
|
|
124
|
+
// align: "right",
|
|
125
|
+
// },
|
|
126
|
+
// {
|
|
127
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure),
|
|
128
|
+
// dataIndex: 'unitOfMeasure',
|
|
129
|
+
// align: "right",
|
|
130
|
+
// editable: true,
|
|
131
|
+
// render: ((text, record) => {
|
|
132
|
+
// return <span>{this.props.intl.formatMessage(commonTranslationMessages[`unitOfMeasure_labels_${record.unitOfMeasure.value}` as keyof typeof commonTranslationMessages])}</span>
|
|
133
|
+
// })
|
|
134
|
+
// },
|
|
135
|
+
// {
|
|
136
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_unitPriceAmount),
|
|
137
|
+
// dataIndex: 'unitPriceAmount',
|
|
138
|
+
// editable: true,
|
|
139
|
+
// align: "right",
|
|
140
|
+
// render: (text, record) => {
|
|
141
|
+
// return icelandicNumberLocaleWorkaroundChrome(record.unitPriceAmount ? record.unitPriceAmount : 0, props.intl);
|
|
142
|
+
// }
|
|
143
|
+
// // render: this.renderCurrencyColumn,
|
|
144
|
+
// },
|
|
145
|
+
// {
|
|
146
|
+
// title: (
|
|
147
|
+
// <Tooltip
|
|
148
|
+
// title={this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryType_title)}
|
|
149
|
+
// placement={"right"}
|
|
150
|
+
// >
|
|
151
|
+
// <span>{this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryType)} <QuestionCircleOutlined/></span>
|
|
152
|
+
// </Tooltip>
|
|
153
|
+
// ),
|
|
154
|
+
// dataIndex: 'taxCategoryType',
|
|
155
|
+
// align: "right",
|
|
156
|
+
// editable: true,
|
|
157
|
+
// render: ((text, record) => {
|
|
158
|
+
// const taxPercentage = calculateTaxPercentage(TaxCategoryTypeEnum[record.taxCategoryType.value]);
|
|
159
|
+
// return <span>{`${this.props.intl.formatMessage(commonTranslationMessages[`taxCategoryType_labels_${record.taxCategoryType.value}` as keyof typeof commonTranslationMessages])} (${taxPercentage}%)`}</span>
|
|
160
|
+
// })
|
|
161
|
+
// },
|
|
162
|
+
// // {
|
|
163
|
+
// // title: this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryPercentage),
|
|
164
|
+
// // dataIndex: 'taxCategoryPercentage',
|
|
165
|
+
// // editable: false,
|
|
166
|
+
// // align: "right",
|
|
167
|
+
// // render: ((text, record) => {
|
|
168
|
+
// // const taxPercentage = calculateTaxPercentage(TaxCategoryTypeEnum[record.taxCategoryType]); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
169
|
+
// // return <span>{taxPercentage}%</span>
|
|
170
|
+
// // })
|
|
171
|
+
// // },
|
|
172
|
+
// {
|
|
173
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_discount),
|
|
174
|
+
// dataIndex: 'discountValue',
|
|
175
|
+
// editable: true,
|
|
176
|
+
// align: "right",
|
|
177
|
+
// width: "5em",
|
|
178
|
+
// render: ((text, record) => {
|
|
179
|
+
// return <div>{record.discountValue}</div>
|
|
180
|
+
// })
|
|
181
|
+
// },
|
|
182
|
+
// {
|
|
183
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_lineAmount),
|
|
184
|
+
// dataIndex: 'taxableAmount',
|
|
185
|
+
// editable: false,
|
|
186
|
+
// align: "right",
|
|
187
|
+
// render: (text, record) => {
|
|
188
|
+
// const taxableAmount = calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount);
|
|
189
|
+
// return (
|
|
190
|
+
// <span>{icelandicNumberLocaleWorkaroundChrome(taxableAmount, props.intl, {style: "decimal"})}</span>
|
|
191
|
+
// );
|
|
192
|
+
// }
|
|
193
|
+
// },
|
|
194
|
+
// {
|
|
195
|
+
// title: this.props.intl.formatMessage(translationMessages.billingLines_taxAmount),
|
|
196
|
+
// dataIndex: 'taxInclusiveAmount',
|
|
197
|
+
// editable: false,
|
|
198
|
+
// align: "right",
|
|
199
|
+
// render: (text, record) => {
|
|
200
|
+
// const taxAmount = calculateTaxAmount(calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount), calculateTaxPercentage(TaxCategoryTypeEnum[record.taxCategoryType.value])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
201
|
+
// const taxableAmount = calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount);
|
|
202
|
+
// const taxInclusiveAmount = taxableAmount + taxAmount;
|
|
203
|
+
// return (
|
|
204
|
+
// <span>{icelandicNumberLocaleWorkaroundChrome(taxInclusiveAmount, props.intl, {style: "decimal"})}</span>
|
|
205
|
+
// );
|
|
206
|
+
// }
|
|
207
|
+
// },
|
|
208
|
+
// {
|
|
209
|
+
// title: "",
|
|
210
|
+
// render: (text, record) => {
|
|
211
|
+
// return <>
|
|
212
|
+
// <MinusCircleOutlined
|
|
213
|
+
// onClick={() => {
|
|
214
|
+
// this.props.handleDelete(record.key);
|
|
215
|
+
// }}/>
|
|
216
|
+
// </>;
|
|
217
|
+
// }
|
|
218
|
+
// }
|
|
219
|
+
// ]
|
|
225
220
|
}
|
|
226
221
|
// renderCurrencyColumn = (text: string | number) => {
|
|
227
222
|
// const currency = this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) ? this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) : "";
|
|
228
223
|
// return text + " " + currency;
|
|
229
224
|
// };
|
|
230
225
|
BillingLines.prototype.render = function () {
|
|
231
|
-
var _this = this;
|
|
232
226
|
// const dataSource = this.props.formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
233
|
-
|
|
227
|
+
// const {dataSource} = this.props;
|
|
234
228
|
// console.log(dataSource);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
229
|
+
// const components = {
|
|
230
|
+
// body: {
|
|
231
|
+
// row: EditableRow,
|
|
232
|
+
// cell: EditableCell,
|
|
233
|
+
// },
|
|
234
|
+
// };
|
|
235
|
+
// const columns: ColumnsType<BillingLineMetadataOverride> = this.columns.map(col => {
|
|
236
|
+
// if (!col.editable) {
|
|
237
|
+
// return col;
|
|
238
|
+
// }
|
|
239
|
+
// return {
|
|
240
|
+
// ...col,
|
|
241
|
+
// onCell: (record: BillingLineMetadataOverride) => ({
|
|
242
|
+
// record,
|
|
243
|
+
// editable: col.editable,
|
|
244
|
+
// dataIndex: col.dataIndex,
|
|
245
|
+
// title: col.title ? col.title.toString() : "", // TODO: will this work?????
|
|
246
|
+
// handleSave: (billingLineMetadataOverrideRecord: BillingLineMetadataOverride, rowIndex: number) => this.props.handleSave(billingLineMetadataOverrideRecord, this.props.formInstance),
|
|
247
|
+
// }),
|
|
248
|
+
// };
|
|
249
|
+
// });
|
|
253
250
|
var billingLinesLabelNode = (React.createElement(antd_1.Tooltip, { title: this.props.intl.formatMessage(exports.translationMessages.billingLines_tooltip_title), placement: "right" },
|
|
254
251
|
React.createElement("span", null,
|
|
255
252
|
this.props.intl.formatMessage(exports.translationMessages.billingLines_title),
|
|
256
|
-
"
|
|
253
|
+
"\u00A0",
|
|
257
254
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
258
255
|
var currencyCode = this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) ? this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) : "";
|
|
256
|
+
var billingLinesFormValues = this.props.formInstance.getFieldsValue(["invoice", "invoiceLines"]);
|
|
257
|
+
// console.log(billingLinesFormValues)
|
|
259
258
|
return (React.createElement(components_1.ComponentContainer, { title: billingLinesLabelNode },
|
|
260
|
-
React.createElement(
|
|
261
|
-
// style={{minHeight: "170px"}}
|
|
262
|
-
components: components, dataSource: dataSource, columns: columns, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }),
|
|
263
|
-
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.fullWidthInput),
|
|
264
|
-
React.createElement(antd_1.Button, { type: "dashed", onClick: function () { return _this.props.handleAdd(_this.props.initialBillingLineData); }, style: { width: "100%" } },
|
|
265
|
-
React.createElement(icons_1.PlusOutlined, null),
|
|
266
|
-
this.props.intl.formatMessage(exports.translationMessages.billingLines_button_addRow))),
|
|
259
|
+
React.createElement(NewBillingLines_1.default, { formInstance: this.props.formInstance, receiverRequirements: this.props.receiverRequirements }),
|
|
267
260
|
React.createElement(antd_1.Row, { style: { marginTop: "1em" }, align: "top", justify: "space-between", gutter: [16, 16] },
|
|
268
261
|
React.createElement(antd_1.Col, { span: 16 },
|
|
269
|
-
React.createElement(BillingTaxSummary_1.default, { billingLines:
|
|
262
|
+
React.createElement(BillingTaxSummary_1.default, { billingLines: this.props.billingLinesMetadata })),
|
|
270
263
|
React.createElement(antd_1.Col, { span: 8 },
|
|
271
|
-
React.createElement(BillingCalculations_1.default, { billingLinesMetadata:
|
|
264
|
+
React.createElement(BillingCalculations_1.default, { billingLinesMetadata: this.props.billingLinesMetadata,
|
|
272
265
|
// renderCurrencyColumn={this.renderCurrencyColumn}
|
|
273
266
|
currencyCode: currencyCode })))));
|
|
274
267
|
};
|
|
@@ -17,7 +17,7 @@ interface Props extends InjectedIntlProps, FormItemProps {
|
|
|
17
17
|
fieldName: NamePath;
|
|
18
18
|
additionalRules?: Rule[];
|
|
19
19
|
style?: React.CSSProperties;
|
|
20
|
-
initialValue?: StringMap;
|
|
20
|
+
initialValue?: StringMap | string | number;
|
|
21
21
|
verticalLabels?: boolean;
|
|
22
22
|
onlyLabelOnFirstInList?: boolean;
|
|
23
23
|
index?: number;
|
|
@@ -45,7 +45,7 @@ var UmzFormItem = function (props) {
|
|
|
45
45
|
? react_1.default.createElement(antd_1.Tooltip, { title: labelTooltip, placement: "right" },
|
|
46
46
|
react_1.default.createElement("span", null,
|
|
47
47
|
labelString,
|
|
48
|
-
"
|
|
48
|
+
"\u00A0",
|
|
49
49
|
react_1.default.createElement(icons_1.QuestionCircleOutlined, null)))
|
|
50
50
|
: labelString;
|
|
51
51
|
var isRequired = RequirementsUtility_1.getFieldIsRequired(receiverRequirements, receiverRequirementsKey, defaultIsRequired);
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
-
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
4
3
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
5
4
|
import { FormInstance } from "antd/lib/form";
|
|
6
5
|
interface Props extends InjectedIntlProps {
|
|
7
6
|
receiverRequirements: NewReceiverRequirements;
|
|
8
|
-
billingLinesDataSource: BillingLineMetadataOverride[];
|
|
9
7
|
rapiApiKey: string;
|
|
10
8
|
rapiBaseUrl: string;
|
|
11
9
|
form: FormInstance;
|
|
12
10
|
}
|
|
13
|
-
declare const SupplierIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "rapiBaseUrl" | "
|
|
11
|
+
declare const SupplierIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "rapiBaseUrl" | "rapiApiKey">, any> & {
|
|
14
12
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
15
13
|
};
|
|
16
14
|
export default SupplierIntl;
|
|
@@ -89,10 +89,21 @@ var Supplier = function (props) {
|
|
|
89
89
|
var electronicMailLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.supplier_contact_email_title), placement: "right" },
|
|
90
90
|
React.createElement("span", null,
|
|
91
91
|
props.intl.formatMessage(translationMessages.supplier_contact_email),
|
|
92
|
-
"
|
|
92
|
+
"\u00A0",
|
|
93
93
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
94
|
-
var
|
|
95
|
-
|
|
94
|
+
var getRequiredVatNumber = function () {
|
|
95
|
+
var fieldsValueAll = props.form.getFieldsValue();
|
|
96
|
+
if (fieldsValueAll.hasOwnProperty("invoice")) {
|
|
97
|
+
if (fieldsValueAll.invoice.hasOwnProperty("invoiceLines")) {
|
|
98
|
+
var invoiceLines = fieldsValueAll.invoice.invoiceLines;
|
|
99
|
+
return invoiceLines.some(function (billingLine) {
|
|
100
|
+
if (billingLine) {
|
|
101
|
+
return (billingLine.taxCategoryType !== mapi_1.TaxCategoryTypeEnum.OutsideTaxScope);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
96
107
|
};
|
|
97
108
|
react_1.useEffect(function () {
|
|
98
109
|
if (participantInfo !== null && participantInfo !== undefined) {
|
|
@@ -176,9 +187,9 @@ var Supplier = function (props) {
|
|
|
176
187
|
React.createElement(antd_mask_input_1.MaskedInput, { mask: "111111-1111", onChange: function (value) { return debouncerSearch(props.rapiBaseUrl, props.rapiApiKey, value.target.value); } })),
|
|
177
188
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.name"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_name), defaultIsRequired: true, fieldName: ["invoice", "supplier", "name"] },
|
|
178
189
|
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo })),
|
|
179
|
-
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.vatNumber"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_vatNumber), defaultIsRequired: false, fieldName: ["invoice", "supplier", "vatNumber"], additionalRules: [
|
|
190
|
+
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.vatNumber"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_vatNumber), defaultIsRequired: false, fieldName: ["invoice", "supplier", "vatNumber"], dependencies: ["invoice", "invoiceLines"], additionalRules: [
|
|
180
191
|
{
|
|
181
|
-
required:
|
|
192
|
+
required: getRequiredVatNumber(),
|
|
182
193
|
message: props.intl.formatMessage(translationMessages.supplier_vatNumber_mandatory) // VAT number is required if some document lines are using any tax category type other than "outside tax scope"
|
|
183
194
|
},
|
|
184
195
|
{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi";
|
|
2
|
-
import {
|
|
2
|
+
import { UnitOfMeasureLabelInValueEnum } from "../components/billing-lines";
|
|
3
|
+
import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
|
|
3
4
|
export interface BillingLineMetadataOverride extends Omit<BillingLineMetadata, 'unitOfMeasure' | 'taxCategoryType'> {
|
|
4
5
|
key: number;
|
|
5
6
|
unitOfMeasure: UnitOfMeasureLabelInValueEnum;
|
|
6
|
-
taxCategoryType:
|
|
7
|
+
taxCategoryType: TaxCategoryTypeEnum;
|
|
7
8
|
}
|