@unimaze/billing 0.1.2-rc.10 → 0.1.2-rc.3

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 (95) hide show
  1. package/README.md +3 -11
  2. package/lib/common/components/attachments/Attachment.d.ts +2 -8
  3. package/lib/common/components/attachments/Attachment.js +7 -33
  4. package/lib/common/components/attachments/index.d.ts +2 -9
  5. package/lib/common/components/attachments/index.js +6 -15
  6. package/lib/common/components/base-information/index.d.ts +3 -6
  7. package/lib/common/components/base-information/index.js +81 -100
  8. package/lib/common/components/billing-lines/index.d.ts +20 -6
  9. package/lib/common/components/billing-lines/index.js +22 -106
  10. package/lib/common/components/component-container/style/index.d.ts +1 -0
  11. package/lib/common/components/component-container/style/index.js +3 -0
  12. package/lib/common/components/delivery-location/index.d.ts +2 -5
  13. package/lib/common/components/delivery-location/index.js +11 -43
  14. package/lib/common/components/editable-cell/index.js +9 -7
  15. package/lib/common/components/index.d.ts +5 -10
  16. package/lib/common/components/index.js +8 -20
  17. package/lib/common/components/issuer/index.d.ts +7 -0
  18. package/lib/common/components/{customer/hardCoddedCustomer.js → issuer/index.js} +8 -5
  19. package/lib/common/components/payer/index.d.ts +3 -0
  20. package/lib/common/components/payer/index.js +51 -0
  21. package/lib/common/components/payment-method/index.d.ts +3 -6
  22. package/lib/common/components/payment-method/index.js +17 -57
  23. package/lib/common/consts/validationRules.js +7 -0
  24. package/lib/common/enums/index.d.ts +1 -1
  25. package/lib/common/enums/index.js +4 -2
  26. package/lib/common/types/ReceiverRequirements.d.ts +17 -72
  27. package/lib/common/types/ReceiverRequirements.js +14 -350
  28. package/lib/create-credit-note/index.d.ts +2 -1
  29. package/lib/create-credit-note/index.js +11 -5
  30. package/lib/create-invoice/index.d.ts +2 -1
  31. package/lib/create-invoice/index.js +17 -77
  32. package/lib/example/src/index.d.ts +1 -1
  33. package/lib/index.js +0 -5
  34. package/lib/src/common/components/base-information/index.d.ts +3 -6
  35. package/lib/src/common/components/billing-lines/index.d.ts +20 -6
  36. package/lib/src/common/components/delivery-location/index.d.ts +2 -5
  37. package/lib/src/common/components/issuer/index.d.ts +7 -0
  38. package/lib/src/common/components/payer/index.d.ts +3 -0
  39. package/lib/src/common/components/payment-method/index.d.ts +3 -6
  40. package/lib/src/common/types/ReceiverRequirements.d.ts +17 -72
  41. package/lib/src/create-invoice/index.d.ts +2 -1
  42. package/lib/src/utils/ApiUtility.d.ts +1 -8
  43. package/lib/src/utils/ConversionUtility.d.ts +2 -3
  44. package/lib/src/utils/index.d.ts +1 -1
  45. package/lib/style/index.css +1222 -0
  46. package/lib/style/index.d.ts +1 -0
  47. package/lib/style/index.js +3 -0
  48. package/lib/utils/ApiUtility.d.ts +1 -8
  49. package/lib/utils/ApiUtility.js +1 -17
  50. package/lib/utils/ConversionUtility.d.ts +2 -3
  51. package/lib/utils/ConversionUtility.js +62 -116
  52. package/lib/utils/index.d.ts +1 -1
  53. package/lib/utils/index.js +0 -1
  54. package/package.json +7 -12
  55. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  56. package/lib/common/components/base-information/ReferenceIdentifiers.js +0 -40
  57. package/lib/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  58. package/lib/common/components/billing-lines/BillingCalculations.js +0 -61
  59. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  60. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -51
  61. package/lib/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  62. package/lib/common/components/billing-lines/billingLIneFormData.js +0 -63
  63. package/lib/common/components/customer/hardCoddedCustomer.d.ts +0 -7
  64. package/lib/common/components/customer/index.d.ts +0 -6
  65. package/lib/common/components/customer/index.js +0 -93
  66. package/lib/common/components/form-item/index.d.ts +0 -21
  67. package/lib/common/components/form-item/index.js +0 -27
  68. package/lib/common/components/locale-intl/index.d.ts +0 -10
  69. package/lib/common/components/locale-intl/index.js +0 -45
  70. package/lib/common/components/supplier/index.d.ts +0 -6
  71. package/lib/common/components/supplier/index.js +0 -93
  72. package/lib/src/common/components/attachments/Attachment.d.ts +0 -21
  73. package/lib/src/common/components/attachments/index.d.ts +0 -10
  74. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  75. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  76. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  77. package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  78. package/lib/src/common/components/customer/index.d.ts +0 -6
  79. package/lib/src/common/components/form-item/index.d.ts +0 -21
  80. package/lib/src/common/components/index.d.ts +0 -10
  81. package/lib/src/common/components/locale-intl/index.d.ts +0 -10
  82. package/lib/src/common/components/supplier/index.d.ts +0 -6
  83. package/lib/src/translations/locales.d.ts +0 -74
  84. package/lib/src/utils/BillingLineUtility.d.ts +0 -8
  85. package/lib/src/utils/RequirementsUtility.d.ts +0 -5
  86. package/lib/src/utils/billingLineFormData.d.ts +0 -7
  87. package/lib/translations/locales/is.json +0 -70
  88. package/lib/translations/locales.d.ts +0 -74
  89. package/lib/translations/locales.js +0 -10
  90. package/lib/utils/BillingLineUtility.d.ts +0 -8
  91. package/lib/utils/BillingLineUtility.js +0 -66
  92. package/lib/utils/RequirementsUtility.d.ts +0 -5
  93. package/lib/utils/RequirementsUtility.js +0 -23
  94. package/lib/utils/billingLineFormData.d.ts +0 -7
  95. package/lib/utils/billingLineFormData.js +0 -63
@@ -5,375 +5,39 @@ var AvailableFields;
5
5
  AvailableFields["invoiceNo"] = "invoiceNo";
6
6
  AvailableFields["issueDate"] = "issueDate";
7
7
  AvailableFields["dueDate"] = "dueDate";
8
- AvailableFields["graceDate"] = "graceDate";
9
8
  AvailableFields["currencyCode"] = "currencyCode";
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";
9
+ AvailableFields["payer.name"] = "payer.name";
10
+ AvailableFields["payer.identifier"] = "payer.identifier";
39
11
  AvailableFields["customer.name"] = "customer.name";
40
12
  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";
71
13
  })(AvailableFields = exports.AvailableFields || (exports.AvailableFields = {}));
72
14
  exports.receiverRequirementsObject = {
73
- invoiceNo: {
15
+ "payer.name": {
74
16
  isRequired: true,
75
17
  key: "",
18
+ label: "Name"
76
19
  },
77
- issueDate: {
20
+ "payer.identifier": {
78
21
  isRequired: true,
79
22
  key: "",
80
- },
81
- dueDate: {
82
- isRequired: true,
83
- key: "",
84
- },
85
- graceDate: {
86
- isRequired: false,
87
- key: "",
88
- },
89
- currencyCode: {
90
- isRequired: true,
91
- key: "",
92
- values: [{
93
- key: "ISK",
94
- label: "Icelandic krona (ISK)"
95
- }]
96
- },
97
- notes: {
98
- isRequired: false,
99
- key: "",
100
- },
101
- accountingCost: {
102
- isRequired: false,
103
- key: "",
104
- },
105
- buyerReference: {
106
- isRequired: false,
107
- key: "",
108
- },
109
- "orderReference.documentNo": {
110
- isRequired: true,
111
- key: "",
112
- },
113
- "billingReferences.invoices": {
114
- isRequired: false,
115
- key: "",
116
- },
117
- "billingReferences.documentNo": {
118
- isRequired: true,
119
- key: "",
120
- },
121
- "billingReferences.issueDate": {
122
- isRequired: false,
123
- key: "",
124
- },
125
- "billingReferences.creditNotes": {
126
- isRequired: false,
127
- key: "",
128
- },
129
- // "referenceIdentifiers.type": {
130
- // isRequired: false,
131
- // key: "",
132
- // label: "Reference identifier type"
133
- // },
134
- // "referenceIdentifiers.code": {
135
- // isRequired: false,
136
- // key: "",
137
- // label: "Reference identifier code"
138
- // },
139
- // "referenceIdentifiers.value": {
140
- // isRequired: true,
141
- // key: "",
142
- // label: "Reference identifier value"
143
- // },
144
- "referenceIdentifiers": {
145
- "isRequired": true,
146
- "key": "",
147
- "values": [
148
- {
149
- "key": "AKY",
150
- "label": "Bílnúmer",
151
- "values": [
152
- {
153
- "key": "NY753",
154
- "label": "NY753"
155
- },
156
- {
157
- "key": "IS123"
158
- },
159
- {
160
- "key": "RR888"
161
- },
162
- ]
163
- },
164
- {
165
- "key": "SSN",
166
- "label": "Kennitala" // "Social security number"
167
- },
168
- {
169
- "key": "LOC",
170
- "label": "Fasteignanúmer",
171
- "values": [{
172
- "key": "30909",
173
- "label": "Mýrargata 26 (30909)"
174
- },
175
- {
176
- "key": "34344",
177
- "label": "Aragata 1 (34344)"
178
- },
179
- ]
180
- }
181
- ]
182
- },
183
- "supplier.vatNumber": {
184
- isRequired: true,
185
- key: "",
186
- },
187
- "supplier.address.streetNameAndNumber": {
188
- isRequired: true,
189
- key: "",
190
- },
191
- "supplier.address.city": {
192
- isRequired: false,
193
- key: "",
194
- },
195
- "supplier.address.postalZone": {
196
- isRequired: false,
197
- key: "",
198
- },
199
- "supplier.address.countryCode": {
200
- isRequired: true,
201
- key: "",
202
- },
203
- "supplier.contact.name": {
204
- isRequired: false,
205
- key: "",
206
- },
207
- "supplier.contact.electronicMail": {
208
- isRequired: false,
209
- key: "",
210
- },
211
- "supplier.contact.telephone": {
212
- isRequired: false,
213
- key: "",
214
- },
215
- "supplier.name": {
216
- isRequired: true,
217
- key: "",
218
- },
219
- "supplier.identifier": {
220
- isRequired: true,
221
- key: "",
222
- },
223
- "customer.address.streetNameAndNumber": {
224
- isRequired: true,
225
- key: "",
226
- },
227
- "customer.address.city": {
228
- isRequired: false,
229
- key: "",
230
- },
231
- "customer.address.postalZone": {
232
- isRequired: false,
233
- key: "",
234
- },
235
- "customer.address.countryCode": {
236
- isRequired: true,
237
- key: "",
238
- },
239
- "customer.contact.name": {
240
- isRequired: false,
241
- key: "",
242
- },
243
- "customer.contact.electronicMail": {
244
- isRequired: false,
245
- key: "",
246
- },
247
- "customer.contact.telephone": {
248
- isRequired: false,
249
- key: "",
23
+ label: "Identifier"
250
24
  },
251
25
  "customer.name": {
252
26
  isRequired: true,
253
27
  key: "",
28
+ label: "Name"
254
29
  },
255
30
  "customer.identifier": {
256
31
  isRequired: true,
257
32
  key: "",
33
+ label: "Identifier"
258
34
  },
259
- "customer.locationIdentifier": {
260
- isRequired: false,
261
- key: "",
262
- },
263
- "payee.name": {
264
- isRequired: true,
265
- key: "",
266
- },
267
- "payee.identifier": {
268
- isRequired: true,
269
- key: "",
270
- },
271
- "payee.sepaBankIdentification": {
272
- isRequired: false,
273
- key: "",
274
- },
275
- "invoiceLines.itemNo": {
276
- isRequired: true,
277
- key: "",
278
- },
279
- "invoiceLines.name": {
280
- isRequired: true,
281
- key: "",
282
- },
283
- "invoiceLines.quantity": {
284
- isRequired: true,
285
- key: "",
286
- },
287
- "invoiceLines.unitOfMeasure.unit": {
288
- isRequired: true,
289
- key: "",
290
- },
291
- "invoiceLines.unitOfMeasure.code": {
292
- isRequired: true,
293
- key: "",
294
- },
295
- "invoiceLines.priceAmount": {
296
- isRequired: true,
297
- key: "",
298
- },
299
- "invoiceLines.taxCategoryType": {
300
- isRequired: true,
301
- key: "",
302
- },
303
- "invoiceLines.taxAmount": {
304
- isRequired: true,
305
- key: "",
306
- },
307
- "invoiceLines.taxableAmount": {
308
- isRequired: true,
309
- key: "",
310
- },
311
- "invoiceLines.taxPercentage": {
312
- isRequired: true,
313
- key: "",
314
- },
315
- "invoiceLines.discountValue": {
316
- isRequired: true,
317
- key: "",
318
- },
319
- "paymentTerms.note": {
320
- isRequired: false,
321
- key: "",
322
- },
323
- "paymentMeans.type": {
35
+ dueDate: {
324
36
  isRequired: true,
325
- key: "",
326
- },
327
- "paymentMeans.internationalTransfer": {
328
- isRequired: false,
329
- key: "",
330
- },
331
- "paymentMeans.domesticTransfer": {
332
- isRequired: false,
333
- key: "",
334
- },
335
- "paymentMeans.domesticClaim": {
336
- isRequired: false,
337
- key: "",
338
- },
339
- "delivery.partyName": {
340
- isRequired: false,
341
- key: "",
342
- },
343
- "delivery.locationIdentifier": {
344
- isRequired: false,
345
- key: "",
346
- },
347
- "delivery.address.streetNameAndNumber": {
348
- isRequired: false,
349
- key: "",
350
- },
351
- "delivery.address.city": {
352
- isRequired: false,
353
- key: "",
354
- },
355
- "delivery.address.postalZone": {
356
- isRequired: false,
357
- key: "",
358
- },
359
- "delivery.address.countryCode": {
360
- isRequired: false,
361
- key: "",
362
- },
363
- "delivery.actualDeliveryDate": {
364
- isRequired: false,
365
- key: "",
366
- },
367
- prepaidAmount: {
368
- isRequired: false,
369
- key: "",
370
- },
371
- payableAmount: {
372
- isRequired: false,
373
- key: "",
374
- },
375
- payableRoundingAmount: {
376
- isRequired: false,
377
- key: "",
37
+ label: "Due date",
38
+ key: ""
378
39
  }
379
40
  };
41
+ exports.getReceiverRequirements = function (recRequirements, key) {
42
+ return recRequirements[key];
43
+ };
@@ -1,8 +1,9 @@
1
+ import "antd/dist/antd.compact.css";
1
2
  import "../style/index.css";
2
3
  import React from "react";
3
4
  import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
5
  interface Props {
5
- customer: ProfileOutput;
6
+ issuer: ProfileOutput;
6
7
  }
7
8
  declare const CreateInvoice: React.FC<Props>;
8
9
  export default CreateInvoice;
@@ -14,10 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("antd/dist/antd.compact.css");
17
18
  require("../style/index.css");
18
19
  var react_1 = __importDefault(require("react"));
19
20
  var antd_1 = require("antd");
20
- var components_1 = require("../common/components");
21
+ var payer_1 = __importDefault(require("../common/components/payer"));
22
+ var issuer_1 = __importDefault(require("../common/components/issuer"));
23
+ var base_information_1 = __importDefault(require("../common/components/base-information"));
24
+ var attachments_1 = __importDefault(require("../common/components/attachments"));
21
25
  // const [createCorrectWithCreditRequest, setCreateCorrectWithCreditRequest] = useState<CreateCorrectWithCreditRequest>(
22
26
  // {
23
27
  // conversationIdentifier: "test",
@@ -52,12 +56,14 @@ var CreateInvoice = function (props) {
52
56
  react_1.default.createElement("h1", null, "Credit note"),
53
57
  react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
54
58
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } },
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 } }),
59
+ react_1.default.createElement(payer_1.default, null)),
60
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } },
61
+ react_1.default.createElement(issuer_1.default, { issuer: props.issuer })),
57
62
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
58
- react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "creditNote" })),
63
+ react_1.default.createElement(base_information_1.default, { form: form, documentType: "creditNote" })),
59
64
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } }),
60
- react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } }),
65
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } },
66
+ react_1.default.createElement(attachments_1.default, null)),
61
67
  react_1.default.createElement(antd_1.Col, { span: 24 },
62
68
  react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))));
63
69
  };
@@ -1,9 +1,10 @@
1
+ import "antd/dist/antd.compact.css";
1
2
  import "../style/index.css";
2
3
  import React from "react";
3
4
  import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
5
  import { CommonProps } from "../common/types/CommonProps";
5
6
  interface Props extends CommonProps {
6
- customer: ProfileOutput;
7
+ issuer: ProfileOutput;
7
8
  }
8
9
  /**
9
10
  * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
@@ -10,27 +10,23 @@ 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
- };
20
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
21
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
22
15
  };
23
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("antd/dist/antd.compact.css");
24
18
  require("../style/index.css");
25
- var react_1 = __importStar(require("react"));
19
+ var react_1 = __importDefault(require("react"));
26
20
  var antd_1 = require("antd");
27
21
  var is_IS_1 = __importDefault(require("antd/es/locale-provider/is_IS"));
28
22
  var en_US_1 = __importDefault(require("antd/es/locale-provider/en_US"));
29
- var components_1 = require("../common/components");
23
+ var payer_1 = __importDefault(require("../common/components/payer"));
24
+ var issuer_1 = __importDefault(require("../common/components/issuer"));
25
+ var delivery_location_1 = __importDefault(require("../common/components/delivery-location"));
26
+ var payment_method_1 = __importDefault(require("../common/components/payment-method"));
27
+ var base_information_1 = __importDefault(require("../common/components/base-information"));
28
+ var billing_lines_1 = __importDefault(require("../common/components/billing-lines"));
30
29
  var utils_1 = require("../utils");
31
- var uuid_1 = require("uuid");
32
- var BillingLineUtility_1 = require("../utils/BillingLineUtility");
33
- var mapi_1 = require("@unimaze/api-clients/lib/mapi");
34
30
  /**
35
31
  * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
36
32
  *
@@ -39,7 +35,6 @@ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
39
35
  var CreateInvoice = function (props) {
40
36
  // const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
41
37
  var form = antd_1.Form.useForm()[0];
42
- var _a = react_1.useState([]), files = _a[0], setFiles = _a[1];
43
38
  var formItemLayout = {
44
39
  labelCol: {
45
40
  xs: { span: 24 },
@@ -50,53 +45,13 @@ var CreateInvoice = function (props) {
50
45
  sm: { span: 16 },
51
46
  },
52
47
  };
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
- };
62
48
  var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
63
49
  formInstance.setFieldsValue({
64
50
  "billingLinesMetadata": billingLineMetadata
65
51
  });
66
52
  };
67
53
  var handleSubmit = function (values) {
68
- var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLineUtility_1.billingLinesFieldsMetadata(form), props.customer);
69
- var createSubmitInvoice = {
70
- invoiceMetadataInput: invoiceMetadataInput,
71
- more: files.length > 0,
72
- messageId: uuid_1.v4(),
73
- processingMode: mapi_1.TransactionProcessingMode.Device
74
- };
75
- utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, props.apiKey, "submitInvoice", props.language)
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
- })
97
- .catch(function (error) {
98
- antd_1.message.error(error.message);
99
- });
54
+ utils_1.convertToInvoiceMetadataInput(values);
100
55
  };
101
56
  var setLocale = function (language) {
102
57
  switch (language) {
@@ -109,37 +64,22 @@ var CreateInvoice = function (props) {
109
64
  }
110
65
  };
111
66
  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
- invoice: {
114
- currencyCode: "ISK",
115
- supplier: {
116
- address: {
117
- countryCode: "IS"
118
- }
119
- },
120
- customer: {
121
- address: {
122
- countryCode: "IS"
123
- }
124
- }
125
- }
126
- } }),
67
+ react_1.default.createElement(antd_1.Form, __assign({}, formItemLayout, { form: form, onFinish: handleSubmit, initialValues: { abc: "abc" } }),
127
68
  react_1.default.createElement("h1", null, "Invoice"),
128
69
  react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
129
70
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
130
- react_1.default.createElement(components_1.Supplier, null)),
71
+ react_1.default.createElement(payer_1.default, null)),
131
72
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
132
- react_1.default.createElement(components_1.Customer, null)),
73
+ react_1.default.createElement(delivery_location_1.default, null)),
133
74
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
134
- react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "invoice" })),
75
+ react_1.default.createElement(issuer_1.default, { issuer: props.issuer })),
135
76
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
136
- react_1.default.createElement(components_1.DeliveryLocation, null)),
77
+ react_1.default.createElement(base_information_1.default, { form: form, documentType: "invoice" })),
137
78
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } },
138
- react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form })),
79
+ react_1.default.createElement(billing_lines_1.default, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form })),
139
80
  react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 }, xl: { span: 8 } },
140
- react_1.default.createElement(components_1.PaymentMethod, null)),
141
- react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } },
142
- react_1.default.createElement(components_1.Attachments, { handleAddFile: handleAddFile })),
81
+ react_1.default.createElement(payment_method_1.default, null)),
82
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 }, xl: { span: 16 } }),
143
83
  react_1.default.createElement(antd_1.Col, { span: 24 },
144
84
  react_1.default.createElement(antd_1.Form.Item, null,
145
85
  react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit" }, "Submit")))))));
@@ -1 +1 @@
1
- import "antd/dist/antd.compact.css";
1
+ export {};
package/lib/index.js CHANGED
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // Enums, Types
7
- __export(require("./common/enums"));
8
3
  // Components
9
4
  var create_invoice_1 = require("./create-invoice");
10
5
  exports.CreateInvoice = create_invoice_1.default;
@@ -1,12 +1,9 @@
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
- import { InjectedIntlProps } from "react-intl";
5
- interface Props extends InjectedIntlProps {
4
+ interface Props {
6
5
  form: FormInstance;
7
6
  documentType: "creditNote" | "invoice";
8
7
  }
9
- declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "documentType">, any> & {
10
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
11
- };
12
- export default BaseInformationIntl;
8
+ declare const BaseInformation: React.FC<Props>;
9
+ export default BaseInformation;
@@ -1,13 +1,27 @@
1
1
  import * as React from 'react';
2
2
  import '@ant-design/compatible/assets/index.css';
3
3
  import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
4
- import { InjectedIntlProps } from "react-intl";
4
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
5
5
  import { FormInstance } from "antd/es/form";
6
- interface Props extends InjectedIntlProps {
6
+ import { ColumnType } from 'antd/es/table';
7
+ interface EditableColumnProps<T> extends ColumnType<T> {
8
+ editable?: boolean;
9
+ }
10
+ interface Props {
7
11
  formInstance: FormInstance;
8
12
  setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
9
13
  }
10
- declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "setBillingLineMetadata">, any> & {
11
- WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
12
- };
13
- export default BillingLinesIntl;
14
+ interface States {
15
+ dataSource: BillingLineMetadataOverride[];
16
+ editableIndex: number;
17
+ }
18
+ declare class BillingLines extends React.Component<Props, States> {
19
+ columns: EditableColumnProps<BillingLineMetadataOverride>[];
20
+ constructor(props: Props);
21
+ renderCurrencyColumn: (text: string) => string;
22
+ handleDelete: (index: number) => void;
23
+ handleAdd: () => void;
24
+ handleSave: (row: BillingLineMetadataOverride, formInstance: FormInstance) => void;
25
+ render(): JSX.Element;
26
+ }
27
+ export default BillingLines;
@@ -1,6 +1,3 @@
1
1
  import * as React from 'react';
2
- import { InjectedIntlProps } from "react-intl";
3
- declare const DeliveryLocationIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
- WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
- };
6
- export default DeliveryLocationIntl;
2
+ declare const DeliveryLocation: React.FC;
3
+ export default DeliveryLocation;