@unimaze/billing 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/common/components/base-information/CostCenter.d.ts +12 -0
  2. package/lib/common/components/base-information/CostCenter.js +107 -0
  3. package/lib/common/components/base-information/index.js +6 -0
  4. package/lib/common/types/ReceiverRequirements.d.ts +1 -0
  5. package/lib/common/types/ReceiverRequirements.js +1 -0
  6. package/lib/create-invoice/CreateInvoiceConstructor.d.ts +11 -0
  7. package/lib/create-invoice/CreateInvoiceConstructor.js +213 -0
  8. package/lib/example/src/index.d.ts +1 -0
  9. package/lib/src/common/components/attachments/Attachment.d.ts +18 -0
  10. package/lib/src/common/components/attachments/index.d.ts +6 -0
  11. package/lib/src/common/components/base-information/ReferenceIdentifiers.d.ts +17 -0
  12. package/lib/src/common/components/base-information/index.d.ts +11 -0
  13. package/lib/src/common/components/billing-lines/BillingCalculations.d.ts +11 -0
  14. package/lib/src/common/components/billing-lines/BillingTaxSummary.d.ts +10 -0
  15. package/lib/src/common/components/billing-lines/index.d.ts +19 -0
  16. package/lib/src/common/components/component-container/Content.d.ts +7 -0
  17. package/lib/src/common/components/component-container/Header.d.ts +9 -0
  18. package/lib/src/common/components/component-container/index.d.ts +10 -0
  19. package/lib/src/common/components/customer/index.d.ts +15 -0
  20. package/lib/src/common/components/delivery-location/index.d.ts +6 -0
  21. package/lib/src/common/components/editable-cell/index.d.ts +11 -0
  22. package/lib/src/common/components/editable-row/index.d.ts +5 -0
  23. package/lib/src/common/components/form-item/index.d.ts +23 -0
  24. package/lib/src/common/components/index.d.ts +10 -0
  25. package/lib/src/common/components/locale-intl/index.d.ts +10 -0
  26. package/lib/src/common/components/payment-method/index.d.ts +6 -0
  27. package/lib/src/common/components/payment-method/paymentMethodForConversion.d.ts +9 -0
  28. package/lib/src/common/components/supplier/index.d.ts +10 -0
  29. package/lib/src/common/consts/formLayout.d.ts +44 -0
  30. package/lib/src/common/consts/validationRules.d.ts +6 -0
  31. package/lib/src/common/types/ReceiverRequirements.d.ts +81 -0
  32. package/lib/src/create-invoice/index.d.ts +14 -0
  33. package/lib/src/translations/locales.d.ts +77 -0
  34. package/lib/src/utils/ApiUtility.d.ts +21 -0
  35. package/lib/src/utils/BillingLineUtility.d.ts +10 -0
  36. package/lib/src/utils/ConversionUtility.d.ts +8 -0
  37. package/lib/src/utils/RequirementsUtility.d.ts +5 -0
  38. package/lib/src/utils/index.d.ts +2 -0
  39. package/lib/style/index.css +50 -50
  40. package/lib/utils/ConversionUtility.js +7 -0
  41. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
4
+ interface Props extends InjectedIntlProps {
5
+ receiverRequirements: NewReceiverRequirements;
6
+ updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void;
7
+ rapiBaseUrl: string;
8
+ }
9
+ declare const _default: React.ComponentClass<Pick<Props, "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl">, any> & {
10
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
11
+ };
12
+ export default _default;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ var react_1 = __importStar(require("react"));
25
+ var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
26
+ var antd_1 = require("antd");
27
+ var form_item_1 = __importDefault(require("../form-item"));
28
+ var react_intl_1 = require("react-intl");
29
+ var axios_1 = __importDefault(require("axios"));
30
+ // import {FormInstance} from "antd/es/form";
31
+ var translationMessages = {
32
+ baseInformation_costCenter: {
33
+ id: "baseInformation_costCenter",
34
+ defaultMessage: "Cost center",
35
+ },
36
+ };
37
+ var getCostCenterFieldDefinitions = function (receiverRequirements) {
38
+ return receiverRequirements && receiverRequirements.fieldDefinitions.find(function (fieldRequirement) { return fieldRequirement.key === "customer.locationIdentifier"; });
39
+ };
40
+ var handleReferenceIdentifierValueSearch = function (searchValue, costCenterFieldDefinition, receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, updateReceiverRequirementsProp) {
41
+ if (costCenterFieldDefinition.properties.href) {
42
+ var searchUrl = rapiBaseUrl + costCenterFieldDefinition.properties.href.replace("%7BtextFilter%7D", searchValue).replace("%7Boffset%7D", "0").replace("%7Blimit%7D", "15");
43
+ setLoadingCostCenterValues(true);
44
+ axios_1.default.get(searchUrl)
45
+ .then(function (response) {
46
+ setLoadingCostCenterValues(false);
47
+ var updatedFieldDefinitions = receiverRequirements.fieldDefinitions.slice();
48
+ var index = updatedFieldDefinitions.findIndex(function (x) { return x.key === costCenterFieldDefinition.key; });
49
+ var updatedReferenceIdentifier = __assign({}, updatedFieldDefinitions[index], { properties: {
50
+ label: updatedFieldDefinitions[index].properties.label,
51
+ href: updatedFieldDefinitions[index].properties.href,
52
+ cardinality: updatedFieldDefinitions[index].properties.cardinality,
53
+ values: response.data.value
54
+ } });
55
+ updatedFieldDefinitions.splice(index, 1, updatedReferenceIdentifier);
56
+ var newReceiverRequirements = __assign({}, receiverRequirements, { fieldDefinitions: updatedFieldDefinitions });
57
+ updateReceiverRequirementsProp(newReceiverRequirements);
58
+ })
59
+ .catch(function (error) {
60
+ setLoadingCostCenterValues(false);
61
+ // tslint:disable-next-line:no-console
62
+ console.log(error);
63
+ });
64
+ }
65
+ };
66
+ var getCostCenterInput = function (receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, loadingCostCenterValues, updateReceiverRequirementsProp) {
67
+ var costCenterFieldDefinition = getCostCenterFieldDefinitions(receiverRequirements);
68
+ if (costCenterFieldDefinition) {
69
+ if (costCenterFieldDefinition.properties && costCenterFieldDefinition.properties.hasOwnProperty("values") && costCenterFieldDefinition.properties.values) {
70
+ var selectProps = costCenterFieldDefinition.properties.hasOwnProperty("href")
71
+ ? {
72
+ showSearch: true,
73
+ filterOption: false,
74
+ onSearch: function (searchValue) {
75
+ handleReferenceIdentifierValueSearch(searchValue, costCenterFieldDefinition, receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, updateReceiverRequirementsProp);
76
+ },
77
+ onChange: function (searchValue) {
78
+ if (!searchValue) {
79
+ handleReferenceIdentifierValueSearch("", costCenterFieldDefinition, receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, updateReceiverRequirementsProp);
80
+ }
81
+ },
82
+ loading: loadingCostCenterValues,
83
+ }
84
+ : {};
85
+ return react_1.default.createElement(antd_1.Select, __assign({ dropdownMatchSelectWidth: false, allowClear: true }, selectProps), costCenterFieldDefinition.properties.values.map(function (costCenterFieldValue) {
86
+ return react_1.default.createElement(antd_1.Select.Option, { key: costCenterFieldValue.key, value: costCenterFieldValue.key }, costCenterFieldValue.name);
87
+ }));
88
+ }
89
+ else {
90
+ return react_1.default.createElement(antd_1.Input, null);
91
+ }
92
+ }
93
+ else {
94
+ return react_1.default.createElement(antd_1.Input, null);
95
+ }
96
+ };
97
+ var CostCenter = function (props) {
98
+ var receiverRequirements = props.receiverRequirements, rapiBaseUrl = props.rapiBaseUrl, updateReceiverRequirementsProp = props.updateReceiverRequirementsProp;
99
+ var _a = react_1.useState(false), loadingCostCenterValues = _a[0], setLoadingCostCenterValues = _a[1];
100
+ if (getCostCenterFieldDefinitions(receiverRequirements)) {
101
+ return (react_1.default.createElement(form_item_1.default, { receiverRequirements: receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.locationIdentifier"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_costCenter), defaultIsRequired: false, fieldName: ["invoice", "customer", "locationIdentifier"] }, getCostCenterInput(receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, loadingCostCenterValues, updateReceiverRequirementsProp)));
102
+ }
103
+ else {
104
+ return null;
105
+ }
106
+ };
107
+ exports.default = react_intl_1.injectIntl(CostCenter);
@@ -56,6 +56,10 @@ var translationMessages = react_intl_1.defineMessages({
56
56
  id: "baseInformation_buyerReferenceLabel_helpText",
57
57
  defaultMessage: "A reference the buyer has requested to be assigned to the invoice, often called \"your reference\". Used by the buyer for internal routing. If buyer has not specifically requested it, the name of the person who ordered or requested the products or services can be used. Must be used when order number is not specified."
58
58
  },
59
+ baseInformation_projectReferenceLabel: {
60
+ id: "baseInformation_projectReferenceLabel",
61
+ defaultMessage: "Project reference"
62
+ },
59
63
  baseInformation_notes: {
60
64
  id: "baseInformation_notes",
61
65
  defaultMessage: "Notes"
@@ -216,6 +220,8 @@ var BaseInformation = function (props) {
216
220
  React.createElement(antd_1.Input, null)),
217
221
  React.createElement(ReferenceIdentifiers_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifierValidateStatus: props.referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus: props.setReferenceIdentifierValidateStatus }),
218
222
  React.createElement(AccountingCost_1.default, { formInstance: props.form, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier }),
223
+ React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["documentReferences.project.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_projectReferenceLabel), defaultIsRequired: false, fieldName: ["invoice", "documentReferences", "project", "documentNo"] },
224
+ React.createElement(antd_1.Input, null)),
219
225
  React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.notes, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_notes), defaultIsRequired: false, fieldName: ["invoice", "notes"] },
220
226
  React.createElement(antd_1.Input.TextArea, null)),
221
227
  React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_currencyCode), defaultIsRequired: true, fieldName: ["invoice", "currencyCode"], initialValue: getCurrencies(props.receiverRequirements)[0].key },
@@ -18,6 +18,7 @@ export declare enum AvailableFields {
18
18
  "notes" = "notes",
19
19
  "accountingCost" = "accountingCost",
20
20
  "buyerReference" = "buyerReference",
21
+ "documentReferences.project.documentNo" = "documentReferences.project.documentNo",
21
22
  "orderReference.documentNo" = "orderReference.documentNo",
22
23
  "billingReferences.invoices" = "billingReferences.invoices",
23
24
  "billingReferences.documentNo" = "billingReferences.documentNo",
@@ -10,6 +10,7 @@ var AvailableFields;
10
10
  AvailableFields["notes"] = "notes";
11
11
  AvailableFields["accountingCost"] = "accountingCost";
12
12
  AvailableFields["buyerReference"] = "buyerReference";
13
+ AvailableFields["documentReferences.project.documentNo"] = "documentReferences.project.documentNo";
13
14
  AvailableFields["orderReference.documentNo"] = "orderReference.documentNo";
14
15
  AvailableFields["billingReferences.invoices"] = "billingReferences.invoices";
15
16
  AvailableFields["billingReferences.documentNo"] = "billingReferences.documentNo";
@@ -0,0 +1,11 @@
1
+ import { ProfileOutputWithApiKey } from "../common/types/AppConfiguration";
2
+ import React from "react";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ import { CommonProps } from "../common/types/CommonProps";
5
+ interface Props extends CommonProps, InjectedIntlProps {
6
+ customers: ProfileOutputWithApiKey[];
7
+ }
8
+ declare const _default: React.ComponentClass<Pick<Props, "customers" | "language" | "mapiBaseUrl" | "rapiBaseUrl">, any> & {
9
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
+ };
11
+ export default _default;
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
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
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var mapi_1 = require("@unimaze/api-clients/lib/mapi");
22
+ var models_1 = require("@unimaze/api-clients/lib/mapi/models");
23
+ var antd_1 = require("antd");
24
+ var formLayout_1 = require("../common/consts/formLayout");
25
+ var components_1 = require("../common/components");
26
+ var react_1 = __importStar(require("react"));
27
+ var react_intl_1 = require("react-intl");
28
+ var utils_1 = require("../utils");
29
+ var BillingLineUtility_1 = require("../utils/BillingLineUtility");
30
+ var paymentMethodForConversion_1 = require("../common/components/payment-method/paymentMethodForConversion");
31
+ var uuid_1 = require("uuid");
32
+ var translationMessages = react_intl_1.defineMessages({
33
+ createInvoice_addDocumentLineMsg: {
34
+ id: "createInvoice_addDocumentLineMsg",
35
+ defaultMessage: "Add at least one document line",
36
+ },
37
+ createInvoice_selectCustomerMsg: {
38
+ id: "createInvoice_selectCustomerMsg",
39
+ defaultMessage: "Customer must be selected",
40
+ },
41
+ createInvoice_successfullySubmittedInvoiceMsg: {
42
+ id: "createInvoice_successfullySubmittedInvoiceMsg",
43
+ defaultMessage: "Successfully submitted the invoice"
44
+ },
45
+ createInvoice_successfullyUploadedAttachmentMsg: {
46
+ id: "createInvoice_successfullyUploadedAttachmentMsg",
47
+ defaultMessage: "Successfully uploaded attachment {attachment}"
48
+ },
49
+ createInvoice_ErrorUploadedAttachmentMsg: {
50
+ id: "createInvoice_ErrorUploadedAttachmentMsg",
51
+ defaultMessage: "Error uploaded attachment {attachment}"
52
+ },
53
+ createInvoice_Submit: {
54
+ id: "createInvoice_Submit",
55
+ defaultMessage: "Submit"
56
+ },
57
+ });
58
+ var CreateInvoiceConstructor = function (props) {
59
+ // const [submitInvoiceRequest, setSubmitInvoiceRequest] = React.useState<CreateSubmitInvoiceRequest>();
60
+ var intl = props.intl;
61
+ var form = antd_1.Form.useForm()[0];
62
+ var _a = react_1.useState(false), submitting = _a[0], setSubmitting = _a[1];
63
+ var _b = react_1.useState(/*profileOutputToPartyMetadata(customers[0])*/ undefined), chosenCustomer = _b[0], setChosenCustomer = _b[1];
64
+ var _c = react_1.useState(), chosenCustomerApiKey = _c[0], setChosenCustomerApiKey = _c[1];
65
+ var _d = react_1.useState(1), billingLinesEditableIndex = _d[0], setBillingLinesEditableIndex = _d[1];
66
+ var initialBillingLineData = {
67
+ key: billingLinesEditableIndex,
68
+ itemNo: "Item No.",
69
+ quantity: 0,
70
+ taxAmount: 0,
71
+ name: "New Item",
72
+ unitOfMeasure: { value: models_1.UnitOfMeasureMetadataUnitEnum.Piece, label: "Piece" },
73
+ unitPriceAmount: 0,
74
+ taxCategoryType: { value: models_1.BillingLineMetadataTaxCategoryTypeEnum.Exempt, label: "Exempt (0%)" },
75
+ discountValue: "0",
76
+ taxableAmount: 0,
77
+ taxPercentage: null
78
+ };
79
+ var _e = react_1.useState([__assign({}, initialBillingLineData, { key: 0 })]), billingLinesDataSource = _e[0], setBillingLinesDataSource = _e[1];
80
+ // BILLING LINES
81
+ var handleBillingLinesDelete = function (index) {
82
+ var newDataSource = billingLinesDataSource.slice();
83
+ var indexToDelete = newDataSource.findIndex(function (billingLine) { return billingLine.key === index; });
84
+ newDataSource.splice(indexToDelete, 1);
85
+ setBillingLinesDataSource(newDataSource);
86
+ };
87
+ var handleBillingLinesAdd = function (billingLineToAdd) {
88
+ setBillingLinesDataSource(billingLinesDataSource.concat([billingLineToAdd]));
89
+ setBillingLinesEditableIndex(billingLinesEditableIndex + 1);
90
+ };
91
+ var handleBillingLinesSave = function (row, formInstance) {
92
+ var newData = billingLinesDataSource.slice();
93
+ var index = newData.findIndex(function (i) {
94
+ return row.key === i.key;
95
+ });
96
+ var item = newData[index];
97
+ newData.splice(index, 1, __assign({}, item, row));
98
+ var billingLineMetadata = newData.map(function (current) {
99
+ return __assign({}, current, { unitOfMeasure: {
100
+ unit: models_1.UnitOfMeasureMetadataUnitEnum[current.unitOfMeasure.value],
101
+ }, taxCategoryType: models_1.BillingLineMetadataTaxCategoryTypeEnum[current.taxCategoryType.value] });
102
+ });
103
+ setBillingLinesDataSource(newData);
104
+ handleSetBillingLineMetadata(formInstance, billingLineMetadata);
105
+ };
106
+ // END BILLING LINES
107
+ var handleSetBillingLineMetadata = function (formInstance, billingLineMetadata) {
108
+ formInstance.setFieldsValue({
109
+ "billingLinesMetadata": billingLineMetadata
110
+ });
111
+ };
112
+ var handleSubmit = function (values) {
113
+ setSubmitting(true);
114
+ var attachments = [
115
+ values.attachments.file1 && values.attachments.file1,
116
+ values.attachments.file2 && values.attachments.file2,
117
+ values.attachments.file3 && values.attachments.file3,
118
+ ];
119
+ // Clear the array of undefined
120
+ attachments = attachments.filter(function (attachment) { return attachment.file !== undefined; });
121
+ var billingLinesArray = form.getFieldValue("billingLinesMetadata");
122
+ if (!billingLinesArray || billingLinesArray.length <= 0) {
123
+ antd_1.message.error(intl.formatMessage(translationMessages.createInvoice_addDocumentLineMsg));
124
+ return;
125
+ }
126
+ if (!chosenCustomer) {
127
+ antd_1.message.error(intl.formatMessage(translationMessages.createInvoice_selectCustomerMsg));
128
+ return;
129
+ }
130
+ var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLineUtility_1.billingLinesFieldsMetadata(form), paymentMethodForConversion_1.PaymentMethodFormData(values), chosenCustomer);
131
+ var createSubmitInvoice = {
132
+ invoiceMetadataInput: invoiceMetadataInput,
133
+ more: attachments.length > 0,
134
+ messageId: uuid_1.v4(),
135
+ processingMode: mapi_1.TransactionProcessingMode.Device
136
+ // processingMode: TransactionProcessingMode.DeviceRouted
137
+ };
138
+ utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, chosenCustomerApiKey, "submitInvoice", props.language)
139
+ .then(function (resp) {
140
+ antd_1.message.success(intl.formatMessage(translationMessages.createInvoice_successfullySubmittedInvoiceMsg));
141
+ var messageId = resp.data.uniqueId;
142
+ var _loop_1 = function () {
143
+ var nextFileArray = attachments.splice(0, 1);
144
+ var nextFile = nextFileArray[0].file[0].originFileObj;
145
+ var nextFileDescription = nextFileArray[0].description;
146
+ var createAttachDocument = {
147
+ messageId: messageId,
148
+ contentType: nextFile.type,
149
+ more: attachments.length > 0,
150
+ name: nextFileDescription // nextFile.name,
151
+ };
152
+ setSubmitting(true);
153
+ utils_1.submitDocument(nextFile, createAttachDocument, props.mapiBaseUrl, chosenCustomerApiKey)
154
+ .then(function (submitDocumentResponse) {
155
+ antd_1.message.success(intl.formatMessage(translationMessages.createInvoice_successfullyUploadedAttachmentMsg, { attachment: nextFileDescription }));
156
+ setSubmitting(false);
157
+ })
158
+ .catch(function (documentSendingErrorMessage) {
159
+ antd_1.message.error(intl.formatMessage(translationMessages.createInvoice_ErrorUploadedAttachmentMsg, { attachment: nextFileDescription }) + " - " + documentSendingErrorMessage.message);
160
+ setSubmitting(false);
161
+ });
162
+ };
163
+ while (attachments.length > 0) {
164
+ _loop_1();
165
+ }
166
+ setSubmitting(false);
167
+ form.resetFields();
168
+ // Clear the billing line dataSource
169
+ setChosenCustomer(undefined);
170
+ setChosenCustomerApiKey(undefined);
171
+ setBillingLinesDataSource([__assign({}, initialBillingLineData, { key: 0 })]);
172
+ setBillingLinesEditableIndex(0);
173
+ location.reload();
174
+ })
175
+ .catch(function (error) {
176
+ setSubmitting(false);
177
+ antd_1.message.error(error.message);
178
+ });
179
+ };
180
+ return (react_1.default.createElement(antd_1.Spin, { spinning: submitting },
181
+ react_1.default.createElement(antd_1.Form, __assign({}, formLayout_1.formItemLayout, { form: form, onFinish: handleSubmit, initialValues: {
182
+ invoice: {
183
+ currencyCode: "ISK",
184
+ supplier: {
185
+ address: {
186
+ countryCode: "IS"
187
+ }
188
+ },
189
+ customer: {
190
+ address: {
191
+ countryCode: "IS"
192
+ }
193
+ }
194
+ }
195
+ } }),
196
+ react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
197
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
198
+ react_1.default.createElement(components_1.BaseInformation, { form: form, documentType: "invoice" })),
199
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
200
+ react_1.default.createElement(components_1.Supplier, { billingLinesDataSource: billingLinesDataSource })),
201
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
202
+ react_1.default.createElement(components_1.Customer, { formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer, setChosenCustomerApiKey: setChosenCustomerApiKey })),
203
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 } },
204
+ react_1.default.createElement(components_1.BillingLines, { setBillingLineMetadata: handleSetBillingLineMetadata, formInstance: form, dataSource: billingLinesDataSource, editableIndex: billingLinesEditableIndex, handleAdd: handleBillingLinesAdd, initialBillingLineData: initialBillingLineData, handleDelete: handleBillingLinesDelete, handleSave: handleBillingLinesSave })),
205
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
206
+ react_1.default.createElement(components_1.PaymentMethod, null)),
207
+ react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 } },
208
+ react_1.default.createElement(components_1.Attachments /*handleAddFile={handleAddFile}*/, null)),
209
+ react_1.default.createElement(antd_1.Row, { style: { width: "100%", padding: "8px" }, justify: "end" },
210
+ react_1.default.createElement(antd_1.Col, null,
211
+ react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large" }, intl.formatMessage(translationMessages.createInvoice_Submit))))))));
212
+ };
213
+ exports.default = react_intl_1.injectIntl(CreateInvoiceConstructor);
@@ -0,0 +1 @@
1
+ import "antd/dist/antd.compact.css";
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ interface Props extends InjectedIntlProps {
4
+ fieldName: "file1" | "file2" | "file3";
5
+ }
6
+ interface States {
7
+ file: any[];
8
+ }
9
+ declare class Attachment extends React.Component<Props, States> {
10
+ constructor(props: Props);
11
+ handleRemoveFile: () => void;
12
+ normFile: (e: any) => any;
13
+ render(): JSX.Element;
14
+ }
15
+ declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "ref" | "key" | "fieldName">, any> & {
16
+ WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
17
+ };
18
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const AttachmentGroupIntl: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default AttachmentGroupIntl;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { InjectedIntlProps } from "react-intl";
3
+ import { StoreValue } from "rc-field-form/lib/interface";
4
+ interface FieldData {
5
+ name: number;
6
+ key: number;
7
+ fieldKey: number;
8
+ }
9
+ interface Props extends InjectedIntlProps {
10
+ fields: FieldData[];
11
+ add: (defaultValue?: StoreValue) => void;
12
+ remove: (index: number) => void;
13
+ }
14
+ declare const _default: React.ComponentClass<Pick<Props, "remove" | "fields" | "add">, any> & {
15
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
16
+ };
17
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ form: FormInstance;
6
+ documentType: "creditNote" | "invoice";
7
+ }
8
+ declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "documentType">, any> & {
9
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
+ };
11
+ export default BaseInformationIntl;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
6
+ renderCurrencyColumn: (text: string | number) => string;
7
+ }
8
+ declare const _default: React.ComponentClass<Pick<Props, "billingLinesMetadata" | "renderCurrencyColumn">, any> & {
9
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
10
+ };
11
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ interface Props extends InjectedIntlProps {
5
+ billingLines: BillingLineMetadataOverride[] | undefined;
6
+ }
7
+ declare const _default: React.ComponentClass<Pick<Props, "billingLines">, any> & {
8
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { BillingLineMetadata } from "@unimaze/api-clients/lib/mapi/models";
3
+ import { InjectedIntlProps } from "react-intl";
4
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
5
+ import { FormInstance } from "antd/es/form";
6
+ interface Props extends InjectedIntlProps {
7
+ formInstance: FormInstance;
8
+ setBillingLineMetadata: (formInstance: FormInstance, billingLineMetadata: BillingLineMetadata[]) => void;
9
+ dataSource: BillingLineMetadataOverride[];
10
+ handleDelete: (index: number) => void;
11
+ handleAdd: (billingLineToAdd: BillingLineMetadataOverride) => void;
12
+ handleSave: (row: BillingLineMetadataOverride, formInstance: FormInstance) => void;
13
+ initialBillingLineData: BillingLineMetadataOverride;
14
+ editableIndex: number;
15
+ }
16
+ declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "setBillingLineMetadata" | "dataSource" | "handleDelete" | "handleAdd" | "handleSave" | "initialBillingLineData" | "editableIndex">, any> & {
17
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
18
+ };
19
+ export default BillingLinesIntl;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { HeightProperty } from "csstype";
3
+ interface Props {
4
+ height?: HeightProperty<number>;
5
+ }
6
+ declare const Content: React.FC<Props>;
7
+ export default Content;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { IconProps } from "@ant-design/compatible/es/icon";
3
+ interface HeaderProps {
4
+ iconProps?: IconProps;
5
+ title?: string | React.ReactNode;
6
+ action?: React.ReactNode;
7
+ }
8
+ declare const Header: React.FC<HeaderProps>;
9
+ export default Header;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { IconProps } from "@ant-design/compatible/es/icon";
3
+ interface Props {
4
+ iconProps?: IconProps;
5
+ title?: string | React.ReactNode;
6
+ action?: React.ReactNode;
7
+ noPadding?: boolean;
8
+ }
9
+ declare const ComponentContainer: React.FC<Props>;
10
+ export default ComponentContainer;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
+ import { FormInstance } from "antd/es/form";
5
+ import { PartyMetadata } from "@unimaze/api-clients/lib/mapi";
6
+ interface Props extends InjectedIntlProps {
7
+ customers: ProfileOutput[];
8
+ formInstance: FormInstance;
9
+ chosenCustomer: PartyMetadata | undefined;
10
+ setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
11
+ }
12
+ declare const CustomerIntl: React.ComponentClass<Pick<Props, "chosenCustomer" | "setChosenCustomer" | "customers" | "formInstance">, any> & {
13
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
14
+ };
15
+ export default CustomerIntl;
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
3
+ interface EditableCellProps {
4
+ record: BillingLineMetadataOverride;
5
+ handleSave: (billingLineMetadata: BillingLineMetadataOverride) => void;
6
+ dataIndex: keyof Omit<BillingLineMetadataOverride, 'key'>;
7
+ editable: boolean;
8
+ index: number;
9
+ }
10
+ declare const EditableCell: React.FC<EditableCellProps>;
11
+ export default EditableCell;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import { FormInstance } from "antd/lib/form";
3
+ export declare const EditableContext: React.Context<FormInstance>;
4
+ declare const EditableRow: ({ index, ...props }: any) => JSX.Element;
5
+ export default EditableRow;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { AvailableFields } from "../../types/ReceiverRequirements";
3
+ import { NamePath, Rule } from "rc-field-form/lib/interface";
4
+ import { InjectedIntlProps } from "react-intl";
5
+ interface StringMap {
6
+ [key: string]: string;
7
+ }
8
+ interface Props extends InjectedIntlProps {
9
+ receiverRequirementsKey: AvailableFields;
10
+ defaultLabel: React.ReactNode;
11
+ defaultIsRequired: boolean;
12
+ fieldName: NamePath;
13
+ additionalRules?: Rule[];
14
+ style?: React.CSSProperties;
15
+ initialValue?: StringMap;
16
+ verticalLabels?: boolean;
17
+ onlyLabelOnFirstInList?: boolean;
18
+ index?: number;
19
+ }
20
+ declare const _default: React.ComponentClass<Pick<Props, "style" | "initialValue" | "fieldName" | "receiverRequirementsKey" | "defaultLabel" | "defaultIsRequired" | "additionalRules" | "verticalLabels" | "onlyLabelOnFirstInList" | "index">, any> & {
21
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
22
+ };
23
+ export default _default;
@@ -0,0 +1,10 @@
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";
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import "moment/locale/is";
3
+ import "moment/locale/sr";
4
+ interface IHotSwappingIntlProviderOwnProps {
5
+ initialLocale: string;
6
+ initialMessages: any;
7
+ languageString?: string;
8
+ }
9
+ declare const HotIntlProvider: React.FC<IHotSwappingIntlProviderOwnProps>;
10
+ export default HotIntlProvider;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ declare const _default: React.ComponentClass<Pick<InjectedIntlProps, never>, any> & {
4
+ WrappedComponent: React.ComponentType<InjectedIntlProps>;
5
+ };
6
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { PaymentMeansType } from "@unimaze/api-clients/lib/mapi";
2
+ import { TransferMetadata, ClaimMetadata } from '@unimaze/api-clients/lib/mapi/models';
3
+ import { Store } from 'antd/es/form/interface';
4
+ export interface IPaymentMeans {
5
+ type: PaymentMeansType;
6
+ domesticTransfer?: TransferMetadata | undefined;
7
+ domesticClaim?: ClaimMetadata | undefined;
8
+ }
9
+ export declare const PaymentMethodFormData: (formData: Store) => IPaymentMeans;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { InjectedIntlProps } from "react-intl";
3
+ import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
4
+ interface Props extends InjectedIntlProps {
5
+ billingLinesDataSource: BillingLineMetadataOverride[];
6
+ }
7
+ declare const SupplierIntl: React.ComponentClass<Pick<Props, "billingLinesDataSource">, any> & {
8
+ WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
9
+ };
10
+ export default SupplierIntl;
@@ -0,0 +1,44 @@
1
+ declare const formItemLayout: {
2
+ labelCol: {
3
+ xs: {
4
+ span: number;
5
+ };
6
+ sm: {
7
+ span: number;
8
+ };
9
+ };
10
+ wrapperCol: {
11
+ xs: {
12
+ span: number;
13
+ };
14
+ sm: {
15
+ span: number;
16
+ };
17
+ };
18
+ };
19
+ declare const formItemVerticalLayout: {
20
+ labelCol: {
21
+ span: number;
22
+ };
23
+ wrapperCol: {
24
+ span: number;
25
+ };
26
+ };
27
+ declare const fullWidthInput: {
28
+ wrapperCol: {
29
+ span: number;
30
+ };
31
+ };
32
+ declare const formItemLayoutWithOutLabel: {
33
+ wrapperCol: {
34
+ xs: {
35
+ span: number;
36
+ offset: number;
37
+ };
38
+ sm: {
39
+ span: number;
40
+ offset: number;
41
+ };
42
+ };
43
+ };
44
+ export { formItemLayout, formItemVerticalLayout, fullWidthInput, formItemLayoutWithOutLabel };
@@ -0,0 +1,6 @@
1
+ import { BillingLineMetadataOverride } from "../types/BillingLineMetadataOverride";
2
+ import { Rule } from "rc-field-form/lib/interface";
3
+ export declare type ValidationRulesObject = {
4
+ [key in keyof Omit<BillingLineMetadataOverride, 'key'>]: Rule[];
5
+ };
6
+ export declare const validationRules: ValidationRulesObject;
@@ -0,0 +1,81 @@
1
+ interface Values {
2
+ key?: string;
3
+ label?: string;
4
+ values?: Values[];
5
+ }
6
+ interface FieldRequirement extends Values {
7
+ isRequired: boolean;
8
+ }
9
+ declare type ReceiverRequirements = {
10
+ [key in AvailableFields]?: FieldRequirement;
11
+ };
12
+ export declare enum AvailableFields {
13
+ "invoiceNo" = "invoiceNo",
14
+ "issueDate" = "issueDate",
15
+ "dueDate" = "dueDate",
16
+ "graceDate" = "graceDate",
17
+ "currencyCode" = "currencyCode",
18
+ "notes" = "notes",
19
+ "accountingCost" = "accountingCost",
20
+ "buyerReference" = "buyerReference",
21
+ "orderReference.documentNo" = "orderReference.documentNo",
22
+ "billingReferences.invoices" = "billingReferences.invoices",
23
+ "billingReferences.documentNo" = "billingReferences.documentNo",
24
+ "billingReferences.issueDate" = "billingReferences.issueDate",
25
+ "billingReferences.creditNotes" = "billingReferences.creditNotes",
26
+ "referenceIdentifiers.type" = "referenceIdentifiers.type",
27
+ "referenceIdentifiers.code" = "referenceIdentifiers.code",
28
+ "referenceIdentifiers.value" = "referenceIdentifiers.value",
29
+ "referenceIdentifiers" = "referenceIdentifiers",
30
+ "supplier.vatNumber" = "supplier.vatNumber",
31
+ "supplier.address.streetNameAndNumber" = "supplier.address.streetNameAndNumber",
32
+ "supplier.address.city" = "supplier.address.city",
33
+ "supplier.address.postalZone" = "supplier.address.postalZone",
34
+ "supplier.address.countryCode" = "supplier.address.countryCode",
35
+ "supplier.contact.name" = "supplier.contact.name",
36
+ "supplier.contact.electronicMail" = "supplier.contact.electronicMail",
37
+ "supplier.contact.telephone" = "supplier.contact.telephone",
38
+ "supplier.name" = "supplier.name",
39
+ "supplier.identifier" = "supplier.identifier",
40
+ "customer.address.streetNameAndNumber" = "customer.address.streetNameAndNumber",
41
+ "customer.address.city" = "customer.address.city",
42
+ "customer.address.postalZone" = "customer.address.postalZone",
43
+ "customer.address.countryCode" = "customer.address.countryCode",
44
+ "customer.contact.name" = "customer.contact.name",
45
+ "customer.contact.electronicMail" = "customer.contact.electronicMail",
46
+ "customer.contact.telephone" = "customer.contact.telephone",
47
+ "customer.name" = "customer.name",
48
+ "customer.identifier" = "customer.identifier",
49
+ "customer.locationIdentifier" = "customer.locationIdentifier",
50
+ "payee.name" = "payee.name",
51
+ "payee.identifier" = "payee.identifier",
52
+ "payee.sepaBankIdentification" = "payee.sepaBankIdentification",
53
+ "invoiceLines.itemNo" = "invoiceLines.itemNo",
54
+ "invoiceLines.name" = "invoiceLines.name",
55
+ "invoiceLines.quantity" = "invoiceLines.quantity",
56
+ "invoiceLines.uniteOfMeasure.unit" = "invoiceLines.unitOfMeasure.unit",
57
+ "invoiceLines.uniteOfMeasure.code" = "invoiceLines.unitOfMeasure.code",
58
+ "invoiceLines.unitPriceAmount" = "invoiceLines.unitPriceAmount",
59
+ "invoiceLines.taxCategoryType" = "invoiceLines.taxCategoryType",
60
+ "invoiceLines.taxableAmount" = "invoiceLines.taxableAmount",
61
+ "invoiceLines.taxAmount" = "invoiceLines.taxAmount",
62
+ "invoiceLines.taxPercentage" = "invoiceLines.taxPercentage",
63
+ "invoiceLines.discountValue" = "invoiceLines.discountValue",
64
+ "paymentTerms.note" = "paymentTerms.note",
65
+ "paymentMeans.type" = "paymentMeans.type",
66
+ "paymentMeans.internationalTransfer" = "paymentMeans.internationalTransfer",
67
+ "paymentMeans.domesticTransfer" = "paymentMeans.domesticTransfer",
68
+ "paymentMeans.domesticClaim" = "paymentMeans.domesticClaim",
69
+ "delivery.partyName" = "delivery.partyName",
70
+ "delivery.locationIdentifier" = "delivery.locationIdentifier",
71
+ "delivery.address.streetNameAndNumber" = "delivery.address.streetNameAndNumber",
72
+ "delivery.address.city" = "delivery.address.city",
73
+ "delivery.address.postalZone" = "delivery.address.postalZone",
74
+ "delivery.address.countryCode" = "delivery.address.countryCode",
75
+ "delivery.actualDeliveryDate" = "delivery.actualDeliveryDate",
76
+ "prepaidAmount" = "prepaidAmount",
77
+ "payableAmount" = "payableAmount",
78
+ "payableRoundingAmount" = "payableRoundingAmount"
79
+ }
80
+ export { ReceiverRequirements, FieldRequirement };
81
+ export declare const receiverRequirementsObject: ReceiverRequirements;
@@ -0,0 +1,14 @@
1
+ import "../style/index.css";
2
+ import React from "react";
3
+ import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
+ import { CommonProps } from "../common/types/CommonProps";
5
+ interface Props extends CommonProps {
6
+ customers: ProfileOutput[];
7
+ }
8
+ /**
9
+ * Component for creating a form for creating an invoice and submitting it to the MAPI transaction services
10
+ *
11
+ * @component
12
+ */
13
+ declare const CreateInvoice: React.FC<Props>;
14
+ export default CreateInvoice;
@@ -0,0 +1,77 @@
1
+ declare const _default: {
2
+ en: {};
3
+ is: {
4
+ "attachment_labels_Reference": string;
5
+ "attachment_labels_Reference_requiredMessage": string;
6
+ "attachment_labels_Description": string;
7
+ "attachment_labels_Description_requiredMessage": string;
8
+ "attachment_labels_File": string;
9
+ "attachment_title": string;
10
+ "baseInformation_title": string;
11
+ "baseInformation_invoiceNo": string;
12
+ "baseInformation_issueDate": string;
13
+ "baseInformation_dueDate": string;
14
+ "baseInformation_orderReference_documentNo": string;
15
+ "baseInformation_notes": string;
16
+ "baseInformation_currencyCode": string;
17
+ "billingCalculations_labels_TaxAmountWithoutVat": string;
18
+ "billingCalculations_labels_TotalVatAmount": string;
19
+ "billingCalculations_labels_TotalAmountWithVat": string;
20
+ "billingTaxSummary_taxOverview": string;
21
+ "billingTaxSummary_taxableAmount": string;
22
+ "billingTaxSummary_taxAmount": string;
23
+ "billingLines_title": string;
24
+ "billingLines_itemNo": string;
25
+ "billingLines_name": string;
26
+ "billingLines_quantity": string;
27
+ "billingLines_unitOfMeasure": string;
28
+ "billingLines_unitPriceAmount": string;
29
+ "billingLines_taxCategoryType": string;
30
+ "billingLines_taxCategoryPercentage": string;
31
+ "billingLines_discount": string;
32
+ "billingLines_lineAmount": string;
33
+ "billingLines_taxAmount": string;
34
+ "billingLines_button_addRow": string;
35
+ "deliveryLocation_title": string;
36
+ "deliveryLocation_partyName": string;
37
+ "deliveryLocation_streetNameAndNumber": string;
38
+ "deliveryLocation_postalZone": string;
39
+ "deliveryLocation_city": string;
40
+ "deliveryLocation_countryCode": string;
41
+ "formItem_required_errorMessage": string;
42
+ "paymentMethod_labels_domesticTransfer_bankNo": string;
43
+ "paymentMethod_labels_domesticTransfer_typeNo": string;
44
+ "paymentMethod_labels_domesticTransfer_accountNo": string;
45
+ "paymentMethod_labels_domesticTransfer_paymentReference": string;
46
+ "paymentMethod_labels_icelandicClaim_bankNo": string;
47
+ "paymentMethod_labels_icelandicClaim_claimNo": string;
48
+ "paymentMethod_labels_methods_undefined": string;
49
+ "paymentMethod_labels_methods_mutuallyAgreed": string;
50
+ "paymentMethod_labels_methods_domesticTransfer": string;
51
+ "paymentMethod_labels_methods_domesticClaim": string;
52
+ "paymentMethod_rulles_number": string;
53
+ "supplier_title": string;
54
+ "supplier_name": string;
55
+ "supplier_identifier": string;
56
+ "supplier_vatNumber": string;
57
+ "supplier_address_streetNameAndNumber": string;
58
+ "supplier_address_zip_postalCode": string;
59
+ "supplier_address_city": string;
60
+ "supplier_address_countryCode": string;
61
+ "supplier_contact_email": string;
62
+ "supplier_contact_name": string;
63
+ "supplier_notValidEmail": string;
64
+ "customer_title": string;
65
+ "customer_name": string;
66
+ "customer_identifier": string;
67
+ "customer_address_streetNameAndNumber": string;
68
+ "customer_address_zip_postalCode": string;
69
+ "customer_address_city": string;
70
+ "customer_address_countryCode": string;
71
+ "customer_contact_email": string;
72
+ "customer_contact_name": string;
73
+ "referenceIdentifiers_labels_addButton": string;
74
+ "referenceIdentifiers_labels_referenceIdentifier": string;
75
+ };
76
+ };
77
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { mapi } from "@unimaze/api-clients";
2
+ import { InvoiceMetadataInput, TransactionProcessingMode } from "@unimaze/api-clients/lib/mapi/api";
3
+ import { AxiosPromise } from "axios";
4
+ import { LanguageProp } from "../common/types/CommonProps";
5
+ interface CreateSubmitInvoice {
6
+ messageId: string;
7
+ more: boolean;
8
+ conversationIdentifier?: string;
9
+ processingMode?: TransactionProcessingMode;
10
+ services?: string[];
11
+ invoiceMetadataInput?: InvoiceMetadataInput;
12
+ }
13
+ interface AttachDocument {
14
+ messageId: string;
15
+ name: string;
16
+ contentType: string;
17
+ more: boolean;
18
+ }
19
+ declare const submitDocument: (data: any, attachDocument: AttachDocument, mapiBaseUrl: string, apiKey?: string | undefined) => AxiosPromise<mapi.MessageOutput>;
20
+ declare const submitInvoice: (createSubmitInvoice: CreateSubmitInvoice, mapiBaseUrl: string, apiKey?: string | undefined, callName?: string | undefined, language?: LanguageProp) => AxiosPromise<mapi.MessageOutput>;
21
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument };
@@ -0,0 +1,10 @@
1
+ import { BillingLineMetadata } from '@unimaze/api-clients/lib/mapi';
2
+ import { FormInstance } from "antd/es/form";
3
+ import { TaxCategoryTypeEnum } from "@unimaze/api-clients/lib/mapi/api";
4
+ import React from "react";
5
+ export declare const billingLinesFieldsMetadata: (formInstance: FormInstance) => BillingLineMetadata[];
6
+ export declare const calculateTaxableAmount: (discountValue: string | null | undefined, quantity: number | null, unitPriceAmount: number | null) => number;
7
+ export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
8
+ export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum) => number;
9
+ export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum) => string;
10
+ export declare const getCorrectInputNode: (dataIdx: "unitOfMeasure" | "itemNo" | "name" | "description" | "quantity" | "unitPriceAmount" | "taxCategoryType" | "taxableAmount" | "taxAmount" | "taxPercentage" | "discountValue" | "discountReason" | "notes" | "accountingCost" | "billingPeriod" | "buyersItemNo" | "standardItemNo" | "originCountryCode" | "commodityClassification" | "additionalItemProperties" | "referenceIdentifiers" | "orderLineReference" | "key") => React.ReactChild;
@@ -0,0 +1,8 @@
1
+ import { BillingLineMetadata, InvoiceMetadataInput, PartyMetadata } from "@unimaze/api-clients/lib/mapi";
2
+ import { Store } from "antd/es/form/interface";
3
+ import { ProfileOutput } from "@unimaze/api-clients/lib/wapi2";
4
+ import { PaymentMeansMetadata } from "@unimaze/api-clients/lib/mapi/api";
5
+ declare const convertToInvoiceMetadataInput: (formValues: Store, billingLines: BillingLineMetadata[], paymentMethod: PaymentMeansMetadata, chosenCustomer: PartyMetadata) => InvoiceMetadataInput;
6
+ declare const profileOutputToPartyMetadata: (profileOutput: ProfileOutput) => PartyMetadata;
7
+ declare const convertToReadableKennitala: (isoIdentifier: string) => string;
8
+ export { convertToInvoiceMetadataInput, profileOutputToPartyMetadata, convertToReadableKennitala };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { AvailableFields, FieldRequirement, ReceiverRequirements } from "../common/types/ReceiverRequirements";
3
+ export declare const getReceiverRequirements: (recRequirements: ReceiverRequirements, key: AvailableFields) => FieldRequirement;
4
+ export declare const getReceiverRequirementsIsRequired: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
5
+ export declare const getReceiverRequirementsLabelWithDefault: (recRequirements: ReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode) => React.ReactNode;
@@ -0,0 +1,2 @@
1
+ export { convertToInvoiceMetadataInput } from "./ConversionUtility";
2
+ export { submitInvoice, CreateSubmitInvoice, submitDocument, AttachDocument } from "./ApiUtility";
@@ -1,51 +1,51 @@
1
- .component_header {
2
- height: 3.3em;
3
- background-color: #fff;
4
- border-bottom: solid 1px #d9d9d9;
5
- border-radius: 4px 4px 0 0;
6
- display: flex;
7
- align-items: center;
8
- justify-content: space-between;
9
- padding: 1em 2em;
10
- }
11
- .component_header_title {
12
- font-size: 1.1em;
13
- }
14
- .component_header_title > span > i {
15
- font-size: 20px;
16
- }
17
- .header_icon {
18
- font-size: 1.5em;
19
- margin-right: 0.75em;
20
- color: #1890ff;
21
- }
22
- .header_right {
23
- display: flex;
24
- justify-content: flex-end;
25
- }
26
- @media screen and (max-width: 768px) {
27
- .header_right {
28
- justify-content: flex-start;
29
- }
30
- }
31
- .header_right > button {
32
- margin-bottom: unset !important;
33
- }
34
- .component_body {
35
- border-radius: 0 0 4px 4px;
36
- }
37
- .component_wrapper {
38
- align-self: stretch;
39
- height: 100%;
40
- background-color: #fff;
41
- border: solid 1px #d9d9d9;
42
- border-radius: 4px;
43
- }
44
- .component_wrapper_padding {
45
- padding: 1em;
46
- }
47
- .umz_noValidationMessage .ant-form-item-explain {
48
- height: 20px !important;
49
- visibility: hidden !important;
50
- }
1
+ .component_header {
2
+ height: 3.3em;
3
+ background-color: #fff;
4
+ border-bottom: solid 1px #d9d9d9;
5
+ border-radius: 4px 4px 0 0;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+ padding: 1em 2em;
10
+ }
11
+ .component_header_title {
12
+ font-size: 1.1em;
13
+ }
14
+ .component_header_title > span > i {
15
+ font-size: 20px;
16
+ }
17
+ .header_icon {
18
+ font-size: 1.5em;
19
+ margin-right: 0.75em;
20
+ color: #1890ff;
21
+ }
22
+ .header_right {
23
+ display: flex;
24
+ justify-content: flex-end;
25
+ }
26
+ @media screen and (max-width: 768px) {
27
+ .header_right {
28
+ justify-content: flex-start;
29
+ }
30
+ }
31
+ .header_right > button {
32
+ margin-bottom: unset !important;
33
+ }
34
+ .component_body {
35
+ border-radius: 0 0 4px 4px;
36
+ }
37
+ .component_wrapper {
38
+ align-self: stretch;
39
+ height: 100%;
40
+ background-color: #fff;
41
+ border: solid 1px #d9d9d9;
42
+ border-radius: 4px;
43
+ }
44
+ .component_wrapper_padding {
45
+ padding: 1em;
46
+ }
47
+ .umz_noValidationMessage .ant-form-item-explain {
48
+ height: 20px !important;
49
+ visibility: hidden !important;
50
+ }
51
51
  /*# sourceMappingURL=index.css.map */
@@ -99,6 +99,12 @@ var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalcul
99
99
  var orderReference = invoice.orderReference && invoice.orderReference.hasOwnProperty("documentNo")
100
100
  ? invoice.orderReference
101
101
  : undefined;
102
+ // NBNB: FOR NOW THIS IS ONLY FOR PROJECT, CREATE FUNCTION THAT WOULD RETURN CORRECT OBJECT STRUCTURE IF OTHER PROPERTIES ARE BEING USED
103
+ var documentReferences = invoice.documentReferences
104
+ && invoice.documentReferences.project
105
+ && invoice.documentReferences.project.documentNo
106
+ ? invoice.documentReferences
107
+ : undefined;
102
108
  var resp = {
103
109
  messageHandling: getMessageHandling(chosenCustomer),
104
110
  invoice: {
@@ -144,6 +150,7 @@ var convertToInvoiceMetadataInput = function (formValues, invoiceLinesWithCalcul
144
150
  buyerReference: invoice.buyerReference,
145
151
  paymentMeans: paymentMethod,
146
152
  referenceIdentifiers: referenceIdentifiers,
153
+ documentReferences: documentReferences,
147
154
  orderReference: orderReference,
148
155
  }
149
156
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",