@unimaze/billing 0.1.2-rc.9 → 0.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/components/attachments/Attachment.d.ts +6 -5
- package/lib/common/components/attachments/Attachment.js +69 -18
- package/lib/common/components/attachments/index.d.ts +5 -6
- package/lib/common/components/attachments/index.js +18 -6
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/common/components/base-information/ReferenceIdentifiers.js +54 -0
- package/lib/common/components/base-information/index.d.ts +6 -3
- package/lib/common/components/base-information/index.js +70 -9
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/common/components/billing-lines/BillingCalculations.js +63 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/common/components/billing-lines/BillingTaxSummary.js +53 -0
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +10 -0
- package/lib/common/components/billing-lines/NewBillingLines.js +77 -0
- package/lib/common/components/billing-lines/index.d.ts +7 -15
- package/lib/common/components/billing-lines/index.js +173 -62
- package/lib/common/components/customer/hardCoddedCustomer.d.ts +7 -0
- package/lib/common/components/customer/hardCoddedCustomer.js +25 -0
- package/lib/common/components/customer/index.d.ts +5 -6
- package/lib/common/components/customer/index.js +101 -12
- package/lib/common/components/delivery-location/index.d.ts +5 -2
- package/lib/common/components/delivery-location/index.js +57 -8
- package/lib/common/components/editable-cell/index.js +7 -9
- package/lib/common/components/form-item/index.d.ts +12 -7
- package/lib/common/components/form-item/index.js +31 -7
- package/lib/common/components/locale-intl/index.d.ts +10 -0
- package/lib/common/components/locale-intl/index.js +45 -0
- package/lib/common/components/payment-method/index.d.ts +6 -3
- package/lib/common/components/payment-method/index.js +107 -15
- package/lib/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/common/components/payment-method/paymentMethodForConversion.js +44 -0
- package/lib/common/components/supplier/index.d.ts +5 -2
- package/lib/common/components/supplier/index.js +99 -25
- package/lib/common/consts/formLayout.d.ts +44 -0
- package/lib/common/consts/formLayout.js +35 -0
- package/lib/common/consts/validationRules.js +0 -7
- package/lib/common/types/ReceiverRequirements.d.ts +1 -1
- package/lib/common/types/ReceiverRequirements.js +4 -66
- package/lib/create-credit-note/index.js +1 -2
- package/lib/create-invoice/index.js +104 -40
- package/lib/src/common/components/attachments/Attachment.d.ts +6 -5
- package/lib/src/common/components/attachments/index.d.ts +5 -6
- package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
- package/lib/src/common/components/base-information/index.d.ts +6 -3
- package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
- package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
- package/lib/src/common/components/billing-lines/NewBillingLines.d.ts +10 -0
- package/lib/src/common/components/billing-lines/index.d.ts +7 -15
- package/lib/src/common/components/customer/index.d.ts +5 -6
- package/lib/src/common/components/delivery-location/index.d.ts +5 -2
- package/lib/src/common/components/form-item/index.d.ts +12 -7
- package/lib/src/common/components/locale-intl/index.d.ts +10 -0
- package/lib/src/common/components/payment-method/index.d.ts +6 -3
- package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
- package/lib/src/common/components/supplier/index.d.ts +5 -2
- package/lib/src/common/consts/formLayout.d.ts +44 -0
- package/lib/src/common/types/ReceiverRequirements.d.ts +1 -1
- package/lib/src/translations/locales.d.ts +75 -0
- package/lib/src/utils/BillingLineUtility.d.ts +10 -0
- package/lib/src/utils/ConversionUtility.d.ts +4 -4
- package/lib/translations/locales/is.json +71 -0
- package/lib/translations/locales.d.ts +75 -0
- package/lib/translations/locales.js +10 -0
- package/lib/utils/ApiUtility.js +1 -1
- package/lib/utils/BillingLineUtility.d.ts +10 -0
- package/lib/utils/BillingLineUtility.js +90 -0
- package/lib/utils/ConversionUtility.d.ts +4 -4
- package/lib/utils/ConversionUtility.js +38 -54
- package/lib/utils/RequirementsUtility.js +1 -1
- package/package.json +8 -5
- package/lib/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
- package/lib/common/components/billing-lines/BillingLIneFormData.js +0 -6
- package/lib/src/common/components/billing-lines/BillingLIneFormData.d.ts +0 -6
|
@@ -55,7 +55,7 @@ export declare enum AvailableFields {
|
|
|
55
55
|
"invoiceLines.quantity" = "invoiceLines.quantity",
|
|
56
56
|
"invoiceLines.uniteOfMeasure.unit" = "invoiceLines.unitOfMeasure.unit",
|
|
57
57
|
"invoiceLines.uniteOfMeasure.code" = "invoiceLines.unitOfMeasure.code",
|
|
58
|
-
"invoiceLines.
|
|
58
|
+
"invoiceLines.unitPriceAmount" = "invoiceLines.unitPriceAmount",
|
|
59
59
|
"invoiceLines.taxCategoryType" = "invoiceLines.taxCategoryType",
|
|
60
60
|
"invoiceLines.taxableAmount" = "invoiceLines.taxableAmount",
|
|
61
61
|
"invoiceLines.taxAmount" = "invoiceLines.taxAmount",
|
|
@@ -47,7 +47,7 @@ var AvailableFields;
|
|
|
47
47
|
AvailableFields["invoiceLines.quantity"] = "invoiceLines.quantity";
|
|
48
48
|
AvailableFields["invoiceLines.uniteOfMeasure.unit"] = "invoiceLines.unitOfMeasure.unit";
|
|
49
49
|
AvailableFields["invoiceLines.uniteOfMeasure.code"] = "invoiceLines.unitOfMeasure.code";
|
|
50
|
-
AvailableFields["invoiceLines.
|
|
50
|
+
AvailableFields["invoiceLines.unitPriceAmount"] = "invoiceLines.unitPriceAmount";
|
|
51
51
|
AvailableFields["invoiceLines.taxCategoryType"] = "invoiceLines.taxCategoryType";
|
|
52
52
|
AvailableFields["invoiceLines.taxableAmount"] = "invoiceLines.taxableAmount";
|
|
53
53
|
AvailableFields["invoiceLines.taxAmount"] = "invoiceLines.taxAmount";
|
|
@@ -73,27 +73,22 @@ exports.receiverRequirementsObject = {
|
|
|
73
73
|
invoiceNo: {
|
|
74
74
|
isRequired: true,
|
|
75
75
|
key: "",
|
|
76
|
-
label: "Invoice number"
|
|
77
76
|
},
|
|
78
77
|
issueDate: {
|
|
79
78
|
isRequired: true,
|
|
80
79
|
key: "",
|
|
81
|
-
label: "Issue date"
|
|
82
80
|
},
|
|
83
81
|
dueDate: {
|
|
84
82
|
isRequired: true,
|
|
85
83
|
key: "",
|
|
86
|
-
label: "Due date"
|
|
87
84
|
},
|
|
88
85
|
graceDate: {
|
|
89
86
|
isRequired: false,
|
|
90
87
|
key: "",
|
|
91
|
-
label: "Grace date"
|
|
92
88
|
},
|
|
93
89
|
currencyCode: {
|
|
94
90
|
isRequired: true,
|
|
95
91
|
key: "",
|
|
96
|
-
label: "Currency code",
|
|
97
92
|
values: [{
|
|
98
93
|
key: "ISK",
|
|
99
94
|
label: "Icelandic krona (ISK)"
|
|
@@ -102,43 +97,35 @@ exports.receiverRequirementsObject = {
|
|
|
102
97
|
notes: {
|
|
103
98
|
isRequired: false,
|
|
104
99
|
key: "",
|
|
105
|
-
label: "Notes"
|
|
106
100
|
},
|
|
107
101
|
accountingCost: {
|
|
108
102
|
isRequired: false,
|
|
109
103
|
key: "",
|
|
110
|
-
label: "Accounting cost",
|
|
111
|
-
values: [{ key: "asdfasd", label: "asdf" },]
|
|
112
104
|
},
|
|
113
105
|
buyerReference: {
|
|
114
|
-
isRequired:
|
|
106
|
+
isRequired: true,
|
|
115
107
|
key: "",
|
|
116
|
-
label: "
|
|
108
|
+
label: "Claim number"
|
|
117
109
|
},
|
|
118
110
|
"orderReference.documentNo": {
|
|
119
111
|
isRequired: true,
|
|
120
112
|
key: "",
|
|
121
|
-
label: "Order no"
|
|
122
113
|
},
|
|
123
114
|
"billingReferences.invoices": {
|
|
124
115
|
isRequired: false,
|
|
125
116
|
key: "",
|
|
126
|
-
label: "Billing references Invoice"
|
|
127
117
|
},
|
|
128
118
|
"billingReferences.documentNo": {
|
|
129
119
|
isRequired: true,
|
|
130
120
|
key: "",
|
|
131
|
-
label: "Billing references Document number"
|
|
132
121
|
},
|
|
133
122
|
"billingReferences.issueDate": {
|
|
134
123
|
isRequired: false,
|
|
135
124
|
key: "",
|
|
136
|
-
label: "Billing references Issue Date"
|
|
137
125
|
},
|
|
138
126
|
"billingReferences.creditNotes": {
|
|
139
127
|
isRequired: false,
|
|
140
128
|
key: "",
|
|
141
|
-
label: "Billing References Credit notes"
|
|
142
129
|
},
|
|
143
130
|
// "referenceIdentifiers.type": {
|
|
144
131
|
// isRequired: false,
|
|
@@ -197,246 +184,197 @@ exports.receiverRequirementsObject = {
|
|
|
197
184
|
"supplier.vatNumber": {
|
|
198
185
|
isRequired: true,
|
|
199
186
|
key: "",
|
|
200
|
-
label: "VAT number"
|
|
201
187
|
},
|
|
202
188
|
"supplier.address.streetNameAndNumber": {
|
|
203
189
|
isRequired: true,
|
|
204
190
|
key: "",
|
|
205
|
-
label: "Street name and number"
|
|
206
191
|
},
|
|
207
192
|
"supplier.address.city": {
|
|
208
193
|
isRequired: false,
|
|
209
194
|
key: "",
|
|
210
|
-
label: "City"
|
|
211
195
|
},
|
|
212
196
|
"supplier.address.postalZone": {
|
|
213
197
|
isRequired: false,
|
|
214
198
|
key: "",
|
|
215
|
-
label: "Postal zone"
|
|
216
199
|
},
|
|
217
200
|
"supplier.address.countryCode": {
|
|
218
201
|
isRequired: true,
|
|
219
202
|
key: "",
|
|
220
|
-
label: "Country code"
|
|
221
203
|
},
|
|
222
204
|
"supplier.contact.name": {
|
|
223
205
|
isRequired: false,
|
|
224
206
|
key: "",
|
|
225
|
-
label: "Contact name"
|
|
226
207
|
},
|
|
227
208
|
"supplier.contact.electronicMail": {
|
|
228
209
|
isRequired: false,
|
|
229
210
|
key: "",
|
|
230
|
-
label: "E-mail"
|
|
231
211
|
},
|
|
232
212
|
"supplier.contact.telephone": {
|
|
233
213
|
isRequired: false,
|
|
234
214
|
key: "",
|
|
235
|
-
label: "Contact phone"
|
|
236
215
|
},
|
|
237
216
|
"supplier.name": {
|
|
238
217
|
isRequired: true,
|
|
239
218
|
key: "",
|
|
240
|
-
label: "Name"
|
|
241
219
|
},
|
|
242
220
|
"supplier.identifier": {
|
|
243
221
|
isRequired: true,
|
|
244
222
|
key: "",
|
|
245
|
-
label: "Identifier"
|
|
246
223
|
},
|
|
247
224
|
"customer.address.streetNameAndNumber": {
|
|
248
225
|
isRequired: true,
|
|
249
226
|
key: "",
|
|
250
|
-
label: "Customer street name and number"
|
|
251
227
|
},
|
|
252
228
|
"customer.address.city": {
|
|
253
229
|
isRequired: false,
|
|
254
230
|
key: "",
|
|
255
|
-
label: "Customer city"
|
|
256
231
|
},
|
|
257
232
|
"customer.address.postalZone": {
|
|
258
233
|
isRequired: false,
|
|
259
234
|
key: "",
|
|
260
|
-
label: "Customer postal zone"
|
|
261
235
|
},
|
|
262
236
|
"customer.address.countryCode": {
|
|
263
237
|
isRequired: true,
|
|
264
238
|
key: "",
|
|
265
|
-
label: "Customer country code"
|
|
266
239
|
},
|
|
267
240
|
"customer.contact.name": {
|
|
268
241
|
isRequired: false,
|
|
269
242
|
key: "",
|
|
270
|
-
label: "Customer contact name"
|
|
271
243
|
},
|
|
272
244
|
"customer.contact.electronicMail": {
|
|
273
245
|
isRequired: false,
|
|
274
246
|
key: "",
|
|
275
|
-
label: "Customer E-mail"
|
|
276
247
|
},
|
|
277
248
|
"customer.contact.telephone": {
|
|
278
249
|
isRequired: false,
|
|
279
250
|
key: "",
|
|
280
|
-
label: "Customer phone"
|
|
281
251
|
},
|
|
282
252
|
"customer.name": {
|
|
283
253
|
isRequired: true,
|
|
284
254
|
key: "",
|
|
285
|
-
label: "Name"
|
|
286
255
|
},
|
|
287
256
|
"customer.identifier": {
|
|
288
257
|
isRequired: true,
|
|
289
258
|
key: "",
|
|
290
|
-
label: "Identifier"
|
|
291
259
|
},
|
|
292
260
|
"customer.locationIdentifier": {
|
|
293
261
|
isRequired: false,
|
|
294
262
|
key: "",
|
|
295
|
-
label: "Customer location identifier"
|
|
296
263
|
},
|
|
297
264
|
"payee.name": {
|
|
298
265
|
isRequired: true,
|
|
299
266
|
key: "",
|
|
300
|
-
label: "Payee name"
|
|
301
267
|
},
|
|
302
268
|
"payee.identifier": {
|
|
303
269
|
isRequired: true,
|
|
304
270
|
key: "",
|
|
305
|
-
label: "Payee identifier"
|
|
306
271
|
},
|
|
307
272
|
"payee.sepaBankIdentification": {
|
|
308
273
|
isRequired: false,
|
|
309
274
|
key: "",
|
|
310
|
-
label: "Payee sepa bank identification"
|
|
311
275
|
},
|
|
312
276
|
"invoiceLines.itemNo": {
|
|
313
277
|
isRequired: true,
|
|
314
278
|
key: "",
|
|
315
|
-
label: "Item number"
|
|
316
279
|
},
|
|
317
280
|
"invoiceLines.name": {
|
|
318
281
|
isRequired: true,
|
|
319
282
|
key: "",
|
|
320
|
-
label: "Name"
|
|
321
283
|
},
|
|
322
284
|
"invoiceLines.quantity": {
|
|
323
285
|
isRequired: true,
|
|
324
286
|
key: "",
|
|
325
|
-
label: "Quantity"
|
|
326
287
|
},
|
|
327
288
|
"invoiceLines.unitOfMeasure.unit": {
|
|
328
289
|
isRequired: true,
|
|
329
290
|
key: "",
|
|
330
|
-
label: "Unit of measure - Unit"
|
|
331
291
|
},
|
|
332
292
|
"invoiceLines.unitOfMeasure.code": {
|
|
333
293
|
isRequired: true,
|
|
334
294
|
key: "",
|
|
335
|
-
label: "Unit of measure - Code"
|
|
336
295
|
},
|
|
337
|
-
"invoiceLines.
|
|
296
|
+
"invoiceLines.unitPriceAmount": {
|
|
338
297
|
isRequired: true,
|
|
339
298
|
key: "",
|
|
340
|
-
label: "Price amount"
|
|
341
299
|
},
|
|
342
300
|
"invoiceLines.taxCategoryType": {
|
|
343
301
|
isRequired: true,
|
|
344
302
|
key: "",
|
|
345
|
-
label: ""
|
|
346
303
|
},
|
|
347
304
|
"invoiceLines.taxAmount": {
|
|
348
305
|
isRequired: true,
|
|
349
306
|
key: "",
|
|
350
|
-
label: "Tax amount"
|
|
351
307
|
},
|
|
352
308
|
"invoiceLines.taxableAmount": {
|
|
353
309
|
isRequired: true,
|
|
354
310
|
key: "",
|
|
355
|
-
label: "Taxable amount"
|
|
356
311
|
},
|
|
357
312
|
"invoiceLines.taxPercentage": {
|
|
358
313
|
isRequired: true,
|
|
359
314
|
key: "",
|
|
360
|
-
label: "Tax percentage"
|
|
361
315
|
},
|
|
362
316
|
"invoiceLines.discountValue": {
|
|
363
317
|
isRequired: true,
|
|
364
318
|
key: "",
|
|
365
|
-
label: "Discount value"
|
|
366
319
|
},
|
|
367
320
|
"paymentTerms.note": {
|
|
368
321
|
isRequired: false,
|
|
369
322
|
key: "",
|
|
370
|
-
label: "Note"
|
|
371
323
|
},
|
|
372
324
|
"paymentMeans.type": {
|
|
373
325
|
isRequired: true,
|
|
374
326
|
key: "",
|
|
375
|
-
label: "Type"
|
|
376
327
|
},
|
|
377
328
|
"paymentMeans.internationalTransfer": {
|
|
378
329
|
isRequired: false,
|
|
379
330
|
key: "",
|
|
380
|
-
label: "International transfer"
|
|
381
331
|
},
|
|
382
332
|
"paymentMeans.domesticTransfer": {
|
|
383
333
|
isRequired: false,
|
|
384
334
|
key: "",
|
|
385
|
-
label: "Domestic transfer"
|
|
386
335
|
},
|
|
387
336
|
"paymentMeans.domesticClaim": {
|
|
388
337
|
isRequired: false,
|
|
389
338
|
key: "",
|
|
390
|
-
label: "Domestic Claim"
|
|
391
339
|
},
|
|
392
340
|
"delivery.partyName": {
|
|
393
341
|
isRequired: false,
|
|
394
342
|
key: "",
|
|
395
|
-
label: "Party Name"
|
|
396
343
|
},
|
|
397
344
|
"delivery.locationIdentifier": {
|
|
398
345
|
isRequired: false,
|
|
399
346
|
key: "",
|
|
400
|
-
label: "Location Identifier"
|
|
401
347
|
},
|
|
402
348
|
"delivery.address.streetNameAndNumber": {
|
|
403
349
|
isRequired: false,
|
|
404
350
|
key: "",
|
|
405
|
-
label: "Street name and number"
|
|
406
351
|
},
|
|
407
352
|
"delivery.address.city": {
|
|
408
353
|
isRequired: false,
|
|
409
354
|
key: "",
|
|
410
|
-
label: "Town/city"
|
|
411
355
|
},
|
|
412
356
|
"delivery.address.postalZone": {
|
|
413
357
|
isRequired: false,
|
|
414
358
|
key: "",
|
|
415
|
-
label: "Postal zone"
|
|
416
359
|
},
|
|
417
360
|
"delivery.address.countryCode": {
|
|
418
361
|
isRequired: false,
|
|
419
362
|
key: "",
|
|
420
|
-
label: "Country code"
|
|
421
363
|
},
|
|
422
364
|
"delivery.actualDeliveryDate": {
|
|
423
365
|
isRequired: false,
|
|
424
366
|
key: "",
|
|
425
|
-
label: "Delivery Date"
|
|
426
367
|
},
|
|
427
368
|
prepaidAmount: {
|
|
428
369
|
isRequired: false,
|
|
429
370
|
key: "",
|
|
430
|
-
label: "Prepaid amount"
|
|
431
371
|
},
|
|
432
372
|
payableAmount: {
|
|
433
373
|
isRequired: false,
|
|
434
374
|
key: "",
|
|
435
|
-
label: "Payable amount"
|
|
436
375
|
},
|
|
437
376
|
payableRoundingAmount: {
|
|
438
377
|
isRequired: false,
|
|
439
378
|
key: "",
|
|
440
|
-
label: "Payable rounding amount"
|
|
441
379
|
}
|
|
442
380
|
};
|
|
@@ -53,8 +53,7 @@ var CreateInvoice = function (props) {
|
|
|
53
53
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
54
54
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } },
|
|
55
55
|
react_1.default.createElement(components_1.Supplier, null)),
|
|
56
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } },
|
|
57
|
-
react_1.default.createElement(components_1.Customer, { customer: props.customer })),
|
|
56
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } }),
|
|
58
57
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
|
|
59
58
|
react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "creditNote" })),
|
|
60
59
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } }),
|
|
@@ -26,11 +26,14 @@ var react_1 = __importStar(require("react"));
|
|
|
26
26
|
var antd_1 = require("antd");
|
|
27
27
|
var is_IS_1 = __importDefault(require("antd/es/locale-provider/is_IS"));
|
|
28
28
|
var en_US_1 = __importDefault(require("antd/es/locale-provider/en_US"));
|
|
29
|
+
var models_1 = require("@unimaze/api-clients/lib/mapi/models");
|
|
29
30
|
var components_1 = require("../common/components");
|
|
30
31
|
var utils_1 = require("../utils");
|
|
31
32
|
var uuid_1 = require("uuid");
|
|
32
|
-
var
|
|
33
|
+
var BillingLineUtility_1 = require("../utils/BillingLineUtility");
|
|
33
34
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
35
|
+
var formLayout_1 = require("../common/consts/formLayout");
|
|
36
|
+
var paymentMethodForConversion_1 = require("../common/components/payment-method/paymentMethodForConversion");
|
|
34
37
|
/**
|
|
35
38
|
* Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
|
|
36
39
|
*
|
|
@@ -39,36 +42,79 @@ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
|
39
42
|
var CreateInvoice = function (props) {
|
|
40
43
|
// const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
|
|
41
44
|
var form = antd_1.Form.useForm()[0];
|
|
42
|
-
var _a = react_1.useState([]),
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
var _a = react_1.useState([]), billingLinesDataSource = _a[0], setBillingLinesDataSource = _a[1];
|
|
46
|
+
var _b = react_1.useState(0), billingLinesEditableIndex = _b[0], setBillingLinesEditableIndex = _b[1];
|
|
47
|
+
// const [files, setFiles] = useState<UploadFile[]>([]);
|
|
48
|
+
//
|
|
49
|
+
// const handleAddFile = (file: UploadFile) => {
|
|
50
|
+
// if (file.status === "removed") {
|
|
51
|
+
// const remainingFiles = files.filter(existingFile => existingFile.uid !== file.uid);
|
|
52
|
+
// setFiles(remainingFiles);
|
|
53
|
+
// } else {
|
|
54
|
+
// setFiles([...files, file])
|
|
55
|
+
// }
|
|
56
|
+
// };
|
|
57
|
+
// BILLING LINES
|
|
58
|
+
var handleBillingLinesDelete = function (index) {
|
|
59
|
+
var newDataSource = billingLinesDataSource.slice();
|
|
60
|
+
newDataSource.splice(index, 1);
|
|
61
|
+
setBillingLinesDataSource(newDataSource);
|
|
52
62
|
};
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
var handleBillingLinesAdd = function () {
|
|
64
|
+
var newData = {
|
|
65
|
+
key: billingLinesEditableIndex,
|
|
66
|
+
itemNo: "Item No.",
|
|
67
|
+
quantity: 0,
|
|
68
|
+
taxAmount: 0,
|
|
69
|
+
name: "New Item",
|
|
70
|
+
unitOfMeasure: models_1.UnitOfMeasureMetadataUnitEnum.Piece,
|
|
71
|
+
unitPriceAmount: 0,
|
|
72
|
+
taxCategoryType: models_1.BillingLineMetadataTaxCategoryTypeEnum.StandardRated,
|
|
73
|
+
discountValue: "0",
|
|
74
|
+
taxableAmount: 0,
|
|
75
|
+
taxPercentage: null
|
|
76
|
+
};
|
|
77
|
+
setBillingLinesDataSource(billingLinesDataSource.concat([newData]));
|
|
78
|
+
setBillingLinesEditableIndex(billingLinesEditableIndex + 1);
|
|
61
79
|
};
|
|
80
|
+
var handleBillingLinesSave = function (row, formInstance) {
|
|
81
|
+
var newData = billingLinesDataSource.slice();
|
|
82
|
+
var index = newData.findIndex(function (i) {
|
|
83
|
+
return row.key === i.key;
|
|
84
|
+
});
|
|
85
|
+
var item = newData[index];
|
|
86
|
+
newData.splice(index, 1, __assign({}, item, row));
|
|
87
|
+
var billingLineMetadata = newData.map(function (current) {
|
|
88
|
+
return __assign({}, current, { unitOfMeasure: {
|
|
89
|
+
unit: current.unitOfMeasure,
|
|
90
|
+
} });
|
|
91
|
+
});
|
|
92
|
+
setBillingLinesDataSource(newData);
|
|
93
|
+
handleSetBillingLineMetadata(formInstance, billingLineMetadata);
|
|
94
|
+
};
|
|
95
|
+
// END BILLING LINES
|
|
62
96
|
var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
|
|
63
97
|
formInstance.setFieldsValue({
|
|
64
98
|
"billingLinesMetadata": billingLineMetadata
|
|
65
99
|
});
|
|
66
100
|
};
|
|
67
101
|
var handleSubmit = function (values) {
|
|
68
|
-
var
|
|
102
|
+
var attachments = [
|
|
103
|
+
values.attachments.file1 && values.attachments.file1,
|
|
104
|
+
values.attachments.file2 && values.attachments.file2,
|
|
105
|
+
values.attachments.file3 && values.attachments.file3,
|
|
106
|
+
];
|
|
107
|
+
// Clear the array of undefined
|
|
108
|
+
attachments = attachments.filter(function (attachment) { return attachment.file !== undefined; });
|
|
109
|
+
var billingLinesArray = form.getFieldValue("billingLinesMetadata");
|
|
110
|
+
if (!billingLinesArray || billingLinesArray.length <= 0) {
|
|
111
|
+
antd_1.message.error("Add at least one document line");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLineUtility_1.billingLinesFieldsMetadata(form), paymentMethodForConversion_1.PaymentMethodFormData(values), props.customer);
|
|
69
115
|
var createSubmitInvoice = {
|
|
70
116
|
invoiceMetadataInput: invoiceMetadataInput,
|
|
71
|
-
more:
|
|
117
|
+
more: attachments.length > 0,
|
|
72
118
|
messageId: uuid_1.v4(),
|
|
73
119
|
processingMode: mapi_1.TransactionProcessingMode.Device
|
|
74
120
|
};
|
|
@@ -77,22 +123,27 @@ var CreateInvoice = function (props) {
|
|
|
77
123
|
antd_1.message.success("successfully submitted the invoice");
|
|
78
124
|
var messageId = resp.data.uniqueId;
|
|
79
125
|
var _loop_1 = function () {
|
|
80
|
-
var nextFileArray =
|
|
81
|
-
var nextFile = nextFileArray[0];
|
|
126
|
+
var nextFileArray = attachments.splice(0, 1);
|
|
127
|
+
var nextFile = nextFileArray[0].file[0].originFileObj;
|
|
128
|
+
var nextFileDescription = nextFileArray[0].description;
|
|
82
129
|
var createAttachDocument = {
|
|
83
130
|
messageId: messageId,
|
|
84
131
|
contentType: nextFile.type,
|
|
85
|
-
more:
|
|
86
|
-
name: nextFile.name,
|
|
132
|
+
more: attachments.length > 0,
|
|
133
|
+
name: nextFileDescription // nextFile.name,
|
|
87
134
|
};
|
|
88
135
|
utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, props.apiKey)
|
|
89
136
|
.then(function (submitDocumentResponse) {
|
|
90
|
-
antd_1.message.success("successfully uploaded attachment " +
|
|
137
|
+
antd_1.message.success("successfully uploaded attachment " + nextFileDescription);
|
|
91
138
|
});
|
|
92
139
|
};
|
|
93
|
-
while (
|
|
140
|
+
while (attachments.length > 0) {
|
|
94
141
|
_loop_1();
|
|
95
142
|
}
|
|
143
|
+
form.resetFields();
|
|
144
|
+
// Clear the billing line dataSource
|
|
145
|
+
setBillingLinesDataSource([]);
|
|
146
|
+
setBillingLinesEditableIndex(0);
|
|
96
147
|
})
|
|
97
148
|
.catch(function (error) {
|
|
98
149
|
antd_1.message.error(error.message);
|
|
@@ -109,23 +160,36 @@ var CreateInvoice = function (props) {
|
|
|
109
160
|
}
|
|
110
161
|
};
|
|
111
162
|
return (react_1.default.createElement(antd_1.ConfigProvider, { locale: setLocale(props.language), componentSize: "small" },
|
|
112
|
-
react_1.default.createElement(antd_1.Form, __assign({}, formItemLayout, { form: form, onFinish: handleSubmit, initialValues: {
|
|
113
|
-
|
|
163
|
+
react_1.default.createElement(antd_1.Form, __assign({}, formLayout_1.formItemLayout, { form: form, onFinish: handleSubmit, initialValues: {
|
|
164
|
+
invoice: {
|
|
165
|
+
currencyCode: "ISK",
|
|
166
|
+
supplier: {
|
|
167
|
+
address: {
|
|
168
|
+
countryCode: "IS"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
customer: {
|
|
172
|
+
address: {
|
|
173
|
+
countryCode: "IS"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} }),
|
|
114
178
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
115
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }
|
|
179
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
116
180
|
react_1.default.createElement(components_1.Supplier, null)),
|
|
117
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }
|
|
118
|
-
react_1.default.createElement(components_1.
|
|
119
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }
|
|
120
|
-
react_1.default.createElement(components_1.Customer, { customer: props.customer })),
|
|
121
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
|
|
181
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
182
|
+
react_1.default.createElement(components_1.Customer, null)),
|
|
183
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
122
184
|
react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "invoice" })),
|
|
123
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span:
|
|
124
|
-
react_1.default.createElement(components_1.
|
|
125
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span:
|
|
185
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 } },
|
|
186
|
+
react_1.default.createElement(components_1.DeliveryLocation, null)),
|
|
187
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 } },
|
|
188
|
+
react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form, dataSource: billingLinesDataSource, editableIndex: billingLinesEditableIndex, handleAdd: handleBillingLinesAdd, handleDelete: handleBillingLinesDelete, handleSave: handleBillingLinesSave })),
|
|
189
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
126
190
|
react_1.default.createElement(components_1.PaymentMethod, null)),
|
|
127
|
-
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }
|
|
128
|
-
react_1.default.createElement(components_1.Attachments
|
|
191
|
+
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 } },
|
|
192
|
+
react_1.default.createElement(components_1.Attachments /*handleAddFile={handleAddFile}*/, null)),
|
|
129
193
|
react_1.default.createElement(antd_1.Col, { span: 24 },
|
|
130
194
|
react_1.default.createElement(antd_1.Form.Item, null,
|
|
131
195
|
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))))));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
|
-
import {
|
|
4
|
-
interface Props {
|
|
5
|
-
fieldName:
|
|
6
|
-
handleAddFile: (file: UploadFile) => void;
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
fieldName: "file1" | "file2" | "file3";
|
|
7
6
|
}
|
|
8
7
|
interface States {
|
|
9
8
|
file: any[];
|
|
@@ -14,5 +13,7 @@ declare class Attachment extends React.Component<Props, States> {
|
|
|
14
13
|
normFile: (e: any) => any;
|
|
15
14
|
render(): JSX.Element;
|
|
16
15
|
}
|
|
17
|
-
declare const _default: React.
|
|
16
|
+
declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "ref" | "key" | "fieldName">, any> & {
|
|
17
|
+
WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
|
|
18
|
+
};
|
|
18
19
|
export default _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default AttachmentsGroup;
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
declare const AttachmentGroupIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
|
|
4
|
+
WrappedComponent: React.ComponentType<InjectedIntlProps>;
|
|
5
|
+
};
|
|
6
|
+
export default AttachmentGroupIntl;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { StoreValue } from "rc-field-form/lib/interface";
|
|
4
|
+
interface FieldData {
|
|
5
|
+
name: number;
|
|
6
|
+
key: number;
|
|
7
|
+
fieldKey: number;
|
|
8
|
+
}
|
|
9
|
+
interface Props extends InjectedIntlProps {
|
|
10
|
+
fields: FieldData[];
|
|
11
|
+
add: (defaultValue?: StoreValue) => void;
|
|
12
|
+
remove: (index: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: React.ComponentClass<Pick<Props, "remove" | "fields" | "add">, any> & {
|
|
15
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@ant-design/compatible/assets/index.css';
|
|
3
3
|
import { FormInstance } from "antd/es/form";
|
|
4
|
-
|
|
4
|
+
import { InjectedIntlProps } from "react-intl";
|
|
5
|
+
interface Props extends InjectedIntlProps {
|
|
5
6
|
form: FormInstance;
|
|
6
7
|
documentType: "creditNote" | "invoice";
|
|
7
8
|
}
|
|
8
|
-
declare const
|
|
9
|
-
|
|
9
|
+
declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "documentType">, any> & {
|
|
10
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
|
+
};
|
|
12
|
+
export default BaseInformationIntl;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
|
|
6
|
+
renderCurrencyColumn: (text: string | number) => string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.ComponentClass<Pick<Props, "billingLinesMetadata" | "renderCurrencyColumn">, any> & {
|
|
9
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
|
+
import { InjectedIntlProps } from "react-intl";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
billingLines: BillingLineMetadataOverride[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
|
|
8
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
|
+
interface Props extends InjectedIntlProps {
|
|
5
|
+
formInstance: FormInstance;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance">, any> & {
|
|
8
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|