@unimaze/billing 0.12.3 → 0.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/components/base-information/OrderReference.d.ts +3 -1
- package/lib/common/components/base-information/OrderReference.js +1 -1
- package/lib/common/components/base-information/index.js +2 -2
- package/lib/common/components/billing-lines/BillingCalculations.d.ts +4 -3
- package/lib/common/components/billing-lines/BillingCalculations.js +13 -6
- package/lib/common/components/billing-lines/BillingTaxSummary.d.ts +4 -3
- package/lib/common/components/billing-lines/BillingTaxSummary.js +13 -5
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +2 -1
- package/lib/common/components/billing-lines/NewBillingLines.js +12 -1
- package/lib/common/components/billing-lines/index.d.ts +2 -1
- package/lib/common/components/billing-lines/index.js +12 -4
- package/lib/common/components/supplier/index.d.ts +3 -1
- package/lib/common/components/supplier/index.js +20 -14
- package/lib/create-invoice/index.js +27 -3
- package/lib/translations/locales/is.json +1 -0
- package/lib/translations/locales.d.ts +1 -0
- package/package.json +1 -1
- package/lib/common/components/base-information/CostCenter.d.ts +0 -12
- package/lib/common/components/base-information/CostCenter.js +0 -107
|
@@ -2,11 +2,13 @@ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { InjectedIntlProps } from "react-intl";
|
|
4
4
|
import { FormInstance } from "antd/es/form";
|
|
5
|
+
import { NamePath } from "rc-field-form/lib/interface";
|
|
5
6
|
interface Props extends InjectedIntlProps {
|
|
6
7
|
receiverRequirements: NewReceiverRequirements;
|
|
7
8
|
formInstance: FormInstance;
|
|
9
|
+
dependencies: NamePath[];
|
|
8
10
|
}
|
|
9
|
-
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements">, any> & {
|
|
11
|
+
declare const _default: React.ComponentClass<Pick<Props, "dependencies" | "formInstance" | "receiverRequirements">, any> & {
|
|
10
12
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -31,7 +31,7 @@ var getOrderReferenceFieldDefinitions = function (receiverRequirements) {
|
|
|
31
31
|
var OrderReference = function (props) {
|
|
32
32
|
if (getOrderReferenceFieldDefinitions(props.receiverRequirements)) {
|
|
33
33
|
var required = !(props.formInstance.getFieldValue(["invoice", "buyerReference"]));
|
|
34
|
-
return React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel_helpText), defaultIsRequired: required, fieldName: ["invoice", "orderReference", "documentNo"] },
|
|
34
|
+
return React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: props.dependencies, receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["orderReference.documentNo"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_orderReferenceLabel_helpText), defaultIsRequired: required, fieldName: ["invoice", "orderReference", "documentNo"] },
|
|
35
35
|
React.createElement(antd_1.Input, null));
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -183,8 +183,8 @@ var BaseInformation = function (props) {
|
|
|
183
183
|
},
|
|
184
184
|
] },
|
|
185
185
|
React.createElement(antd_1.DatePicker, { style: { width: "100%" }, format: "DD.MM.YYYY", onChange: checkIfEmpty, disabledDate: (function (current) { return disabledDate(current, props.form.getFieldValue(["invoice", "issueDate"])); }) })),
|
|
186
|
-
React.createElement(OrderReference_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form }),
|
|
187
|
-
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_buyerReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultIsRequired: !(props.form.getFieldValue(["invoice", "orderReference", "documentNo"])), fieldName: ["invoice", "buyerReference"] },
|
|
186
|
+
React.createElement(OrderReference_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, dependencies: [["invoice", "buyerReference"]] }),
|
|
187
|
+
React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: [["invoice", "orderReference", "documentNo"]], receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_buyerReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultIsRequired: !(props.form.getFieldValue(["invoice", "orderReference", "documentNo"])), fieldName: ["invoice", "buyerReference"] },
|
|
188
188
|
React.createElement(antd_1.Input, null)),
|
|
189
189
|
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 }),
|
|
190
190
|
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"] },
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
4
|
interface Props extends InjectedIntlProps {
|
|
5
|
-
billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
|
|
6
5
|
currencyCode: string;
|
|
6
|
+
formInstance: FormInstance;
|
|
7
|
+
outsideVatScope: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const _default: React.ComponentClass<Pick<Props, "currencyCode" | "
|
|
9
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "currencyCode" | "outsideVatScope">, any> & {
|
|
9
10
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
10
11
|
};
|
|
11
12
|
export default _default;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
4
8
|
};
|
|
5
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var react_1 =
|
|
10
|
+
var react_1 = __importStar(require("react"));
|
|
7
11
|
var antd_1 = require("antd");
|
|
8
12
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
13
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
@@ -32,15 +36,18 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
32
36
|
},
|
|
33
37
|
});
|
|
34
38
|
var BillingCalculations = function (props) {
|
|
35
|
-
var
|
|
39
|
+
var _a = react_1.useState(props.formInstance.getFieldValue(["invoice", "invoiceLines"])), invoiceLines = _a[0], setInvoiceLines = _a[1];
|
|
40
|
+
react_1.useEffect(function () {
|
|
41
|
+
setInvoiceLines(props.formInstance.getFieldValue(["invoice", "invoiceLines"]));
|
|
42
|
+
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"])]);
|
|
36
43
|
var totals = {
|
|
37
44
|
totalTaxableAmount: 0,
|
|
38
45
|
totalTaxAmount: 0,
|
|
39
46
|
totalTaxInclusiveAmount: 0,
|
|
40
47
|
roundingAmount: 0,
|
|
41
48
|
};
|
|
42
|
-
if (
|
|
43
|
-
|
|
49
|
+
if (invoiceLines) {
|
|
50
|
+
invoiceLines.map(function (billingLine) {
|
|
44
51
|
if (billingLine) {
|
|
45
52
|
var taxAmount = BillingLineUtility_1.calculateTaxAmount(BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount), BillingLineUtility_1.calculateTaxPercentage(billingLine.taxCategoryType ? api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType] : undefined)); // BillingLineMetadataTaxCategoryTypeEnum -> TaxCategoryTypeEnum
|
|
46
53
|
var taxableAmount = BillingLineUtility_1.calculateTaxableAmount(billingLine.discountValue, billingLine.quantity, billingLine.unitPriceAmount);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { BillingLineMetadataOverride } from "../../types/BillingLineMetadataOverride";
|
|
3
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
4
|
interface Props extends InjectedIntlProps {
|
|
5
|
-
|
|
5
|
+
formInstance: FormInstance;
|
|
6
|
+
outsideVatScope: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.ComponentClass<Pick<Props, "
|
|
8
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "outsideVatScope">, any> & {
|
|
8
9
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
4
8
|
};
|
|
5
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var react_1 =
|
|
10
|
+
var react_1 = __importStar(require("react"));
|
|
7
11
|
var antd_1 = require("antd");
|
|
8
12
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
9
13
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
@@ -45,8 +49,12 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
45
49
|
},
|
|
46
50
|
});
|
|
47
51
|
var BillingTaxSummary = function (props) {
|
|
48
|
-
var
|
|
49
|
-
|
|
52
|
+
var _a = react_1.useState(props.formInstance.getFieldValue(["invoice", "invoiceLines"])), invoiceLines = _a[0], setInvoiceLines = _a[1];
|
|
53
|
+
react_1.useEffect(function () {
|
|
54
|
+
setInvoiceLines(props.formInstance.getFieldValue(["invoice", "invoiceLines"]));
|
|
55
|
+
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"])]);
|
|
56
|
+
var dataSource = invoiceLines
|
|
57
|
+
? invoiceLines.map(function (billingLine) {
|
|
50
58
|
var taxCategoryType = billingLine.taxCategoryType ? api_1.TaxCategoryTypeEnum[billingLine.taxCategoryType] : undefined;
|
|
51
59
|
var translationString = "taxCategoryType_labels_" + taxCategoryType;
|
|
52
60
|
var taxCategoryTypeTranslated = editable_cell_1.commonTranslationMessages.hasOwnProperty(translationString)
|
|
@@ -5,8 +5,9 @@ import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
|
5
5
|
interface Props extends InjectedIntlProps {
|
|
6
6
|
receiverRequirements: NewReceiverRequirements;
|
|
7
7
|
formInstance: FormInstance;
|
|
8
|
+
outsideVatScope: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare const BillingLinesWithIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements">, any> & {
|
|
10
|
+
declare const BillingLinesWithIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "outsideVatScope">, any> & {
|
|
10
11
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
12
|
};
|
|
12
13
|
export default BillingLinesWithIntl;
|
|
@@ -76,6 +76,17 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
var BillingLines = function (props) {
|
|
79
|
+
var getTaxCategoryDisabled = function (taxCategoryType, outsideVatScope) {
|
|
80
|
+
switch (taxCategoryType) {
|
|
81
|
+
case mapi_1.TaxCategoryTypeEnum.StandardRated:
|
|
82
|
+
case mapi_1.TaxCategoryTypeEnum.ReducedRated:
|
|
83
|
+
case mapi_1.TaxCategoryTypeEnum.ZeroRated:
|
|
84
|
+
case mapi_1.TaxCategoryTypeEnum.Exempt:
|
|
85
|
+
return outsideVatScope;
|
|
86
|
+
case mapi_1.TaxCategoryTypeEnum.OutsideTaxScope:
|
|
87
|
+
return !outsideVatScope;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
79
90
|
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "invoiceLines"] }, function (fields, _a) {
|
|
80
91
|
var add = _a.add, remove = _a.remove;
|
|
81
92
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
@@ -127,7 +138,7 @@ var BillingLines = function (props) {
|
|
|
127
138
|
taxCatType = value;
|
|
128
139
|
}, dropdownMatchSelectWidth: false }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
129
140
|
var taxPercentage = BillingLineUtility_1.calculateTaxPercentage(mapi_1.TaxCategoryTypeEnum[taxCategoryType]);
|
|
130
|
-
return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, props.intl.formatMessage(editable_cell_1.commonTranslationMessages["taxCategoryType_labels_" + taxCategoryType]) + " (" + taxPercentage + "%)"));
|
|
141
|
+
return (react_1.default.createElement(antd_1.Select.Option, { disabled: getTaxCategoryDisabled(mapi_1.TaxCategoryTypeEnum[taxCategoryType], props.outsideVatScope), value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, props.intl.formatMessage(editable_cell_1.commonTranslationMessages["taxCategoryType_labels_" + taxCategoryType]) + " (" + taxPercentage + "%)"));
|
|
131
142
|
})))),
|
|
132
143
|
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
133
144
|
react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.discountValue"], defaultIsRequired: false, fieldName: [field.name, "discountValue"], defaultLabel: props.intl.formatMessage(translationMessages.billingLines_discount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, BillingLineUtility_1.getCorrectInputNode("discountValue", props.intl))),
|
|
@@ -16,9 +16,10 @@ interface Props extends InjectedIntlProps {
|
|
|
16
16
|
formInstance: FormInstance;
|
|
17
17
|
billingLinesMetadata: BillingLineMetadataOverride[] | undefined;
|
|
18
18
|
receiverRequirements: NewReceiverRequirements;
|
|
19
|
+
outsideVatScope: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const translationMessages: ReactIntl.Messages<"billingLines_title" | "billingLines_tooltip_title" | "billingLines_button_addRow" | "billingLines_placeholders_itemNo" | "billingLines_placeholders_newItem">;
|
|
21
|
-
declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "billingLinesMetadata">, any> & {
|
|
22
|
+
declare const BillingLinesIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "outsideVatScope" | "billingLinesMetadata">, any> & {
|
|
22
23
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
23
24
|
};
|
|
24
25
|
export default BillingLinesIntl;
|
|
@@ -256,14 +256,22 @@ var BillingLines = /** @class */ (function (_super) {
|
|
|
256
256
|
var billingLinesFormValues = this.props.formInstance.getFieldsValue(["invoice", "invoiceLines"]);
|
|
257
257
|
// console.log(billingLinesFormValues)
|
|
258
258
|
return (React.createElement(components_1.ComponentContainer, { title: billingLinesLabelNode },
|
|
259
|
-
React.createElement(NewBillingLines_1.default, { formInstance: this.props.formInstance, receiverRequirements: this.props.receiverRequirements }),
|
|
259
|
+
React.createElement(NewBillingLines_1.default, { formInstance: this.props.formInstance, receiverRequirements: this.props.receiverRequirements, outsideVatScope: this.props.outsideVatScope }),
|
|
260
260
|
React.createElement(antd_1.Row, { style: { marginTop: "1em" }, align: "top", justify: "space-between", gutter: [16, 16] },
|
|
261
261
|
React.createElement(antd_1.Col, { span: 16 },
|
|
262
|
-
React.createElement(BillingTaxSummary_1.default
|
|
262
|
+
React.createElement(BillingTaxSummary_1.default
|
|
263
|
+
// billingLines={this.props.billingLinesMetadata}
|
|
264
|
+
, {
|
|
265
|
+
// billingLines={this.props.billingLinesMetadata}
|
|
266
|
+
formInstance: this.props.formInstance, outsideVatScope: this.props.outsideVatScope })),
|
|
263
267
|
React.createElement(antd_1.Col, { span: 8 },
|
|
264
|
-
React.createElement(BillingCalculations_1.default
|
|
268
|
+
React.createElement(BillingCalculations_1.default
|
|
269
|
+
// billingLinesMetadata={this.props.billingLinesMetadata}
|
|
270
|
+
// renderCurrencyColumn={this.renderCurrencyColumn}
|
|
271
|
+
, {
|
|
272
|
+
// billingLinesMetadata={this.props.billingLinesMetadata}
|
|
265
273
|
// renderCurrencyColumn={this.renderCurrencyColumn}
|
|
266
|
-
currencyCode: currencyCode })))));
|
|
274
|
+
currencyCode: currencyCode, formInstance: this.props.formInstance, outsideVatScope: this.props.outsideVatScope })))));
|
|
267
275
|
};
|
|
268
276
|
return BillingLines;
|
|
269
277
|
}(React.Component));
|
|
@@ -7,8 +7,10 @@ interface Props extends InjectedIntlProps {
|
|
|
7
7
|
rapiApiKey: string;
|
|
8
8
|
rapiBaseUrl: string;
|
|
9
9
|
form: FormInstance;
|
|
10
|
+
outsideVatScope: boolean;
|
|
11
|
+
setOutsideVatScope: (outsideVatScope: boolean) => void;
|
|
10
12
|
}
|
|
11
|
-
declare const SupplierIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "rapiBaseUrl" | "rapiApiKey">, any> & {
|
|
13
|
+
declare const SupplierIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "rapiBaseUrl" | "rapiApiKey" | "outsideVatScope" | "setOutsideVatScope">, any> & {
|
|
12
14
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
13
15
|
};
|
|
14
16
|
export default SupplierIntl;
|
|
@@ -21,7 +21,6 @@ var icons_1 = require("@ant-design/icons");
|
|
|
21
21
|
// import {defineMessages} from "react-intl.macro"
|
|
22
22
|
var payment_method_1 = require("../payment-method");
|
|
23
23
|
var antd_mask_input_1 = require("antd-mask-input");
|
|
24
|
-
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
25
24
|
var axios_1 = __importDefault(require("axios"));
|
|
26
25
|
var lodash_1 = require("lodash");
|
|
27
26
|
var ApiUtility_1 = require("../../../utils/ApiUtility");
|
|
@@ -42,6 +41,10 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
42
41
|
id: "supplier_vatNumber",
|
|
43
42
|
defaultMessage: "VAT no"
|
|
44
43
|
},
|
|
44
|
+
supplier_notVatRegistered: {
|
|
45
|
+
id: "supplier_notVatRegistered",
|
|
46
|
+
defaultMessage: "Not VAT registered"
|
|
47
|
+
},
|
|
45
48
|
supplier_address_streetNameAndNumber: {
|
|
46
49
|
id: "supplier_address_streetNameAndNumber",
|
|
47
50
|
defaultMessage: "Address"
|
|
@@ -92,18 +95,19 @@ var Supplier = function (props) {
|
|
|
92
95
|
"\u00A0",
|
|
93
96
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
94
97
|
var getRequiredVatNumber = function () {
|
|
95
|
-
|
|
96
|
-
if (fieldsValueAll.hasOwnProperty("invoice")) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
return true;
|
|
98
|
+
// const fieldsValueAll = props.form.getFieldsValue();
|
|
99
|
+
// if (fieldsValueAll.hasOwnProperty("invoice")) {
|
|
100
|
+
// if (fieldsValueAll.invoice.hasOwnProperty("invoiceLines")) {
|
|
101
|
+
// const invoiceLines: BillingLineMetadata[] = fieldsValueAll.invoice.invoiceLines;
|
|
102
|
+
// return invoiceLines.some(billingLine => {
|
|
103
|
+
// if (billingLine) {
|
|
104
|
+
// return (billingLine.taxCategoryType !== TaxCategoryTypeEnum.OutsideTaxScope);
|
|
105
|
+
// }
|
|
106
|
+
// })
|
|
107
|
+
// }
|
|
108
|
+
// }
|
|
109
|
+
// return true;
|
|
110
|
+
return !props.outsideVatScope;
|
|
107
111
|
};
|
|
108
112
|
react_1.useEffect(function () {
|
|
109
113
|
if (participantInfo !== null && participantInfo !== undefined) {
|
|
@@ -202,7 +206,9 @@ var Supplier = function (props) {
|
|
|
202
206
|
})
|
|
203
207
|
}
|
|
204
208
|
] },
|
|
205
|
-
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo })),
|
|
209
|
+
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo || props.outsideVatScope })),
|
|
210
|
+
React.createElement(antd_1.Form.Item, { name: "outsideVatScope", label: props.intl.formatMessage(translationMessages.supplier_notVatRegistered), valuePropName: "checked" },
|
|
211
|
+
React.createElement(antd_1.Checkbox, { onChange: function (e) { return props.setOutsideVatScope(e.target.checked); } })),
|
|
206
212
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.address.streetNameAndNumber"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_address_streetNameAndNumber), defaultIsRequired: true, fieldName: ["invoice", "supplier", "address", "streetNameAndNumber"] },
|
|
207
213
|
React.createElement(antd_1.Input, { disabled: isLoadingParticipantInfo })),
|
|
208
214
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.address.postalZone"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_address_zip_postalCode), defaultIsRequired: true, fieldName: ["invoice", "supplier", "address", "postalZone"] },
|
|
@@ -73,6 +73,30 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
73
73
|
var _c = react_1.useState(ConversionUtility_1.profileOutputToPartyMetadata(props.customers[0])), chosenCustomer = _c[0], setChosenCustomer = _c[1];
|
|
74
74
|
var _d = react_1.useState(), chosenCustomerApiKey = _d[0], setChosenCustomerApiKey = _d[1];
|
|
75
75
|
// const [billingLinesEditableIndex, setBillingLinesEditableIndex] = useState<number>(1)
|
|
76
|
+
var _e = react_1.useState(false), outsideVatScope = _e[0], setOutsideVatScope = _e[1];
|
|
77
|
+
react_1.useEffect(function () {
|
|
78
|
+
form.resetFields([
|
|
79
|
+
["invoice", "supplier", "vatNumber"],
|
|
80
|
+
]);
|
|
81
|
+
var invoiceLines = form.getFieldValue(["invoice", "invoiceLines"]);
|
|
82
|
+
if (outsideVatScope) {
|
|
83
|
+
invoiceLines = invoiceLines.map(function (invoiceLine) {
|
|
84
|
+
invoiceLine.taxCategoryType = mapi_1.TaxCategoryTypeEnum.OutsideTaxScope;
|
|
85
|
+
return invoiceLine;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
invoiceLines = invoiceLines.map(function (invoiceLine) {
|
|
90
|
+
invoiceLine.taxCategoryType = mapi_1.TaxCategoryTypeEnum.StandardRated;
|
|
91
|
+
return invoiceLine;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
form.setFieldsValue({
|
|
95
|
+
invoice: {
|
|
96
|
+
invoiceLines: invoiceLines
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}, [outsideVatScope]);
|
|
76
100
|
// const initialBillingLineData: BillingLineMetadataOverride = {
|
|
77
101
|
// key: billingLinesEditableIndex,
|
|
78
102
|
// itemNo: props.intl.formatMessage(billingLineTranslationMessages.billingLines_placeholders_itemNo), // "Item No.",// (dataSource.length > 0 ? Number(dataSource[dataSource.length-1].itemNo) + 1 : 1).toString(),
|
|
@@ -283,7 +307,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
283
307
|
});
|
|
284
308
|
setChosenCustomerApiKey(props.customers[0].apiKey);
|
|
285
309
|
}
|
|
286
|
-
var
|
|
310
|
+
var _f = react_1.useState(undefined), billingLinesMetadata = _f[0], setBillingLinesMetadata = _f[1];
|
|
287
311
|
var getBillingLines = function (changedValues, allValues) {
|
|
288
312
|
var invoiceLines = allValues.invoice.invoiceLines;
|
|
289
313
|
if (invoiceLines) {
|
|
@@ -332,7 +356,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
332
356
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
333
357
|
react_1.default.createElement(components_1.Supplier, { receiverRequirements: props.receiverRequirements,
|
|
334
358
|
// billingLinesDataSource={billingLinesDataSource}
|
|
335
|
-
rapiBaseUrl: props.rapiBaseUrl, rapiApiKey: props.rapiApiKey, form: form })),
|
|
359
|
+
rapiBaseUrl: props.rapiBaseUrl, rapiApiKey: props.rapiApiKey, form: form, outsideVatScope: outsideVatScope, setOutsideVatScope: setOutsideVatScope })),
|
|
336
360
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
337
361
|
react_1.default.createElement(components_1.Customer, { receiverRequirements: props.receiverRequirements, formInstance: form, customers: props.customers, chosenCustomer: chosenCustomer, setChosenCustomer: setChosenCustomer, setChosenCustomerApiKey: setChosenCustomerApiKey, rapiBaseUrl: props.rapiBaseUrl, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp })),
|
|
338
362
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
@@ -348,7 +372,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
348
372
|
// initialBillingLineData={initialBillingLineData}
|
|
349
373
|
// handleDelete={handleBillingLinesDelete}
|
|
350
374
|
// handleSave={handleBillingLinesSave}
|
|
351
|
-
receiverRequirements: props.receiverRequirements })),
|
|
375
|
+
receiverRequirements: props.receiverRequirements, outsideVatScope: outsideVatScope })),
|
|
352
376
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
353
377
|
react_1.default.createElement(components_1.PaymentMethod, { receiverRequirements: props.receiverRequirements, formInstance: form })),
|
|
354
378
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 } },
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"supplier_name": "Nafn birgja",
|
|
78
78
|
"supplier_identifier": "Kennitala",
|
|
79
79
|
"supplier_vatNumber": "VSK nr.",
|
|
80
|
+
"supplier_notVatRegistered": "Ekki VSK skyldur rekstur",
|
|
80
81
|
"supplier_vatNumber_mandatory": "Gerð er krafa um VSK númer ef línur í skjali nota aðra skattflokka heldur en 'Utan skattumfangs'",
|
|
81
82
|
"supplier_address_streetNameAndNumber": "Heimilisfang",
|
|
82
83
|
"supplier_address_zip_postalCode": "Póstnúmer",
|
|
@@ -79,6 +79,7 @@ declare const _default: {
|
|
|
79
79
|
"supplier_name": string;
|
|
80
80
|
"supplier_identifier": string;
|
|
81
81
|
"supplier_vatNumber": string;
|
|
82
|
+
"supplier_notVatRegistered": string;
|
|
82
83
|
"supplier_vatNumber_mandatory": string;
|
|
83
84
|
"supplier_address_streetNameAndNumber": string;
|
|
84
85
|
"supplier_address_zip_postalCode": string;
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,107 +0,0 @@
|
|
|
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);
|