@unimaze/billing 0.21.7 → 0.21.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/components/base-information/index.js +1 -1
- package/lib/common/components/billing-lines/BillingCalculations.js +0 -3
- package/lib/common/components/billing-lines/NewBillingLines.js +1 -1
- package/lib/common/components/billing-lines/SingleBillingLine.js +1 -1
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +0 -0
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +109 -0
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.d.ts +14 -0
- package/lib/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.js +73 -0
- package/lib/common/components/invoice-preview/InvoicePreviewInvoiceLines.d.ts +12 -0
- package/lib/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +93 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +0 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +110 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.d.ts +14 -0
- package/lib/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.js +77 -0
- package/lib/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.d.ts +14 -0
- package/lib/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +52 -0
- package/lib/common/components/payment-method/index.js +3 -0
- package/lib/unimaze-billing/src/common/components/CommonTranslations.d.ts +1 -29
- package/lib/unimaze-billing/src/common/components/CommonTranslations.js +4 -32
- package/lib/unimaze-billing/src/common/components/attachments/Attachment.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/attachments/AttachmentModal.js +5 -2
- package/lib/unimaze-billing/src/common/components/attachments/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/base-information/AccountingCost.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/base-information/OrderReference.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/base-information/ProjectReference.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts +6 -1
- package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.js +34 -12
- package/lib/unimaze-billing/src/common/components/base-information/index.d.ts +10 -1
- package/lib/unimaze-billing/src/common/components/base-information/index.js +10 -2
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingCalculations.js +3 -5
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.d.ts +4 -1
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingLinePreview.js +45 -25
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/billing-lines/BillingTaxSummary.js +0 -1
- package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.d.ts +6 -1
- package/lib/unimaze-billing/src/common/components/billing-lines/NewBillingLines.js +41 -327
- package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.d.ts +10 -5
- package/lib/unimaze-billing/src/common/components/billing-lines/SingleBillingLine.js +137 -61
- package/lib/unimaze-billing/src/common/components/billing-lines/index.d.ts +3 -6
- package/lib/unimaze-billing/src/common/components/billing-lines/index.js +1 -1
- package/lib/unimaze-billing/src/common/components/customer/CostCenter.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/customer/CustomerContactName.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/customer/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/customer/index.js +7 -9
- package/lib/unimaze-billing/src/common/components/delivery-location/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/form-item/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/input/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/invoice/index.d.ts +3 -1
- package/lib/unimaze-billing/src/common/components/invoice/index.js +21 -14
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfo.js +75 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewCustomerSupplierInfoBox.js +73 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewHeader.js +7 -8
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.d.ts +12 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewInvoiceLines.js +93 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfo.js +77 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewPaymentInfoBox.js +58 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.d.ts +14 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/InvoicePreviewTotalAmountPreview.js +52 -0
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.d.ts +87 -1
- package/lib/unimaze-billing/src/common/components/invoice-preview/index.js +27 -236
- package/lib/unimaze-billing/src/common/components/payment-method/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/supplier/CityAutofill.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/supplier/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/components/supplier/index.js +1 -1
- package/lib/unimaze-billing/src/common/components/welcome-modal/index.d.ts +1 -1
- package/lib/unimaze-billing/src/common/types/AppConfiguration.d.ts +7 -4
- package/lib/unimaze-billing/src/common/types/ReceiverRequirements.d.ts +2 -0
- package/lib/unimaze-billing/src/common/types/ReceiverRequirements.js +2 -0
- package/lib/unimaze-billing/src/create-invoice/index.d.ts +11 -3
- package/lib/unimaze-billing/src/create-invoice/index.js +91 -64
- package/lib/unimaze-billing/src/enums.d.ts +3 -0
- package/lib/unimaze-billing/src/translations/locales/en.json +13 -13
- package/lib/unimaze-billing/src/translations/locales/is.json +8 -8
- package/lib/unimaze-billing/src/translations/locales.d.ts +16 -16
- package/lib/unimaze-billing/src/utils/ApiUtility.d.ts +9 -3
- package/lib/unimaze-billing/src/utils/ApiUtility.js +31 -13
- package/lib/unimaze-billing/src/utils/BillingLineUtility.d.ts +4 -1
- package/lib/unimaze-billing/src/utils/BillingLineUtility.js +36 -4
- package/lib/unimaze-billing/src/utils/ConversionUtility.d.ts +2 -2
- package/lib/unimaze-billing/src/utils/ConversionUtility.js +10 -11
- package/lib/unimaze-billing/src/utils/IntlUtility.d.ts +1 -0
- package/lib/unimaze-billing/src/utils/IntlUtility.js +33 -10
- package/lib/unimaze-billing/src/utils/RequirementsUtility.d.ts +3 -1
- package/lib/unimaze-billing/src/utils/RequirementsUtility.js +49 -1
- package/lib/utils/BillingLineUtility.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var antd_1 = require("antd");
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var react_intl_1 = require("react-intl");
|
|
9
|
+
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
10
|
+
var index_1 = require("./index");
|
|
11
|
+
var IntlUtility_1 = require("../../../utils/IntlUtility");
|
|
12
|
+
var enums_1 = require("../../../enums");
|
|
13
|
+
var InvoicePreviewTotalAmountPreview = function (props) {
|
|
14
|
+
var token = antd_1.theme.useToken().token;
|
|
15
|
+
var getLinesTax = function () {
|
|
16
|
+
var _a;
|
|
17
|
+
return ((_a = props.form.getFieldValue(["invoice", "invoiceLines"])) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
18
|
+
props.form.getFieldValue(["invoice", "invoiceLines"]).map(function (line, index) {
|
|
19
|
+
var taxPercentage = (0, BillingLineUtility_1.calculateTaxPercentage)(enums_1.AvailableTaxCategoryTypeEnum[line.taxCategoryType]);
|
|
20
|
+
return (react_1.default.createElement(antd_1.Flex, { justify: "space-between", key: index },
|
|
21
|
+
react_1.default.createElement(antd_1.Typography.Text, null,
|
|
22
|
+
taxPercentage,
|
|
23
|
+
"% VAT"),
|
|
24
|
+
react_1.default.createElement(antd_1.Typography.Text, null, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)((0, BillingLineUtility_1.calculateTaxAmount)(line.taxableAmount, taxPercentage), props.intl))));
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return (react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "small" },
|
|
28
|
+
react_1.default.createElement(antd_1.Card, { bordered: false, style: { backgroundColor: "#F5F5F5" }, size: "small" },
|
|
29
|
+
react_1.default.createElement(antd_1.Flex, { vertical: true, style: { padding: "0 12px" } },
|
|
30
|
+
react_1.default.createElement(antd_1.Flex, { justify: "space-between" },
|
|
31
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, props.intl.formatMessage(index_1.translationMessages.billingCalculations_labels_TaxAmountWithoutVat)),
|
|
32
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
|
|
33
|
+
props.form.getFieldValue(["invoice", "currencyCode"]),
|
|
34
|
+
" ",
|
|
35
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(props.totals.totalTaxableAmount, props.intl)))),
|
|
36
|
+
getLinesTax(),
|
|
37
|
+
react_1.default.createElement(antd_1.Flex, { justify: "space-between" },
|
|
38
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, props.intl.formatMessage(index_1.translationMessages.billingCalculations_labels_TotalRoundingAmount)),
|
|
39
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeSM } },
|
|
40
|
+
props.form.getFieldValue(["invoice", "currencyCode"]),
|
|
41
|
+
" ",
|
|
42
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(props.totals.discountAmount, props.intl)))))),
|
|
43
|
+
react_1.default.createElement(antd_1.Flex, { justify: "space-between", align: "center", style: { padding: "0 24px" } },
|
|
44
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: "16px" } },
|
|
45
|
+
props.intl.formatMessage(index_1.translationMessages.billingCalculations_labels_AmountPayable),
|
|
46
|
+
":"),
|
|
47
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeHeading4 } },
|
|
48
|
+
props.form.getFieldValue(["invoice", "currencyCode"]),
|
|
49
|
+
" ",
|
|
50
|
+
react_1.default.createElement(antd_1.Typography.Text, { style: { fontSize: token.fontSizeXL } }, (0, IntlUtility_1.icelandicNumberLocaleWorkaroundChrome)(Math.round(props.totals.totalTaxInclusiveAmount), props.intl))))));
|
|
51
|
+
};
|
|
52
|
+
exports.default = (0, react_intl_1.injectIntl)(InvoicePreviewTotalAmountPreview);
|
|
@@ -129,6 +129,9 @@ var PaymentMethod = function (props) {
|
|
|
129
129
|
if (!props.isActiveStep)
|
|
130
130
|
return;
|
|
131
131
|
debouncedValidateFields(fieldPaths, true);
|
|
132
|
+
if (!props.formInstance.getFieldValue(["invoice", "paymentMeans", "domesticTransfer", "accountTypeNumber"])) {
|
|
133
|
+
props.formInstance.setFieldValue(["invoice", "paymentMeans", "domesticTransfer", "accountTypeNumber"], "04");
|
|
134
|
+
}
|
|
132
135
|
}, [props.isActiveStep, JSON.stringify(props.formInstance.getFieldsValue(fieldPaths))]);
|
|
133
136
|
var domesticTransferFormFields = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
134
137
|
react_1.default.createElement(antd_1.Form.Item, null,
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
export declare const commonTranslationMessages: {
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
};
|
|
6
|
-
taxCategoryType_labels_ReducedRated: {
|
|
7
|
-
id: string;
|
|
8
|
-
defaultMessage: string;
|
|
9
|
-
};
|
|
10
|
-
taxCategoryType_labels_ZeroRated: {
|
|
11
|
-
id: string;
|
|
12
|
-
defaultMessage: string;
|
|
13
|
-
};
|
|
14
|
-
taxCategoryType_labels_Exempt: {
|
|
15
|
-
id: string;
|
|
16
|
-
defaultMessage: string;
|
|
17
|
-
};
|
|
18
|
-
taxCategoryType_labels_OutsideTaxScope: {
|
|
19
|
-
id: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
taxCategoryType_labels_ReverseCharged: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
};
|
|
26
|
-
taxCategoryType_labels_FreeExportTaxNotCharged: {
|
|
27
|
-
id: string;
|
|
28
|
-
defaultMessage: string;
|
|
29
|
-
};
|
|
30
|
-
taxCategoryType_labels_ExemptEuropeanEconomicArea: {
|
|
2
|
+
taxCategoryType_label: {
|
|
31
3
|
id: string;
|
|
32
4
|
defaultMessage: string;
|
|
33
5
|
};
|
|
@@ -3,37 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.commonTranslationMessages = void 0;
|
|
4
4
|
var react_intl_1 = require("react-intl");
|
|
5
5
|
exports.commonTranslationMessages = (0, react_intl_1.defineMessages)({
|
|
6
|
-
|
|
7
|
-
id: "
|
|
8
|
-
defaultMessage: "Standard rated",
|
|
9
|
-
},
|
|
10
|
-
taxCategoryType_labels_ReducedRated: {
|
|
11
|
-
id: "taxCategoryType_labels_ReducedRated",
|
|
12
|
-
defaultMessage: "Reduced rated",
|
|
13
|
-
},
|
|
14
|
-
taxCategoryType_labels_ZeroRated: {
|
|
15
|
-
id: "taxCategoryType_labels_ZeroRated",
|
|
16
|
-
defaultMessage: "Zero rated",
|
|
17
|
-
},
|
|
18
|
-
taxCategoryType_labels_Exempt: {
|
|
19
|
-
id: "taxCategoryType_labels_Exempt",
|
|
20
|
-
defaultMessage: "Exempt",
|
|
21
|
-
},
|
|
22
|
-
taxCategoryType_labels_OutsideTaxScope: {
|
|
23
|
-
id: "taxCategoryType_labels_OutsideTaxScope",
|
|
24
|
-
defaultMessage: "Outside tax scope",
|
|
25
|
-
},
|
|
26
|
-
taxCategoryType_labels_ReverseCharged: {
|
|
27
|
-
id: "taxCategoryType_labels_ReverseCharged",
|
|
28
|
-
defaultMessage: "Reverse charged",
|
|
29
|
-
},
|
|
30
|
-
taxCategoryType_labels_FreeExportTaxNotCharged: {
|
|
31
|
-
id: "taxCategoryType_labels_FreeExportTaxNotCharged",
|
|
32
|
-
defaultMessage: "Free export tax not charged",
|
|
33
|
-
},
|
|
34
|
-
taxCategoryType_labels_ExemptEuropeanEconomicArea: {
|
|
35
|
-
id: "taxCategoryType_labels_ExemptEuropeanEconomicArea",
|
|
36
|
-
defaultMessage: "Exempt European economic area",
|
|
6
|
+
taxCategoryType_label: {
|
|
7
|
+
id: "taxCategoryType_label",
|
|
8
|
+
defaultMessage: "{taxCategoryType, select , StandardRated {Standard rated} ReducedRated {Reduced rated} ZeroRated {Zero rated} Exempt {Exempt} OutsideTaxScope {Outside tax scope} ReverseCharged {Reverse charged} FreeExportTaxNotCharged {Free export tax not charged} ExemptEuropeanEconomicArea {Exempt European economic area} ExemptionForResale {Exemption for resale} other {taxCategoryType}}",
|
|
37
9
|
},
|
|
38
10
|
unitOfMeasure_labels_Piece: {
|
|
39
11
|
id: "unitOfMeasure_labels_Piece",
|
|
@@ -93,7 +65,7 @@ exports.commonTranslationMessages = (0, react_intl_1.defineMessages)({
|
|
|
93
65
|
},
|
|
94
66
|
unitOfMeasure_labels_One: {
|
|
95
67
|
id: "unitOfMeasure_labels_One",
|
|
96
|
-
defaultMessage: "
|
|
68
|
+
defaultMessage: "Unit",
|
|
97
69
|
},
|
|
98
70
|
saveInformation_label: {
|
|
99
71
|
id: "saveInformation_label",
|
|
@@ -13,7 +13,7 @@ interface Props extends WrappedComponentProps {
|
|
|
13
13
|
setAttachmentFieldValidation: (attachmentFieldValidation: ValidateStatus) => void;
|
|
14
14
|
}
|
|
15
15
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
16
|
-
forwardedRef?: React.Ref<any
|
|
16
|
+
forwardedRef?: React.Ref<any>;
|
|
17
17
|
} & React.RefAttributes<any>> & {
|
|
18
18
|
WrappedComponent: React.ComponentType<Props>;
|
|
19
19
|
};
|
|
@@ -14,7 +14,7 @@ interface AttachmentModalProps extends WrappedComponentProps {
|
|
|
14
14
|
onSave: () => void;
|
|
15
15
|
}
|
|
16
16
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<AttachmentModalProps, "intl"> & {
|
|
17
|
-
forwardedRef?: React.Ref<any
|
|
17
|
+
forwardedRef?: React.Ref<any>;
|
|
18
18
|
} & React.RefAttributes<any>> & {
|
|
19
19
|
WrappedComponent: React.ComponentType<AttachmentModalProps>;
|
|
20
20
|
};
|
|
@@ -115,7 +115,7 @@ var AttachmentModal = function (props) {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
React.useEffect(function () {
|
|
118
|
-
var _isSaveAttachmentsDisabled = props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; });
|
|
118
|
+
var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || !attachment.description; }) : true;
|
|
119
119
|
setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
|
|
120
120
|
}, [props.attachments]);
|
|
121
121
|
var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
@@ -191,7 +191,10 @@ var AttachmentModal = function (props) {
|
|
|
191
191
|
React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined, style: { width: "100%" } }, attachment.file.name),
|
|
192
192
|
React.createElement(lib_1.Form.Item, { name: ["attachments", "file".concat(index + 1), "file"], initialValue: attachment.file, hidden: true }),
|
|
193
193
|
attachment.file.status === "uploading" ? (React.createElement(icons_1.LoadingOutlined, null)) : (React.createElement(antd_1.Typography.Text, { type: attachment.file.status === "error" ? "danger" : undefined },
|
|
194
|
-
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
194
|
+
React.createElement(icons_1.DeleteOutlined, { onClick: function () {
|
|
195
|
+
props.formInstance.setFieldValue(["attachments", "file".concat(index + 1), "description"], "");
|
|
196
|
+
props.onRemove(attachment.file);
|
|
197
|
+
} })))),
|
|
195
198
|
attachment.fieldValidation === "success" && (React.createElement(lib_1.Form.Item, __assign({}, formLayout_1.fullWidthInput, { rules: [
|
|
196
199
|
{
|
|
197
200
|
required: true,
|
|
@@ -20,7 +20,7 @@ export type AttachmentType = {
|
|
|
20
20
|
description: string;
|
|
21
21
|
};
|
|
22
22
|
declare const AttachmentGroupIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
23
|
-
forwardedRef?: React.Ref<any
|
|
23
|
+
forwardedRef?: React.Ref<any>;
|
|
24
24
|
} & React.RefAttributes<any>> & {
|
|
25
25
|
WrappedComponent: React.ComponentType<Props>;
|
|
26
26
|
};
|
|
@@ -10,7 +10,7 @@ interface Props extends WrappedComponentProps {
|
|
|
10
10
|
legalIdentifier: string;
|
|
11
11
|
}
|
|
12
12
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
13
|
-
forwardedRef?: React.Ref<any
|
|
13
|
+
forwardedRef?: React.Ref<any>;
|
|
14
14
|
} & React.RefAttributes<any>> & {
|
|
15
15
|
WrappedComponent: React.ComponentType<Props>;
|
|
16
16
|
};
|
|
@@ -9,7 +9,7 @@ interface Props extends WrappedComponentProps {
|
|
|
9
9
|
dependencies: NamePath[];
|
|
10
10
|
}
|
|
11
11
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
12
|
-
forwardedRef?: React.Ref<any
|
|
12
|
+
forwardedRef?: React.Ref<any>;
|
|
13
13
|
} & React.RefAttributes<any>> & {
|
|
14
14
|
WrappedComponent: React.ComponentType<Props>;
|
|
15
15
|
};
|
|
@@ -7,7 +7,7 @@ interface Props extends WrappedComponentProps {
|
|
|
7
7
|
form: FormInstance;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
10
|
-
forwardedRef?: React.Ref<any
|
|
10
|
+
forwardedRef?: React.Ref<any>;
|
|
11
11
|
} & React.RefAttributes<any>> & {
|
|
12
12
|
WrappedComponent: React.ComponentType<Props>;
|
|
13
13
|
};
|
package/lib/unimaze-billing/src/common/components/base-information/ReferenceIdentifiers.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export declare const translationMessages: {
|
|
|
28
28
|
id: string;
|
|
29
29
|
defaultMessage: string;
|
|
30
30
|
};
|
|
31
|
+
referenceIdentifiers_values_validation_message: {
|
|
32
|
+
id: string;
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
};
|
|
31
35
|
};
|
|
32
36
|
interface Props extends WrappedComponentProps {
|
|
33
37
|
receiverRequirements: NewReceiverRequirements;
|
|
@@ -39,9 +43,10 @@ interface Props extends WrappedComponentProps {
|
|
|
39
43
|
referenceIdentifiersHelpText?: string;
|
|
40
44
|
referenceIdentifierValidateStatus: ValidateStatus;
|
|
41
45
|
setReferenceIdentifierValidateStatus: (referenceIdentifierValidateStatus: ValidateStatus) => void;
|
|
46
|
+
setReferenceIdentifierIsMandatory: (referenceIdentifierIsMandatory: boolean) => void;
|
|
42
47
|
}
|
|
43
48
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
44
|
-
forwardedRef?: React.Ref<any
|
|
49
|
+
forwardedRef?: React.Ref<any>;
|
|
45
50
|
} & React.RefAttributes<any>> & {
|
|
46
51
|
WrappedComponent: React.ComponentType<Props>;
|
|
47
52
|
};
|
|
@@ -55,8 +55,9 @@ var ReferenceIdentifierUtility_1 = require("../../../utils/ReferenceIdentifierUt
|
|
|
55
55
|
var axios_1 = __importDefault(require("axios"));
|
|
56
56
|
var ApiUtility_1 = require("../../../utils/ApiUtility");
|
|
57
57
|
var lodash_1 = require("lodash");
|
|
58
|
-
var form_item_1 = require("../form-item");
|
|
58
|
+
var form_item_1 = __importStar(require("../form-item"));
|
|
59
59
|
var __1 = require("..");
|
|
60
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
60
61
|
exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
61
62
|
referenceIdentifiers_labels_addButton: {
|
|
62
63
|
id: "referenceIdentifiers_labels_addButton",
|
|
@@ -82,10 +83,15 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
82
83
|
id: "referenceIdentifiers_labels_LOC",
|
|
83
84
|
defaultMessage: "Real estate number", // "Fasteignanúmer",
|
|
84
85
|
},
|
|
86
|
+
referenceIdentifiers_values_validation_message: {
|
|
87
|
+
id: "referenceIdentifiers_values_validation_message",
|
|
88
|
+
defaultMessage: "This value doesn't exist",
|
|
89
|
+
},
|
|
85
90
|
});
|
|
86
91
|
var ReferenceIdentifiers = function (props) {
|
|
87
|
-
var _a
|
|
88
|
-
var
|
|
92
|
+
var _a, _b, _c, _d, _e, _f;
|
|
93
|
+
var _g = (0, react_1.useState)([]), referenceIdentifierValue = _g[0], setReferenceIdentifierValue = _g[1];
|
|
94
|
+
var _h = (0, react_1.useState)(false), loadingReferenceIdentifierValues = _h[0], setLoadingReferenceIdentifierValues = _h[1]; // TODO: change this to boolean[] for handling the list
|
|
89
95
|
var token = antd_1.theme.useToken().token;
|
|
90
96
|
var referenceIdentifiersHelp = props.referenceIdentifiersHelpText
|
|
91
97
|
? props.referenceIdentifiersHelpText
|
|
@@ -183,7 +189,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
183
189
|
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
184
190
|
}
|
|
185
191
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
186
|
-
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true });
|
|
192
|
+
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true, help: referenceIdentifierValidateStatus === "error" ? props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_values_validation_message) : '' });
|
|
187
193
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
188
194
|
react_1.default.createElement(__1.UmzInput, { defaultIsRequired: !!(value && value.key), onBlur: function (event) {
|
|
189
195
|
return handleReferenceIdentifierValueValidation(legalIdentifier, fieldDefinition_1.name, event.currentTarget.value, rapiBaseUrl, ["invoice", "referenceIdentifiers", field.name, "value"], setReferenceIdentifierValidateStatus);
|
|
@@ -202,7 +208,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
202
208
|
}
|
|
203
209
|
: {};
|
|
204
210
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
205
|
-
react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false }, selectProps), fieldDefinition_1.properties.values.map(function (op) {
|
|
211
|
+
react_1.default.createElement(antd_1.Select, __assign({ popupMatchSelectWidth: false }, selectProps, { prefix: react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") }), fieldDefinition_1.properties.values.map(function (op) {
|
|
206
212
|
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
207
213
|
}))));
|
|
208
214
|
}
|
|
@@ -221,6 +227,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
221
227
|
};
|
|
222
228
|
var referenceIdentifiersDefinitions = (0, ReferenceIdentifierUtility_1.getReferenceIdentifierFieldDefinitions)(props.receiverRequirements);
|
|
223
229
|
var getSingleReferenceIdentifierInput = function () {
|
|
230
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
224
231
|
var fieldHandling = null;
|
|
225
232
|
var fieldDefinition = referenceIdentifiersDefinitions[0];
|
|
226
233
|
var singleReferenceIdentifierLabel = fieldDefinition.properties.label;
|
|
@@ -231,13 +238,18 @@ var ReferenceIdentifiers = function (props) {
|
|
|
231
238
|
? fieldHandling.helpText
|
|
232
239
|
: undefined;
|
|
233
240
|
}
|
|
241
|
+
// Condition 1 - If referenceidentifier should not show field values (options to choose from), but we need to validate
|
|
242
|
+
// Test: Always with "Should be validated" checked. Then test both mandatory and optional
|
|
234
243
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
244
|
+
props.setReferenceIdentifierIsMandatory((_d = (((_c = (_b = (_a = props.receiverRequirements) === null || _a === void 0 ? void 0 : _a.fieldDefinitions) === null || _b === void 0 ? void 0 : _b[0].properties) === null || _c === void 0 ? void 0 : _c.cardinality) === "1..1")) !== null && _d !== void 0 ? _d : false);
|
|
235
245
|
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"], validateStatus: props.referenceIdentifierValidateStatus, hasFeedback: true },
|
|
236
|
-
react_1.default.createElement(__1.UmzInput, { defaultPlaceholder: singleReferenceIdentifierLabel, defaultTooltip: singleReferenceIdentifiersHelp ? singleReferenceIdentifiersHelp : undefined,
|
|
246
|
+
react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"], defaultPlaceholder: singleReferenceIdentifierLabel, defaultTooltip: singleReferenceIdentifiersHelp ? singleReferenceIdentifiersHelp : undefined, onChange: function (event) {
|
|
237
247
|
return handleReferenceIdentifierValueValidation(props.legalIdentifier, fieldDefinition.name, event.currentTarget.value, props.rapiBaseUrl, ["invoice", "singleReferenceIdentifier", "value"], props.setReferenceIdentifierValidateStatus);
|
|
238
248
|
} })));
|
|
239
249
|
}
|
|
240
250
|
if (fieldDefinition.properties.hasOwnProperty("values") && fieldDefinition.properties.values) {
|
|
251
|
+
// Condition 2 - If referenceidentifier has field values (options to choose from)
|
|
252
|
+
props.setReferenceIdentifierIsMandatory((_h = (((_g = (_f = (_e = props.receiverRequirements) === null || _e === void 0 ? void 0 : _e.fieldDefinitions) === null || _f === void 0 ? void 0 : _f[0].properties) === null || _g === void 0 ? void 0 : _g.cardinality) === "1..1")) !== null && _h !== void 0 ? _h : false);
|
|
241
253
|
var selectProps = fieldDefinition.properties.hasOwnProperty("href")
|
|
242
254
|
? {
|
|
243
255
|
showSearch: true,
|
|
@@ -248,14 +260,20 @@ var ReferenceIdentifiers = function (props) {
|
|
|
248
260
|
loading: loadingReferenceIdentifierValues,
|
|
249
261
|
}
|
|
250
262
|
: {};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
263
|
+
var isRequired = function () {
|
|
264
|
+
var _a;
|
|
265
|
+
return ((_a = fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.properties) === null || _a === void 0 ? void 0 : _a.cardinality) === "1..1";
|
|
266
|
+
};
|
|
267
|
+
var selectField = (react_1.default.createElement(antd_1.Select, __assign({ prefix: isRequired() ? react_1.default.createElement(antd_1.Typography.Text, { type: "danger" }, "*") : null, placeholder: singleReferenceIdentifierLabel, popupMatchSelectWidth: false }, selectProps, { suffixIcon: react_1.default.createElement(__1.UmzTooltip, { title: singleReferenceIdentifiersHelp }) }), fieldDefinition.properties.values.map(function (op) {
|
|
268
|
+
return (react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name));
|
|
269
|
+
})));
|
|
270
|
+
return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields[fieldDefinition.key], defaultLabel: "", defaultIsRequired: false, fieldName: ["invoice", "singleReferenceIdentifier", "value"], name: ["invoice", "singleReferenceIdentifier", "value"] }, selectField));
|
|
255
271
|
}
|
|
256
272
|
else {
|
|
273
|
+
// Condition 3
|
|
274
|
+
props.setReferenceIdentifierIsMandatory((_m = (((_l = (_k = (_j = props.receiverRequirements) === null || _j === void 0 ? void 0 : _j.fieldDefinitions) === null || _k === void 0 ? void 0 : _k[0].properties) === null || _l === void 0 ? void 0 : _l.cardinality) === "1..1")) !== null && _m !== void 0 ? _m : false);
|
|
257
275
|
return (react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "singleReferenceIdentifier", "value"] },
|
|
258
|
-
react_1.default.createElement(__1.UmzInput, { defaultPlaceholder: singleReferenceIdentifierLabel })));
|
|
276
|
+
react_1.default.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["referenceIdentifier.*"], defaultPlaceholder: singleReferenceIdentifierLabel })));
|
|
259
277
|
}
|
|
260
278
|
};
|
|
261
279
|
if (referenceIdentifiersDefinitions.length === 0) {
|
|
@@ -272,6 +290,10 @@ var ReferenceIdentifiers = function (props) {
|
|
|
272
290
|
return getSingleReferenceIdentifierInput();
|
|
273
291
|
}
|
|
274
292
|
else {
|
|
293
|
+
// Many reference identifiers
|
|
294
|
+
props.setReferenceIdentifierIsMandatory((_d = (((_c = (_b = (_a = props.receiverRequirements) === null || _a === void 0 ? void 0 : _a.fieldDefinitions) === null || _b === void 0 ? void 0 : _b[0].properties) === null || _c === void 0 ? void 0 : _c.cardinality) === "1..1")) !== null && _d !== void 0 ? _d : false);
|
|
295
|
+
var isAnyRefRequired = Boolean((_f = (_e = props.receiverRequirements) === null || _e === void 0 ? void 0 : _e.fieldDefinitions) === null || _f === void 0 ? void 0 : _f.find(function (item) { var _a; return ((_a = item.properties) === null || _a === void 0 ? void 0 : _a.cardinality) === "1..1"; }));
|
|
296
|
+
props.setReferenceIdentifierIsMandatory(isAnyRefRequired);
|
|
275
297
|
return (react_1.default.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
276
298
|
var add = _a.add, remove = _a.remove;
|
|
277
299
|
return fields.map(function (field, index) {
|
|
@@ -281,7 +303,7 @@ var ReferenceIdentifiers = function (props) {
|
|
|
281
303
|
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
282
304
|
react_1.default.createElement(antd_1.Row, { gutter: 10 },
|
|
283
305
|
react_1.default.createElement(antd_1.Col, { span: index === 0 ? 22 : 24 },
|
|
284
|
-
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"]
|
|
306
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"] }),
|
|
285
307
|
react_1.default.createElement(antd_1.Select, { labelInValue: true, allowClear: true, style: { width: "100%" }, popupMatchSelectWidth: false, placeholder: referenceIdentifiersLabel, onChange: function (a) {
|
|
286
308
|
var newState = referenceIdentifierValue.slice();
|
|
287
309
|
newState.splice(index, 1, a);
|
|
@@ -17,6 +17,7 @@ interface Props extends WrappedComponentProps {
|
|
|
17
17
|
dueDateMinimumOffset: number;
|
|
18
18
|
isSaveFieldValuesSelected: boolean;
|
|
19
19
|
onSaveFieldValuesChange: () => void;
|
|
20
|
+
setReferenceIdentifierIsMandatory: (referenceIdentifierIsMandatory: boolean) => void;
|
|
20
21
|
}
|
|
21
22
|
export declare const translationMessages: {
|
|
22
23
|
baseInformation_title: {
|
|
@@ -59,9 +60,17 @@ export declare const translationMessages: {
|
|
|
59
60
|
id: string;
|
|
60
61
|
defaultMessage: string;
|
|
61
62
|
};
|
|
63
|
+
baseInformation_objectIdentifier: {
|
|
64
|
+
id: string;
|
|
65
|
+
defaultMessage: string;
|
|
66
|
+
};
|
|
67
|
+
baseInformation_projectReference: {
|
|
68
|
+
id: string;
|
|
69
|
+
defaultMessage: string;
|
|
70
|
+
};
|
|
62
71
|
};
|
|
63
72
|
declare const BaseInformationIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
64
|
-
forwardedRef?: React.Ref<any
|
|
73
|
+
forwardedRef?: React.Ref<any>;
|
|
65
74
|
} & React.RefAttributes<any>> & {
|
|
66
75
|
WrappedComponent: React.ComponentType<Props>;
|
|
67
76
|
};
|
|
@@ -83,6 +83,14 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
83
83
|
id: "baseInformation_dueDateErrorMsg",
|
|
84
84
|
defaultMessage: "Due date must be after the issue date",
|
|
85
85
|
},
|
|
86
|
+
baseInformation_objectIdentifier: {
|
|
87
|
+
id: "baseInformation_objectIdentifier",
|
|
88
|
+
defaultMessage: "Object identifier",
|
|
89
|
+
},
|
|
90
|
+
baseInformation_projectReference: {
|
|
91
|
+
id: "baseInformation_projectReference",
|
|
92
|
+
defaultMessage: "Project reference is required",
|
|
93
|
+
},
|
|
86
94
|
});
|
|
87
95
|
var BaseInformation = function (props) {
|
|
88
96
|
var _a, _b;
|
|
@@ -121,7 +129,7 @@ var BaseInformation = function (props) {
|
|
|
121
129
|
};
|
|
122
130
|
var checkIfEmpty = function (date) {
|
|
123
131
|
if (!date) {
|
|
124
|
-
props.form.
|
|
132
|
+
props.form.setFieldValue(["invoice", "dueDate"], null);
|
|
125
133
|
props.form.validateFields(["invoice", "dueDate"]);
|
|
126
134
|
}
|
|
127
135
|
};
|
|
@@ -169,7 +177,7 @@ var BaseInformation = function (props) {
|
|
|
169
177
|
React.createElement(OrderReference_1.default, { receiverRequirements: props.receiverRequirements, formInstance: props.form, dependencies: [["invoice", "buyerReference"]] }),
|
|
170
178
|
React.createElement(form_item_1.default, { shouldUpdate: true, dependencies: [["invoice", "orderReference", "documentNo"]], receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultLabel: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel), defaultLabelTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultIsRequired: !props.form.getFieldValue(["invoice", "orderReference", "documentNo"]), fieldName: ["invoice", "buyerReference"] },
|
|
171
179
|
React.createElement(__1.UmzInput, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.buyerReference, defaultIsRequired: !props.form.getFieldValue(["invoice", "orderReference", "documentNo"]), defaultPlaceholder: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel), defaultTooltip: props.intl.formatMessage(exports.translationMessages.baseInformation_buyerReferenceLabel_helpText), defaultValue: (_b = formData.invoice) === null || _b === void 0 ? void 0 : _b.buyerReference })),
|
|
172
|
-
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 }),
|
|
180
|
+
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, setReferenceIdentifierIsMandatory: props.setReferenceIdentifierIsMandatory }),
|
|
173
181
|
React.createElement(AccountingCost_1.default, { formInstance: props.form, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier }),
|
|
174
182
|
React.createElement(ProjectReference_1.default, { receiverRequirements: props.receiverRequirements, form: props.form }))),
|
|
175
183
|
React.createElement(antd_1.Checkbox, { checked: props.isSaveFieldValuesSelected, onChange: props.onSaveFieldValuesChange }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages.saveInformation_label)))));
|
|
@@ -7,7 +7,7 @@ interface Props extends WrappedComponentProps {
|
|
|
7
7
|
outsideVatScope: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
10
|
-
forwardedRef?: React.Ref<any
|
|
10
|
+
forwardedRef?: React.Ref<any>;
|
|
11
11
|
} & React.RefAttributes<any>> & {
|
|
12
12
|
WrappedComponent: React.ComponentType<Props>;
|
|
13
13
|
};
|
|
@@ -57,9 +57,10 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
57
57
|
});
|
|
58
58
|
;
|
|
59
59
|
var BillingCalculations = function (props) {
|
|
60
|
-
var _a = (0, react_1.useState)(
|
|
60
|
+
var _a = (0, react_1.useState)([]), invoiceLines = _a[0], setInvoiceLines = _a[1];
|
|
61
61
|
(0, react_1.useEffect)(function () {
|
|
62
|
-
|
|
62
|
+
var savedLines = props.formInstance.getFieldValue(["invoice", "invoiceLines"]).filter(function (line) { return line.editing === false; });
|
|
63
|
+
setInvoiceLines(savedLines);
|
|
63
64
|
}, [props.outsideVatScope, props.formInstance.getFieldValue(["invoice", "invoiceLines"])]);
|
|
64
65
|
var totals = {
|
|
65
66
|
totalTaxableAmount: 0,
|
|
@@ -91,9 +92,6 @@ var BillingCalculations = function (props) {
|
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
if (totals.totalTaxableAmount <= 0 || totals.totalTaxInclusiveAmount <= 0) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
95
|
var roundedAmount = Math.round(totals.totalTaxInclusiveAmount);
|
|
98
96
|
var roundingAmount = totals.totalTaxInclusiveAmount - roundedAmount;
|
|
99
97
|
return (react_1.default.createElement(antd_1.Flex, { vertical: true },
|
|
@@ -2,19 +2,22 @@ import React from "react";
|
|
|
2
2
|
import { AvailableTaxCategoryTypeEnum } from "../../../enums";
|
|
3
3
|
import { WrappedComponentProps } from "react-intl";
|
|
4
4
|
interface BillingLinePreviewProps extends WrappedComponentProps {
|
|
5
|
+
itemNo?: string;
|
|
5
6
|
name?: string;
|
|
6
7
|
taxableAmount?: number;
|
|
7
8
|
quantity?: number;
|
|
8
9
|
unit?: string;
|
|
9
10
|
unitPriceAmount?: number;
|
|
11
|
+
unitOfMeasure?: any;
|
|
10
12
|
taxCategoryType?: AvailableTaxCategoryTypeEnum;
|
|
11
13
|
discountValue?: string;
|
|
12
14
|
discountType?: string;
|
|
13
15
|
currencyCode: string;
|
|
14
16
|
onDelete: () => void;
|
|
17
|
+
onEdit: () => void;
|
|
15
18
|
}
|
|
16
19
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<BillingLinePreviewProps, "intl"> & {
|
|
17
|
-
forwardedRef?: React.Ref<any
|
|
20
|
+
forwardedRef?: React.Ref<any>;
|
|
18
21
|
} & React.RefAttributes<any>> & {
|
|
19
22
|
WrappedComponent: React.ComponentType<BillingLinePreviewProps>;
|
|
20
23
|
};
|
|
@@ -11,31 +11,51 @@ var icons_1 = require("@ant-design/icons");
|
|
|
11
11
|
var NewBillingLines_1 = require("./NewBillingLines");
|
|
12
12
|
var react_intl_1 = require("react-intl");
|
|
13
13
|
var BillingLinePreview = function (props) {
|
|
14
|
-
var
|
|
14
|
+
var billingLineHeader = function () {
|
|
15
|
+
var itemNo = props.itemNo, name = props.name, taxableAmount = props.taxableAmount, currencyCode = props.currencyCode;
|
|
16
|
+
return react_1.default.createElement("div", { style: { display: "flex", justifyContent: "space-between", flexDirection: 'row' } },
|
|
17
|
+
react_1.default.createElement("div", null,
|
|
18
|
+
itemNo,
|
|
19
|
+
" ",
|
|
20
|
+
react_1.default.createElement("span", { style: { fontWeight: 'bold' } }, name)),
|
|
21
|
+
react_1.default.createElement("div", { style: { fontWeight: 'bold' } },
|
|
22
|
+
taxableAmount,
|
|
23
|
+
" ",
|
|
24
|
+
currencyCode));
|
|
25
|
+
};
|
|
26
|
+
var billingLineContent = function () {
|
|
27
|
+
var quantity = props.quantity, unitOfMeasure = props.unitOfMeasure, unitPriceAmount = props.unitPriceAmount, currencyCode = props.currencyCode, discountValue = props.discountValue, discountType = props.discountType;
|
|
28
|
+
var unitOfMeasureUnit = (unitOfMeasure === null || unitOfMeasure === void 0 ? void 0 : unitOfMeasure.unit) === "One" ? undefined : (unitOfMeasure === null || unitOfMeasure === void 0 ? void 0 : unitOfMeasure.unit) + ("(s)");
|
|
29
|
+
var discountExist = Number(discountValue) > 0;
|
|
30
|
+
var taxPercentage = (0, BillingLineUtility_1.calculateTaxPercentage)(enums_1.AvailableTaxCategoryTypeEnum[props.taxCategoryType]);
|
|
31
|
+
var discount = discountExist ? ", ".concat(discountValue).concat(discountType === "PERCENTAGE" ? "%" : " ".concat(currencyCode), " ").concat(props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount)) : null;
|
|
32
|
+
var tax = "".concat(taxPercentage, "% tax");
|
|
33
|
+
return react_1.default.createElement(antd_1.Typography.Text, null,
|
|
34
|
+
quantity,
|
|
35
|
+
" ",
|
|
36
|
+
unitOfMeasureUnit,
|
|
37
|
+
" ",
|
|
38
|
+
"@",
|
|
39
|
+
" ",
|
|
40
|
+
unitPriceAmount,
|
|
41
|
+
" ",
|
|
42
|
+
currencyCode,
|
|
43
|
+
" ",
|
|
44
|
+
"each",
|
|
45
|
+
" ",
|
|
46
|
+
"(",
|
|
47
|
+
tax,
|
|
48
|
+
" ",
|
|
49
|
+
discount,
|
|
50
|
+
")");
|
|
51
|
+
};
|
|
15
52
|
return (react_1.default.createElement(antd_1.Card, { style: { backgroundColor: "#F5F5F5", width: "full" }, size: "small", bordered: false },
|
|
16
|
-
react_1.default.createElement(antd_1.Flex, {
|
|
17
|
-
react_1.default.createElement(antd_1.Flex, { vertical: true },
|
|
18
|
-
react_1.default.createElement(antd_1.Typography.Text,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
props.currencyCode),
|
|
24
|
-
react_1.default.createElement(antd_1.Typography.Text, null,
|
|
25
|
-
props.quantity,
|
|
26
|
-
" ",
|
|
27
|
-
props.unit,
|
|
28
|
-
" | ",
|
|
29
|
-
props.unitPriceAmount,
|
|
30
|
-
" ",
|
|
31
|
-
props.currencyCode,
|
|
32
|
-
" / ",
|
|
33
|
-
props.unit,
|
|
34
|
-
" | ",
|
|
35
|
-
taxPercentage,
|
|
36
|
-
"%",
|
|
37
|
-
" ",
|
|
38
|
-
props.discountValue && " | ".concat(props.discountValue).concat(props.discountType === "PERCENTAGE" ? "%" : " ".concat(props.currencyCode), " ").concat(props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_discount)))),
|
|
39
|
-
react_1.default.createElement(antd_1.Button, { onClick: props.onDelete, icon: react_1.default.createElement(icons_1.DeleteOutlined, null), type: "text", danger: true }))));
|
|
53
|
+
react_1.default.createElement(antd_1.Flex, { align: "center", justify: "space-between" },
|
|
54
|
+
react_1.default.createElement(antd_1.Flex, { vertical: true, style: { width: '100%' } },
|
|
55
|
+
react_1.default.createElement(antd_1.Typography.Text, null, billingLineHeader()),
|
|
56
|
+
react_1.default.createElement(antd_1.Typography.Text, null, billingLineContent())),
|
|
57
|
+
react_1.default.createElement("div", { style: { display: "flex", flexDirection: 'row' } },
|
|
58
|
+
react_1.default.createElement(antd_1.Button, { onClick: props.onEdit, icon: react_1.default.createElement(icons_1.EditOutlined, null), type: "text" }),
|
|
59
|
+
react_1.default.createElement(antd_1.Button, { onClick: props.onDelete, icon: react_1.default.createElement(icons_1.DeleteOutlined, null), type: "text", danger: true })))));
|
|
40
60
|
};
|
|
41
61
|
exports.default = (0, react_intl_1.injectIntl)(BillingLinePreview);
|
|
@@ -6,7 +6,7 @@ interface Props extends WrappedComponentProps {
|
|
|
6
6
|
outsideVatScope: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
9
|
-
forwardedRef?: React.Ref<any
|
|
9
|
+
forwardedRef?: React.Ref<any>;
|
|
10
10
|
} & React.RefAttributes<any>> & {
|
|
11
11
|
WrappedComponent: React.ComponentType<Props>;
|
|
12
12
|
};
|
|
@@ -73,7 +73,6 @@ var translationMessages = (0, react_intl_1.defineMessages)({
|
|
|
73
73
|
defaultMessage: "Outside tax scope",
|
|
74
74
|
},
|
|
75
75
|
});
|
|
76
|
-
;
|
|
77
76
|
var BillingTaxSummary = function (props) {
|
|
78
77
|
var _a = (0, react_1.useState)(props.formInstance.getFieldValue(["invoice", "invoiceLines"])), invoiceLines = _a[0], setInvoiceLines = _a[1];
|
|
79
78
|
(0, react_1.useEffect)(function () {
|
|
@@ -115,14 +115,19 @@ export declare const translationMessages: {
|
|
|
115
115
|
id: string;
|
|
116
116
|
defaultMessage: string;
|
|
117
117
|
};
|
|
118
|
+
billingLines_input_must_be_number_validationMessage: {
|
|
119
|
+
id: string;
|
|
120
|
+
defaultMessage: string;
|
|
121
|
+
};
|
|
118
122
|
};
|
|
119
123
|
interface Props extends WrappedComponentProps {
|
|
120
124
|
receiverRequirements: NewReceiverRequirements;
|
|
121
125
|
formInstance: FormInstance;
|
|
122
126
|
outsideVatScope: boolean;
|
|
127
|
+
validateFields: (fieldNames: string[][], validateOnly?: boolean | undefined) => void;
|
|
123
128
|
}
|
|
124
129
|
declare const BillingLinesWithIntl: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
125
|
-
forwardedRef?: React.Ref<any
|
|
130
|
+
forwardedRef?: React.Ref<any>;
|
|
126
131
|
} & React.RefAttributes<any>> & {
|
|
127
132
|
WrappedComponent: React.ComponentType<Props>;
|
|
128
133
|
};
|