@unimaze/billing 0.6.0-rc.0 → 0.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/components/attachments/Attachment.d.ts +8 -2
- package/lib/common/components/attachments/Attachment.js +33 -3
- package/lib/common/components/attachments/index.d.ts +13 -2
- package/lib/common/components/attachments/index.js +8 -5
- package/lib/common/components/base-information/ReferenceIdentifiers.d.ts +2 -1
- package/lib/common/components/base-information/ReferenceIdentifiers.js +41 -12
- package/lib/common/components/base-information/index.d.ts +2 -1
- package/lib/common/components/base-information/index.js +2 -2
- package/lib/common/components/billing-lines/NewBillingLines.d.ts +1 -1
- package/lib/common/components/billing-lines/NewBillingLines.js +1 -1
- package/lib/common/components/customer/index.d.ts +1 -1
- package/lib/common/components/customer/index.js +1 -1
- package/lib/common/components/editable-cell/index.js +2 -2
- package/lib/common/components/form-item/index.js +1 -1
- package/lib/common/components/payment-method/index.d.ts +1 -1
- package/lib/common/components/payment-method/index.js +2 -2
- package/lib/common/components/supplier/index.js +22 -4
- package/lib/common/types/CommonProps.d.ts +6 -0
- package/lib/common/types/NewReceiverRequirements.d.ts +2 -0
- package/lib/create-credit-note/index.js +1 -1
- package/lib/create-invoice/IntlLoader.js +1 -1
- package/lib/create-invoice/index.d.ts +1 -1
- package/lib/create-invoice/index.js +39 -9
- package/lib/translations/locales/is.json +2 -1
- package/lib/translations/locales.d.ts +1 -0
- package/lib/utils/BillingLineUtility.js +2 -2
- package/lib/utils/ConversionUtility.js +8 -4
- package/lib/utils/FileUploadUtility.d.ts +7 -0
- package/lib/utils/FileUploadUtility.js +26 -0
- package/package.json +4 -1
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
|
+
import { ValidateStatus } from "antd/lib/form/FormItem";
|
|
5
|
+
import { UploadFile } from "antd/es/upload/interface";
|
|
3
6
|
interface Props extends InjectedIntlProps {
|
|
4
7
|
fieldName: "file1" | "file2" | "file3";
|
|
8
|
+
formInstance: FormInstance;
|
|
9
|
+
uploadSizeLimit: number;
|
|
5
10
|
}
|
|
6
11
|
interface States {
|
|
7
|
-
file:
|
|
12
|
+
file: UploadFile[];
|
|
13
|
+
attachmentFiledValid: ValidateStatus;
|
|
8
14
|
}
|
|
9
15
|
declare class Attachment extends React.Component<Props, States> {
|
|
10
16
|
constructor(props: Props);
|
|
@@ -12,7 +18,7 @@ declare class Attachment extends React.Component<Props, States> {
|
|
|
12
18
|
normFile: (e: any) => any;
|
|
13
19
|
render(): JSX.Element;
|
|
14
20
|
}
|
|
15
|
-
declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "key" | "ref" | "fieldName">, any> & {
|
|
21
|
+
declare const _default: React.ComponentClass<Pick<Props & React.RefAttributes<Attachment>, "key" | "ref" | "fieldName" | "formInstance" | "uploadSizeLimit">, any> & {
|
|
16
22
|
WrappedComponent: React.ComponentType<Props & React.RefAttributes<Attachment> & InjectedIntlProps>;
|
|
17
23
|
};
|
|
18
24
|
export default _default;
|
|
@@ -36,6 +36,7 @@ var React = __importStar(require("react"));
|
|
|
36
36
|
var antd_1 = require("antd");
|
|
37
37
|
var react_intl_1 = require("react-intl");
|
|
38
38
|
var formLayout_1 = require("../../consts/formLayout");
|
|
39
|
+
var FileUploadUtility_1 = require("../../../utils/FileUploadUtility");
|
|
39
40
|
var translationMessages = react_intl_1.defineMessages({
|
|
40
41
|
attachment_labels_Reference: {
|
|
41
42
|
id: "attachment_labels_Reference",
|
|
@@ -65,13 +66,25 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
65
66
|
id: "attachment_labels_descriptionErrorMsg",
|
|
66
67
|
defaultMessage: "Description must not match to another file description",
|
|
67
68
|
},
|
|
69
|
+
attachment_error_fileTooLarge: {
|
|
70
|
+
id: "attachment_error_fileTooLarge",
|
|
71
|
+
defaultMessage: "File size must be less than {uploadSizeLimit}KB",
|
|
72
|
+
},
|
|
73
|
+
attachment_error_fileWrongType: {
|
|
74
|
+
id: "attachment_error_fileWrongType",
|
|
75
|
+
defaultMessage: "Wrong file type",
|
|
76
|
+
},
|
|
77
|
+
attachment_error_fileFailedToUpload: {
|
|
78
|
+
id: "attachment_error_fileFailedToUpload",
|
|
79
|
+
defaultMessage: "File failed to upload",
|
|
80
|
+
},
|
|
68
81
|
});
|
|
69
82
|
var Attachment = /** @class */ (function (_super) {
|
|
70
83
|
__extends(Attachment, _super);
|
|
71
84
|
function Attachment(props) {
|
|
72
85
|
var _this = _super.call(this, props) || this;
|
|
73
86
|
_this.handleRemoveFile = function () {
|
|
74
|
-
_this.setState(function (prevStates) { return (__assign({}, prevStates, { file: [] })); });
|
|
87
|
+
_this.setState(function (prevStates) { return (__assign({}, prevStates, { file: [], attachmentFiledValid: "" })); });
|
|
75
88
|
};
|
|
76
89
|
_this.normFile = function (e) {
|
|
77
90
|
if (Array.isArray(e)) {
|
|
@@ -82,10 +95,12 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
82
95
|
};
|
|
83
96
|
_this.state = {
|
|
84
97
|
file: [],
|
|
98
|
+
attachmentFiledValid: "",
|
|
85
99
|
};
|
|
86
100
|
return _this;
|
|
87
101
|
}
|
|
88
102
|
Attachment.prototype.render = function () {
|
|
103
|
+
var _this = this;
|
|
89
104
|
var fieldName = this.props.fieldName;
|
|
90
105
|
var returnOtherFieldNames = function (fn) {
|
|
91
106
|
switch (fn) {
|
|
@@ -98,9 +113,24 @@ var Attachment = /** @class */ (function (_super) {
|
|
|
98
113
|
}
|
|
99
114
|
};
|
|
100
115
|
var attachmentLabelsDescriptionErrorMsg = this.props.intl.formatMessage(translationMessages.attachment_labels_descriptionErrorMsg);
|
|
116
|
+
var verifyTheAttachment = function (info, uploadSizeLimit, formInstance) {
|
|
117
|
+
_this.setState(function (prevState) { return (__assign({}, prevState, { attachmentFiledValid: "validating" })); });
|
|
118
|
+
var ifFileIsValid = FileUploadUtility_1.reportIfFileIsValid(info.file, uploadSizeLimit, {
|
|
119
|
+
uploadErrorToLarge: _this.props.intl.formatMessage(translationMessages.attachment_error_fileTooLarge, { uploadSizeLimit: uploadSizeLimit / 1024 }),
|
|
120
|
+
uploadErrorWrongType: _this.props.intl.formatMessage(translationMessages.attachment_error_fileWrongType),
|
|
121
|
+
uploadFailed: _this.props.intl.formatMessage(translationMessages.attachment_error_fileFailedToUpload),
|
|
122
|
+
});
|
|
123
|
+
if (!ifFileIsValid) {
|
|
124
|
+
formInstance.resetFields(["attachments", "" + _this.props.fieldName, "file"]);
|
|
125
|
+
_this.setState(function (prevState) { return (__assign({}, prevState, { attachmentFiledValid: "error", file: [] })); });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
_this.setState(function (prevState) { return (__assign({}, prevState, { attachmentFiledValid: "success", file: [info.file] })); });
|
|
129
|
+
}
|
|
130
|
+
};
|
|
101
131
|
return (React.createElement(React.Fragment, null,
|
|
102
|
-
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemVerticalLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_File), name: ["attachments", "" + fieldName, "file"], valuePropName: "fileList", getValueFromEvent: this.normFile }),
|
|
103
|
-
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + fieldName, multiple: false, onRemove: this.handleRemoveFile, beforeUpload: function () { return false; } },
|
|
132
|
+
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemVerticalLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_File), name: ["attachments", "" + fieldName, "file"], valuePropName: "fileList", getValueFromEvent: this.normFile, validateStatus: this.state.attachmentFiledValid }),
|
|
133
|
+
React.createElement(antd_1.Upload.Dragger, { name: "attachment:" + fieldName, multiple: false, onRemove: this.handleRemoveFile, onChange: function (info) { verifyTheAttachment(info, _this.props.uploadSizeLimit, _this.props.formInstance); }, beforeUpload: function (file) { return false; }, fileList: this.state.file },
|
|
104
134
|
React.createElement("p", null, this.props.intl.formatMessage(translationMessages.attachment_labels_uploadFileMsg)))),
|
|
105
135
|
React.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemVerticalLayout, { label: this.props.intl.formatMessage(translationMessages.attachment_labels_Description), name: ["attachments", "" + fieldName, "description"], rules: [
|
|
106
136
|
{
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { FormInstance } from "antd/es/form";
|
|
4
|
+
import { LanguageProp } from "../../types/CommonProps";
|
|
5
|
+
interface Props extends InjectedIntlProps {
|
|
6
|
+
formInstance: FormInstance;
|
|
7
|
+
uploadSizeLimit: number;
|
|
8
|
+
attachmentTooltipText?: {
|
|
9
|
+
is: string;
|
|
10
|
+
en: string;
|
|
11
|
+
};
|
|
12
|
+
languageString: LanguageProp;
|
|
13
|
+
}
|
|
14
|
+
declare const AttachmentGroupIntl: React.ComponentClass<Pick<Props, "formInstance" | "uploadSizeLimit" | "attachmentTooltipText" | "languageString">, any> & {
|
|
15
|
+
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
5
16
|
};
|
|
6
17
|
export default AttachmentGroupIntl;
|
|
@@ -23,11 +23,14 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
23
23
|
},
|
|
24
24
|
attachment_tooltip_title: {
|
|
25
25
|
id: "attachment_tooltip_title",
|
|
26
|
-
defaultMessage: "The maximum size is
|
|
26
|
+
defaultMessage: "The maximum size is {uploadSizeLimit}KB. Enclosed documents can be a copy of the original invoice, or timesheets for example."
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
var AttachmentsGroup = function (props) {
|
|
30
|
-
var
|
|
30
|
+
var tooltipTitle = (props.languageString === "en" || props.languageString === "is") && props.attachmentTooltipText
|
|
31
|
+
? props.attachmentTooltipText[props.languageString]
|
|
32
|
+
: props.intl.formatMessage(translationMessages.attachment_tooltip_title, { uploadSizeLimit: props.uploadSizeLimit });
|
|
33
|
+
var attachmentLabelNode = (React.createElement(antd_1.Tooltip, { title: tooltipTitle, placement: "right" },
|
|
31
34
|
React.createElement("span", null,
|
|
32
35
|
props.intl.formatMessage(translationMessages.attachment_title),
|
|
33
36
|
" ",
|
|
@@ -35,11 +38,11 @@ var AttachmentsGroup = function (props) {
|
|
|
35
38
|
return (React.createElement(components_1.ComponentContainer, { title: attachmentLabelNode },
|
|
36
39
|
React.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
37
40
|
React.createElement(antd_1.Col, { span: 8 },
|
|
38
|
-
React.createElement(Attachment_1.default, { key: "attachment1", fieldName: "file1" })),
|
|
41
|
+
React.createElement(Attachment_1.default, { key: "attachment1", fieldName: "file1", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit })),
|
|
39
42
|
React.createElement(antd_1.Col, { span: 8 },
|
|
40
|
-
React.createElement(Attachment_1.default, { key: "attachment2", fieldName: "file2" })),
|
|
43
|
+
React.createElement(Attachment_1.default, { key: "attachment2", fieldName: "file2", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit })),
|
|
41
44
|
React.createElement(antd_1.Col, { span: 8 },
|
|
42
|
-
React.createElement(Attachment_1.default, { key: "attachment3", fieldName: "file3" })))));
|
|
45
|
+
React.createElement(Attachment_1.default, { key: "attachment3", fieldName: "file3", formInstance: props.formInstance, uploadSizeLimit: props.uploadSizeLimit })))));
|
|
43
46
|
};
|
|
44
47
|
var AttachmentGroupIntl = react_intl_1.injectIntl(AttachmentsGroup);
|
|
45
48
|
exports.default = AttachmentGroupIntl;
|
|
@@ -17,8 +17,9 @@ interface Props extends InjectedIntlProps {
|
|
|
17
17
|
formInstance: FormInstance;
|
|
18
18
|
updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
|
|
19
19
|
rapiBaseUrl: string;
|
|
20
|
+
legalIdentifier: string;
|
|
20
21
|
}
|
|
21
|
-
declare const _default: React.ComponentClass<Pick<Props, "add" | "remove" | "fields" | "
|
|
22
|
+
declare const _default: React.ComponentClass<Pick<Props, "add" | "remove" | "fields" | "formInstance" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier">, any> & {
|
|
22
23
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
23
24
|
};
|
|
24
25
|
export default _default;
|
|
@@ -55,8 +55,9 @@ exports.translationMessages = react_intl_1.defineMessages({
|
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
var ReferenceIdentifiers = function (props) {
|
|
58
|
-
var _a = react_1.useState(
|
|
59
|
-
var _b = react_1.useState(
|
|
58
|
+
var _a = react_1.default.useState(""), validateStatus = _a[0], setValidateStatus = _a[1];
|
|
59
|
+
var _b = react_1.useState([]), referenceIdentifierValue = _b[0], setReferenceIdentifierValue = _b[1];
|
|
60
|
+
var _c = react_1.useState(false), loadingReferenceIdentifierValues = _c[0], setLoadingReferenceIdentifierValues = _c[1]; // TODO: change this to boolean[] for handling the list
|
|
60
61
|
var referenceIdentifierLabelNode = (react_1.default.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier_title), placement: "right" },
|
|
61
62
|
react_1.default.createElement("span", null,
|
|
62
63
|
props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_labels_referenceIdentifier),
|
|
@@ -100,11 +101,34 @@ var ReferenceIdentifiers = function (props) {
|
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
};
|
|
103
|
-
var
|
|
104
|
+
var handleReferenceIdentifierValueValidation = function (isoNumber, fieldName, value, rapiBaseUrl) {
|
|
105
|
+
var searchUrl = rapiBaseUrl + ("/api/v1/requirements/" + isoNumber + "/" + fieldName + "/values/validate?value=" + value);
|
|
106
|
+
setValidateStatus("validating");
|
|
107
|
+
axios_1.default.get(searchUrl)
|
|
108
|
+
.then(function (response) {
|
|
109
|
+
response.data ? setValidateStatus("success") : setValidateStatus("error");
|
|
110
|
+
})
|
|
111
|
+
.catch(function (error) {
|
|
112
|
+
// tslint:disable-next-line:no-console
|
|
113
|
+
console.log(error);
|
|
114
|
+
setValidateStatus("error");
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field) {
|
|
118
|
+
var fieldProps = __assign({}, field, { name: [field.name, "value"], fieldKey: [field.fieldKey, "value"], rules: [{ required: false }] });
|
|
104
119
|
if (value && value.key) {
|
|
105
120
|
var options = ReferenceIdentifierUtility_1.getReferenceIdentifierOptions(receiverRequirements);
|
|
106
121
|
var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
|
|
107
122
|
if (fieldDefinition_1) {
|
|
123
|
+
var fieldHandling = null;
|
|
124
|
+
if (fieldDefinition_1.properties.hasOwnProperty("handling") && fieldDefinition_1.properties.handling) {
|
|
125
|
+
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
126
|
+
}
|
|
127
|
+
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
128
|
+
fieldProps = __assign({}, fieldProps, { validateStatus: validateStatus, hasFeedback: true });
|
|
129
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
130
|
+
react_1.default.createElement(antd_1.Input, { onBlur: function (event) { return handleReferenceIdentifierValueValidation(legalIdentifier, fieldDefinition_1.name, event.currentTarget.value, rapiBaseUrl); } })));
|
|
131
|
+
}
|
|
108
132
|
if (fieldDefinition_1.properties.hasOwnProperty("values") && fieldDefinition_1.properties.values /*&& fieldDefinition.properties.values.length > 0*/) {
|
|
109
133
|
var selectProps = fieldDefinition_1.properties.hasOwnProperty("href")
|
|
110
134
|
? {
|
|
@@ -116,32 +140,37 @@ var ReferenceIdentifiers = function (props) {
|
|
|
116
140
|
loading: loadingReferenceIdentifierValues,
|
|
117
141
|
}
|
|
118
142
|
: {};
|
|
119
|
-
return (react_1.default.createElement(antd_1.
|
|
120
|
-
|
|
121
|
-
|
|
143
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
144
|
+
react_1.default.createElement(antd_1.Select, __assign({ dropdownMatchSelectWidth: false }, selectProps), fieldDefinition_1.properties.values.map(function (op) {
|
|
145
|
+
return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
|
|
146
|
+
}))));
|
|
122
147
|
}
|
|
123
148
|
else {
|
|
124
|
-
return react_1.default.createElement(antd_1.
|
|
149
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
150
|
+
react_1.default.createElement(antd_1.Input, null)));
|
|
125
151
|
}
|
|
126
152
|
}
|
|
127
153
|
else {
|
|
128
|
-
return react_1.default.createElement(antd_1.
|
|
154
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
155
|
+
react_1.default.createElement(antd_1.Input, null)));
|
|
129
156
|
}
|
|
130
157
|
}
|
|
131
|
-
return react_1.default.createElement(antd_1.
|
|
158
|
+
return (react_1.default.createElement(antd_1.Form.Item, __assign({}, fieldProps),
|
|
159
|
+
react_1.default.createElement(antd_1.Input, { disabled: true })));
|
|
132
160
|
};
|
|
133
161
|
return (react_1.default.createElement("div", null, props.fields.map(function (field, index) {
|
|
134
162
|
return (react_1.default.createElement(antd_1.Form.Item, __assign({ key: "referenceIdentifier-" + index }, (index === 0 ? formLayout_1.formItemLayout : formLayout_1.formItemLayoutWithOutLabel), { label: index === 0 ? referenceIdentifierLabelNode : "" }),
|
|
135
163
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 0] },
|
|
136
164
|
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
137
|
-
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"], fieldKey: [field.fieldKey, "code"], rules: [{ required:
|
|
165
|
+
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "code"], fieldKey: [field.fieldKey, "code"], rules: [{ required: false }] }),
|
|
138
166
|
react_1.default.createElement(antd_1.Select, { labelInValue: true, style: { width: "100%" }, dropdownMatchSelectWidth: false, onChange: function (a) {
|
|
139
167
|
var newState = referenceIdentifierValue.slice();
|
|
140
168
|
newState.splice(index, 1, a);
|
|
141
169
|
setReferenceIdentifierValue(newState);
|
|
170
|
+
setValidateStatus("");
|
|
171
|
+
props.formInstance.resetFields([["invoice", "referenceIdentifiers", index, "value"]]);
|
|
142
172
|
} }, getReferenceIdentifier(props.receiverRequirements)))),
|
|
143
|
-
react_1.default.createElement(antd_1.Col, { span: 12 },
|
|
144
|
-
react_1.default.createElement(antd_1.Form.Item, __assign({}, field, { name: [field.name, "value"], fieldKey: [field.fieldKey, "value"], rules: [{ required: true }] }), getReferenceIdentifierValueInput(referenceIdentifierValue[index], props.receiverRequirements, props.rapiBaseUrl))))));
|
|
173
|
+
react_1.default.createElement(antd_1.Col, { span: 12 }, getReferenceIdentifierValueFormItemInput(referenceIdentifierValue[index], props.receiverRequirements, props.rapiBaseUrl, props.legalIdentifier, field)))));
|
|
145
174
|
})));
|
|
146
175
|
};
|
|
147
176
|
exports.default = react_intl_1.injectIntl(ReferenceIdentifiers);
|
|
@@ -8,8 +8,9 @@ interface Props extends InjectedIntlProps {
|
|
|
8
8
|
documentType: "creditNote" | "invoice";
|
|
9
9
|
updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void;
|
|
10
10
|
rapiBaseUrl: string;
|
|
11
|
+
legalIdentifier: string;
|
|
11
12
|
}
|
|
12
|
-
declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "documentType">, any> & {
|
|
13
|
+
declare const BaseInformationIntl: React.ComponentClass<Pick<Props, "form" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier" | "documentType">, any> & {
|
|
13
14
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
14
15
|
};
|
|
15
16
|
export default BaseInformationIntl;
|
|
@@ -195,12 +195,12 @@ var BaseInformation = function (props) {
|
|
|
195
195
|
React.createElement(antd_1.Input, null)),
|
|
196
196
|
React.createElement(antd_1.Form.List, { name: ["invoice", "referenceIdentifiers"] }, function (fields, _a) {
|
|
197
197
|
var add = _a.add, remove = _a.remove;
|
|
198
|
-
return (React.createElement(ReferenceIdentifiers_1.default, { fields: fields, add: add, remove: remove, receiverRequirements: props.receiverRequirements, formInstance: props.form, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl }));
|
|
198
|
+
return (React.createElement(ReferenceIdentifiers_1.default, { fields: fields, add: add, remove: remove, receiverRequirements: props.receiverRequirements, formInstance: props.form, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier }));
|
|
199
199
|
}),
|
|
200
200
|
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"] },
|
|
201
201
|
React.createElement(antd_1.Input.TextArea, null)),
|
|
202
202
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields.currencyCode, defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_currencyCode), defaultIsRequired: true, fieldName: ["invoice", "currencyCode"] },
|
|
203
|
-
React.createElement(antd_1.Select, {
|
|
203
|
+
React.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, getCurrencies(props.receiverRequirements)))));
|
|
204
204
|
};
|
|
205
205
|
var BaseInformationIntl = react_intl_1.injectIntl(BaseInformation);
|
|
206
206
|
exports.default = BaseInformationIntl;
|
|
@@ -6,7 +6,7 @@ interface Props extends InjectedIntlProps {
|
|
|
6
6
|
receiverRequirements: NewReceiverRequirements;
|
|
7
7
|
formInstance: FormInstance;
|
|
8
8
|
}
|
|
9
|
-
declare const _default: React.ComponentClass<Pick<Props, "
|
|
9
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements">, any> & {
|
|
10
10
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
11
|
};
|
|
12
12
|
export default _default;
|
|
@@ -51,7 +51,7 @@ var BillingLines = function (props) {
|
|
|
51
51
|
react_1.default.createElement(antd_1.Select, { onChange: function (value) {
|
|
52
52
|
// console.log("valueChanged", value);
|
|
53
53
|
taxCatType = value;
|
|
54
|
-
} }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
54
|
+
}, dropdownMatchSelectWidth: false }, Object.keys(mapi_1.TaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
55
55
|
return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
|
|
56
56
|
})))),
|
|
57
57
|
react_1.default.createElement(antd_1.Col, { span: 2 },
|
|
@@ -12,7 +12,7 @@ interface Props extends InjectedIntlProps {
|
|
|
12
12
|
setChosenCustomer: (chosenCustomer: PartyMetadata) => void;
|
|
13
13
|
setChosenCustomerApiKey: (chosenCustomerApiKey: string) => void;
|
|
14
14
|
}
|
|
15
|
-
declare const CustomerIntl: React.ComponentClass<Pick<Props, "
|
|
15
|
+
declare const CustomerIntl: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "customers" | "chosenCustomer" | "setChosenCustomer" | "setChosenCustomerApiKey">, any> & {
|
|
16
16
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
17
17
|
};
|
|
18
18
|
export default CustomerIntl;
|
|
@@ -78,7 +78,7 @@ var Customer = function (props) {
|
|
|
78
78
|
react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, defaultLabel: props.intl.formatMessage(translationMessages.customer_selectTheCustomer), defaultIsRequired: true, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.identifier"], fieldName: ["invoice", "customer", "name"] },
|
|
79
79
|
react_1.default.createElement(antd_1.Select, { onChange: function (value) {
|
|
80
80
|
onCustomerChange(value);
|
|
81
|
-
} }, props.customers.map(function (customer, index) { return (react_1.default.createElement(antd_1.Select.Option, { key: index, value: index }, customer.name)); }))),
|
|
81
|
+
}, dropdownMatchSelectWidth: false }, props.customers.map(function (customer, index) { return (react_1.default.createElement(antd_1.Select.Option, { key: index, value: index }, customer.name)); }))),
|
|
82
82
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_name), style: { display: "none" } }), chosenCustomer && chosenCustomer.name),
|
|
83
83
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_identifier) }), chosenCustomer && ConversionUtility_1.convertToReadableKennitala(chosenCustomer.identifier)),
|
|
84
84
|
react_1.default.createElement(antd_1.Form.Item, __assign({}, formLayout_1.formItemLayout, { label: props.intl.formatMessage(translationMessages.customer_address_streetNameAndNumber) }), chosenCustomer && chosenCustomer.address
|
|
@@ -223,7 +223,7 @@ var EditableCell = function (props) {
|
|
|
223
223
|
case "discountValue":
|
|
224
224
|
return react_1.default.createElement(antd_1.Input, { onBlur: save });
|
|
225
225
|
case "unitOfMeasure":
|
|
226
|
-
return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); },
|
|
226
|
+
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false, ref: function (node) { return (input = node); },
|
|
227
227
|
// defaultActiveFirstOption
|
|
228
228
|
// onSelect={save}
|
|
229
229
|
labelInValue: true, onChange: save }, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
|
|
@@ -233,7 +233,7 @@ var EditableCell = function (props) {
|
|
|
233
233
|
key: unitOfMeasure }, props.intl.formatMessage(exports.commonTranslationMessages["unitOfMeasure_labels_" + unitOfMeasure])));
|
|
234
234
|
})));
|
|
235
235
|
case "taxCategoryType":
|
|
236
|
-
return (react_1.default.createElement(antd_1.Select, { ref: function (node) { return (input = node); },
|
|
236
|
+
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false, ref: function (node) { return (input = node); },
|
|
237
237
|
// defaultActiveFirstOption
|
|
238
238
|
labelInValue: true,
|
|
239
239
|
// onSelect={save}
|
|
@@ -55,7 +55,7 @@ var UmzFormItem = function (props) {
|
|
|
55
55
|
: label, name: fieldName, rules: [
|
|
56
56
|
{
|
|
57
57
|
required: isRequired,
|
|
58
|
-
message:
|
|
58
|
+
message: intl.formatMessage(exports.translationMessages.formItem_required_errorMessage),
|
|
59
59
|
}
|
|
60
60
|
].concat((additionalRules || []) // if the array is undefined
|
|
61
61
|
), style: style, initialValue: initialValue }, rest), children));
|
|
@@ -7,7 +7,7 @@ interface Props extends InjectedIntlProps {
|
|
|
7
7
|
formInstance: FormInstance;
|
|
8
8
|
receiverRequirements: NewReceiverRequirements;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: React.ComponentClass<Pick<Props, "
|
|
10
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements">, any> & {
|
|
11
11
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
12
12
|
};
|
|
13
13
|
export default _default;
|
|
@@ -94,7 +94,7 @@ var PaymentMethod = function (props) {
|
|
|
94
94
|
required: true,
|
|
95
95
|
message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage)
|
|
96
96
|
}] },
|
|
97
|
-
react_1.default.createElement(antd_1.Select,
|
|
97
|
+
react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false },
|
|
98
98
|
react_1.default.createElement(antd_1.Select.Option, { value: "05" }, "05"),
|
|
99
99
|
react_1.default.createElement(antd_1.Select.Option, { value: "15" }, "15"),
|
|
100
100
|
react_1.default.createElement(antd_1.Select.Option, { value: "26" }, "26"))),
|
|
@@ -211,7 +211,7 @@ var PaymentMethod = function (props) {
|
|
|
211
211
|
};
|
|
212
212
|
return (react_1.default.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(exports.translationMessages.paymentMethod_title) },
|
|
213
213
|
react_1.default.createElement(antd_1.Form.Item, { name: ["invoice", "paymentMeans", "type"] },
|
|
214
|
-
react_1.default.createElement(antd_1.Select, { value: paymentMethod, onSelect: setPaymentMethod }, getPaymentMeansTypeOptions(props.receiverRequirements))),
|
|
214
|
+
react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false, value: paymentMethod, onSelect: setPaymentMethod }, getPaymentMeansTypeOptions(props.receiverRequirements))),
|
|
215
215
|
renderFormFields(paymentMethod)));
|
|
216
216
|
};
|
|
217
217
|
exports.default = react_intl_1.injectIntl(PaymentMethod);
|
|
@@ -20,6 +20,8 @@ var models_1 = require("@unimaze/api-clients/lib/mapi/models");
|
|
|
20
20
|
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
|
+
var form_item_2 = require("../form-item");
|
|
24
|
+
var antd_mask_input_1 = require("antd-mask-input");
|
|
23
25
|
var translationMessages = react_intl_1.defineMessages({
|
|
24
26
|
supplier_title: {
|
|
25
27
|
id: "supplier_title",
|
|
@@ -68,19 +70,31 @@ var translationMessages = react_intl_1.defineMessages({
|
|
|
68
70
|
supplier_notValidEmail: {
|
|
69
71
|
id: "supplier_notValidEmail",
|
|
70
72
|
defaultMessage: "This is not a valid E-Mail"
|
|
73
|
+
},
|
|
74
|
+
validationRule_kennitalaPattern: {
|
|
75
|
+
id: "validationRule_kennitalaPattern",
|
|
76
|
+
defaultMessage: "Identifier must match pattern 111111-1111"
|
|
71
77
|
}
|
|
72
78
|
});
|
|
73
79
|
var Supplier = function (props) {
|
|
74
80
|
var electronicMailLabelNode = (React.createElement(antd_1.Tooltip, { title: props.intl.formatMessage(translationMessages.supplier_contact_email_title), placement: "right" },
|
|
75
81
|
React.createElement("span", null,
|
|
76
82
|
props.intl.formatMessage(translationMessages.supplier_contact_email),
|
|
77
|
-
" ",
|
|
78
83
|
React.createElement(icons_1.QuestionCircleOutlined, null))));
|
|
79
84
|
return (React.createElement(components_1.ComponentContainer, { title: props.intl.formatMessage(translationMessages.supplier_title) },
|
|
80
85
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.name"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_name), defaultIsRequired: true, fieldName: ["invoice", "supplier", "name"] },
|
|
81
86
|
React.createElement(antd_1.Input, null)),
|
|
82
|
-
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_identifier), defaultIsRequired: true, fieldName: ["invoice", "supplier", "identifier"]
|
|
83
|
-
|
|
87
|
+
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.identifier"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_identifier), defaultIsRequired: true, fieldName: ["invoice", "supplier", "identifier"], rules: [
|
|
88
|
+
{
|
|
89
|
+
pattern: /\d{6}-\d{4}/g,
|
|
90
|
+
message: props.intl.formatMessage(translationMessages.validationRule_kennitalaPattern)
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
required: true,
|
|
94
|
+
message: props.intl.formatMessage(form_item_2.translationMessages.formItem_required_errorMessage),
|
|
95
|
+
}
|
|
96
|
+
] },
|
|
97
|
+
React.createElement(antd_mask_input_1.MaskedInput, { mask: "111111-1111" })),
|
|
84
98
|
React.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["supplier.vatNumber"], defaultLabel: props.intl.formatMessage(translationMessages.supplier_vatNumber), defaultIsRequired: true, fieldName: ["invoice", "supplier", "vatNumber"], additionalRules: [
|
|
85
99
|
{
|
|
86
100
|
required: props.billingLinesDataSource.some(function (billingLine) { return (billingLine.taxCategoryType.value !== models_1.BillingLineMetadataTaxCategoryTypeEnum.Exempt); }),
|
|
@@ -90,7 +104,11 @@ var Supplier = function (props) {
|
|
|
90
104
|
{
|
|
91
105
|
max: 6,
|
|
92
106
|
min: 5,
|
|
93
|
-
message: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_rules_Length, {
|
|
107
|
+
message: props.intl.formatMessage(payment_method_1.translationMessages.paymentMethod_rules_Length, {
|
|
108
|
+
fieldName: props.intl.formatMessage(translationMessages.supplier_vatNumber),
|
|
109
|
+
min: 5,
|
|
110
|
+
max: 6
|
|
111
|
+
})
|
|
94
112
|
}
|
|
95
113
|
] },
|
|
96
114
|
React.createElement(antd_1.Input, null)),
|
|
@@ -5,5 +5,11 @@ export interface CommonProps {
|
|
|
5
5
|
rapiBaseUrl: string;
|
|
6
6
|
receiverRequirements: NewReceiverRequirements;
|
|
7
7
|
updateReceiverRequirementsProp: (newReceiverRequirementsProp: NewReceiverRequirements) => void;
|
|
8
|
+
uploadSizeLimit: number;
|
|
9
|
+
attachmentTooltipText?: {
|
|
10
|
+
is: string;
|
|
11
|
+
en: string;
|
|
12
|
+
};
|
|
13
|
+
legalIdentifier: string;
|
|
8
14
|
}
|
|
9
15
|
export declare type LanguageProp = "en" | "is" | undefined;
|
|
@@ -8,9 +8,11 @@ export interface FieldProperties {
|
|
|
8
8
|
values?: FieldValues[];
|
|
9
9
|
cardinality?: string;
|
|
10
10
|
href?: string;
|
|
11
|
+
handling?: string;
|
|
11
12
|
}
|
|
12
13
|
export interface FieldDefinition {
|
|
13
14
|
key: string;
|
|
15
|
+
name?: string;
|
|
14
16
|
properties: FieldProperties;
|
|
15
17
|
}
|
|
16
18
|
export interface FieldGrouping {
|
|
@@ -54,7 +54,7 @@ var CreateInvoice = function (props) {
|
|
|
54
54
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } }),
|
|
55
55
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 12 } }),
|
|
56
56
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 12 }, xl: { span: 8 } },
|
|
57
|
-
react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "creditNote", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl })),
|
|
57
|
+
react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "creditNote", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier })),
|
|
58
58
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 16 } }),
|
|
59
59
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 24 }, xl: { span: 24 } }),
|
|
60
60
|
react_1.default.createElement(antd_1.Col, { span: 24 },
|
|
@@ -44,6 +44,6 @@ var CreateInvoice = function (props) {
|
|
|
44
44
|
react_intl_1.addLocaleData(en_1.default.concat(sr_1.default, is_1.default));
|
|
45
45
|
return (react_1.default.createElement(antd_1.ConfigProvider, { locale: andLocale, componentSize: "small" },
|
|
46
46
|
react_1.default.createElement(react_intl_1.IntlProvider, { locale: languageString, defaultLocale: "en", key: languageString, messages: locales_1.default[languageString] },
|
|
47
|
-
react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp }))));
|
|
47
|
+
react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, legalIdentifier: props.legalIdentifier, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText }))));
|
|
48
48
|
};
|
|
49
49
|
exports.default = CreateInvoice;
|
|
@@ -5,7 +5,7 @@ import { CommonProps } from "../common/types/CommonProps";
|
|
|
5
5
|
interface Props extends CommonProps, InjectedIntlProps {
|
|
6
6
|
customers: ProfileOutputWithApiKey[];
|
|
7
7
|
}
|
|
8
|
-
declare const _default: React.ComponentClass<Pick<Props, "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "customers" | "language" | "mapiBaseUrl">, any> & {
|
|
8
|
+
declare const _default: React.ComponentClass<Pick<Props, "uploadSizeLimit" | "attachmentTooltipText" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier" | "customers" | "language" | "mapiBaseUrl">, any> & {
|
|
9
9
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
@@ -17,6 +17,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
17
17
|
result["default"] = mod;
|
|
18
18
|
return result;
|
|
19
19
|
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
20
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
24
|
var mapi_1 = require("@unimaze/api-clients/lib/mapi");
|
|
22
25
|
var models_1 = require("@unimaze/api-clients/lib/mapi/models");
|
|
@@ -31,6 +34,7 @@ var paymentMethodForConversion_1 = require("../common/components/payment-method/
|
|
|
31
34
|
var uuid_1 = require("uuid");
|
|
32
35
|
var editable_cell_1 = require("../common/components/editable-cell");
|
|
33
36
|
var billing_lines_1 = require("../common/components/billing-lines");
|
|
37
|
+
var react_google_recaptcha_1 = __importDefault(require("react-google-recaptcha"));
|
|
34
38
|
var translationMessages = react_intl_1.defineMessages({
|
|
35
39
|
createInvoice_addDocumentLineMsg: {
|
|
36
40
|
id: "createInvoice_addDocumentLineMsg",
|
|
@@ -66,23 +70,30 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
66
70
|
var intl = props.intl;
|
|
67
71
|
var form = antd_1.Form.useForm()[0];
|
|
68
72
|
var _a = react_1.useState(false), submitting = _a[0], setSubmitting = _a[1];
|
|
69
|
-
var _b = react_1.useState(
|
|
70
|
-
var _c = react_1.useState(),
|
|
71
|
-
var _d = react_1.useState(
|
|
73
|
+
var _b = react_1.useState(true), isSubmitDisabled = _b[0], setIsSubmitDisabled = _b[1];
|
|
74
|
+
var _c = react_1.useState(/*profileOutputToPartyMetadata(customers[0])*/ undefined), chosenCustomer = _c[0], setChosenCustomer = _c[1];
|
|
75
|
+
var _d = react_1.useState(), chosenCustomerApiKey = _d[0], setChosenCustomerApiKey = _d[1];
|
|
76
|
+
var _e = react_1.useState(1), billingLinesEditableIndex = _e[0], setBillingLinesEditableIndex = _e[1];
|
|
72
77
|
var initialBillingLineData = {
|
|
73
78
|
key: billingLinesEditableIndex,
|
|
74
79
|
itemNo: props.intl.formatMessage(billing_lines_1.translationMessages.billingLines_placeholders_itemNo),
|
|
75
80
|
quantity: 0,
|
|
76
81
|
taxAmount: 0,
|
|
77
82
|
name: props.intl.formatMessage(billing_lines_1.translationMessages.billingLines_placeholders_newItem),
|
|
78
|
-
unitOfMeasure: {
|
|
83
|
+
unitOfMeasure: {
|
|
84
|
+
value: models_1.UnitOfMeasureMetadataUnitEnum.Piece,
|
|
85
|
+
label: props.intl.formatMessage(editable_cell_1.commonTranslationMessages.unitOfMeasure_labels_Piece)
|
|
86
|
+
},
|
|
79
87
|
unitPriceAmount: 0,
|
|
80
|
-
taxCategoryType: {
|
|
88
|
+
taxCategoryType: {
|
|
89
|
+
value: models_1.BillingLineMetadataTaxCategoryTypeEnum.Exempt,
|
|
90
|
+
label: props.intl.formatMessage(editable_cell_1.commonTranslationMessages.taxCategoryType_labels_Exempt) + " (0%)"
|
|
91
|
+
},
|
|
81
92
|
discountValue: "0",
|
|
82
93
|
taxableAmount: 0,
|
|
83
94
|
taxPercentage: null
|
|
84
95
|
};
|
|
85
|
-
var
|
|
96
|
+
var _f = react_1.useState([__assign({}, initialBillingLineData, { key: 0 })]), billingLinesDataSource = _f[0], setBillingLinesDataSource = _f[1];
|
|
86
97
|
// BILLING LINES
|
|
87
98
|
var handleBillingLinesDelete = function (index) {
|
|
88
99
|
var newDataSource = billingLinesDataSource.slice();
|
|
@@ -124,6 +135,18 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
124
135
|
];
|
|
125
136
|
// Clear the array of undefined
|
|
126
137
|
attachments = attachments.filter(function (attachment) { return attachment.file !== undefined; });
|
|
138
|
+
// Verify the attachment
|
|
139
|
+
// attachments.forEach(att => {
|
|
140
|
+
// const ifFileIsValid = reportIfFileIsValid(att.file[0], {
|
|
141
|
+
// uploadErrorToLarge: "to large",
|
|
142
|
+
// uploadErrorWrongType: "wrong type",
|
|
143
|
+
// uploadFailed: "failed",
|
|
144
|
+
// })
|
|
145
|
+
// if(!ifFileIsValid) {
|
|
146
|
+
// return;
|
|
147
|
+
// }
|
|
148
|
+
//
|
|
149
|
+
// })
|
|
127
150
|
var billingLinesArray = form.getFieldValue("billingLinesMetadata");
|
|
128
151
|
if (!billingLinesArray || billingLinesArray.length <= 0) {
|
|
129
152
|
antd_1.message.error(intl.formatMessage(translationMessages.createInvoice_addDocumentLineMsg));
|
|
@@ -149,6 +172,8 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
149
172
|
var nextFileArray = attachments.splice(0, 1);
|
|
150
173
|
var nextFile = nextFileArray[0].file[0].originFileObj;
|
|
151
174
|
var nextFileDescription = nextFileArray[0].description;
|
|
175
|
+
if (!nextFile)
|
|
176
|
+
throw new Error("NextFile is empty");
|
|
152
177
|
var createAttachDocument = {
|
|
153
178
|
messageId: messageId,
|
|
154
179
|
contentType: nextFile.type,
|
|
@@ -247,7 +272,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
247
272
|
} }),
|
|
248
273
|
react_1.default.createElement(antd_1.Row, { gutter: [16, 16] },
|
|
249
274
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
250
|
-
react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "invoice", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl })),
|
|
275
|
+
react_1.default.createElement(components_1.BaseInformation, { receiverRequirements: props.receiverRequirements, form: form, documentType: "invoice", updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: props.legalIdentifier })),
|
|
251
276
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
252
277
|
react_1.default.createElement(components_1.Supplier, { receiverRequirements: props.receiverRequirements, billingLinesDataSource: billingLinesDataSource })),
|
|
253
278
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
@@ -257,9 +282,14 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
257
282
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 8 } },
|
|
258
283
|
react_1.default.createElement(components_1.PaymentMethod, { receiverRequirements: props.receiverRequirements, formInstance: form })),
|
|
259
284
|
react_1.default.createElement(antd_1.Col, { xs: { span: 24 }, md: { span: 16 } },
|
|
260
|
-
react_1.default.createElement(components_1.Attachments,
|
|
285
|
+
react_1.default.createElement(components_1.Attachments, { formInstance: form, uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, languageString: props.language })),
|
|
286
|
+
react_1.default.createElement(antd_1.Row, { style: { width: "100%", padding: "8px" }, justify: "end" },
|
|
287
|
+
react_1.default.createElement(antd_1.Col, null,
|
|
288
|
+
react_1.default.createElement(react_google_recaptcha_1.default, { sitekey: "6LdMUdEZAAAAAG--2WEyu8CIRVlv6CzdZIwaQ-zt", onChange: function (token) {
|
|
289
|
+
setIsSubmitDisabled(!token);
|
|
290
|
+
}, hl: props.language }))),
|
|
261
291
|
react_1.default.createElement(antd_1.Row, { style: { width: "100%", padding: "8px" }, justify: "end" },
|
|
262
292
|
react_1.default.createElement(antd_1.Col, null,
|
|
263
|
-
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large" }, intl.formatMessage(translationMessages.createInvoice_Submit))))))));
|
|
293
|
+
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large", disabled: isSubmitDisabled }, intl.formatMessage(translationMessages.createInvoice_Submit))))))));
|
|
264
294
|
};
|
|
265
295
|
exports.default = react_intl_1.injectIntl(CreateInvoiceConstructor);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"attachment_labels_Description_requiredMessage": "Vinsamlega sláið inn lýsingu",
|
|
6
6
|
"attachment_labels_File": "Skrá",
|
|
7
7
|
"attachment_title": "Viðhengi",
|
|
8
|
-
"attachment_tooltip_title": "Hámarks stærð er
|
|
8
|
+
"attachment_tooltip_title": "Hámarks stærð er {uploadSizeLimit}KB. Fylgigögn reiknings geta verið afrit af upprunalega reikningnum eða fylgigögn, svo sem tímaskýrslur",
|
|
9
9
|
"baseInformation_title": "Grunnupplýsingar",
|
|
10
10
|
"baseInformation_invoiceNo": "Reikningsnr.",
|
|
11
11
|
"baseInformation_issueDate": "Útgáfudags.",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"supplier_contact_email_title": "Send verður greiðslutilkynning á þetta netfang",
|
|
78
78
|
"supplier_contact_name": "Nafn tengiliðs",
|
|
79
79
|
"supplier_notValidEmail": "Þetta er ekki gilt netfang",
|
|
80
|
+
"validationRule_kennitalaPattern": "Kennitala verður að passa við mynstur 111111-1111",
|
|
80
81
|
"customer_title": "Viðskiptavinur",
|
|
81
82
|
"customer_selectTheCustomer": "Veldu viðskiptavini",
|
|
82
83
|
"customer_name": "Nafn",
|
|
@@ -79,6 +79,7 @@ declare const _default: {
|
|
|
79
79
|
"supplier_contact_email_title": string;
|
|
80
80
|
"supplier_contact_name": string;
|
|
81
81
|
"supplier_notValidEmail": string;
|
|
82
|
+
"validationRule_kennitalaPattern": string;
|
|
82
83
|
"customer_title": string;
|
|
83
84
|
"customer_selectTheCustomer": string;
|
|
84
85
|
"customer_name": string;
|
|
@@ -76,12 +76,12 @@ exports.getCorrectInputNode = function (dataIdx) {
|
|
|
76
76
|
case "unitPriceAmount":
|
|
77
77
|
return react_1.default.createElement(antd_1.InputNumber, { step: 1 });
|
|
78
78
|
case "unitOfMeasure":
|
|
79
|
-
return (react_1.default.createElement(antd_1.Select,
|
|
79
|
+
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(models_1.UnitOfMeasureMetadataUnitEnum).map(function (unitOfMeasure) {
|
|
80
80
|
if (unitOfMeasure !== "Rec20" && unitOfMeasure !== "Rec21")
|
|
81
81
|
return (react_1.default.createElement(antd_1.Select.Option, { value: unitOfMeasure, title: unitOfMeasure, key: unitOfMeasure }, unitOfMeasure));
|
|
82
82
|
})));
|
|
83
83
|
case "taxCategoryType":
|
|
84
|
-
return (react_1.default.createElement(antd_1.Select,
|
|
84
|
+
return (react_1.default.createElement(antd_1.Select, { dropdownMatchSelectWidth: false }, Object.keys(models_1.BillingLineMetadataTaxCategoryTypeEnum).map(function (taxCategoryType) {
|
|
85
85
|
return (react_1.default.createElement(antd_1.Select.Option, { value: taxCategoryType, title: taxCategoryType, key: taxCategoryType }, taxCategoryType));
|
|
86
86
|
})));
|
|
87
87
|
default:
|
|
@@ -74,10 +74,14 @@ var convertToInvoiceMetadataInput = function (formValues, billingLines, paymentM
|
|
|
74
74
|
var referenceIdentifiers = referenceIdentifiersArray
|
|
75
75
|
? referenceIdentifiersArray.length === 0
|
|
76
76
|
? null
|
|
77
|
-
: [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
: referenceIdentifiersArray[0].code
|
|
78
|
+
?
|
|
79
|
+
// TODO: handle multiple?
|
|
80
|
+
[{
|
|
81
|
+
code: referenceIdentifiersArray[0].code.value,
|
|
82
|
+
value: referenceIdentifiersArray[0].value
|
|
83
|
+
}]
|
|
84
|
+
: null
|
|
81
85
|
: null;
|
|
82
86
|
var getMessageHandling = function (partyMetadata) {
|
|
83
87
|
if (!(partyMetadata && partyMetadata.identifier && partyMetadata.contact && partyMetadata.contact.electronicMail)) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UploadFile } from "antd/es/upload/interface";
|
|
2
|
+
declare const reportIfFileIsValid: (file: UploadFile<any>, uploadSizeLimit: number, errorMessages: {
|
|
3
|
+
uploadFailed: string;
|
|
4
|
+
uploadErrorWrongType: string;
|
|
5
|
+
uploadErrorToLarge: string;
|
|
6
|
+
}) => boolean;
|
|
7
|
+
export { reportIfFileIsValid };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var antd_1 = require("antd");
|
|
4
|
+
var reportIfFileIsValid = function (file, uploadSizeLimit, errorMessages) {
|
|
5
|
+
var isFileCorrectType = (file.type === "application/pdf"
|
|
6
|
+
|| file.type === "image/jpeg"
|
|
7
|
+
|| file.type === "image/png"
|
|
8
|
+
|| file.type === "image/gif"
|
|
9
|
+
|| file.type === "image/tiff"
|
|
10
|
+
|| file.type === "text/plain");
|
|
11
|
+
var isFileCorrectSize = (file.size <= uploadSizeLimit);
|
|
12
|
+
if (!isFileCorrectType) {
|
|
13
|
+
antd_1.notification.error({
|
|
14
|
+
message: errorMessages.uploadFailed,
|
|
15
|
+
description: errorMessages.uploadErrorWrongType
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (!isFileCorrectSize) {
|
|
19
|
+
antd_1.notification.error({
|
|
20
|
+
message: errorMessages.uploadFailed,
|
|
21
|
+
description: errorMessages.uploadErrorToLarge
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return isFileCorrectType && isFileCorrectSize;
|
|
25
|
+
};
|
|
26
|
+
exports.reportIfFileIsValid = reportIfFileIsValid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unimaze/billing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@ant-design/compatible": "latest",
|
|
12
|
+
"@types/react-google-recaptcha": "^2.1.0",
|
|
12
13
|
"@unimaze/api-clients": "2.0.1",
|
|
14
|
+
"antd-mask-input": "^0.1.13",
|
|
15
|
+
"react-google-recaptcha": "^2.1.0",
|
|
13
16
|
"react-hot-loader": "^4.12.20",
|
|
14
17
|
"react-intl": "2.9.0",
|
|
15
18
|
"uuid": "latest"
|