@unimaze/billing 0.20.17 → 0.21.1

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.
Files changed (115) hide show
  1. package/README.md +2 -2
  2. package/lib/common/components/CommonTranslations.d.ts +102 -2
  3. package/lib/common/components/CommonTranslations.js +10 -1
  4. package/lib/common/components/attachments/Attachment.d.ts +6 -4
  5. package/lib/common/components/attachments/Attachment.js +26 -10
  6. package/lib/common/components/attachments/AttachmentModal.d.ts +21 -0
  7. package/lib/common/components/attachments/AttachmentModal.js +203 -0
  8. package/lib/common/components/attachments/index.d.ts +13 -17
  9. package/lib/common/components/attachments/index.js +189 -23
  10. package/lib/common/components/base-information/AccountingCost.d.ts +7 -5
  11. package/lib/common/components/base-information/AccountingCost.js +32 -11
  12. package/lib/common/components/base-information/OrderReference.d.ts +6 -4
  13. package/lib/common/components/base-information/OrderReference.js +31 -14
  14. package/lib/common/components/base-information/ProjectReference.d.ts +9 -5
  15. package/lib/common/components/base-information/ProjectReference.js +8 -6
  16. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +32 -5
  17. package/lib/common/components/base-information/ReferenceIdentifiers.js +126 -83
  18. package/lib/common/components/base-information/index.d.ts +51 -5
  19. package/lib/common/components/base-information/index.js +99 -154
  20. package/lib/common/components/billing-lines/BillingCalculations.d.ts +7 -5
  21. package/lib/common/components/billing-lines/BillingCalculations.js +79 -46
  22. package/lib/common/components/billing-lines/BillingLinePreview.d.ts +21 -0
  23. package/lib/common/components/billing-lines/BillingLinePreview.js +41 -0
  24. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +6 -4
  25. package/lib/common/components/billing-lines/BillingTaxSummary.js +39 -13
  26. package/lib/common/components/billing-lines/NewBillingLines.d.ts +120 -4
  27. package/lib/common/components/billing-lines/NewBillingLines.js +396 -72
  28. package/lib/common/components/billing-lines/index.d.ts +33 -6
  29. package/lib/common/components/billing-lines/index.js +71 -244
  30. package/lib/common/components/component-container/Content.d.ts +2 -2
  31. package/lib/common/components/component-container/index.d.ts +1 -0
  32. package/lib/common/components/component-container/index.js +1 -1
  33. package/lib/common/components/customer/CostCenter.d.ts +6 -4
  34. package/lib/common/components/customer/CostCenter.js +25 -9
  35. package/lib/common/components/customer/CustomerContactName.d.ts +6 -4
  36. package/lib/common/components/customer/CustomerContactName.js +24 -8
  37. package/lib/common/components/customer/hardCoddedCustomer.js +19 -3
  38. package/lib/common/components/customer/index.d.ts +11 -5
  39. package/lib/common/components/customer/index.js +97 -42
  40. package/lib/common/components/date-picker/index.d.ts +21 -0
  41. package/lib/common/components/date-picker/index.js +23 -0
  42. package/lib/common/components/delivery-location/index.d.ts +6 -4
  43. package/lib/common/components/delivery-location/index.js +20 -4
  44. package/lib/common/components/editable-cell/index.js +2 -2
  45. package/lib/common/components/editable-row/index.d.ts +1 -1
  46. package/lib/common/components/editable-row/index.js +24 -7
  47. package/lib/common/components/form-item/index.d.ts +13 -6
  48. package/lib/common/components/form-item/index.js +16 -20
  49. package/lib/common/components/index.d.ts +10 -0
  50. package/lib/common/components/index.js +30 -8
  51. package/lib/common/components/input/index.d.ts +23 -0
  52. package/lib/common/components/input/index.js +37 -0
  53. package/lib/common/components/invoice/index.d.ts +40 -0
  54. package/lib/common/components/invoice/index.js +52 -0
  55. package/lib/common/components/invoice-preview/InvoicePreviewHeader.d.ts +12 -0
  56. package/lib/common/components/invoice-preview/InvoicePreviewHeader.js +105 -0
  57. package/lib/common/components/invoice-preview/index.d.ts +16 -0
  58. package/lib/common/components/invoice-preview/index.js +393 -0
  59. package/lib/common/components/locale-intl/index.d.ts +0 -10
  60. package/lib/common/components/locale-intl/index.js +50 -42
  61. package/lib/common/components/payment-method/index.d.ts +69 -6
  62. package/lib/common/components/payment-method/index.js +145 -57
  63. package/lib/common/components/payment-method/paymentMethodForConversion.js +3 -1
  64. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.d.ts +3 -0
  65. package/lib/common/components/submit-confirmation/SubmitConfirmationSVG.js +17 -0
  66. package/lib/common/components/submit-confirmation/index.d.ts +8 -0
  67. package/lib/common/components/submit-confirmation/index.js +34 -0
  68. package/lib/common/components/supplier/CityAutofill.d.ts +18 -0
  69. package/lib/common/components/supplier/CityAutofill.js +159 -0
  70. package/lib/common/components/supplier/index.d.ts +83 -5
  71. package/lib/common/components/supplier/index.js +200 -104
  72. package/lib/common/components/tooltip/index.d.ts +7 -0
  73. package/lib/common/components/tooltip/index.js +15 -0
  74. package/lib/common/components/welcome-modal/index.d.ts +15 -0
  75. package/lib/common/components/welcome-modal/index.js +26 -0
  76. package/lib/common/consts/formLayout.js +4 -3
  77. package/lib/common/consts/validationRules.d.ts +1 -1
  78. package/lib/common/consts/validationRules.js +6 -0
  79. package/lib/common/enums/index.js +5 -1
  80. package/lib/common/style/index.css +18 -0
  81. package/lib/common/types/BillingLineMetadataOverride.d.ts +2 -0
  82. package/lib/common/types/CommonProps.d.ts +15 -1
  83. package/lib/common/types/DiscountType.d.ts +1 -0
  84. package/lib/common/types/DiscountType.js +2 -0
  85. package/lib/common/types/ReceiverRequirements.d.ts +1 -1
  86. package/lib/common/types/ReceiverRequirements.js +1 -0
  87. package/lib/common/types/index.js +15 -0
  88. package/lib/create-invoice/IntlLoader.d.ts +0 -6
  89. package/lib/create-invoice/IntlLoader.js +78 -13
  90. package/lib/create-invoice/index.d.ts +65 -4
  91. package/lib/create-invoice/index.js +437 -181
  92. package/lib/enums.d.ts +2 -3
  93. package/lib/enums.js +1 -0
  94. package/lib/index.js +22 -6
  95. package/lib/translations/locales/en.json +182 -0
  96. package/lib/translations/locales/is.json +136 -116
  97. package/lib/translations/locales.d.ts +362 -161
  98. package/lib/translations/locales.js +3 -2
  99. package/lib/utils/ApiUtility.d.ts +4 -4
  100. package/lib/utils/ApiUtility.js +13 -10
  101. package/lib/utils/BillingLineUtility.d.ts +16 -5
  102. package/lib/utils/BillingLineUtility.js +65 -26
  103. package/lib/utils/ConversionUtility.js +15 -7
  104. package/lib/utils/FileUploadUtility.d.ts +4 -2
  105. package/lib/utils/FileUploadUtility.js +28 -9
  106. package/lib/utils/IntlUtility.d.ts +3 -2
  107. package/lib/utils/IntlUtility.js +2 -1
  108. package/lib/utils/LocationUtility.d.ts +1 -0
  109. package/lib/utils/LocationUtility.js +81 -0
  110. package/lib/utils/ReferenceIdentifierUtility.js +2 -1
  111. package/lib/utils/RequirementsUtility.d.ts +9 -7
  112. package/lib/utils/RequirementsUtility.js +46 -22
  113. package/lib/utils/index.js +4 -3
  114. package/package.json +36 -18
  115. package/lib/style/index.css +0 -51
@@ -10,11 +10,80 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
73
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
74
+ if (ar || !(i in from)) {
75
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
76
+ ar[i] = from[i];
77
+ }
78
+ }
79
+ return to.concat(ar || Array.prototype.slice.call(from));
80
+ };
13
81
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
82
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
83
  };
16
84
  Object.defineProperty(exports, "__esModule", { value: true });
17
- var react_1 = __importDefault(require("react"));
85
+ exports.translationMessages = void 0;
86
+ var react_1 = __importStar(require("react"));
18
87
  var react_intl_1 = require("react-intl");
19
88
  var antd_1 = require("antd");
20
89
  var formLayout_1 = require("../../consts/formLayout");
@@ -25,7 +94,14 @@ var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
25
94
  var CommonTranslations_1 = require("../CommonTranslations");
26
95
  var IntlUtility_1 = require("../../../utils/IntlUtility");
27
96
  var enums_1 = require("../../../enums");
28
- var translationMessages = react_intl_1.defineMessages({
97
+ var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
98
+ var Form_1 = require("antd/es/form/Form");
99
+ var react_use_1 = require("react-use");
100
+ var lodash_1 = require("lodash");
101
+ var BillingLinePreview_1 = __importDefault(require("./BillingLinePreview"));
102
+ var tooltip_1 = __importDefault(require("../tooltip"));
103
+ var api_1 = require("@unimaze/api-clients/lib/mapi/api");
104
+ exports.translationMessages = (0, react_intl_1.defineMessages)({
29
105
  billingLines_labels_addButton: {
30
106
  id: "billingLines_labels_addButton",
31
107
  defaultMessage: "Add new line",
@@ -36,50 +112,201 @@ var translationMessages = react_intl_1.defineMessages({
36
112
  },
37
113
  billingLines_name: {
38
114
  id: "billingLines_name",
39
- defaultMessage: "Name"
115
+ defaultMessage: "Name",
40
116
  },
41
117
  billingLines_quantity: {
42
118
  id: "billingLines_quantity",
43
- defaultMessage: "Quantity"
119
+ defaultMessage: "Quantity",
44
120
  },
45
121
  billingLines_unitOfMeasure: {
46
122
  id: "billingLines_unitOfMeasure",
47
- defaultMessage: "Unit of measure"
123
+ defaultMessage: "Unit of measure",
48
124
  },
49
125
  billingLines_unitPriceAmount: {
50
126
  id: "billingLines_unitPriceAmount",
51
- defaultMessage: "Unit price"
127
+ defaultMessage: "Unit price",
52
128
  },
53
129
  billingLines_taxCategoryType: {
54
130
  id: "billingLines_taxCategoryType",
55
- defaultMessage: "Tax category"
131
+ defaultMessage: "Tax category",
56
132
  },
57
133
  billingLines_taxCategoryType_title: {
58
134
  id: "billingLines_taxCategoryType_title",
59
- 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
135
+ 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
60
136
  },
61
137
  billingLines_taxCategoryPercentage: {
62
138
  id: "billingLines_taxCategoryPercentage",
63
- defaultMessage: "Tax percentage"
139
+ defaultMessage: "Tax percentage",
64
140
  },
65
141
  billingLines_discount: {
66
142
  id: "billingLines_discount",
67
- defaultMessage: "Discount"
143
+ defaultMessage: "Discount",
68
144
  },
69
145
  billingLines_discount_helpText: {
70
146
  id: "billingLines_discount_helpText",
71
- defaultMessage: "Discount can be represented as an amount or a percentage indicated with a percentage sign (%)"
147
+ defaultMessage: "Discount can be represented as an amount or a percentage indicated with a percentage sign (%)",
72
148
  },
73
149
  billingLines_lineAmount: {
74
150
  id: "billingLines_lineAmount",
75
- defaultMessage: "Amount"
151
+ defaultMessage: "Amount",
76
152
  },
77
153
  billingLines_taxAmount: {
78
154
  id: "billingLines_taxAmount",
79
- defaultMessage: "Tax inclusive amount"
155
+ defaultMessage: "Tax inclusive amount",
156
+ },
157
+ billingLines_currencyCode: {
158
+ id: "billingLines_currencyCode",
159
+ defaultMessage: "Currency",
160
+ },
161
+ billingLines_currency_ISK: {
162
+ id: "billingLines_currency_ISK",
163
+ defaultMessage: "Icelandic krona (ISK)",
164
+ },
165
+ billingLines_currency_ISK_short: {
166
+ id: "billingLines_currency_ISK_short",
167
+ defaultMessage: "ISK",
168
+ },
169
+ billingLines_currency_DKK: {
170
+ id: "billingLines_currency_DKK",
171
+ defaultMessage: "Danish krona (DKK)",
172
+ },
173
+ billingLines_currency_DKK_short: {
174
+ id: "billingLines_currency_DKK_short",
175
+ defaultMessage: "DKK",
176
+ },
177
+ billingLines_currency_NOK: {
178
+ id: "billingLines_currency_NOK",
179
+ defaultMessage: "Norwegian krona (NOK)",
180
+ },
181
+ billingLines_currency_NOK_short: {
182
+ id: "billingLines_currency_NOK_short",
183
+ defaultMessage: "NOK",
184
+ },
185
+ billingLines_currency_SEK: {
186
+ id: "billingLines_currency_SEK",
187
+ defaultMessage: "Swedish krona (SEK)",
188
+ },
189
+ billingLines_currency_SEK_short: {
190
+ id: "billingLines_currency_SEK_short",
191
+ defaultMessage: "SEK",
192
+ },
193
+ billingLines_currency_EUR: {
194
+ id: "billingLines_currency_EUR",
195
+ defaultMessage: "Euro (EUR)",
196
+ },
197
+ billingLines_currency_EUR_short: {
198
+ id: "billingLines_currency_EUR_short",
199
+ defaultMessage: "EUR",
200
+ },
201
+ billingLines_currency_USD: {
202
+ id: "billingLines_currency_USD",
203
+ defaultMessage: "US dollar (USD)",
204
+ },
205
+ billingLines_currency_USD_short: {
206
+ id: "billingLines_currency_USD_short",
207
+ defaultMessage: "USD",
208
+ },
209
+ billingLines_currency_GBP: {
210
+ id: "billingLines_currency_GBP",
211
+ defaultMessage: "British pound (GBP)",
212
+ },
213
+ billingLines_currency_GBP_short: {
214
+ id: "billingLines_currency_GBP_short",
215
+ defaultMessage: "GBP",
80
216
  },
81
217
  });
82
218
  var BillingLines = function (props) {
219
+ var _a = react_1.default.useState(), taxCatType = _a[0], setTaxCatType = _a[1];
220
+ var _b = react_1.default.useState([]), billingLineData = _b[0], setBillingLineData = _b[1];
221
+ var _c = react_1.default.useState(true), isSaveButtonDisabled = _c[0], setIsSaveButtonDisabled = _c[1];
222
+ var _d = react_1.default.useState(false), isCurrencyDisabled = _d[0], setIsCurrencyDisabled = _d[1];
223
+ var _e = react_1.default.useState("PERCENTAGE"), discountType = _e[0], setDiscountType = _e[1];
224
+ var _f = (0, react_1.useState)(undefined), addNewLinesTooltip = _f[0], setAddNewLinesTooltip = _f[1];
225
+ var width = (0, react_use_1.useWindowSize)().width;
226
+ var _g = react_1.default.useState(false), isMobile = _g[0], setIsMobile = _g[1];
227
+ (0, react_1.useEffect)(function () {
228
+ if (props.outsideVatScope) {
229
+ setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope);
230
+ }
231
+ else {
232
+ setTaxCatType(enums_1.AvailableTaxCategoryTypeEnum.StandardRated);
233
+ }
234
+ }, [props.outsideVatScope]);
235
+ (0, react_1.useEffect)(function () {
236
+ if (width < 768) {
237
+ setIsMobile(true);
238
+ }
239
+ else {
240
+ setIsMobile(false);
241
+ }
242
+ }, [width]);
243
+ var invoiceLines = (0, Form_1.useWatch)(["invoice", "invoiceLines"], props.formInstance);
244
+ var validateFormListFields = function () { return __awaiter(void 0, void 0, void 0, function () {
245
+ var fieldPaths;
246
+ return __generator(this, function (_a) {
247
+ switch (_a.label) {
248
+ case 0:
249
+ if (!invoiceLines)
250
+ return [2 /*return*/];
251
+ fieldPaths = invoiceLines
252
+ .map(function (_, index) { return [
253
+ ["invoice", "invoiceLines", index, "itemNo"],
254
+ ["invoice", "invoiceLines", index, "name"],
255
+ ["invoice", "invoiceLines", index, "quantity"],
256
+ ["invoice", "invoiceLines", index, "unitPriceAmount"],
257
+ ["invoice", "invoiceLines", index, "taxableAmount"],
258
+ ["invoice", "invoiceLines", index, "taxCategoryType"],
259
+ ["invoice", "invoiceLines", index, "discountValue"],
260
+ ["invoice", "invoiceLines", index, "unitOfMeasure", "unit"],
261
+ ]; })
262
+ .flat();
263
+ return [4 /*yield*/, props.formInstance.validateFields(fieldPaths, { validateOnly: true })
264
+ .then(function () {
265
+ setIsSaveButtonDisabled(false);
266
+ setAddNewLinesTooltip(undefined);
267
+ })
268
+ .catch(function (error) {
269
+ var _a;
270
+ var requiredFields = [];
271
+ (_a = error.errorFields) === null || _a === void 0 ? void 0 : _a.map(function (errorField) {
272
+ requiredFields.push(errorField.name[errorField.name.length - 1]);
273
+ });
274
+ if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.length) > 0)
275
+ setAddNewLinesTooltip((0, RequirementsUtility_1.getRequiredTooltipMessage)(props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages.missingRequiredData), getFieldNames(requiredFields)));
276
+ setIsSaveButtonDisabled(true);
277
+ })];
278
+ case 1:
279
+ _a.sent();
280
+ return [2 /*return*/];
281
+ }
282
+ });
283
+ }); };
284
+ var debouncedValidateFormListFields = react_1.default.useCallback((0, lodash_1.debounce)(validateFormListFields, 500), [invoiceLines]);
285
+ (0, react_1.useEffect)(function () {
286
+ debouncedValidateFormListFields();
287
+ }, [invoiceLines, props.formInstance.getFieldValue(["invoice", "currencyCode"])]);
288
+ (0, react_1.useEffect)(function () {
289
+ if (billingLineData.length >= 1) {
290
+ setIsCurrencyDisabled(true);
291
+ }
292
+ else {
293
+ setIsCurrencyDisabled(false);
294
+ }
295
+ }, [billingLineData]);
296
+ var getFieldNames = function (keys) {
297
+ return keys === null || keys === void 0 ? void 0 : keys.map(function (key) {
298
+ switch (key) {
299
+ case "name":
300
+ return props.intl.formatMessage(exports.translationMessages.billingLines_name);
301
+ case "quantity":
302
+ return props.intl.formatMessage(exports.translationMessages.billingLines_quantity);
303
+ case "unitPriceAmount":
304
+ return props.intl.formatMessage(exports.translationMessages.billingLines_unitPriceAmount);
305
+ default:
306
+ return "";
307
+ }
308
+ });
309
+ };
83
310
  var getTaxCategoryDisabled = function (taxCategoryType, outsideVatScope) {
84
311
  switch (taxCategoryType) {
85
312
  case enums_1.AvailableTaxCategoryTypeEnum.StandardRated:
@@ -93,79 +320,176 @@ var BillingLines = function (props) {
93
320
  return true;
94
321
  }
95
322
  };
323
+ var getCurrencies = function (recRequirements) {
324
+ var currencies = [
325
+ {
326
+ key: "ISK",
327
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_ISK),
328
+ },
329
+ {
330
+ key: "DKK",
331
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_DKK),
332
+ },
333
+ {
334
+ key: "NOK",
335
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_NOK),
336
+ },
337
+ {
338
+ key: "SEK",
339
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_SEK),
340
+ },
341
+ {
342
+ key: "EUR",
343
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_EUR),
344
+ },
345
+ {
346
+ key: "USD",
347
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_USD),
348
+ },
349
+ {
350
+ key: "GBP",
351
+ name: props.intl.formatMessage(exports.translationMessages.billingLines_currency_GBP),
352
+ },
353
+ ];
354
+ var currencyCodeRequirements = (0, RequirementsUtility_1.getFieldRequirements)(recRequirements, ReceiverRequirements_1.AvailableFields.currencyCode);
355
+ if (currencyCodeRequirements &&
356
+ currencyCodeRequirements.properties &&
357
+ currencyCodeRequirements.properties.values &&
358
+ currencyCodeRequirements.properties.values.length > 0) {
359
+ return currencyCodeRequirements.properties.values;
360
+ }
361
+ else {
362
+ return currencies;
363
+ }
364
+ };
365
+ (0, react_1.useEffect)(function () {
366
+ if (!props.formInstance.getFieldValue(["invoice", "currencyCode"])) {
367
+ props.formInstance.setFieldsValue({
368
+ invoice: { currencyCode: getCurrencies(props.receiverRequirements)[0].key },
369
+ });
370
+ }
371
+ }, []);
96
372
  return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "invoiceLines"] }, function (fields, _a) {
97
373
  var add = _a.add, remove = _a.remove;
98
- return (react_1.default.createElement(react_1.default.Fragment, null,
374
+ return (react_1.default.createElement(antd_1.Flex, { vertical: true },
99
375
  fields.map(function (field, index) {
100
- var taxCatType = null;
376
+ var _a;
377
+ var removeBillingLine = function (id) {
378
+ remove(index);
379
+ var newBillingLines = billingLineData.filter(function (lineData) { return lineData.key !== id; });
380
+ setBillingLineData(newBillingLines);
381
+ };
382
+ var addBillingLine = function () {
383
+ var fieldValues = props.formInstance.getFieldsValue(["invoice", "invoiceLines"]);
384
+ if (fieldValues &&
385
+ fieldValues.invoice &&
386
+ fieldValues.invoice.invoiceLines &&
387
+ fieldValues.invoice.invoiceLines[field.name]) {
388
+ var _a = fieldValues.invoice.invoiceLines[field.name], name_1 = _a.name, taxableAmount = _a.taxableAmount, quantity = _a.quantity, unitOfMeasure = _a.unitOfMeasure, unitPriceAmount = _a.unitPriceAmount, taxCategoryType = _a.taxCategoryType, discountValue = _a.discountValue, _discountType = _a.discountType, currencyCode = _a.currencyCode;
389
+ var unit = unitOfMeasure.unit;
390
+ var billingLineId_1 = "billingLine-".concat(name_1, "-").concat(field.name);
391
+ var newBillingLineData = {
392
+ key: billingLineId_1,
393
+ name: name_1,
394
+ taxableAmount: taxableAmount,
395
+ quantity: quantity,
396
+ unit: unit,
397
+ unitPriceAmount: unitPriceAmount,
398
+ taxCategoryType: taxCategoryType,
399
+ discountValue: discountValue,
400
+ discountType: _discountType,
401
+ currencyCode: currencyCode,
402
+ onDelete: function () {
403
+ removeBillingLine(billingLineId_1);
404
+ },
405
+ };
406
+ setBillingLineData(__spreadArray(__spreadArray([], billingLineData, true), [newBillingLineData], false));
407
+ add();
408
+ }
409
+ };
101
410
  var getTaxableAmount = function () {
102
- var fieldValues = props.formInstance.getFieldsValue([["invoice", "invoiceLines", field.name]]);
103
- if (fieldValues && fieldValues.invoice && fieldValues.invoice.invoiceLines && fieldValues.invoice.invoiceLines[field.name]) {
411
+ var fieldValues = props.formInstance.getFieldsValue([
412
+ ["invoice", "invoiceLines", field.name],
413
+ ]);
414
+ if (fieldValues &&
415
+ fieldValues.invoice &&
416
+ fieldValues.invoice.invoiceLines &&
417
+ fieldValues.invoice.invoiceLines[field.name]) {
104
418
  var _a = fieldValues.invoice.invoiceLines[field.name], discountValue = _a.discountValue, quantity = _a.quantity, unitPriceAmount = _a.unitPriceAmount;
105
- var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(discountValue, quantity, unitPriceAmount);
419
+ var taxableAmount = (0, BillingLineUtility_1.calculateTaxableAmount)(discountValue, quantity, unitPriceAmount, discountType);
106
420
  props.formInstance.setFields([
107
421
  {
108
422
  name: ["invoice", "invoiceLines", field.name, "taxableAmount"],
109
- value: taxableAmount
110
- }
423
+ value: taxableAmount,
424
+ },
111
425
  ]);
112
426
  return taxableAmount;
113
427
  }
114
428
  return 0;
115
429
  };
116
- var getTaxInclusiveAmount = function () {
117
- var fieldValues = props.formInstance.getFieldsValue([["invoice", "invoiceLines", field.name]]);
118
- if (fieldValues && fieldValues.invoice && fieldValues.invoice.invoiceLines && fieldValues.invoice.invoiceLines[field.name]) {
119
- var _a = fieldValues.invoice.invoiceLines[field.name], taxCategoryType = _a.taxCategoryType, taxableAmount = _a.taxableAmount;
120
- var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(taxCategoryType);
121
- return taxableAmount + BillingLineUtility_1.calculateTaxAmount(taxableAmount, taxPercentage);
122
- }
123
- return 0;
124
- };
125
- return (react_1.default.createElement(antd_1.Row, { gutter: [8, 0], justify: "space-between", align: "bottom", key: index.toString() },
126
- react_1.default.createElement(antd_1.Col, { span: 2 },
127
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.itemNo"], defaultIsRequired: false, fieldName: [field.name, "itemNo"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_itemNo), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("itemNo", props.intl))),
128
- react_1.default.createElement(antd_1.Col, { span: 3 },
129
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.name"], defaultIsRequired: true, fieldName: [field.name, "name"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_name), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("name", props.intl))),
130
- react_1.default.createElement(antd_1.Col, { span: 2 },
131
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], defaultIsRequired: true, fieldName: [field.name, "quantity"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_quantity), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("quantity", props.intl))),
132
- react_1.default.createElement(antd_1.Col, { span: 3 },
133
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], defaultIsRequired: true, fieldName: [field.name, "unitOfMeasure", "unit"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("unitOfMeasure", props.intl))),
134
- react_1.default.createElement(antd_1.Col, { span: 2 },
135
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], defaultIsRequired: true, fieldName: [field.name, "unitPriceAmount"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_unitPriceAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("unitPriceAmount", props.intl))),
136
- react_1.default.createElement(antd_1.Col, { span: 3 },
137
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxCategoryType"], defaultIsRequired: true, fieldName: [field.name, "taxCategoryType"], initialValue: enums_1.AvailableTaxCategoryTypeEnum.OutsideTaxScope, defaultLabel: react_1.default.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.billingLines_taxCategoryType_title), placement: "right" },
138
- react_1.default.createElement("span", null,
139
- props.intl.formatMessage(translationMessages.billingLines_taxCategoryType),
140
- "\u00A0",
141
- react_1.default.createElement(icons_1.QuestionCircleOutlined, null))), verticalLabels: true, onlyLabelOnFirstInList: true, index: index },
142
- react_1.default.createElement(antd_1.Select, { onChange: function (value) {
143
- taxCatType = value;
144
- }, dropdownMatchSelectWidth: false }, Object.keys(enums_1.AvailableTaxCategoryTypeEnum).map(function (taxCategoryType) {
145
- var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(enums_1.AvailableTaxCategoryTypeEnum[taxCategoryType]);
146
- return (react_1.default.createElement(antd_1.Select.Option, { disabled: getTaxCategoryDisabled(enums_1.AvailableTaxCategoryTypeEnum[taxCategoryType], props.outsideVatScope), value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages["taxCategoryType_labels_" + taxCategoryType]) + " (" + taxPercentage + "%)"));
147
- })))),
148
- react_1.default.createElement(antd_1.Col, { span: 2 },
149
- 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))),
150
- react_1.default.createElement(antd_1.Col, { span: 2 },
151
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxableAmount"], defaultIsRequired: false, fieldName: [field.name, "taxableAmount"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_lineAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(getTaxableAmount(), props.intl))),
152
- react_1.default.createElement(antd_1.Col, { span: 3 },
153
- react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxAmount"], defaultIsRequired: false, fieldName: [field.name, "taxAmount"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_taxAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome(getTaxInclusiveAmount(), props.intl))),
154
- props.formInstance.getFieldValue(["invoice", "invoiceLines"]).length > 1
155
- ? react_1.default.createElement(antd_1.Col, { span: 1 },
156
- react_1.default.createElement(icons_1.MinusCircleOutlined, { style: { marginBottom: "22px" }, onClick: function () {
157
- remove(field.name);
158
- } }))
159
- : null));
430
+ var unitOfMeasureSelector = (react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], defaultIsRequired: true, fieldName: [field.name, "unitOfMeasure", "unit"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_unitOfMeasure), verticalLabels: true, onlyLabelOnFirstInList: true, style: { marginBottom: "-2px" }, initialValue: api_1.Units.One }, (0, BillingLineUtility_1.getCorrectInputNode)("unitOfMeasure", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_unitOfMeasure), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], true), undefined, isMobile)));
431
+ var currencySelector = (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_currencyCode), defaultIsRequired: true, fieldName: [field.name, "currencyCode"], initialValue: (_a = props.formInstance.getFieldValue(["invoice", "currencyCode"])) !== null && _a !== void 0 ? _a : getCurrencies(props.receiverRequirements)[0].key, style: { marginBottom: "-2px" } },
432
+ react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, style: { width: isMobile ? 64 : "auto" }, placeholder: props.intl.formatMessage(exports.translationMessages.billingLines_currencyCode), onSelect: function (value) {
433
+ props.formInstance.setFieldsValue({ invoice: { currencyCode: value } });
434
+ }, disabled: isCurrencyDisabled }, getCurrencies(props.receiverRequirements).map(function (currency) {
435
+ return (react_1.default.createElement(antd_1.Select.Option, { value: currency.key, title: currency.name, key: currency.key }, currency.name));
436
+ }))));
437
+ var discountTypeSelector = (react_1.default.createElement(antd_1.Form.Item, { name: [field.name, "discountType"], initialValue: discountType, style: { marginBottom: "-2px" } },
438
+ react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, onSelect: function (value) { return setDiscountType(value); }, value: discountType, style: { width: 90 } },
439
+ react_1.default.createElement(antd_1.Select.Option, { value: "AMOUNT" }, props.formInstance.getFieldValue(["invoice", "currencyCode"])),
440
+ react_1.default.createElement(antd_1.Select.Option, { value: "PERCENTAGE" }, "%"))));
441
+ return (react_1.default.createElement(antd_1.Flex, { vertical: true, style: field.name !== fields.length - 1 ? { display: "none" } : {}, key: "invoiceLine-".concat(index) },
442
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.itemNo"], defaultIsRequired: false, fieldName: [field.name, "itemNo"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_itemNo), verticalLabels: true, onlyLabelOnFirstInList: true }, (0, BillingLineUtility_1.getCorrectInputNode)("itemNo", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_itemNo), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.itemNo"], false))),
443
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.name"], defaultIsRequired: true, fieldName: [field.name, "name"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_name), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("name", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_name), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.name"], true))),
444
+ react_1.default.createElement(antd_1.Row, { gutter: 20 },
445
+ react_1.default.createElement(antd_1.Col, { span: 12 },
446
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], defaultIsRequired: true, fieldName: [field.name, "quantity"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_quantity), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("quantity", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_quantity), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], true), unitOfMeasureSelector))),
447
+ react_1.default.createElement(antd_1.Col, { span: 12 },
448
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], defaultIsRequired: true, fieldName: [field.name, "unitPriceAmount"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_unitPriceAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("unitPriceAmount", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_unitPriceAmount), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], true), currencySelector)))),
449
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxableAmount"], defaultIsRequired: false, fieldName: [field.name, "taxableAmount"], defaultLabel: props.intl.formatMessage(exports.translationMessages.billingLines_lineAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index },
450
+ react_1.default.createElement(antd_1.InputNumber, { style: { width: "100%" }, disabled: true, defaultValue: (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(getTaxableAmount(), props.intl) })),
451
+ react_1.default.createElement(antd_1.Row, { gutter: 20 },
452
+ react_1.default.createElement(antd_1.Col, { span: 12 },
453
+ react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxCategoryType"], defaultIsRequired: true, fieldName: [field.name, "taxCategoryType"], name: [field.name, "taxCategoryType"], initialValue: taxCatType, verticalLabels: true, onlyLabelOnFirstInList: true, index: index },
454
+ react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "center" },
455
+ react_1.default.createElement(antd_1.Select, { style: isMobile ? { maxWidth: "80%" } : {}, value: taxCatType, onChange: function (value) {
456
+ var _a;
457
+ setTaxCatType(value);
458
+ props.formInstance.setFieldsValue({
459
+ invoice: {
460
+ invoiceLines: (_a = {},
461
+ _a[index] = {
462
+ taxCategoryType: value,
463
+ },
464
+ _a),
465
+ },
466
+ });
467
+ }, placeholder: (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.taxCategoryType"], true) ? (react_1.default.createElement(react_1.default.Fragment, null,
468
+ react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*"),
469
+ " ",
470
+ props.intl.formatMessage(exports.translationMessages.billingLines_taxCategoryType))) : (props.intl.formatMessage(exports.translationMessages.billingLines_taxCategoryType)), popupMatchSelectWidth: false }, Object.keys(enums_1.AvailableTaxCategoryTypeEnum).map(function (taxCategoryType) {
471
+ var taxPercentage = (0, BillingLineUtility_1.calculateTaxPercentage)(enums_1.AvailableTaxCategoryTypeEnum[taxCategoryType]);
472
+ return (react_1.default.createElement(antd_1.Select.Option, { disabled: getTaxCategoryDisabled(enums_1.AvailableTaxCategoryTypeEnum[taxCategoryType], props.outsideVatScope), value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, "".concat(props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages["taxCategoryType_labels_".concat(taxCategoryType)]), " (").concat(taxPercentage, "%)")));
473
+ })),
474
+ " ",
475
+ react_1.default.createElement(tooltip_1.default, { title: props.intl.formatMessage(exports.translationMessages.billingLines_taxCategoryType_title) })))),
476
+ react_1.default.createElement(antd_1.Col, { span: 12 },
477
+ 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(exports.translationMessages.billingLines_discount), verticalLabels: true, onlyLabelOnFirstInList: true, defaultLabelTooltip: props.intl.formatMessage(exports.translationMessages.billingLines_discount_helpText), index: index },
478
+ react_1.default.createElement(antd_1.Flex, { gap: "middle", align: "center" },
479
+ (0, BillingLineUtility_1.getCorrectInputNode)("discountValue", props.intl, props.intl.formatMessage(exports.translationMessages.billingLines_discount), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], false), discountTypeSelector),
480
+ react_1.default.createElement(tooltip_1.default, { title: (0, RequirementsUtility_1.getFieldLabelTooltipOverride)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], props.intl.formatMessage(exports.translationMessages.billingLines_discount_helpText)) }))))),
481
+ react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.fullWidthInput),
482
+ react_1.default.createElement(antd_1.Tooltip, { title: addNewLinesTooltip },
483
+ react_1.default.createElement(antd_1.Button, { type: "primary", onClick: addBillingLine, style: { width: "100%" }, disabled: isSaveButtonDisabled },
484
+ react_1.default.createElement(icons_1.CheckCircleOutlined, null),
485
+ props.intl.formatMessage(exports.translationMessages.billingLines_labels_addButton))))));
160
486
  }),
161
- react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.fullWidthInput),
162
- react_1.default.createElement(antd_1.Button, { type: "dashed", onClick: function () {
163
- add();
164
- }, style: { width: "100%" } },
165
- react_1.default.createElement(icons_1.PlusOutlined, null),
166
- " ",
167
- props.intl.formatMessage(translationMessages.billingLines_labels_addButton)))));
487
+ react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "middle", style: isMobile
488
+ ? { width: "100vw", backgroundColor: "white", margin: "0 -20px", padding: "20px" }
489
+ : {} }, billingLineData.map(function (lineData) {
490
+ return react_1.default.createElement(BillingLinePreview_1.default, __assign({ key: lineData.key }, lineData));
491
+ }))));
168
492
  }));
169
493
  };
170
- var BillingLinesWithIntl = react_intl_1.injectIntl(BillingLines);
494
+ var BillingLinesWithIntl = (0, react_intl_1.injectIntl)(BillingLines);
171
495
  exports.default = BillingLinesWithIntl;
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
1
+ import * as React from "react";
2
+ import { WrappedComponentProps } from "react-intl";
3
3
  import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
4
4
  import { FormInstance } from "antd/es/form";
5
5
  import { TaxCategoryTypeEnum, Units } from "@unimaze/api-clients/lib/mapi/api";
@@ -12,14 +12,41 @@ export interface UnitOfMeasureLabelInValueEnum {
12
12
  value: Units;
13
13
  label: string;
14
14
  }
15
- interface Props extends InjectedIntlProps {
15
+ interface Props extends WrappedComponentProps {
16
16
  formInstance: FormInstance;
17
17
  billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
18
18
  receiverRequirements: NewReceiverRequirements;
19
19
  outsideVatScope: boolean;
20
20
  }
21
- export declare const translationMessages: ReactIntl.Messages<"billingLines_title" | "billingLines_tooltip_title" | "billingLines_button_addRow" | "billingLines_placeholders_itemNo" | "billingLines_placeholders_newItem">;
22
- declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "outsideVatScope" | "billingLinesMetadata">, any> & {
23
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
21
+ export declare const translationMessages: {
22
+ billingLines_title: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ };
26
+ billingLines_tooltip_title: {
27
+ id: string;
28
+ defaultMessage: string;
29
+ };
30
+ baseInformation_notes: {
31
+ id: string;
32
+ defaultMessage: string;
33
+ };
34
+ billingLines_button_addRow: {
35
+ id: string;
36
+ defaultMessage: string;
37
+ };
38
+ billingLines_placeholders_itemNo: {
39
+ id: string;
40
+ defaultMessage: string;
41
+ };
42
+ billingLines_placeholders_newItem: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ };
46
+ };
47
+ declare const BillingLinesIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
48
+ forwardedRef?: React.Ref<any> | undefined;
49
+ } & React.RefAttributes<any>> & {
50
+ WrappedComponent: React.ComponentType<Props>;
24
51
  };
25
52
  export default BillingLinesIntl;