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

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 (101) 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 +8 -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 +23 -9
  9. package/lib/common/components/billing-lines/index.js +38 -116
  10. package/lib/common/components/delivery-location/index.d.ts +2 -5
  11. package/lib/common/components/delivery-location/index.js +11 -43
  12. package/lib/common/components/editable-cell/index.d.ts +1 -1
  13. package/lib/common/components/editable-cell/index.js +10 -76
  14. package/lib/common/components/editable-row/index.d.ts +5 -5
  15. package/lib/common/components/editable-row/index.js +6 -8
  16. package/lib/common/components/index.d.ts +5 -10
  17. package/lib/common/components/index.js +8 -20
  18. package/lib/common/components/issuer/index.d.ts +7 -0
  19. package/lib/common/components/{customer/hardCoddedCustomer.js → issuer/index.js} +8 -5
  20. package/lib/common/components/payer/index.d.ts +3 -0
  21. package/lib/common/components/payer/index.js +50 -0
  22. package/lib/common/components/payment-method/index.d.ts +3 -6
  23. package/lib/common/components/payment-method/index.js +17 -57
  24. package/lib/common/consts/validationRules.d.ts +3 -2
  25. package/lib/common/consts/validationRules.js +7 -0
  26. package/lib/common/enums/index.d.ts +1 -1
  27. package/lib/common/enums/index.js +4 -2
  28. package/lib/common/types/BillingLineMetadataOverride.d.ts +0 -1
  29. package/lib/create-credit-note/index.d.ts +2 -1
  30. package/lib/create-credit-note/index.js +14 -6
  31. package/lib/create-invoice/index.d.ts +2 -1
  32. package/lib/create-invoice/index.js +21 -79
  33. package/lib/example/src/index.d.ts +1 -1
  34. package/lib/index.js +0 -5
  35. package/lib/src/common/components/attachments/Attachment.d.ts +2 -8
  36. package/lib/src/common/components/attachments/index.d.ts +2 -9
  37. package/lib/src/common/components/base-information/index.d.ts +3 -6
  38. package/lib/src/common/components/billing-lines/index.d.ts +23 -9
  39. package/lib/src/common/components/delivery-location/index.d.ts +2 -5
  40. package/lib/src/common/components/editable-cell/index.d.ts +1 -1
  41. package/lib/src/common/components/editable-row/index.d.ts +5 -5
  42. package/lib/src/common/components/issuer/index.d.ts +7 -0
  43. package/lib/src/common/components/payer/index.d.ts +3 -0
  44. package/lib/src/common/components/payment-method/index.d.ts +3 -6
  45. package/lib/src/common/consts/validationRules.d.ts +3 -2
  46. package/lib/src/create-credit-note/index.d.ts +9 -0
  47. package/lib/src/create-invoice/index.d.ts +2 -1
  48. package/lib/src/index.d.ts +4 -0
  49. package/lib/style/index.css +1222 -0
  50. package/lib/utils/ApiUtility.d.ts +1 -8
  51. package/lib/utils/ApiUtility.js +1 -17
  52. package/lib/utils/ConversionUtility.d.ts +4 -5
  53. package/lib/utils/ConversionUtility.js +133 -121
  54. package/lib/utils/index.d.ts +2 -2
  55. package/lib/utils/index.js +2 -2
  56. package/package.json +7 -12
  57. package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  58. package/lib/common/components/base-information/ReferenceIdentifiers.js +0 -40
  59. package/lib/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  60. package/lib/common/components/billing-lines/BillingCalculations.js +0 -61
  61. package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  62. package/lib/common/components/billing-lines/BillingTaxSummary.js +0 -51
  63. package/lib/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  64. package/lib/common/components/billing-lines/billingLIneFormData.js +0 -63
  65. package/lib/common/components/customer/hardCoddedCustomer.d.ts +0 -7
  66. package/lib/common/components/customer/index.d.ts +0 -6
  67. package/lib/common/components/customer/index.js +0 -93
  68. package/lib/common/components/form-item/index.d.ts +0 -21
  69. package/lib/common/components/form-item/index.js +0 -27
  70. package/lib/common/components/locale-intl/index.d.ts +0 -10
  71. package/lib/common/components/locale-intl/index.js +0 -45
  72. package/lib/common/components/supplier/index.d.ts +0 -6
  73. package/lib/common/components/supplier/index.js +0 -93
  74. package/lib/common/types/ReceiverRequirements.d.ts +0 -81
  75. package/lib/common/types/ReceiverRequirements.js +0 -379
  76. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +0 -6
  77. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +0 -11
  78. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +0 -10
  79. package/lib/src/common/components/billing-lines/billingLIneFormData.d.ts +0 -7
  80. package/lib/src/common/components/customer/index.d.ts +0 -6
  81. package/lib/src/common/components/form-item/index.d.ts +0 -21
  82. package/lib/src/common/components/index.d.ts +0 -10
  83. package/lib/src/common/components/locale-intl/index.d.ts +0 -10
  84. package/lib/src/common/components/supplier/index.d.ts +0 -6
  85. package/lib/src/common/types/ReceiverRequirements.d.ts +0 -81
  86. package/lib/src/translations/locales.d.ts +0 -74
  87. package/lib/src/utils/ApiUtility.d.ts +0 -21
  88. package/lib/src/utils/BillingLineUtility.d.ts +0 -8
  89. package/lib/src/utils/ConversionUtility.d.ts +0 -5
  90. package/lib/src/utils/RequirementsUtility.d.ts +0 -5
  91. package/lib/src/utils/billingLineFormData.d.ts +0 -7
  92. package/lib/src/utils/index.d.ts +0 -2
  93. package/lib/translations/locales/is.json +0 -70
  94. package/lib/translations/locales.d.ts +0 -74
  95. package/lib/translations/locales.js +0 -10
  96. package/lib/utils/BillingLineUtility.d.ts +0 -8
  97. package/lib/utils/BillingLineUtility.js +0 -66
  98. package/lib/utils/RequirementsUtility.d.ts +0 -5
  99. package/lib/utils/RequirementsUtility.js +0 -23
  100. package/lib/utils/billingLineFormData.d.ts +0 -7
  101. package/lib/utils/billingLineFormData.js +0 -63
@@ -35,87 +35,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  var React = __importStar(require("react"));
38
- var components_1 = require("../../components");
38
+ var component_container_1 = __importDefault(require("../component-container"));
39
39
  var icons_1 = require("@ant-design/icons");
40
40
  require("@ant-design/compatible/assets/index.css");
41
41
  var antd_1 = require("antd");
42
42
  var models_1 = require("@unimaze/api-clients/lib/mapi/models");
43
- var react_intl_1 = require("react-intl");
44
- var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
45
- var api_1 = require("@unimaze/api-clients/lib/mapi/api");
46
- var BillingCalculations_1 = __importDefault(require("./BillingCalculations"));
47
- var BillingTaxSummary_1 = __importDefault(require("./BillingTaxSummary"));
48
- var translationMessages = react_intl_1.defineMessages({
49
- billingLines_title: {
50
- id: "billingLines_title",
51
- defaultMessage: "Document lines",
52
- },
53
- billingLines_itemNo: {
54
- id: "billingLines_itemNo",
55
- defaultMessage: "Item no",
56
- },
57
- billingLines_name: {
58
- id: "billingLines_itemNo",
59
- defaultMessage: "Name"
60
- },
61
- billingLines_quantity: {
62
- id: "billingLines_quantity",
63
- defaultMessage: "Quantity"
64
- },
65
- billingLines_unitOfMeasure: {
66
- id: "billingLines_unitOfMeasure",
67
- defaultMessage: "Unit of measure"
68
- },
69
- billingLines_unitPriceAmount: {
70
- id: "billingLines_unitPriceAmount",
71
- defaultMessage: "Unit price amount"
72
- },
73
- billingLines_taxCategoryType: {
74
- id: "billingLines_taxCategoryType",
75
- defaultMessage: "Tax category"
76
- },
77
- billingLines_taxCategoryPercentage: {
78
- id: "billingLines_taxCategoryPercentage",
79
- defaultMessage: "Tax percentage"
80
- },
81
- billingLines_discount: {
82
- id: "billingLines_discount",
83
- defaultMessage: "Discount"
84
- },
85
- billingLines_lineAmount: {
86
- id: "billingLines_lineAmount",
87
- defaultMessage: "Amount"
88
- },
89
- billingLines_taxAmount: {
90
- id: "billingLines_taxAmount",
91
- defaultMessage: "Tax inclusive amount"
92
- },
93
- billingLines_button_addRow: {
94
- id: "billingLines_button_addRow",
95
- defaultMessage: "Add a row"
96
- },
97
- });
43
+ var editable_cell_1 = __importDefault(require("../editable-cell"));
44
+ var editable_row_1 = __importDefault(require("../editable-row"));
98
45
  var BillingLines = /** @class */ (function (_super) {
99
46
  __extends(BillingLines, _super);
100
47
  function BillingLines(props) {
101
48
  var _this = _super.call(this, props) || this;
102
49
  _this.renderCurrencyColumn = function (text) {
103
- var currency = _this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) ? _this.props.formInstance.getFieldValue(["invoice", "currencyCode"]) : "";
50
+ var currency = _this.props.form.getFieldValue("baseInformation:currency") ? _this.props.form.getFieldValue("baseInformation:currency") : "";
104
51
  return text + " " + currency;
105
52
  };
106
53
  _this.handleDelete = function (index) {
107
- var newDataSource = _this.state.dataSource.slice();
54
+ var newDataSource = _this.state.dataSource;
108
55
  newDataSource.splice(index, 1);
109
56
  _this.setState(function (prevState) { return (__assign({}, prevState, { dataSource: newDataSource })); });
110
57
  };
111
58
  _this.handleAdd = function () {
112
59
  var dataSource = _this.state.dataSource;
113
60
  var newData = {
114
- key: _this.state.editableIndex,
115
61
  itemNo: "Item No.",
116
62
  quantity: 0,
117
63
  taxAmount: 0,
118
- name: "New Item",
64
+ name: "New item",
119
65
  unitOfMeasure: models_1.UnitOfMeasureMetadataUnitEnum.Piece,
120
66
  unitPriceAmount: 0,
121
67
  taxCategoryType: models_1.BillingLineMetadataTaxCategoryTypeEnum.StandardRated,
@@ -123,12 +69,12 @@ var BillingLines = /** @class */ (function (_super) {
123
69
  taxableAmount: 0,
124
70
  taxPercentage: null
125
71
  };
126
- _this.setState(__assign({}, _this.state, { dataSource: dataSource.concat([newData]), editableIndex: _this.state.editableIndex + 1 }));
72
+ _this.setState(function (prevState) { return (__assign({}, prevState, { dataSource: prevState.dataSource.concat([newData]), editableIndex: prevState.dataSource.length + 1 })); });
127
73
  };
128
- _this.handleSave = function (row, formInstance) {
74
+ _this.handleSave = function (row, form) {
129
75
  var newData = _this.state.dataSource.slice();
130
76
  var index = newData.findIndex(function (i) {
131
- return row.key === i.key;
77
+ return row.itemNo === i.itemNo;
132
78
  });
133
79
  var item = newData[index];
134
80
  newData.splice(index, 1, __assign({}, item, row));
@@ -137,83 +83,58 @@ var BillingLines = /** @class */ (function (_super) {
137
83
  unit: current.unitOfMeasure,
138
84
  } });
139
85
  });
140
- _this.setState(__assign({}, _this.state, { dataSource: newData }));
141
- _this.props.setBillingLineMetadata(formInstance, billingLineMetadata);
86
+ _this.setState({ dataSource: newData });
87
+ _this.props.setBillingLineMetadata(form, billingLineMetadata);
142
88
  };
143
89
  _this.state = {
144
90
  dataSource: [],
145
- editableIndex: 0,
91
+ editableIndex: null,
146
92
  };
147
93
  _this.columns = [
148
94
  {
149
- title: _this.props.intl.formatMessage(translationMessages.billingLines_itemNo),
95
+ title: "Item No",
150
96
  dataIndex: 'itemNo',
151
97
  editable: true,
152
98
  },
153
99
  {
154
- title: _this.props.intl.formatMessage(translationMessages.billingLines_name),
100
+ title: "Name",
155
101
  dataIndex: 'name',
156
102
  editable: true,
157
103
  },
158
104
  {
159
- title: _this.props.intl.formatMessage(translationMessages.billingLines_quantity),
105
+ title: "Quantity",
160
106
  dataIndex: 'quantity',
161
107
  editable: true,
162
- align: "right",
163
108
  },
164
109
  {
165
- title: _this.props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure),
110
+ title: "Unit of measure",
166
111
  dataIndex: 'unitOfMeasure',
167
112
  editable: true,
168
113
  },
169
114
  {
170
- title: _this.props.intl.formatMessage(translationMessages.billingLines_unitPriceAmount),
115
+ title: "Unit price amount",
171
116
  dataIndex: 'unitPriceAmount',
172
117
  editable: true,
173
- align: "right",
174
118
  },
175
119
  {
176
- title: _this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryType),
120
+ title: "Tax category",
177
121
  dataIndex: 'taxCategoryType',
178
122
  editable: true,
179
123
  },
180
124
  {
181
- title: _this.props.intl.formatMessage(translationMessages.billingLines_taxCategoryPercentage),
182
- dataIndex: 'taxCategoryPercentage',
183
- editable: false,
184
- align: "right",
185
- render: (function (text, record) {
186
- var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[record.taxCategoryType]); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
187
- return React.createElement("span", null,
188
- taxPercentage,
189
- "%");
190
- })
191
- },
192
- {
193
- title: _this.props.intl.formatMessage(translationMessages.billingLines_discount),
125
+ title: "Discount",
194
126
  dataIndex: 'discountValue',
195
127
  editable: true,
196
- align: "right",
197
128
  },
198
129
  {
199
- title: _this.props.intl.formatMessage(translationMessages.billingLines_lineAmount),
130
+ title: "Line amount",
200
131
  dataIndex: 'taxableAmount',
201
- editable: false,
202
- align: "right",
203
- render: function (text, record) {
204
- return (React.createElement("span", null, BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount).toFixed(2)));
205
- }
206
- },
207
- {
208
- title: _this.props.intl.formatMessage(translationMessages.billingLines_taxAmount),
209
- dataIndex: 'taxInclusiveAmount',
210
- editable: false,
211
- align: "right",
212
132
  render: function (text, record) {
213
- var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(api_1.TaxCategoryTypeEnum[record.taxCategoryType])); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
214
- var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(record.discountValue, record.quantity, record.unitPriceAmount);
215
- var taxInclusiveAmount = taxableAmount + taxAmount;
216
- return (React.createElement("span", null, taxInclusiveAmount.toFixed(2)));
133
+ var lineAmount = 0;
134
+ if (record.quantity && record.unitPriceAmount) {
135
+ lineAmount = record.quantity * record.unitPriceAmount;
136
+ }
137
+ return (React.createElement("span", null, lineAmount));
217
138
  }
218
139
  },
219
140
  {
@@ -234,8 +155,8 @@ var BillingLines = /** @class */ (function (_super) {
234
155
  // console.log(dataSource);
235
156
  var components = {
236
157
  body: {
237
- row: components_1.EditableRow,
238
- cell: components_1.EditableCell,
158
+ row: editable_row_1.default,
159
+ cell: editable_cell_1.default,
239
160
  },
240
161
  };
241
162
  var columns = this.columns.map(function (col) {
@@ -247,18 +168,19 @@ var BillingLines = /** @class */ (function (_super) {
247
168
  editable: col.editable,
248
169
  dataIndex: col.dataIndex,
249
170
  title: col.title ? col.title.toString() : "",
250
- handleSave: function (billingLineMetadataOverrideRecord, rowIndex) { return _this.handleSave(billingLineMetadataOverrideRecord, _this.props.formInstance); },
171
+ handleSave: _this.handleSave,
251
172
  }); } });
252
173
  });
253
- return (React.createElement(components_1.ComponentContainer, { title: this.props.intl.formatMessage(translationMessages.billingLines_title), action: React.createElement(antd_1.Button, { onClick: this.handleAdd, type: "primary", style: { marginBottom: 16 } }, this.props.intl.formatMessage(translationMessages.billingLines_button_addRow)) },
254
- React.createElement(antd_1.Table, { style: { minHeight: "170px" }, components: components, dataSource: dataSource, columns: columns, pagination: false, rowKey: (function (record, index) { return index.toString(); }) }),
255
- React.createElement(antd_1.Row, { style: { marginTop: "1em" }, align: "top", justify: "space-between", gutter: [16, 16] },
256
- React.createElement(antd_1.Col, { span: 16 },
257
- React.createElement(BillingTaxSummary_1.default, { billingLines: dataSource })),
258
- React.createElement(antd_1.Col, { span: 8 },
259
- React.createElement(BillingCalculations_1.default, { billingLinesMetadata: dataSource, renderCurrencyColumn: this.renderCurrencyColumn })))));
174
+ return (React.createElement(component_container_1.default, { title: "Document Lines", action: React.createElement(antd_1.Button, { onClick: this.handleAdd, type: "primary", style: { marginBottom: 16 } }, "Add a row") },
175
+ React.createElement(antd_1.Table, { components: components, dataSource: dataSource, columns: columns, pagination: false, rowKey: function (record, index) {
176
+ if (index) {
177
+ return (index.toString());
178
+ }
179
+ else {
180
+ return Math.random().toString();
181
+ }
182
+ } })));
260
183
  };
261
184
  return BillingLines;
262
185
  }(React.Component));
263
- var BillingLinesIntl = react_intl_1.injectIntl(BillingLines);
264
- exports.default = BillingLinesIntl;
186
+ exports.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;
@@ -11,50 +11,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  var React = __importStar(require("react"));
14
- var components_1 = require("../../components");
14
+ var component_container_1 = __importDefault(require("../component-container"));
15
15
  var antd_1 = require("antd");
16
- var form_item_1 = __importDefault(require("../form-item"));
17
- var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
18
- var react_intl_1 = require("react-intl");
19
- // import {defineMessages} from "react-intl.macro"
20
- var translationMessages = react_intl_1.defineMessages({
21
- deliveryLocation_title: {
22
- id: "deliveryLocation_title",
23
- defaultMessage: "Delivery location",
24
- },
25
- deliveryLocation_partyName: {
26
- id: "deliveryLocation_partyName",
27
- defaultMessage: "Party name",
28
- },
29
- deliveryLocation_streetNameAndNumber: {
30
- id: "deliveryLocation_streetNameAndNumber",
31
- defaultMessage: "Address"
32
- },
33
- deliveryLocation_postalZone: {
34
- id: "deliveryLocation_postalZone",
35
- defaultMessage: "Postal no"
36
- },
37
- deliveryLocation_city: {
38
- id: "deliveryLocation_city",
39
- defaultMessage: "Town/City"
40
- },
41
- deliveryLocation_countryCode: {
42
- id: "deliveryLocation_countryCode",
43
- defaultMessage: "Country code"
44
- }
45
- });
46
- var DeliveryLocation = function (props) {
47
- return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.deliveryLocation_title) },
48
- React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["delivery.partyName"], defaultLabel: props.intl.formatMessage(translationMessages.deliveryLocation_partyName), defaultIsRequired: false, fieldName: ["invoice", "delivery", "partyName"] },
16
+ var DeliveryLocation = function () {
17
+ return (React.createElement(component_container_1.default, { title: "Delivery location" },
18
+ React.createElement(antd_1.Form.Item, { label: "Description", name: "deliveryLocation:description" },
49
19
  React.createElement(antd_1.Input, null)),
50
- React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["delivery.address.streetNameAndNumber"], defaultLabel: props.intl.formatMessage(translationMessages.deliveryLocation_streetNameAndNumber), defaultIsRequired: false, fieldName: ["invoice", "delivery", "address", "streetNameAndNumber"] },
20
+ React.createElement(antd_1.Form.Item, { label: "Address", name: "deliveryLocation:address" },
51
21
  React.createElement(antd_1.Input, null)),
52
- React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["delivery.address.postalZone"], defaultLabel: props.intl.formatMessage(translationMessages.deliveryLocation_postalZone), defaultIsRequired: false, fieldName: ["invoice", "delivery", "address", "postalZone"] },
53
- React.createElement(antd_1.Input, null)),
54
- React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["delivery.address.city"], defaultLabel: props.intl.formatMessage(translationMessages.deliveryLocation_city), defaultIsRequired: false, fieldName: ["invoice", "delivery", "address", "city"] },
55
- React.createElement(antd_1.Input, null)),
56
- React.createElement(form_item_1.default, { receiverRequirements: ReceiverRequirements_1.receiverRequirementsObject, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["delivery.address.countryCode"], defaultLabel: props.intl.formatMessage(translationMessages.deliveryLocation_countryCode), defaultIsRequired: true, fieldName: ["invoice", "delivery", "address", "countryCode"] },
57
- React.createElement(antd_1.Input, null))));
22
+ React.createElement(antd_1.Form.Item, { label: "Post no., town/city", style: { marginBottom: 0 } },
23
+ React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "30%" }, name: "deliveryLocation:postNo" },
24
+ React.createElement(antd_1.Input, null)),
25
+ React.createElement(antd_1.Form.Item, { style: { display: 'inline-block', width: "70%", paddingLeft: "3px" }, name: "deliveryLocation:city" },
26
+ React.createElement(antd_1.Input, null)))));
58
27
  };
59
- var DeliveryLocationIntl = react_intl_1.injectIntl(DeliveryLocation);
60
- exports.default = DeliveryLocationIntl;
28
+ exports.default = DeliveryLocation;
@@ -3,7 +3,7 @@ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOver
3
3
  interface EditableCellProps {
4
4
  record: BillingLineMetadataOverride;
5
5
  handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
6
- dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
6
+ dataIndex: keyof BillingLineMetadataOverride;
7
7
  editable: boolean;
8
8
  index: number;
9
9
  }
@@ -10,41 +10,6 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- 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;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
13
  var __rest = (this && this.__rest) || function (s, e) {
49
14
  var t = {};
50
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -63,7 +28,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
63
28
  result["default"] = mod;
64
29
  return result;
65
30
  };
66
- var _this = this;
67
31
  Object.defineProperty(exports, "__esModule", { value: true });
68
32
  var react_1 = __importStar(require("react"));
69
33
  var antd_1 = require("antd");
@@ -76,66 +40,36 @@ var EditableCell = function (props) {
76
40
  record = props.record, index = props.index, handleSave = props.handleSave, children = props.children, restProps = __rest(props, ["editable", "dataIndex", "record", "index", "handleSave", "children"]);
77
41
  var _a = react_1.useState(false), editing = _a[0], setEditing = _a[1];
78
42
  var input = null;
79
- var form = react_1.useContext(editable_row_1.EditableContext);
80
43
  var toggleEdit = function () {
81
44
  setEditing(!editing);
82
45
  if (!editing && input)
83
46
  input.focus();
84
47
  };
85
- var save = function () { return __awaiter(_this, void 0, void 0, function () {
86
- var values, errInfo_1;
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
89
- case 0:
90
- _a.trys.push([0, 2, , 3]);
91
- return [4 /*yield*/, form.validateFields()];
92
- case 1:
93
- values = _a.sent();
94
- toggleEdit();
95
- handleSave(__assign({}, record, values));
96
- return [3 /*break*/, 3];
97
- case 2:
98
- errInfo_1 = _a.sent();
99
- // tslint:disable-next-line:no-console
100
- console.log('Save failed:', errInfo_1);
101
- return [3 /*break*/, 3];
102
- case 3: return [2 /*return*/];
103
- }
104
- });
105
- }); };
106
48
  var getCorrectInputNode = function (dataIdx) {
107
49
  switch (dataIdx) {
108
50
  case "quantity":
109
51
  case "unitPriceAmount":
110
- return react_1.default.createElement(antd_1.InputNumber, { step: 1,
111
- // ref={node => (input = node)}
112
- // onPressEnter={save}
113
- onBlur: save });
52
+ case "taxableAmount":
53
+ case "taxAmount":
54
+ case "taxPercentage":
114
55
  case "discountValue":
115
- return react_1.default.createElement(antd_1.Input, { onBlur: save });
56
+ case "accountingCost":
57
+ return react_1.default.createElement(antd_1.InputNumber, { step: 0.01 });
116
58
  case "unitOfMeasure":
117
- return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); }, defaultActiveFirstOption: true,
118
- // onSelect={save}
119
- onChange: save }, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
120
- if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
121
- return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, unitOfMeasure));
59
+ return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); }, defaultActiveFirstOption: true }, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
60
+ return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, unitOfMeasure));
122
61
  })));
123
62
  case "taxCategoryType":
124
- return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); }, defaultActiveFirstOption: true,
125
- // onSelect={save}
126
- onChange: save }, Object.keys(models_1.BillingLineMetadataTaxCategoryTypeEnum).map(function (taxCategoryType) {
63
+ return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); }, defaultActiveFirstOption: true }, Object.keys(models_1.BillingLineMetadataTaxCategoryTypeEnum).map(function (taxCategoryType) {
127
64
  return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
128
65
  })));
129
66
  default:
130
- return react_1.default.createElement(antd_1.Input, { ref: function (node) { return (input = node); },
131
- // onPressEnter={save}
132
- onBlur: save });
67
+ return react_1.default.createElement(antd_1.Input, { ref: function (node) { return (input = node); } });
133
68
  }
134
69
  };
135
70
  var renderCell = function () {
136
71
  var inputNode = getCorrectInputNode(dataIndex);
137
- var rules = validationRules_1.validationRules[dataIndex];
138
- return editing ? (react_1.default.createElement(antd_1.Form.Item, { style: { margin: 0 }, rules: rules, name: dataIndex, initialValue: record[dataIndex] }, inputNode)) : (react_1.default.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24 }, onClick: toggleEdit }, children));
72
+ return editing ? (react_1.default.createElement(antd_1.Form.Item, { style: { margin: 0 }, rules: validationRules_1.validationRules[dataIndex], name: dataIndex, initialValue: record[dataIndex] }, inputNode)) : (react_1.default.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24 }, onClick: toggleEdit }, children));
139
73
  };
140
74
  return (react_1.default.createElement("td", __assign({}, restProps), editable ? (react_1.default.createElement(editable_row_1.EditableContext.Consumer, null, renderCell)) : (children)));
141
75
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import 'antd/dist/antd.css';
3
- import { FormInstance } from "antd/lib/form";
4
- export declare const EditableContext: React.Context<FormInstance>;
5
- declare const EditableRow: ({ index, ...props }: any) => JSX.Element;
6
- export default EditableRow;
2
+ import { WrappedFormUtils } from '@ant-design/compatible/es/form/Form';
3
+ import '@ant-design/compatible/assets/index.css';
4
+ export declare const EditableContext: React.Context<WrappedFormUtils<any>>;
5
+ declare const _default: import("@ant-design/compatible/lib/form/interface").ConnectedComponentClass<({ form, index, ...props }: any) => JSX.Element, Pick<import("@ant-design/compatible/lib/form").FormComponentProps<any>, "wrappedComponentRef">>;
6
+ export default _default;
@@ -30,14 +30,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  var React = __importStar(require("react"));
33
- var antd_1 = require("antd");
34
- require("antd/dist/antd.css");
33
+ var compatible_1 = require("@ant-design/compatible");
34
+ require("@ant-design/compatible/assets/index.css");
35
35
  exports.EditableContext = React.createContext({});
36
36
  var EditableRow = function (_a) {
37
- var index = _a.index, props = __rest(_a, ["index"]);
38
- var form = antd_1.Form.useForm()[0];
39
- return React.createElement(antd_1.Form, { form: form, component: false },
40
- React.createElement(exports.EditableContext.Provider, { value: form },
41
- React.createElement("tr", __assign({}, props))));
37
+ var form = _a.form, index = _a.index, props = __rest(_a, ["form", "index"]);
38
+ return (React.createElement(exports.EditableContext.Provider, { value: form },
39
+ React.createElement("tr", __assign({}, props))));
42
40
  };
43
- exports.default = EditableRow;
41
+ exports.default = compatible_1.Form.create()(EditableRow);
@@ -1,10 +1,5 @@
1
- export { default as Attachments } from "./attachments";
2
- export { default as BaseInformation } from "./base-information";
3
- export { default as BillingLines } from "./billing-lines";
4
- export { default as ComponentContainer } from "./component-container";
5
- export { default as Customer } from "./customer";
6
- export { default as DeliveryLocation } from "./delivery-location";
7
- export { default as EditableCell } from "./editable-cell";
8
- export { default as EditableRow } from "./editable-row";
9
- export { default as PaymentMethod } from "./payment-method";
10
- export { default as Supplier } from "./supplier";
1
+ export * from "./component-container";
2
+ export * from "./payer";
3
+ export * from "./issuer";
4
+ export * from "./base-information";
5
+ export * from "./delivery-location";
@@ -1,22 +1,10 @@
1
1
  "use strict";
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var attachments_1 = require("./attachments");
4
- exports.Attachments = attachments_1.default;
5
- var base_information_1 = require("./base-information");
6
- exports.BaseInformation = base_information_1.default;
7
- var billing_lines_1 = require("./billing-lines");
8
- exports.BillingLines = billing_lines_1.default;
9
- var component_container_1 = require("./component-container");
10
- exports.ComponentContainer = component_container_1.default;
11
- var customer_1 = require("./customer");
12
- exports.Customer = customer_1.default;
13
- var delivery_location_1 = require("./delivery-location");
14
- exports.DeliveryLocation = delivery_location_1.default;
15
- var editable_cell_1 = require("./editable-cell");
16
- exports.EditableCell = editable_cell_1.default;
17
- var editable_row_1 = require("./editable-row");
18
- exports.EditableRow = editable_row_1.default;
19
- var payment_method_1 = require("./payment-method");
20
- exports.PaymentMethod = payment_method_1.default;
21
- var supplier_1 = require("./supplier");
22
- exports.Supplier = supplier_1.default;
6
+ __export(require("./component-container"));
7
+ __export(require("./payer"));
8
+ __export(require("./issuer"));
9
+ __export(require("./base-information"));
10
+ __export(require("./delivery-location"));
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { wapi2 } from "@unimaze/api-clients";
3
+ interface Props {
4
+ issuer: wapi2.ProfileOutput;
5
+ }
6
+ declare const Issuer: React.FC<Props>;
7
+ export default Issuer;
@@ -6,12 +6,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
6
6
  result["default"] = mod;
7
7
  return result;
8
8
  };
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
10
13
  var React = __importStar(require("react"));
11
- var components_1 = require("../../components");
12
- var Customer = function (props) {
13
- var _a = props.customer, participantLegalIsoIdentifier = _a.participantLegalIsoIdentifier, participantLegalAddressPostalCode = _a.participantLegalAddressPostalCode, participantLegalAddressCity = _a.participantLegalAddressCity, participantLegalAddressStreet = _a.participantLegalAddressStreet, email = _a.email, name = _a.name, country = _a.country;
14
- return (React.createElement(components_1.ComponentContainer, { title: "Invoice payer" },
14
+ var component_container_1 = __importDefault(require("../component-container"));
15
+ var Issuer = function (props) {
16
+ var _a = props.issuer, participantLegalIsoIdentifier = _a.participantLegalIsoIdentifier, participantLegalAddressPostalCode = _a.participantLegalAddressPostalCode, participantLegalAddressCity = _a.participantLegalAddressCity, participantLegalAddressStreet = _a.participantLegalAddressStreet, email = _a.email, name = _a.name, country = _a.country;
17
+ return (React.createElement(component_container_1.default, { title: "Issuer" },
15
18
  React.createElement("div", null,
16
19
  React.createElement("strong", null, name),
17
20
  " (",
@@ -22,4 +25,4 @@ var Customer = function (props) {
22
25
  React.createElement("div", null, country),
23
26
  React.createElement("div", null, email)));
24
27
  };
25
- exports.default = Customer;
28
+ exports.default = Issuer;
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const Payer: React.FC;
3
+ export default Payer;