@unimaze/billing 0.12.18 → 0.12.19
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/CommonTranslations.d.ts +2 -0
- package/lib/common/components/CommonTranslations.js +85 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.js +3 -3
- package/lib/common/components/billing-lines/NewBillingLines.js +2 -2
- package/lib/common/components/editable-cell/index.d.ts +0 -15
- package/lib/common/components/editable-cell/index.js +296 -276
- package/lib/common/components/editable-row/index.d.ts +1 -1
- package/lib/common/components/form-item/index.d.ts +1 -1
- package/lib/common/components/index.d.ts +0 -2
- package/lib/common/components/index.js +2 -4
- package/lib/utils/BillingLineUtility.d.ts +1 -1
- package/lib/utils/BillingLineUtility.js +2 -2
- package/lib/utils/RequirementsUtility.d.ts +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react-intl" />
|
|
2
|
+
export declare const commonTranslationMessages: ReactIntl.Messages<"taxCategoryType_labels_StandardRated" | "taxCategoryType_labels_ReducedRated" | "taxCategoryType_labels_ZeroRated" | "taxCategoryType_labels_Exempt" | "taxCategoryType_labels_OutsideTaxScope" | "unitOfMeasure_labels_Piece" | "unitOfMeasure_labels_Kilogram" | "unitOfMeasure_labels_Month" | "unitOfMeasure_labels_Package" | "unitOfMeasure_labels_Year" | "unitOfMeasure_labels_Day" | "unitOfMeasure_labels_Hour" | "unitOfMeasure_labels_Kilometre" | "unitOfMeasure_labels_Metre" | "unitOfMeasure_labels_Litre" | "unitOfMeasure_labels_SquareMetre" | "unitOfMeasure_labels_CubicMetre" | "unitOfMeasure_labels_Tonne" | "unitOfMeasure_labels_KiloWattHour" | "unitOfMeasure_labels_One">;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_intl_1 = require("react-intl");
|
|
4
|
+
exports.commonTranslationMessages = react_intl_1.defineMessages({
|
|
5
|
+
taxCategoryType_labels_StandardRated: {
|
|
6
|
+
id: "taxCategoryType_labels_StandardRated",
|
|
7
|
+
defaultMessage: "Standard rated",
|
|
8
|
+
},
|
|
9
|
+
taxCategoryType_labels_ReducedRated: {
|
|
10
|
+
id: "taxCategoryType_labels_ReducedRated",
|
|
11
|
+
defaultMessage: "Reduced rated",
|
|
12
|
+
},
|
|
13
|
+
taxCategoryType_labels_ZeroRated: {
|
|
14
|
+
id: "taxCategoryType_labels_ZeroRated",
|
|
15
|
+
defaultMessage: "Zero rated",
|
|
16
|
+
},
|
|
17
|
+
taxCategoryType_labels_Exempt: {
|
|
18
|
+
id: "taxCategoryType_labels_Exempt",
|
|
19
|
+
defaultMessage: "Exempt",
|
|
20
|
+
},
|
|
21
|
+
taxCategoryType_labels_OutsideTaxScope: {
|
|
22
|
+
id: "taxCategoryType_labels_OutsideTaxScope",
|
|
23
|
+
defaultMessage: "Outside tax scope",
|
|
24
|
+
},
|
|
25
|
+
unitOfMeasure_labels_Piece: {
|
|
26
|
+
id: "unitOfMeasure_labels_Piece",
|
|
27
|
+
defaultMessage: "Piece",
|
|
28
|
+
},
|
|
29
|
+
unitOfMeasure_labels_Kilogram: {
|
|
30
|
+
id: "unitOfMeasure_labels_Kilogram",
|
|
31
|
+
defaultMessage: "Kilogram",
|
|
32
|
+
},
|
|
33
|
+
unitOfMeasure_labels_Month: {
|
|
34
|
+
id: "unitOfMeasure_labels_Month",
|
|
35
|
+
defaultMessage: "Month",
|
|
36
|
+
},
|
|
37
|
+
unitOfMeasure_labels_Package: {
|
|
38
|
+
id: "unitOfMeasure_labels_Package",
|
|
39
|
+
defaultMessage: "Package",
|
|
40
|
+
},
|
|
41
|
+
unitOfMeasure_labels_Year: {
|
|
42
|
+
id: "unitOfMeasure_labels_Year",
|
|
43
|
+
defaultMessage: "Year",
|
|
44
|
+
},
|
|
45
|
+
unitOfMeasure_labels_Day: {
|
|
46
|
+
id: "unitOfMeasure_labels_Day",
|
|
47
|
+
defaultMessage: "Day",
|
|
48
|
+
},
|
|
49
|
+
unitOfMeasure_labels_Hour: {
|
|
50
|
+
id: "unitOfMeasure_labels_Hour",
|
|
51
|
+
defaultMessage: "Hour",
|
|
52
|
+
},
|
|
53
|
+
unitOfMeasure_labels_Kilometre: {
|
|
54
|
+
id: "unitOfMeasure_labels_Kilometre",
|
|
55
|
+
defaultMessage: "Kilometre",
|
|
56
|
+
},
|
|
57
|
+
unitOfMeasure_labels_Metre: {
|
|
58
|
+
id: "unitOfMeasure_labels_Metre",
|
|
59
|
+
defaultMessage: "Metre",
|
|
60
|
+
},
|
|
61
|
+
unitOfMeasure_labels_Litre: {
|
|
62
|
+
id: "unitOfMeasure_labels_Litre",
|
|
63
|
+
defaultMessage: "Litre",
|
|
64
|
+
},
|
|
65
|
+
unitOfMeasure_labels_SquareMetre: {
|
|
66
|
+
id: "unitOfMeasure_labels_SquareMetre",
|
|
67
|
+
defaultMessage: "Square metre",
|
|
68
|
+
},
|
|
69
|
+
unitOfMeasure_labels_CubicMetre: {
|
|
70
|
+
id: "unitOfMeasure_labels_CubicMetre",
|
|
71
|
+
defaultMessage: "Cubic metre",
|
|
72
|
+
},
|
|
73
|
+
unitOfMeasure_labels_Tonne: {
|
|
74
|
+
id: "unitOfMeasure_labels_Tonne",
|
|
75
|
+
defaultMessage: "Tonne",
|
|
76
|
+
},
|
|
77
|
+
unitOfMeasure_labels_KiloWattHour: {
|
|
78
|
+
id: "unitOfMeasure_labels_KiloWattHour",
|
|
79
|
+
defaultMessage: "KiloWatt hour",
|
|
80
|
+
},
|
|
81
|
+
unitOfMeasure_labels_One: {
|
|
82
|
+
id: "unitOfMeasure_labels_One",
|
|
83
|
+
defaultMessage: "One",
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -12,7 +12,7 @@ var antd_1 = require("antd");
|
|
|
12
12
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
13
13
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
14
14
|
var react_intl_1 = require("react-intl");
|
|
15
|
-
var
|
|
15
|
+
var CommonTranslations_1 = require("../CommonTranslations");
|
|
16
16
|
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
17
17
|
var translationMessages = react_intl_1.defineMessages({
|
|
18
18
|
billingTaxSummary_taxOverview: {
|
|
@@ -57,8 +57,8 @@ var BillingTaxSummary = function (props) {
|
|
|
57
57
|
? invoiceLines.map(function (billingLine) {
|
|
58
58
|
var taxCategoryType = billingLine.taxCategoryType ? api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType] : undefined;
|
|
59
59
|
var translationString = "taxCategoryType_labels_" + taxCategoryType;
|
|
60
|
-
var taxCategoryTypeTranslated =
|
|
61
|
-
? props.intl.formatMessage(
|
|
60
|
+
var taxCategoryTypeTranslated = CommonTranslations_1.commonTranslationMessages.hasOwnProperty(translationString)
|
|
61
|
+
? props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages[translationString])
|
|
62
62
|
: "";
|
|
63
63
|
return {
|
|
64
64
|
taxOverview: BillingLineUtility_1.generateTaxCategoryLabel(taxCategoryType, taxCategoryTypeTranslated),
|
|
@@ -23,7 +23,7 @@ var form_item_1 = __importDefault(require("../form-item"));
|
|
|
23
23
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
24
24
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
25
25
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
26
|
-
var
|
|
26
|
+
var CommonTranslations_1 = require("../CommonTranslations");
|
|
27
27
|
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
28
28
|
var translationMessages = react_intl_1.defineMessages({
|
|
29
29
|
billingLines_labels_addButton: {
|
|
@@ -142,7 +142,7 @@ var BillingLines = function (props) {
|
|
|
142
142
|
taxCatType = value;
|
|
143
143
|
}, dropdownMatchSelectWidth: false }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
144
144
|
var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(mapi_1.TaxCategoryTypeEnum[taxCategoryType]);
|
|
145
|
-
return (react_1.default.createElement(antd_1.Select.Option, { disabled: getTaxCategoryDisabled(mapi_1.TaxCategoryTypeEnum[taxCategoryType], props.outsideVatScope), value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, props.intl.formatMessage(
|
|
145
|
+
return (react_1.default.createElement(antd_1.Select.Option, { disabled: getTaxCategoryDisabled(mapi_1.TaxCategoryTypeEnum[taxCategoryType], props.outsideVatScope), value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages["taxCategoryType_labels_" + taxCategoryType]) + " (" + taxPercentage + "%)"));
|
|
146
146
|
})))),
|
|
147
147
|
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
148
148
|
react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], defaultIsRequired: false, fieldName: [field.name, "discountValue"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_discount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index, defaultLabelTooltip: props.intl.formatMessage(translationMessages.billingLines_discount_helpText) }, BillingLineUtility_1.getCorrectInputNode("discountValue", props.intl))),
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
|
-
import { InjectedIntlProps } from "react-intl";
|
|
4
|
-
export declare const commonTranslationMessages: ReactIntl.Messages<"taxCategoryType_labels_StandardRated" | "taxCategoryType_labels_ReducedRated" | "taxCategoryType_labels_ZeroRated" | "taxCategoryType_labels_Exempt" | "taxCategoryType_labels_OutsideTaxScope" | "unitOfMeasure_labels_Piece" | "unitOfMeasure_labels_Kilogram" | "unitOfMeasure_labels_Month" | "unitOfMeasure_labels_Package" | "unitOfMeasure_labels_Year" | "unitOfMeasure_labels_Day" | "unitOfMeasure_labels_Hour" | "unitOfMeasure_labels_Kilometre" | "unitOfMeasure_labels_Metre" | "unitOfMeasure_labels_Litre" | "unitOfMeasure_labels_SquareMetre" | "unitOfMeasure_labels_CubicMetre" | "unitOfMeasure_labels_Tonne" | "unitOfMeasure_labels_KiloWattHour" | "unitOfMeasure_labels_One">;
|
|
5
|
-
interface EditableCellProps extends InjectedIntlProps {
|
|
6
|
-
record: BillingLineMetadataOverride;
|
|
7
|
-
handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
|
|
8
|
-
dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
|
|
9
|
-
editable: boolean;
|
|
10
|
-
index: number;
|
|
11
|
-
}
|
|
12
|
-
declare const EditableCellIntl: React.ComponentClass<Pick<EditableCellProps, "dataIndex" | "editable" | "index" | "record" | "handleSave">, any> & {
|
|
13
|
-
WrappedComponent: React.ComponentType<EditableCellProps & InjectedIntlProps>;
|
|
14
|
-
};
|
|
15
|
-
export default EditableCellIntl;
|
|
@@ -1,277 +1,297 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
2
|
+
// import React, {useState, useContext, MutableRefObject} from "react";
|
|
3
|
+
// import {Form, Input, InputNumber, Select, message} from "antd";
|
|
4
|
+
//
|
|
5
|
+
// import {
|
|
6
|
+
// BillingLineMetadataTaxCategoryTypeEnum,
|
|
7
|
+
// UnitOfMeasureMetadataUnitEnum
|
|
8
|
+
// } from "@unimaze/api-clients/lib/mapi/models";
|
|
9
|
+
//
|
|
10
|
+
// import {validationRules, ValidationRulesObject} from "../../consts/validationRules";
|
|
11
|
+
// import {BillingLineMetadataOverride} from "../../types/BillingLineMetadataOverride";
|
|
12
|
+
// import {EditableContext} from "../editable-row";
|
|
13
|
+
// import {FormInstance} from "antd/lib/form";
|
|
14
|
+
// import {calculateTaxPercentage} from "../../../utils/BillingLineUtility";
|
|
15
|
+
// import {TaxCategoryTypeEnum} from "@unimaze/api-clients/lib/mapi/api";
|
|
16
|
+
// import {defineMessages, injectIntl, InjectedIntlProps} from "react-intl";
|
|
17
|
+
// import {returnDecimalSeparatorForLocale} from "../../../utils/IntlUtility";
|
|
18
|
+
//
|
|
19
|
+
// export const commonTranslationMessages = defineMessages({
|
|
20
|
+
// taxCategoryType_labels_StandardRated: {
|
|
21
|
+
// id: "taxCategoryType_labels_StandardRated",
|
|
22
|
+
// defaultMessage: "Standard rated",
|
|
23
|
+
// },
|
|
24
|
+
// taxCategoryType_labels_ReducedRated: {
|
|
25
|
+
// id: "taxCategoryType_labels_ReducedRated",
|
|
26
|
+
// defaultMessage: "Reduced rated",
|
|
27
|
+
// },
|
|
28
|
+
// taxCategoryType_labels_ZeroRated: {
|
|
29
|
+
// id: "taxCategoryType_labels_ZeroRated",
|
|
30
|
+
// defaultMessage: "Zero rated",
|
|
31
|
+
// },
|
|
32
|
+
// taxCategoryType_labels_Exempt: {
|
|
33
|
+
// id: "taxCategoryType_labels_Exempt",
|
|
34
|
+
// defaultMessage: "Exempt",
|
|
35
|
+
// },
|
|
36
|
+
// taxCategoryType_labels_OutsideTaxScope: {
|
|
37
|
+
// id: "taxCategoryType_labels_OutsideTaxScope",
|
|
38
|
+
// defaultMessage: "Outside tax scope",
|
|
39
|
+
// },
|
|
40
|
+
// unitOfMeasure_labels_Piece: {
|
|
41
|
+
// id: "unitOfMeasure_labels_Piece",
|
|
42
|
+
// defaultMessage: "Piece",
|
|
43
|
+
// },
|
|
44
|
+
// unitOfMeasure_labels_Kilogram: {
|
|
45
|
+
// id: "unitOfMeasure_labels_Kilogram",
|
|
46
|
+
// defaultMessage: "Kilogram",
|
|
47
|
+
// },
|
|
48
|
+
// unitOfMeasure_labels_Month: {
|
|
49
|
+
// id: "unitOfMeasure_labels_Month",
|
|
50
|
+
// defaultMessage: "Month",
|
|
51
|
+
// },
|
|
52
|
+
// unitOfMeasure_labels_Package: {
|
|
53
|
+
// id: "unitOfMeasure_labels_Package",
|
|
54
|
+
// defaultMessage: "Package",
|
|
55
|
+
// },
|
|
56
|
+
// unitOfMeasure_labels_Year: {
|
|
57
|
+
// id: "unitOfMeasure_labels_Year",
|
|
58
|
+
// defaultMessage: "Year",
|
|
59
|
+
// },
|
|
60
|
+
// unitOfMeasure_labels_Day: {
|
|
61
|
+
// id: "unitOfMeasure_labels_Day",
|
|
62
|
+
// defaultMessage: "Day",
|
|
63
|
+
// },
|
|
64
|
+
// unitOfMeasure_labels_Hour: {
|
|
65
|
+
// id: "unitOfMeasure_labels_Hour",
|
|
66
|
+
// defaultMessage: "Hour",
|
|
67
|
+
// },
|
|
68
|
+
// unitOfMeasure_labels_Kilometre: {
|
|
69
|
+
// id: "unitOfMeasure_labels_Kilometre",
|
|
70
|
+
// defaultMessage: "Kilometre",
|
|
71
|
+
// },
|
|
72
|
+
// unitOfMeasure_labels_Metre: {
|
|
73
|
+
// id: "unitOfMeasure_labels_Metre",
|
|
74
|
+
// defaultMessage: "Metre",
|
|
75
|
+
// },
|
|
76
|
+
// unitOfMeasure_labels_Litre: {
|
|
77
|
+
// id: "unitOfMeasure_labels_Litre",
|
|
78
|
+
// defaultMessage: "Litre",
|
|
79
|
+
// },
|
|
80
|
+
// unitOfMeasure_labels_SquareMetre: {
|
|
81
|
+
// id: "unitOfMeasure_labels_SquareMetre",
|
|
82
|
+
// defaultMessage: "Square metre",
|
|
83
|
+
// },
|
|
84
|
+
// unitOfMeasure_labels_CubicMetre: {
|
|
85
|
+
// id: "unitOfMeasure_labels_CubicMetre",
|
|
86
|
+
// defaultMessage: "Cubic metre",
|
|
87
|
+
// },
|
|
88
|
+
// unitOfMeasure_labels_Tonne: {
|
|
89
|
+
// id: "unitOfMeasure_labels_Tonne",
|
|
90
|
+
// defaultMessage: "Tonne",
|
|
91
|
+
// },
|
|
92
|
+
// unitOfMeasure_labels_KiloWattHour: {
|
|
93
|
+
// id: "unitOfMeasure_labels_KiloWattHour",
|
|
94
|
+
// defaultMessage: "KiloWatt hour",
|
|
95
|
+
// },
|
|
96
|
+
// unitOfMeasure_labels_One: {
|
|
97
|
+
// id: "unitOfMeasure_labels_One",
|
|
98
|
+
// defaultMessage: "One",
|
|
99
|
+
// },
|
|
100
|
+
// });
|
|
101
|
+
//
|
|
102
|
+
// const validationTranslationMessages = defineMessages({
|
|
103
|
+
// rulesMessages_name_required: {
|
|
104
|
+
// id: "rulesMessages_name_required",
|
|
105
|
+
// defaultMessage: "Please insert item name",
|
|
106
|
+
// },
|
|
107
|
+
// rulesMessages_unitOfMeasure_required: {
|
|
108
|
+
// id: "rulesMessages_unitOfMeasure_required",
|
|
109
|
+
// defaultMessage: "Please choose unit of measure",
|
|
110
|
+
// },
|
|
111
|
+
// rulesMessages_unitPriceAmount_required: {
|
|
112
|
+
// id: "rulesMessages_unitPriceAmount_required",
|
|
113
|
+
// defaultMessage: "Please fill in unit price amount",
|
|
114
|
+
// },
|
|
115
|
+
// rulesMessages_unitPriceAmount_type: {
|
|
116
|
+
// id: "rulesMessages_unitPriceAmount_type",
|
|
117
|
+
// defaultMessage: "Unit price amount must be a number",
|
|
118
|
+
// },
|
|
119
|
+
// rulesMessages_taxCategoryType_required: {
|
|
120
|
+
// id: "rulesMessages_taxCategoryType_required",
|
|
121
|
+
// defaultMessage: "Please choose tax category type",
|
|
122
|
+
// },
|
|
123
|
+
// rulesMessages_discountValue_pattern: {
|
|
124
|
+
// id: "rulesMessages_discountValue_pattern",
|
|
125
|
+
// defaultMessage: "Please use only numbers characters and percentage character at the end",
|
|
126
|
+
// },
|
|
127
|
+
// });
|
|
128
|
+
//
|
|
129
|
+
// interface EditableCellProps extends InjectedIntlProps {
|
|
130
|
+
// record: BillingLineMetadataOverride;
|
|
131
|
+
// handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
|
|
132
|
+
// // title: string;
|
|
133
|
+
// dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
|
|
134
|
+
// editable: boolean;
|
|
135
|
+
// index: number;
|
|
136
|
+
// }
|
|
137
|
+
//
|
|
138
|
+
// const EditableCell: React.FC<EditableCellProps> = (props) => {
|
|
139
|
+
// const {
|
|
140
|
+
// editable,
|
|
141
|
+
// dataIndex,
|
|
142
|
+
// // title,
|
|
143
|
+
// record,
|
|
144
|
+
// index,
|
|
145
|
+
// handleSave,
|
|
146
|
+
// children,
|
|
147
|
+
// ...restProps
|
|
148
|
+
// } = props;
|
|
149
|
+
//
|
|
150
|
+
// const [editing, setEditing] = useState<boolean>(true);
|
|
151
|
+
// let input: Select<any> | Input | null = null;
|
|
152
|
+
// const form = useContext<FormInstance>(EditableContext);
|
|
153
|
+
//
|
|
154
|
+
// const toggleEdit = (): void => {
|
|
155
|
+
// setEditing(!editing);
|
|
156
|
+
// if (!editing && input) input.focus();
|
|
157
|
+
// };
|
|
158
|
+
//
|
|
159
|
+
// const save = async () => {
|
|
160
|
+
// try {
|
|
161
|
+
// const values = await form.validateFields();
|
|
162
|
+
// toggleEdit();
|
|
163
|
+
// handleSave({...record, ...values});
|
|
164
|
+
// } catch (errInfo) {
|
|
165
|
+
// // tslint:disable-next-line:no-console
|
|
166
|
+
// console.log('Save failed:', errInfo);
|
|
167
|
+
// message.error(errInfo)
|
|
168
|
+
// }
|
|
169
|
+
// };
|
|
170
|
+
//
|
|
171
|
+
// const getCorrectInputNode = (dataIdx: keyof BillingLineMetadataOverride): React.ReactChild => {
|
|
172
|
+
// switch (dataIdx) {
|
|
173
|
+
// case "quantity":
|
|
174
|
+
// case "unitPriceAmount":
|
|
175
|
+
// return <InputNumber step={1}
|
|
176
|
+
// decimalSeparator={returnDecimalSeparatorForLocale(localStorage.getItem("languageString"))}
|
|
177
|
+
// // ref={node => (input = node)}
|
|
178
|
+
// // onPressEnter={save}
|
|
179
|
+
// onBlur={save}
|
|
180
|
+
// />;
|
|
181
|
+
//
|
|
182
|
+
// case "discountValue":
|
|
183
|
+
// return <Input onBlur={save}/>
|
|
184
|
+
// case "unitOfMeasure":
|
|
185
|
+
// return (
|
|
186
|
+
// <Select
|
|
187
|
+
// dropdownMatchSelectWidth={false}
|
|
188
|
+
// ref={node => (input = node)}
|
|
189
|
+
// // defaultActiveFirstOption
|
|
190
|
+
// // onSelect={save}
|
|
191
|
+
// labelInValue
|
|
192
|
+
// onChange={save}
|
|
193
|
+
// >
|
|
194
|
+
// {Object.keys(UnitOfMeasureMetadataUnitEnum).map(unitOfMeasure => {
|
|
195
|
+
// if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|
|
196
|
+
// return (
|
|
197
|
+
// <Select.Option
|
|
198
|
+
// value={unitOfMeasure}
|
|
199
|
+
// // title={unitOfMeasure}
|
|
200
|
+
// key={unitOfMeasure}
|
|
201
|
+
// >
|
|
202
|
+
// {/*{unitOfMeasure}*/}
|
|
203
|
+
// {props.intl.formatMessage(commonTranslationMessages[`unitOfMeasure_labels_${unitOfMeasure}` as keyof typeof commonTranslationMessages])}
|
|
204
|
+
// </Select.Option>
|
|
205
|
+
// )
|
|
206
|
+
// })}
|
|
207
|
+
// </Select>
|
|
208
|
+
// );
|
|
209
|
+
// case "taxCategoryType":
|
|
210
|
+
// return (
|
|
211
|
+
// <Select
|
|
212
|
+
// dropdownMatchSelectWidth={false}
|
|
213
|
+
// ref={node => (input = node)}
|
|
214
|
+
// // defaultActiveFirstOption
|
|
215
|
+
// labelInValue
|
|
216
|
+
// // onSelect={save}
|
|
217
|
+
// onChange={save}
|
|
218
|
+
// >
|
|
219
|
+
// {Object.keys(TaxCategoryTypeEnum).map(taxCategoryType => {
|
|
220
|
+
// const taxPercentage = calculateTaxPercentage(TaxCategoryTypeEnum[taxCategoryType as TaxCategoryTypeEnum]);
|
|
221
|
+
//
|
|
222
|
+
// return (
|
|
223
|
+
// <Select.Option
|
|
224
|
+
// value={taxCategoryType}
|
|
225
|
+
// key={taxCategoryType}
|
|
226
|
+
// >
|
|
227
|
+
// {/*{`${taxCategoryType} (${taxPercentage}%)`}*/}
|
|
228
|
+
// {`${props.intl.formatMessage(commonTranslationMessages[`taxCategoryType_labels_${taxCategoryType}` as keyof typeof commonTranslationMessages])} (${taxPercentage}%)`}
|
|
229
|
+
// </Select.Option>
|
|
230
|
+
// )
|
|
231
|
+
// })}
|
|
232
|
+
// </Select>
|
|
233
|
+
// );
|
|
234
|
+
// default:
|
|
235
|
+
// return <Input
|
|
236
|
+
// ref={node => (input = node)}
|
|
237
|
+
// // onPressEnter={save}
|
|
238
|
+
// onBlur={save}
|
|
239
|
+
// />;
|
|
240
|
+
//
|
|
241
|
+
// }
|
|
242
|
+
// };
|
|
243
|
+
//
|
|
244
|
+
// const renderCell = () => {
|
|
245
|
+
// const inputNode: React.ReactChild = getCorrectInputNode(dataIndex);
|
|
246
|
+
//
|
|
247
|
+
// const rules = (validationRules as ValidationRulesObject)[dataIndex];
|
|
248
|
+
//
|
|
249
|
+
// const translatableRules = rules && rules.map(singleRule => {
|
|
250
|
+
// return {
|
|
251
|
+
// ...singleRule,
|
|
252
|
+
// message: singleRule.message && props.intl.formatMessage(validationTranslationMessages[`rulesMessages_${singleRule.message}` as keyof typeof validationTranslationMessages])
|
|
253
|
+
// }
|
|
254
|
+
// })
|
|
255
|
+
//
|
|
256
|
+
// return editing ? (
|
|
257
|
+
// <Form.Item
|
|
258
|
+
// style={{margin: 0}}
|
|
259
|
+
// rules={translatableRules}
|
|
260
|
+
// name={dataIndex}
|
|
261
|
+
// initialValue={record[dataIndex]}
|
|
262
|
+
// >
|
|
263
|
+
// {inputNode}
|
|
264
|
+
// </Form.Item>
|
|
265
|
+
// ) : (
|
|
266
|
+
// <div
|
|
267
|
+
// className="editable-cell-value-wrap"
|
|
268
|
+
// // style={{paddingRight: 24}}
|
|
269
|
+
// onClick={toggleEdit}
|
|
270
|
+
// >
|
|
271
|
+
// {children}
|
|
272
|
+
// </div>
|
|
273
|
+
// );
|
|
274
|
+
// // return (
|
|
275
|
+
// // <Form.Item
|
|
276
|
+
// // style={{margin: 0}}
|
|
277
|
+
// // rules={rules}
|
|
278
|
+
// // name={dataIndex}
|
|
279
|
+
// // initialValue={record[dataIndex]}
|
|
280
|
+
// // >
|
|
281
|
+
// // {inputNode}
|
|
282
|
+
// // </Form.Item>
|
|
283
|
+
// // )
|
|
284
|
+
// };
|
|
285
|
+
//
|
|
286
|
+
// return (
|
|
287
|
+
// <td {...restProps}>
|
|
288
|
+
// {editable ? (
|
|
289
|
+
// <EditableContext.Consumer>{renderCell}</EditableContext.Consumer>
|
|
290
|
+
// ) : (
|
|
291
|
+
// children
|
|
292
|
+
// )}
|
|
293
|
+
// </td>
|
|
294
|
+
// );
|
|
295
|
+
// };
|
|
296
|
+
// const EditableCellIntl = injectIntl(EditableCell);
|
|
297
|
+
// export default EditableCellIntl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { FormInstance } from "antd/lib/form";
|
|
3
|
-
export declare const EditableContext: React.Context<FormInstance
|
|
3
|
+
export declare const EditableContext: React.Context<FormInstance<any>>;
|
|
4
4
|
declare const EditableRow: ({ index, ...props }: any) => JSX.Element;
|
|
5
5
|
export default EditableRow;
|
|
@@ -22,7 +22,7 @@ interface Props extends InjectedIntlProps, FormItemProps {
|
|
|
22
22
|
onlyLabelOnFirstInList?: boolean;
|
|
23
23
|
index?: number;
|
|
24
24
|
}
|
|
25
|
-
declare const _default: React.ComponentClass<Pick<Props, "normalize" | "required" | "label" | "style" | "help" | "children" | "name" | "validateTrigger" | "
|
|
25
|
+
declare const _default: React.ComponentClass<Pick<Props, "normalize" | "required" | "hidden" | "label" | "style" | "preserve" | "help" | "tooltip" | "children" | "name" | "validateTrigger" | "className" | "prefixCls" | "id" | "trigger" | "onReset" | "status" | "dependencies" | "getValueFromEvent" | "rules" | "shouldUpdate" | "validateFirst" | "valuePropName" | "getValueProps" | "messageVariables" | "initialValue" | "isListField" | "isList" | "extra" | "colon" | "htmlFor" | "index" | "fieldName" | "noStyle" | "hasFeedback" | "validateStatus" | "fieldKey" | "labelAlign" | "labelCol" | "requiredMark" | "wrapperCol" | "receiverRequirements" | "receiverRequirementsKey" | "defaultLabel" | "defaultLabelTooltip" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList">, any> & {
|
|
26
26
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
27
27
|
};
|
|
28
28
|
export default _default;
|
|
@@ -4,7 +4,5 @@ export { default as BillingLines } from "./billing-lines";
|
|
|
4
4
|
export { default as ComponentContainer } from "./component-container";
|
|
5
5
|
export { default as Customer } from "./customer";
|
|
6
6
|
export { default as DeliveryLocation } from "./delivery-location";
|
|
7
|
-
export { default as EditableCell } from "./editable-cell";
|
|
8
|
-
export { default as EditableRow } from "./editable-row";
|
|
9
7
|
export { default as PaymentMethod } from "./payment-method";
|
|
10
8
|
export { default as Supplier } from "./supplier";
|
|
@@ -12,10 +12,8 @@ var customer_1 = require("./customer");
|
|
|
12
12
|
exports.Customer = customer_1.default;
|
|
13
13
|
var delivery_location_1 = require("./delivery-location");
|
|
14
14
|
exports.DeliveryLocation = delivery_location_1.default;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var editable_row_1 = require("./editable-row");
|
|
18
|
-
exports.EditableRow = editable_row_1.default;
|
|
15
|
+
// export {default as EditableCell} from "./editable-cell";
|
|
16
|
+
// export {default as EditableRow} from "./editable-row";
|
|
19
17
|
var payment_method_1 = require("./payment-method");
|
|
20
18
|
exports.PaymentMethod = payment_method_1.default;
|
|
21
19
|
var supplier_1 = require("./supplier");
|
|
@@ -3,7 +3,7 @@ import { FormInstance } from "antd/es/form";
|
|
|
3
3
|
import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { InjectedIntl } from "react-intl";
|
|
6
|
-
export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
|
|
6
|
+
export declare const billingLinesFieldsMetadata: (formInstance: FormInstance<any>) => BillingLineMetadata[];
|
|
7
7
|
export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
|
|
8
8
|
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
9
9
|
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum | undefined) => number;
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var antd_1 = require("antd");
|
|
20
|
-
var
|
|
20
|
+
var CommonTranslations_1 = require("../common/components/CommonTranslations");
|
|
21
21
|
exports.billingLinesFieldsMetadata = function (formInstance) {
|
|
22
22
|
var billingLinesMetadata = formInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
23
23
|
return billingLinesMetadata.map(function (billingLine) {
|
|
@@ -81,7 +81,7 @@ exports.getCorrectInputNode = function (dataIdx, intl) {
|
|
|
81
81
|
case "unitOfMeasure":
|
|
82
82
|
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
|
|
83
83
|
if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|
|
84
|
-
return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, intl.formatMessage(
|
|
84
|
+
return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, intl.formatMessage(CommonTranslations_1.commonTranslationMessages["unitOfMeasure_labels_" + unitOfMeasure])));
|
|
85
85
|
})));
|
|
86
86
|
case "taxCategoryType":
|
|
87
87
|
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(api_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
@@ -10,6 +10,6 @@ export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewRec
|
|
|
10
10
|
export declare const getFieldIsRequired: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
|
|
11
11
|
export interface FormItemPropsWithoutChildren extends Omit<FormItemProps, "children"> {
|
|
12
12
|
}
|
|
13
|
-
export declare const handleValueValidation: ((isoNumber: string, fieldName: string, value: string, rapiBaseUrl: string, namePath: string | number | (string | number)[], setValidationStatus: (validationStatus: "" | "error" | "success" | "validating" | "warning") => void, formInstance: FormInstance
|
|
13
|
+
export declare const handleValueValidation: ((isoNumber: string, fieldName: string, value: string, rapiBaseUrl: string, namePath: string | number | (string | number)[], setValidationStatus: (validationStatus: "" | "error" | "success" | "validating" | "warning") => void, formInstance: FormInstance<any>, callName: string) => void) & import("lodash").Cancelable;
|
|
14
14
|
export declare const debouncedHandleSearchValues: ((searchValue: string, fieldDefinition: FieldDefinition, setLoadingValues: (loadingValues: boolean) => void, loadingValues: boolean, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void, callName: string, rapiBaseUrl: string, overwrittenFieldDefinitionKey?: string | undefined) => void) & import("lodash").Cancelable;
|
|
15
|
-
export declare const getInput: (fieldDefinition: FieldDefinition, namePath: string | number | (string | number)[], validationCallName: string, legalIdentifier: string, formInstance: FormInstance
|
|
15
|
+
export declare const getInput: (fieldDefinition: FieldDefinition, namePath: string | number | (string | number)[], validationCallName: string, legalIdentifier: string, formInstance: FormInstance<any>, rapiBaseUrl: string, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void, setAccountingCostFieldProps: (accountingCostFiledProps: FormItemPropsWithoutChildren) => void, accountingCostFieldProps: FormItemPropsWithoutChildren, setLoadingAccountingCostValues: (loadingAccountingCostValues: boolean) => void, loadingAccountingCostValues: boolean, setHandlingValidationStatus: (handlingValidationStatus: "" | "error" | "success" | "validating" | "warning") => void) => React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unimaze/billing",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/react-dom": "16.9.7",
|
|
25
25
|
"@types/react-intl": "2.3.18",
|
|
26
26
|
"@types/uuid": "latest",
|
|
27
|
-
"antd": "4.
|
|
27
|
+
"antd": "4.9.4",
|
|
28
28
|
"awesome-typescript-loader": "^5.2.1",
|
|
29
29
|
"axios": "0.19.2",
|
|
30
30
|
"babel-loader": "^8.1.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"webpack-dev-server": "^3.10.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"antd": "4.
|
|
54
|
+
"antd": "4.9.4",
|
|
55
55
|
"axios": "^0.19.2",
|
|
56
56
|
"react": "16.13.1",
|
|
57
57
|
"react-dom": "16.13.1"
|