@unimaze/billing 0.1.2-rc.7 → 0.1.2-rc.9

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 (44) hide show
  1. package/lib/common/components/attachments/Attachment.d.ts +4 -1
  2. package/lib/common/components/attachments/Attachment.js +5 -2
  3. package/lib/common/components/attachments/index.d.ts +5 -1
  4. package/lib/common/components/attachments/index.js +4 -3
  5. package/lib/common/components/base-information/index.js +68 -78
  6. package/lib/common/components/billing-lines/BillingLIneFormData.d.ts +6 -0
  7. package/lib/common/components/billing-lines/BillingLIneFormData.js +6 -0
  8. package/lib/common/components/delivery-location/index.js +13 -7
  9. package/lib/common/components/form-item/index.d.ts +18 -0
  10. package/lib/common/components/form-item/index.js +20 -0
  11. package/lib/common/components/supplier/index.js +31 -25
  12. package/lib/common/types/ReceiverRequirements.d.ts +71 -15
  13. package/lib/common/types/ReceiverRequirements.js +410 -8
  14. package/lib/create-credit-note/index.js +1 -2
  15. package/lib/create-invoice/index.js +47 -6
  16. package/lib/src/common/components/attachments/Attachment.d.ts +4 -1
  17. package/lib/src/common/components/attachments/index.d.ts +5 -1
  18. package/lib/src/common/components/billing-lines/BillingLIneFormData.d.ts +6 -0
  19. package/lib/src/common/components/form-item/index.d.ts +18 -0
  20. package/lib/src/common/types/ReceiverRequirements.d.ts +71 -15
  21. package/lib/src/utils/ApiUtility.d.ts +8 -1
  22. package/lib/src/utils/ConversionUtility.d.ts +2 -1
  23. package/lib/src/utils/RequirementsUtility.d.ts +3 -1
  24. package/lib/src/utils/index.d.ts +1 -1
  25. package/lib/style/index.css +0 -1222
  26. package/lib/utils/ApiUtility.d.ts +8 -1
  27. package/lib/utils/ApiUtility.js +17 -1
  28. package/lib/utils/ConversionUtility.d.ts +2 -1
  29. package/lib/utils/ConversionUtility.js +98 -50
  30. package/lib/utils/RequirementsUtility.d.ts +3 -1
  31. package/lib/utils/RequirementsUtility.js +15 -5
  32. package/lib/utils/index.d.ts +1 -1
  33. package/lib/utils/index.js +1 -0
  34. package/package.json +1 -1
  35. package/lib/common/components/component-container/style/index.d.ts +0 -1
  36. package/lib/common/components/component-container/style/index.js +0 -3
  37. package/lib/common/components/issuer/index.d.ts +0 -7
  38. package/lib/common/components/issuer/index.js +0 -28
  39. package/lib/common/components/payer/index.d.ts +0 -3
  40. package/lib/common/components/payer/index.js +0 -51
  41. package/lib/src/common/components/issuer/index.d.ts +0 -7
  42. package/lib/src/common/components/payer/index.d.ts +0 -3
  43. package/lib/style/index.d.ts +0 -1
  44. package/lib/style/index.js +0 -3
@@ -5,23 +5,280 @@ var AvailableFields;
5
5
  AvailableFields["invoiceNo"] = "invoiceNo";
6
6
  AvailableFields["issueDate"] = "issueDate";
7
7
  AvailableFields["dueDate"] = "dueDate";
8
+ AvailableFields["graceDate"] = "graceDate";
8
9
  AvailableFields["currencyCode"] = "currencyCode";
9
- AvailableFields["payer.name"] = "payer.name";
10
- AvailableFields["payer.identifier"] = "payer.identifier";
10
+ AvailableFields["notes"] = "notes";
11
+ AvailableFields["accountingCost"] = "accountingCost";
12
+ AvailableFields["buyerReference"] = "buyerReference";
13
+ AvailableFields["orderReference.documentNo"] = "orderReference.documentNo";
14
+ AvailableFields["billingReferences.invoices"] = "billingReferences.invoices";
15
+ AvailableFields["billingReferences.documentNo"] = "billingReferences.documentNo";
16
+ AvailableFields["billingReferences.issueDate"] = "billingReferences.issueDate";
17
+ AvailableFields["billingReferences.creditNotes"] = "billingReferences.creditNotes";
18
+ AvailableFields["referenceIdentifiers.type"] = "referenceIdentifiers.type";
19
+ AvailableFields["referenceIdentifiers.code"] = "referenceIdentifiers.code";
20
+ AvailableFields["referenceIdentifiers.value"] = "referenceIdentifiers.value";
21
+ AvailableFields["referenceIdentifiers"] = "referenceIdentifiers";
22
+ AvailableFields["supplier.vatNumber"] = "supplier.vatNumber";
23
+ AvailableFields["supplier.address.streetNameAndNumber"] = "supplier.address.streetNameAndNumber";
24
+ AvailableFields["supplier.address.city"] = "supplier.address.city";
25
+ AvailableFields["supplier.address.postalZone"] = "supplier.address.postalZone";
26
+ AvailableFields["supplier.address.countryCode"] = "supplier.address.countryCode";
27
+ AvailableFields["supplier.contact.name"] = "supplier.contact.name";
28
+ AvailableFields["supplier.contact.electronicMail"] = "supplier.contact.electronicMail";
29
+ AvailableFields["supplier.contact.telephone"] = "supplier.contact.telephone";
30
+ AvailableFields["supplier.name"] = "supplier.name";
31
+ AvailableFields["supplier.identifier"] = "supplier.identifier";
32
+ AvailableFields["customer.address.streetNameAndNumber"] = "customer.address.streetNameAndNumber";
33
+ AvailableFields["customer.address.city"] = "customer.address.city";
34
+ AvailableFields["customer.address.postalZone"] = "customer.address.postalZone";
35
+ AvailableFields["customer.address.countryCode"] = "customer.address.countryCode";
36
+ AvailableFields["customer.contact.name"] = "customer.contact.name";
37
+ AvailableFields["customer.contact.electronicMail"] = "customer.contact.electronicMail";
38
+ AvailableFields["customer.contact.telephone"] = "customer.contact.telephone";
11
39
  AvailableFields["customer.name"] = "customer.name";
12
40
  AvailableFields["customer.identifier"] = "customer.identifier";
41
+ AvailableFields["customer.locationIdentifier"] = "customer.locationIdentifier";
42
+ AvailableFields["payee.name"] = "payee.name";
43
+ AvailableFields["payee.identifier"] = "payee.identifier";
44
+ AvailableFields["payee.sepaBankIdentification"] = "payee.sepaBankIdentification";
45
+ AvailableFields["invoiceLines.itemNo"] = "invoiceLines.itemNo";
46
+ AvailableFields["invoiceLines.name"] = "invoiceLines.name";
47
+ AvailableFields["invoiceLines.quantity"] = "invoiceLines.quantity";
48
+ AvailableFields["invoiceLines.uniteOfMeasure.unit"] = "invoiceLines.unitOfMeasure.unit";
49
+ AvailableFields["invoiceLines.uniteOfMeasure.code"] = "invoiceLines.unitOfMeasure.code";
50
+ AvailableFields["invoiceLines.priceAmount"] = "invoiceLines.priceAmount";
51
+ AvailableFields["invoiceLines.taxCategoryType"] = "invoiceLines.taxCategoryType";
52
+ AvailableFields["invoiceLines.taxableAmount"] = "invoiceLines.taxableAmount";
53
+ AvailableFields["invoiceLines.taxAmount"] = "invoiceLines.taxAmount";
54
+ AvailableFields["invoiceLines.taxPercentage"] = "invoiceLines.taxPercentage";
55
+ AvailableFields["invoiceLines.discountValue"] = "invoiceLines.discountValue";
56
+ AvailableFields["paymentTerms.note"] = "paymentTerms.note";
57
+ AvailableFields["paymentMeans.type"] = "paymentMeans.type";
58
+ AvailableFields["paymentMeans.internationalTransfer"] = "paymentMeans.internationalTransfer";
59
+ AvailableFields["paymentMeans.domesticTransfer"] = "paymentMeans.domesticTransfer";
60
+ AvailableFields["paymentMeans.domesticClaim"] = "paymentMeans.domesticClaim";
61
+ AvailableFields["delivery.partyName"] = "delivery.partyName";
62
+ AvailableFields["delivery.locationIdentifier"] = "delivery.locationIdentifier";
63
+ AvailableFields["delivery.address.streetNameAndNumber"] = "delivery.address.streetNameAndNumber";
64
+ AvailableFields["delivery.address.city"] = "delivery.address.city";
65
+ AvailableFields["delivery.address.postalZone"] = "delivery.address.postalZone";
66
+ AvailableFields["delivery.address.countryCode"] = "delivery.address.countryCode";
67
+ AvailableFields["delivery.actualDeliveryDate"] = "delivery.actualDeliveryDate";
68
+ AvailableFields["prepaidAmount"] = "prepaidAmount";
69
+ AvailableFields["payableAmount"] = "payableAmount";
70
+ AvailableFields["payableRoundingAmount"] = "payableRoundingAmount";
13
71
  })(AvailableFields = exports.AvailableFields || (exports.AvailableFields = {}));
14
72
  exports.receiverRequirementsObject = {
15
- "payer.name": {
73
+ invoiceNo: {
16
74
  isRequired: true,
17
75
  key: "",
18
- label: "Payer name"
76
+ label: "Invoice number"
19
77
  },
20
- "payer.identifier": {
78
+ issueDate: {
79
+ isRequired: true,
80
+ key: "",
81
+ label: "Issue date"
82
+ },
83
+ dueDate: {
84
+ isRequired: true,
85
+ key: "",
86
+ label: "Due date"
87
+ },
88
+ graceDate: {
89
+ isRequired: false,
90
+ key: "",
91
+ label: "Grace date"
92
+ },
93
+ currencyCode: {
94
+ isRequired: true,
95
+ key: "",
96
+ label: "Currency code",
97
+ values: [{
98
+ key: "ISK",
99
+ label: "Icelandic krona (ISK)"
100
+ }]
101
+ },
102
+ notes: {
103
+ isRequired: false,
104
+ key: "",
105
+ label: "Notes"
106
+ },
107
+ accountingCost: {
108
+ isRequired: false,
109
+ key: "",
110
+ label: "Accounting cost",
111
+ values: [{ key: "asdfasd", label: "asdf" },]
112
+ },
113
+ buyerReference: {
114
+ isRequired: false,
115
+ key: "",
116
+ label: "Buyer Reference"
117
+ },
118
+ "orderReference.documentNo": {
119
+ isRequired: true,
120
+ key: "",
121
+ label: "Order no"
122
+ },
123
+ "billingReferences.invoices": {
124
+ isRequired: false,
125
+ key: "",
126
+ label: "Billing references Invoice"
127
+ },
128
+ "billingReferences.documentNo": {
129
+ isRequired: true,
130
+ key: "",
131
+ label: "Billing references Document number"
132
+ },
133
+ "billingReferences.issueDate": {
134
+ isRequired: false,
135
+ key: "",
136
+ label: "Billing references Issue Date"
137
+ },
138
+ "billingReferences.creditNotes": {
139
+ isRequired: false,
140
+ key: "",
141
+ label: "Billing References Credit notes"
142
+ },
143
+ // "referenceIdentifiers.type": {
144
+ // isRequired: false,
145
+ // key: "",
146
+ // label: "Reference identifier type"
147
+ // },
148
+ // "referenceIdentifiers.code": {
149
+ // isRequired: false,
150
+ // key: "",
151
+ // label: "Reference identifier code"
152
+ // },
153
+ // "referenceIdentifiers.value": {
154
+ // isRequired: true,
155
+ // key: "",
156
+ // label: "Reference identifier value"
157
+ // },
158
+ "referenceIdentifiers": {
159
+ "isRequired": true,
160
+ "key": "",
161
+ "values": [
162
+ {
163
+ "key": "AKY",
164
+ "label": "Bílnúmer",
165
+ "values": [
166
+ {
167
+ "key": "NY753",
168
+ "label": "NY753"
169
+ },
170
+ {
171
+ "key": "IS123"
172
+ },
173
+ {
174
+ "key": "RR888"
175
+ },
176
+ ]
177
+ },
178
+ {
179
+ "key": "SSN",
180
+ "label": "Kennitala" // "Social security number"
181
+ },
182
+ {
183
+ "key": "LOC",
184
+ "label": "Fasteignanúmer",
185
+ "values": [{
186
+ "key": "30909",
187
+ "label": "Mýrargata 26 (30909)"
188
+ },
189
+ {
190
+ "key": "34344",
191
+ "label": "Aragata 1 (34344)"
192
+ },
193
+ ]
194
+ }
195
+ ]
196
+ },
197
+ "supplier.vatNumber": {
198
+ isRequired: true,
199
+ key: "",
200
+ label: "VAT number"
201
+ },
202
+ "supplier.address.streetNameAndNumber": {
203
+ isRequired: true,
204
+ key: "",
205
+ label: "Street name and number"
206
+ },
207
+ "supplier.address.city": {
208
+ isRequired: false,
209
+ key: "",
210
+ label: "City"
211
+ },
212
+ "supplier.address.postalZone": {
213
+ isRequired: false,
214
+ key: "",
215
+ label: "Postal zone"
216
+ },
217
+ "supplier.address.countryCode": {
218
+ isRequired: true,
219
+ key: "",
220
+ label: "Country code"
221
+ },
222
+ "supplier.contact.name": {
223
+ isRequired: false,
224
+ key: "",
225
+ label: "Contact name"
226
+ },
227
+ "supplier.contact.electronicMail": {
228
+ isRequired: false,
229
+ key: "",
230
+ label: "E-mail"
231
+ },
232
+ "supplier.contact.telephone": {
233
+ isRequired: false,
234
+ key: "",
235
+ label: "Contact phone"
236
+ },
237
+ "supplier.name": {
238
+ isRequired: true,
239
+ key: "",
240
+ label: "Name"
241
+ },
242
+ "supplier.identifier": {
21
243
  isRequired: true,
22
244
  key: "",
23
245
  label: "Identifier"
24
246
  },
247
+ "customer.address.streetNameAndNumber": {
248
+ isRequired: true,
249
+ key: "",
250
+ label: "Customer street name and number"
251
+ },
252
+ "customer.address.city": {
253
+ isRequired: false,
254
+ key: "",
255
+ label: "Customer city"
256
+ },
257
+ "customer.address.postalZone": {
258
+ isRequired: false,
259
+ key: "",
260
+ label: "Customer postal zone"
261
+ },
262
+ "customer.address.countryCode": {
263
+ isRequired: true,
264
+ key: "",
265
+ label: "Customer country code"
266
+ },
267
+ "customer.contact.name": {
268
+ isRequired: false,
269
+ key: "",
270
+ label: "Customer contact name"
271
+ },
272
+ "customer.contact.electronicMail": {
273
+ isRequired: false,
274
+ key: "",
275
+ label: "Customer E-mail"
276
+ },
277
+ "customer.contact.telephone": {
278
+ isRequired: false,
279
+ key: "",
280
+ label: "Customer phone"
281
+ },
25
282
  "customer.name": {
26
283
  isRequired: true,
27
284
  key: "",
@@ -32,9 +289,154 @@ exports.receiverRequirementsObject = {
32
289
  key: "",
33
290
  label: "Identifier"
34
291
  },
35
- dueDate: {
292
+ "customer.locationIdentifier": {
293
+ isRequired: false,
294
+ key: "",
295
+ label: "Customer location identifier"
296
+ },
297
+ "payee.name": {
298
+ isRequired: true,
299
+ key: "",
300
+ label: "Payee name"
301
+ },
302
+ "payee.identifier": {
303
+ isRequired: true,
304
+ key: "",
305
+ label: "Payee identifier"
306
+ },
307
+ "payee.sepaBankIdentification": {
308
+ isRequired: false,
309
+ key: "",
310
+ label: "Payee sepa bank identification"
311
+ },
312
+ "invoiceLines.itemNo": {
313
+ isRequired: true,
314
+ key: "",
315
+ label: "Item number"
316
+ },
317
+ "invoiceLines.name": {
318
+ isRequired: true,
319
+ key: "",
320
+ label: "Name"
321
+ },
322
+ "invoiceLines.quantity": {
323
+ isRequired: true,
324
+ key: "",
325
+ label: "Quantity"
326
+ },
327
+ "invoiceLines.unitOfMeasure.unit": {
328
+ isRequired: true,
329
+ key: "",
330
+ label: "Unit of measure - Unit"
331
+ },
332
+ "invoiceLines.unitOfMeasure.code": {
333
+ isRequired: true,
334
+ key: "",
335
+ label: "Unit of measure - Code"
336
+ },
337
+ "invoiceLines.priceAmount": {
338
+ isRequired: true,
339
+ key: "",
340
+ label: "Price amount"
341
+ },
342
+ "invoiceLines.taxCategoryType": {
343
+ isRequired: true,
344
+ key: "",
345
+ label: ""
346
+ },
347
+ "invoiceLines.taxAmount": {
348
+ isRequired: true,
349
+ key: "",
350
+ label: "Tax amount"
351
+ },
352
+ "invoiceLines.taxableAmount": {
353
+ isRequired: true,
354
+ key: "",
355
+ label: "Taxable amount"
356
+ },
357
+ "invoiceLines.taxPercentage": {
358
+ isRequired: true,
359
+ key: "",
360
+ label: "Tax percentage"
361
+ },
362
+ "invoiceLines.discountValue": {
363
+ isRequired: true,
364
+ key: "",
365
+ label: "Discount value"
366
+ },
367
+ "paymentTerms.note": {
368
+ isRequired: false,
369
+ key: "",
370
+ label: "Note"
371
+ },
372
+ "paymentMeans.type": {
36
373
  isRequired: true,
37
- label: "Due date",
38
- key: ""
374
+ key: "",
375
+ label: "Type"
376
+ },
377
+ "paymentMeans.internationalTransfer": {
378
+ isRequired: false,
379
+ key: "",
380
+ label: "International transfer"
381
+ },
382
+ "paymentMeans.domesticTransfer": {
383
+ isRequired: false,
384
+ key: "",
385
+ label: "Domestic transfer"
386
+ },
387
+ "paymentMeans.domesticClaim": {
388
+ isRequired: false,
389
+ key: "",
390
+ label: "Domestic Claim"
391
+ },
392
+ "delivery.partyName": {
393
+ isRequired: false,
394
+ key: "",
395
+ label: "Party Name"
396
+ },
397
+ "delivery.locationIdentifier": {
398
+ isRequired: false,
399
+ key: "",
400
+ label: "Location Identifier"
401
+ },
402
+ "delivery.address.streetNameAndNumber": {
403
+ isRequired: false,
404
+ key: "",
405
+ label: "Street name and number"
406
+ },
407
+ "delivery.address.city": {
408
+ isRequired: false,
409
+ key: "",
410
+ label: "Town/city"
411
+ },
412
+ "delivery.address.postalZone": {
413
+ isRequired: false,
414
+ key: "",
415
+ label: "Postal zone"
416
+ },
417
+ "delivery.address.countryCode": {
418
+ isRequired: false,
419
+ key: "",
420
+ label: "Country code"
421
+ },
422
+ "delivery.actualDeliveryDate": {
423
+ isRequired: false,
424
+ key: "",
425
+ label: "Delivery Date"
426
+ },
427
+ prepaidAmount: {
428
+ isRequired: false,
429
+ key: "",
430
+ label: "Prepaid amount"
431
+ },
432
+ payableAmount: {
433
+ isRequired: false,
434
+ key: "",
435
+ label: "Payable amount"
436
+ },
437
+ payableRoundingAmount: {
438
+ isRequired: false,
439
+ key: "",
440
+ label: "Payable rounding amount"
39
441
  }
40
442
  };
@@ -58,8 +58,7 @@ var CreateInvoice = function (props) {
58
58
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
59
59
  react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "creditNote" })),
60
60
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } }),
61
- react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } },
62
- react_1.default.createElement(components_1.Attachments, null)),
61
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } }),
63
62
  react_1.default.createElement(antd_1.Col, { span: 24 },
64
63
  react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))));
65
64
  };
@@ -10,18 +10,27 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __importStar = (this && this.__importStar) || function (mod) {
14
+ if (mod && mod.__esModule) return mod;
15
+ var result = {};
16
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
17
+ result["default"] = mod;
18
+ return result;
19
+ };
13
20
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
21
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
22
  };
16
23
  Object.defineProperty(exports, "__esModule", { value: true });
17
24
  require("../style/index.css");
18
- var react_1 = __importDefault(require("react"));
25
+ var react_1 = __importStar(require("react"));
19
26
  var antd_1 = require("antd");
20
27
  var is_IS_1 = __importDefault(require("antd/es/locale-provider/is_IS"));
21
28
  var en_US_1 = __importDefault(require("antd/es/locale-provider/en_US"));
22
29
  var components_1 = require("../common/components");
23
30
  var utils_1 = require("../utils");
24
31
  var uuid_1 = require("uuid");
32
+ var BillingLIneFormData_1 = require("../common/components/billing-lines/BillingLIneFormData");
33
+ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
25
34
  /**
26
35
  * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
27
36
  *
@@ -30,6 +39,7 @@ var uuid_1 = require("uuid");
30
39
  var CreateInvoice = function (props) {
31
40
  // const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
32
41
  var form = antd_1.Form.useForm()[0];
42
+ var _a = react_1.useState([]), files = _a[0], setFiles = _a[1];
33
43
  var formItemLayout = {
34
44
  labelCol: {
35
45
  xs: { span: 24 },
@@ -40,22 +50,52 @@ var CreateInvoice = function (props) {
40
50
  sm: { span: 16 },
41
51
  },
42
52
  };
53
+ var handleAddFile = function (file) {
54
+ if (file.status === "removed") {
55
+ var remainingFiles = files.filter(function (existingFile) { return existingFile.uid !== file.uid; });
56
+ setFiles(remainingFiles);
57
+ }
58
+ else {
59
+ setFiles(files.concat([file]));
60
+ }
61
+ };
43
62
  var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
44
63
  formInstance.setFieldsValue({
45
64
  "billingLinesMetadata": billingLineMetadata
46
65
  });
47
66
  };
48
67
  var handleSubmit = function (values) {
49
- var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, props.customer);
68
+ var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLIneFormData_1.BillingLinesFieldsMetadata(form), props.customer);
50
69
  var createSubmitInvoice = {
51
70
  invoiceMetadataInput: invoiceMetadataInput,
52
- more: false,
71
+ more: files.length > 0,
53
72
  messageId: uuid_1.v4(),
73
+ processingMode: mapi_1.TransactionProcessingMode.Device
54
74
  };
55
75
  utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, props.apiKey, "submitInvoice", props.language)
56
- .then(antd_1.message.success("successfully submitted the invoice"))
76
+ .then(function (resp) {
77
+ antd_1.message.success("successfully submitted the invoice");
78
+ var messageId = resp.data.uniqueId;
79
+ var _loop_1 = function () {
80
+ var nextFileArray = files.splice(0, 1);
81
+ var nextFile = nextFileArray[0];
82
+ var createAttachDocument = {
83
+ messageId: messageId,
84
+ contentType: nextFile.type,
85
+ more: files.length > 0,
86
+ name: nextFile.name,
87
+ };
88
+ utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, props.apiKey)
89
+ .then(function (submitDocumentResponse) {
90
+ antd_1.message.success("successfully uploaded attachment " + nextFile.name);
91
+ });
92
+ };
93
+ while (files.length > 0) {
94
+ _loop_1();
95
+ }
96
+ })
57
97
  .catch(function (error) {
58
- antd_1.message.error(error);
98
+ antd_1.message.error(error.message);
59
99
  });
60
100
  };
61
101
  var setLocale = function (language) {
@@ -84,7 +124,8 @@ var CreateInvoice = function (props) {
84
124
  react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form })),
85
125
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 }, xl: { span: 8 } },
86
126
  react_1.default.createElement(components_1.PaymentMethod, null)),
87
- react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } }),
127
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } },
128
+ react_1.default.createElement(components_1.Attachments, { handleAddFile: handleAddFile })),
88
129
  react_1.default.createElement(antd_1.Col, { span: 24 },
89
130
  react_1.default.createElement(antd_1.Form.Item, null,
90
131
  react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))))));
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import '@ant-design/compatible/assets/index.css';
3
+ import { UploadFile } from "antd/lib/upload/interface";
3
4
  interface Props {
4
5
  fieldName: string;
6
+ handleAddFile: (file: UploadFile) => void;
5
7
  }
6
8
  interface States {
7
9
  file: any[];
@@ -12,4 +14,5 @@ declare class Attachment extends React.Component<Props, States> {
12
14
  normFile: (e: any) => any;
13
15
  render(): JSX.Element;
14
16
  }
15
- export default Attachment;
17
+ declare const _default: React.MemoExoticComponent<typeof Attachment>;
18
+ export default _default;
@@ -1,3 +1,7 @@
1
1
  import * as React from 'react';
2
- declare const AttachmentsGroup: React.FC;
2
+ import { UploadFile } from "antd/lib/upload/interface";
3
+ interface Props {
4
+ handleAddFile: (file: UploadFile) => void;
5
+ }
6
+ declare const AttachmentsGroup: React.FC<Props>;
3
7
  export default AttachmentsGroup;
@@ -0,0 +1,6 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ export interface IBillingLinesMetadata {
4
+ billingLineMetadata: Array<BillingLineMetadata>;
5
+ }
6
+ export declare const BillingLinesFieldsMetadata: (formInstance: FormInstance) => IBillingLinesMetadata;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { AvailableFields, ReceiverRequirements } from "../../types/ReceiverRequirements";
3
+ import { Rule } from "rc-field-form/lib/interface";
4
+ interface StringMap {
5
+ [key: string]: string;
6
+ }
7
+ interface Props {
8
+ receiverRequirements: ReceiverRequirements;
9
+ receiverRequirementsKey: AvailableFields;
10
+ defaultLabel: React.ReactNode;
11
+ defaultIsRequired: boolean;
12
+ fieldName: string | string[];
13
+ additionalRules?: Rule[];
14
+ style?: React.CSSProperties;
15
+ initialValue?: StringMap;
16
+ }
17
+ declare const FormItem: React.FC<Props>;
18
+ export default FormItem;