@unimaze/billing 0.21.60 → 0.21.62
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/billing-lines/SingleBillingLine.js +1 -1
- package/lib/common/components/billing-lines/UnitOfMeasureSelector.d.ts +0 -3
- package/lib/common/components/billing-lines/UnitOfMeasureSelector.js +7 -111
- package/lib/common/components/submit-confirmation/AttachmentUploadStatus.d.ts +17 -0
- package/lib/common/components/submit-confirmation/AttachmentUploadStatus.js +58 -0
- package/lib/create-invoice/index.js +14 -3
- package/lib/utils/AttachmentsUtility.d.ts +4 -0
- package/lib/utils/AttachmentsUtility.js +20 -0
- package/lib/utils/BillingLineUtility.d.ts +0 -1
- package/lib/utils/BillingLineUtility.js +2 -39
- package/package.json +1 -1
|
@@ -248,7 +248,7 @@ var SingleBillingLine = function (props) {
|
|
|
248
248
|
] }, (0, BillingLineUtility_1.getCorrectInputNode)("name", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_name), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.name"], true))),
|
|
249
249
|
React.createElement(antd_1.Row, { gutter: 20 },
|
|
250
250
|
React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
|
|
251
|
-
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], defaultIsRequired: true, fieldName: [fieldName, "quantity"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("quantity", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], true), React.createElement(UnitOfMeasureSelector_1.default, { receiverRequirements: props.receiverRequirements, fieldName: fieldName, mobile: isMobile
|
|
251
|
+
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], defaultIsRequired: true, fieldName: [fieldName, "quantity"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("quantity", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_quantity), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.quantity"], true), React.createElement(UnitOfMeasureSelector_1.default, { receiverRequirements: props.receiverRequirements, fieldName: fieldName, mobile: isMobile })))),
|
|
252
252
|
React.createElement(antd_1.Col, { span: isMobile ? 24 : 12 },
|
|
253
253
|
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], defaultIsRequired: true, fieldName: [fieldName, "unitPriceAmount"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitPriceAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index }, (0, BillingLineUtility_1.getCorrectInputNode)("unitPriceAmount", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitPriceAmount), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.unitPriceAmount"], true), React.createElement(CurrencySelector_1.default, { receiverRequirements: props.receiverRequirements, fieldName: fieldName, invoiceLinesFormInstance: props.invoiceLinesFormInstance, formInstance: props.formInstance, mobile: isMobile, onSelect: currencySelectorOnSelect, disabled: isCurrencyDisabled }))))),
|
|
254
254
|
React.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.taxableAmount"], defaultIsRequired: false, fieldName: [fieldName, "taxableAmount"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_lineAmount), verticalLabels: true, onlyLabelOnFirstInList: true, index: index },
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
2
2
|
import { WrappedComponentProps } from "react-intl";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { FormInstance } from "antd/es/form";
|
|
5
4
|
interface Props extends WrappedComponentProps {
|
|
6
5
|
receiverRequirements: NewReceiverRequirements;
|
|
7
6
|
fieldName: any;
|
|
8
7
|
mobile: boolean;
|
|
9
|
-
invoiceLinesFormInstance: FormInstance;
|
|
10
|
-
formInstance: FormInstance;
|
|
11
8
|
}
|
|
12
9
|
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
|
|
13
10
|
forwardedRef?: React.Ref<any>;
|
|
@@ -1,119 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
4
|
};
|
|
36
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
var antd_1 = require("antd");
|
|
38
6
|
var react_intl_1 = require("react-intl");
|
|
7
|
+
var form_item_1 = __importDefault(require("../form-item"));
|
|
8
|
+
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
39
9
|
var BillingLineUtility_1 = require("../../../utils/BillingLineUtility");
|
|
40
|
-
var
|
|
10
|
+
var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
41
12
|
var NewBillingLines_1 = require("./NewBillingLines");
|
|
42
13
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
43
|
-
var
|
|
44
|
-
var UnitOfMeasureSelector = function (props) {
|
|
45
|
-
var _a = (0, react_1.useState)(), selectedValue = _a[0], setSelectedValue = _a[1];
|
|
46
|
-
(0, react_1.useEffect)(function () {
|
|
47
|
-
var unitOfMeasureOnLine = props.invoiceLinesFormInstance.getFieldValue(["invoice", "invoiceLines", props.fieldName, "unitOfMeasure", "unit"]);
|
|
48
|
-
if (unitOfMeasureOnLine) {
|
|
49
|
-
if (props.mobile) {
|
|
50
|
-
setSelectedValue({
|
|
51
|
-
value: unitOfMeasureOnLine,
|
|
52
|
-
label: (0, BillingLineUtility_1.getShortNameForUnitOfMeasure)(unitOfMeasureOnLine, props.intl),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
setSelectedValue({
|
|
57
|
-
value: unitOfMeasureOnLine,
|
|
58
|
-
label: props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages["unitOfMeasure_labels_".concat(unitOfMeasureOnLine)])
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
var defaultUnitOfMeasure = {
|
|
64
|
-
value: "One",
|
|
65
|
-
label: props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages.unitOfMeasure_labels_One)
|
|
66
|
-
};
|
|
67
|
-
setSelectedValue(defaultUnitOfMeasure);
|
|
68
|
-
unitOfMeasureSelectorOnSelect(defaultUnitOfMeasure);
|
|
69
|
-
}
|
|
70
|
-
}, [props.invoiceLinesFormInstance.getFieldValue(["invoice", "invoiceLines"]), props.mobile]);
|
|
71
|
-
var unitOfMeasureSelectorOnSelect = function (value) {
|
|
72
|
-
var lines = props.invoiceLinesFormInstance.getFieldValue(["invoice", "invoiceLines"]);
|
|
73
|
-
var newLines = [];
|
|
74
|
-
lines.map((function (line, index) {
|
|
75
|
-
if (index === props.fieldName) {
|
|
76
|
-
newLines.push(__assign(__assign({}, line), { unitOfMeasure: {
|
|
77
|
-
unit: value === null || value === void 0 ? void 0 : value.value
|
|
78
|
-
} }));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
newLines.push(line);
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
props.invoiceLinesFormInstance.setFieldsValue({ invoice: { invoiceLines: newLines } });
|
|
85
|
-
props.formInstance.setFieldsValue({ invoice: { invoiceLines: newLines } });
|
|
86
|
-
};
|
|
87
|
-
// return <UmzFormItem
|
|
88
|
-
// className={"umz_noValidationMessage"}
|
|
89
|
-
// receiverRequirements={props.receiverRequirements}
|
|
90
|
-
// receiverRequirementsKey={AvailableFields["invoiceLines.uniteOfMeasure.unit"]}
|
|
91
|
-
// defaultIsRequired={true}
|
|
92
|
-
// fieldName={""}
|
|
93
|
-
// defaultLabel={props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure)}
|
|
94
|
-
// verticalLabels
|
|
95
|
-
// onlyLabelOnFirstInList
|
|
96
|
-
// style={{marginBottom: "-2px", width: props.mobile ? 58 : "auto"}}
|
|
97
|
-
// initialValue={Units.One}
|
|
98
|
-
// >
|
|
99
|
-
return react_1.default.createElement(antd_1.Select, { labelInValue: true, value: selectedValue, popupMatchSelectWidth: false, placeholder: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitOfMeasure), style: { width: props.mobile ? 80 : "auto" }, onSelect: function (value) {
|
|
100
|
-
unitOfMeasureSelectorOnSelect(value);
|
|
101
|
-
} }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
|
|
102
|
-
if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|
|
103
|
-
return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, key: unitOfMeasure }, props.intl.formatMessage(CommonTranslations_1.commonTranslationMessages["unitOfMeasure_labels_".concat(unitOfMeasure)])));
|
|
104
|
-
}));
|
|
105
|
-
{ /*{getCorrectInputNode(*/ }
|
|
106
|
-
{ /* "unitOfMeasure",*/ }
|
|
107
|
-
{ /* props.intl,*/ }
|
|
108
|
-
{ /* props.intl.formatMessage(translationMessages.billingLines_unitOfMeasure),*/ }
|
|
109
|
-
{ /* getFieldIsRequired(*/ }
|
|
110
|
-
{ /* props.receiverRequirements,*/ }
|
|
111
|
-
{ /* AvailableFields["invoiceLines.uniteOfMeasure.unit"],*/ }
|
|
112
|
-
{ /* true*/ }
|
|
113
|
-
{ /* ),*/ }
|
|
114
|
-
{ /* undefined,*/ }
|
|
115
|
-
{ /* props.mobile*/ }
|
|
116
|
-
{ /*)}*/ }
|
|
117
|
-
// </UmzFormItem>;
|
|
118
|
-
};
|
|
14
|
+
var UnitOfMeasureSelector = function (props) { return react_1.default.createElement(form_item_1.default, { className: "umz_noValidationMessage", receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], defaultIsRequired: true, fieldName: [props.fieldName, "unitOfMeasure", "unit"], defaultLabel: props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitOfMeasure), verticalLabels: true, onlyLabelOnFirstInList: true, style: { marginBottom: "-2px", width: props.mobile ? "50%" : "auto" }, initialValue: api_1.Units.One }, (0, BillingLineUtility_1.getCorrectInputNode)("unitOfMeasure", props.intl, props.intl.formatMessage(NewBillingLines_1.translationMessages.billingLines_unitOfMeasure), (0, RequirementsUtility_1.getFieldIsRequired)(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["invoiceLines.uniteOfMeasure.unit"], true), undefined, props.mobile)); };
|
|
119
15
|
exports.default = (0, react_intl_1.injectIntl)(UnitOfMeasureSelector);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WrappedComponentProps } from "react-intl";
|
|
3
|
+
interface AttachmentUploadStatusProps extends WrappedComponentProps {
|
|
4
|
+
name: string;
|
|
5
|
+
status: SubmittingStatus;
|
|
6
|
+
}
|
|
7
|
+
export declare enum SubmittingStatus {
|
|
8
|
+
Pending = "PENDING",
|
|
9
|
+
Done = "DONE",
|
|
10
|
+
Failed = "FAILED"
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<AttachmentUploadStatusProps, "intl"> & {
|
|
13
|
+
forwardedRef?: React.Ref<any>;
|
|
14
|
+
} & React.RefAttributes<any>> & {
|
|
15
|
+
WrappedComponent: React.ComponentType<AttachmentUploadStatusProps>;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
exports.SubmittingStatus = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var icons_1 = require("@ant-design/icons");
|
|
9
|
+
var antd_1 = require("antd");
|
|
10
|
+
var react_intl_1 = require("react-intl");
|
|
11
|
+
var SubmittingStatus;
|
|
12
|
+
(function (SubmittingStatus) {
|
|
13
|
+
SubmittingStatus["Pending"] = "PENDING";
|
|
14
|
+
SubmittingStatus["Done"] = "DONE";
|
|
15
|
+
SubmittingStatus["Failed"] = "FAILED";
|
|
16
|
+
})(SubmittingStatus = exports.SubmittingStatus || (exports.SubmittingStatus = {}));
|
|
17
|
+
// const getSubmittingStatusIcon = (_name: string, _numberOfSuccessCalls: number, _namesOfFailedUploads: string[], _attachments: string[]) => {
|
|
18
|
+
// const _index = _attachments.findIndex((att) => att === _name);
|
|
19
|
+
// if (_namesOfFailedUploads.includes(_name)) return <CloseCircleTwoTone twoToneColor={"red"} style={{marginRight: 5}}/>
|
|
20
|
+
// if (_index <= _numberOfSuccessCalls && !_namesOfFailedUploads.includes(_name)) return <CheckCircleTwoTone twoToneColor={"green"} style={{marginRight: 5}}/>
|
|
21
|
+
// if (_index < _numberOfSuccessCalls || _index > _numberOfSuccessCalls) return <LoadingOutlined style={{marginRight: 5}}/>
|
|
22
|
+
// }
|
|
23
|
+
// const SingleSubmittingStatus: React.FC<AttachmentUploadStatusProps> = (props) => {
|
|
24
|
+
//
|
|
25
|
+
// const {name, index, numberOfSuccessCalls, namesOfFailedUploads, attachments, otherNameForDisplay} = props;
|
|
26
|
+
//
|
|
27
|
+
// return <Flex gap={5} align={"center"}>
|
|
28
|
+
// <>{getSubmittingStatusIcon(name, numberOfSuccessCalls - 1, namesOfFailedUploads, attachments)}</>
|
|
29
|
+
// <Typography.Text>
|
|
30
|
+
// { otherNameForDisplay
|
|
31
|
+
// ? otherNameForDisplay
|
|
32
|
+
// : `${props.intl.formatMessage(translationMessages.submitConfirmation_SuccessfullyUploadedAttachment)} ${name}`
|
|
33
|
+
// }
|
|
34
|
+
// </Typography.Text>
|
|
35
|
+
// </Flex>
|
|
36
|
+
// };
|
|
37
|
+
var SingleSubmittingStatus = function (props) {
|
|
38
|
+
var name = props.name, status = props.status;
|
|
39
|
+
var iconStyle = {
|
|
40
|
+
marginRight: 5
|
|
41
|
+
};
|
|
42
|
+
var getIcon = function (_status) {
|
|
43
|
+
switch (_status) {
|
|
44
|
+
case SubmittingStatus.Failed:
|
|
45
|
+
return react_1.default.createElement(icons_1.CloseCircleTwoTone, { twoToneColor: "red", style: iconStyle });
|
|
46
|
+
case SubmittingStatus.Done:
|
|
47
|
+
return react_1.default.createElement(icons_1.CheckCircleTwoTone, { twoToneColor: "green", style: iconStyle });
|
|
48
|
+
case SubmittingStatus.Pending:
|
|
49
|
+
return react_1.default.createElement(icons_1.LoadingOutlined, { style: iconStyle });
|
|
50
|
+
default:
|
|
51
|
+
return react_1.default.createElement(icons_1.LoadingOutlined, { style: iconStyle });
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return react_1.default.createElement(antd_1.Flex, { gap: 5, align: "center" },
|
|
55
|
+
getIcon(status),
|
|
56
|
+
react_1.default.createElement(antd_1.Typography.Text, null, name));
|
|
57
|
+
};
|
|
58
|
+
exports.default = (0, react_intl_1.injectIntl)(SingleSubmittingStatus);
|
|
@@ -33,6 +33,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
36
47
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
48
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
49
|
if (ar || !(i in from)) {
|
|
@@ -295,8 +306,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
295
306
|
file1: { file: undefined, description: undefined },
|
|
296
307
|
file2: { file: undefined, description: undefined },
|
|
297
308
|
file3: { file: undefined, description: undefined },
|
|
298
|
-
}
|
|
299
|
-
issueDate: (0, dayjs_1.default)(),
|
|
309
|
+
}
|
|
300
310
|
},
|
|
301
311
|
};
|
|
302
312
|
(0, LocalStorageUtility_1.setFormToLocalStorage)(objectForLocalStorage, props.localStorageFormDataVersion);
|
|
@@ -337,7 +347,8 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
337
347
|
var customerFromLocalStorage = (_c = savedValuesObject.invoice) === null || _c === void 0 ? void 0 : _c.customer;
|
|
338
348
|
setChosenCustomer(customerFromLocalStorage);
|
|
339
349
|
}
|
|
340
|
-
|
|
350
|
+
var issueDate = savedValuesObject.issueDate, rest = __rest(savedValuesObject, ["issueDate"]);
|
|
351
|
+
form.setFieldsValue(rest);
|
|
341
352
|
}
|
|
342
353
|
}, []);
|
|
343
354
|
(0, react_1.useEffect)(function () {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SubmittingStatus } from "../common/components/submit-confirmation/AttachmentUploadStatus";
|
|
2
|
+
declare const getSubmittingStatus: (name: string, failedUploads: string[], attachments: string[], numberOfAttemptedCalls: number) => SubmittingStatus;
|
|
3
|
+
declare const isRetryButtonVisible: (numberOfAttemptedCalls: number, totalNumberOfCalls: number, numberOfSuccessfulCalls: number, failedAttachments: string[], alreadyRetried: boolean) => boolean;
|
|
4
|
+
export { getSubmittingStatus, isRetryButtonVisible };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRetryButtonVisible = exports.getSubmittingStatus = void 0;
|
|
4
|
+
var AttachmentUploadStatus_1 = require("../common/components/submit-confirmation/AttachmentUploadStatus");
|
|
5
|
+
var getSubmittingStatus = function (name, failedUploads, attachments, numberOfAttemptedCalls) {
|
|
6
|
+
var index = attachments.findIndex(function (att) { return att === name; });
|
|
7
|
+
if (failedUploads.includes(name))
|
|
8
|
+
return AttachmentUploadStatus_1.SubmittingStatus.Failed;
|
|
9
|
+
if (index < numberOfAttemptedCalls && !failedUploads.includes(name))
|
|
10
|
+
return AttachmentUploadStatus_1.SubmittingStatus.Done;
|
|
11
|
+
if (index <= numberOfAttemptedCalls || index > numberOfAttemptedCalls)
|
|
12
|
+
return AttachmentUploadStatus_1.SubmittingStatus.Pending;
|
|
13
|
+
};
|
|
14
|
+
exports.getSubmittingStatus = getSubmittingStatus;
|
|
15
|
+
var isRetryButtonVisible = function (numberOfAttemptedCalls, totalNumberOfCalls, numberOfSuccessfulCalls, failedAttachments, alreadyRetried) {
|
|
16
|
+
if (numberOfAttemptedCalls === totalNumberOfCalls && (numberOfSuccessfulCalls + (failedAttachments === null || failedAttachments === void 0 ? void 0 : failedAttachments.length) === totalNumberOfCalls)) {
|
|
17
|
+
return (failedAttachments === null || failedAttachments === void 0 ? void 0 : failedAttachments.length) > 0 && !alreadyRetried;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.isRetryButtonVisible = isRetryButtonVisible;
|
|
@@ -18,7 +18,6 @@ export declare const calculateTaxableAmount: (discountValue: string | null | und
|
|
|
18
18
|
export declare const calculateTaxAmount: (taxableAmount: number, taxPercentage: number) => number;
|
|
19
19
|
export declare const calculateTaxPercentage: (taxCategoryType: TaxCategoryTypeEnum | undefined) => number;
|
|
20
20
|
export declare const generateTaxCategoryLabel: (taxCategoryType: TaxCategoryTypeEnum | undefined, taxCategoryTypeTranslated: string) => string;
|
|
21
|
-
export declare const getShortNameForUnitOfMeasure: (unitOfMeasure: string, intl: IntlShape) => string;
|
|
22
21
|
export declare const getCorrectInputNode: (dataIdx: keyof BillingLineMetadataOverride, intl: IntlShape, placeholder: string, required: boolean, addonAfter?: React.ReactNode, mobile?: boolean, value?: any) => React.ReactChild;
|
|
23
22
|
export declare const getTotals: (invoiceLines: BillingLineMetadataOverride[]) => Totals;
|
|
24
23
|
export declare const getTaxCategoryDisabled: (taxCategoryType: AvailableTaxCategoryTypeEnum, outsideVatScope: boolean) => boolean;
|
|
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.
|
|
28
|
+
exports.getDiscountLabel = exports.getUnitOfMeasureUnitLabel = exports.combinedTaxesForLines = exports.getFieldNames = exports.getTaxCategoryDisabled = exports.getTotals = exports.getCorrectInputNode = exports.generateTaxCategoryLabel = exports.calculateTaxPercentage = exports.calculateTaxAmount = exports.calculateTaxableAmount = exports.calculateDiscountAmount = exports.billingLinesFieldsMetadata = void 0;
|
|
29
29
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
30
30
|
var api_1 = require("@unimaze/api-clients/lib/mapi/api");
|
|
31
31
|
var react_1 = __importDefault(require("react"));
|
|
@@ -113,41 +113,6 @@ var generateTaxCategoryLabel = function (taxCategoryType, taxCategoryTypeTransla
|
|
|
113
113
|
return taxCategoryType ? "".concat(taxCategoryTypeTranslated, " (").concat((0, exports.calculateTaxPercentage)(taxCategoryType), "%)") : "";
|
|
114
114
|
};
|
|
115
115
|
exports.generateTaxCategoryLabel = generateTaxCategoryLabel;
|
|
116
|
-
var getShortNameForUnitOfMeasure = function (unitOfMeasure, intl) {
|
|
117
|
-
switch (unitOfMeasure) {
|
|
118
|
-
case "Kilogram":
|
|
119
|
-
return 'kg';
|
|
120
|
-
case "Month":
|
|
121
|
-
return 'mo';
|
|
122
|
-
case "Package":
|
|
123
|
-
return 'pkg';
|
|
124
|
-
case "Piece":
|
|
125
|
-
return 'pc';
|
|
126
|
-
case "Year":
|
|
127
|
-
return 'yr';
|
|
128
|
-
case "Day":
|
|
129
|
-
return 'd';
|
|
130
|
-
case "Hour":
|
|
131
|
-
return 'h';
|
|
132
|
-
case "Kilometre":
|
|
133
|
-
return 'km';
|
|
134
|
-
case "Metre":
|
|
135
|
-
return 'm';
|
|
136
|
-
case "Litre":
|
|
137
|
-
return 'L';
|
|
138
|
-
case "SquareMetre":
|
|
139
|
-
return 'm²';
|
|
140
|
-
case "CubicMetre":
|
|
141
|
-
return 'm³';
|
|
142
|
-
case "Tonne":
|
|
143
|
-
return 't';
|
|
144
|
-
case "KiloWattHour":
|
|
145
|
-
return 'kWh';
|
|
146
|
-
case "One": // Unit
|
|
147
|
-
return intl.formatMessage(CommonTranslations_1.commonTranslationMessages.unitOfMeasure_labels_One);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
exports.getShortNameForUnitOfMeasure = getShortNameForUnitOfMeasure;
|
|
151
116
|
var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonAfter, mobile, value) {
|
|
152
117
|
switch (dataIdx) {
|
|
153
118
|
case "quantity":
|
|
@@ -157,9 +122,7 @@ var getCorrectInputNode = function (dataIdx, intl, placeholder, required, addonA
|
|
|
157
122
|
case "unitOfMeasure":
|
|
158
123
|
return (react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, placeholder: placeholder, style: { width: "auto" } }, Object.keys(api_1.Units).map(function (unitOfMeasure) {
|
|
159
124
|
if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|
|
160
|
-
return (react_1.default.createElement(antd_1.Select.Option, { value:
|
|
161
|
-
? (0, exports.getShortNameForUnitOfMeasure)(unitOfMeasure, intl)
|
|
162
|
-
: intl.formatMessage(CommonTranslations_1.commonTranslationMessages["unitOfMeasure_labels_".concat(unitOfMeasure)])));
|
|
125
|
+
return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, intl.formatMessage(CommonTranslations_1.commonTranslationMessages["unitOfMeasure_labels_".concat(unitOfMeasure)])));
|
|
163
126
|
})));
|
|
164
127
|
case "taxCategoryType":
|
|
165
128
|
return (react_1.default.createElement(antd_1.Select, { popupMatchSelectWidth: false, placeholder: placeholder }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|