@unimaze/billing 0.13.1 → 0.13.2
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.
|
@@ -137,14 +137,21 @@ var BaseInformation = function (props) {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
var disabledDate = function (dueDate, issueDate, dueDateMinimumOffset) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// const baseDate = moment().startOf("day");
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
// const baseDate = issueDate
|
|
141
|
+
// ? issueDate.startOf("day") > moment().startOf("day")
|
|
142
|
+
// ? issueDate.clone().startOf("day")
|
|
143
|
+
// : moment().startOf("day")
|
|
144
|
+
// : moment().startOf("day");
|
|
145
|
+
// // const baseDate = moment().startOf("day");
|
|
146
|
+
// const addedDate = dueDateMinimumOffset ? baseDate.add(dueDateMinimumOffset, "days") : baseDate;
|
|
147
|
+
var dueDateLimit;
|
|
148
|
+
if (issueDate) {
|
|
149
|
+
dueDateLimit = moment_1.default.max(moment_1.default().startOf("day").add(dueDateMinimumOffset, "days"), issueDate.startOf("day"));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
dueDateLimit = moment_1.default().startOf("day").add(dueDateMinimumOffset, "days");
|
|
153
|
+
}
|
|
154
|
+
return dueDate < dueDateLimit;
|
|
148
155
|
};
|
|
149
156
|
var checkIfEmpty = function (date) {
|
|
150
157
|
if (!date) {
|
|
@@ -73,17 +73,19 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
73
73
|
var _b = react_1.useState(true), isSubmitDisabled = _b[0], setIsSubmitDisabled = _b[1];
|
|
74
74
|
var _c = react_1.useState(ConversionUtility_1.profileOutputToPartyMetadata(props.customers[0])), chosenCustomer = _c[0], setChosenCustomer = _c[1];
|
|
75
75
|
var _d = react_1.useState(props.customers[0].apiKey), chosenCustomerApiKey = _d[0], setChosenCustomerApiKey = _d[1];
|
|
76
|
-
var _e = react_1.
|
|
76
|
+
var _e = react_1.useState(true), sendCopyDisabled = _e[0], setSendCopyDisabled = _e[1];
|
|
77
|
+
var _f = react_1.useState(false), sendCopy = _f[0], setSendCopy = _f[1];
|
|
78
|
+
var _g = react_1.default.useState(""), referenceIdentifierValidateStatus = _g[0], setReferenceIdentifierValidateStatus = _g[1];
|
|
77
79
|
// const [billingLinesEditableIndex, setBillingLinesEditableIndex] = useState<number>(1)
|
|
78
|
-
var
|
|
80
|
+
var _h = react_1.useState(false), outsideVatScope = _h[0], setOutsideVatScope = _h[1];
|
|
79
81
|
// attachments
|
|
80
82
|
// TODO: remove the states, set the values to the form in attachment components
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
83
|
+
var _j = react_1.useState([]), file1 = _j[0], setFile1 = _j[1];
|
|
84
|
+
var _k = react_1.useState(""), attachmentFieldValidation1 = _k[0], setAttachmentFieldValidation1 = _k[1];
|
|
85
|
+
var _l = react_1.useState([]), file2 = _l[0], setFile2 = _l[1];
|
|
86
|
+
var _m = react_1.useState(""), attachmentFieldValidation2 = _m[0], setAttachmentFieldValidation2 = _m[1];
|
|
87
|
+
var _o = react_1.useState([]), file3 = _o[0], setFile3 = _o[1];
|
|
88
|
+
var _p = react_1.useState(""), attachmentFieldValidation3 = _p[0], setAttachmentFieldValidation3 = _p[1];
|
|
87
89
|
react_1.useEffect(function () {
|
|
88
90
|
form.resetFields([
|
|
89
91
|
["invoice", "supplier", "vatNumber"],
|
|
@@ -115,6 +117,18 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
115
117
|
setFile3([]);
|
|
116
118
|
setAttachmentFieldValidation3("");
|
|
117
119
|
};
|
|
120
|
+
var supplierEmailValue = form.getFieldValue(["invoice", "supplier", "contact", "electronicMail"]);
|
|
121
|
+
react_1.useEffect(function () {
|
|
122
|
+
if (supplierEmailValue) {
|
|
123
|
+
form.validateFields([["invoice", "supplier", "contact", "electronicMail"]])
|
|
124
|
+
.then(function (v) { return setSendCopyDisabled(!supplierEmailValue); })
|
|
125
|
+
.catch(function (e) { return setSendCopyDisabled(true); });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
setSendCopy(false);
|
|
129
|
+
setSendCopyDisabled(true);
|
|
130
|
+
}
|
|
131
|
+
}, [supplierEmailValue]);
|
|
118
132
|
var handleSubmit = function (values) {
|
|
119
133
|
// console.log("values at the start of submit", values);
|
|
120
134
|
setSubmitting(true);
|
|
@@ -136,12 +150,16 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
136
150
|
setSubmitting(false);
|
|
137
151
|
return;
|
|
138
152
|
}
|
|
153
|
+
var services = sendCopy
|
|
154
|
+
? ["urn:services:dispatcher:mail.pdf?email=" + supplierEmailValue]
|
|
155
|
+
: undefined;
|
|
139
156
|
var invoiceMetadataInput = utils_1.convertToInvoiceMetadataInput(values, BillingLineUtility_1.billingLinesFieldsMetadata(form), paymentMethodForConversion_1.PaymentMethodFormData(values), chosenCustomer);
|
|
140
157
|
var createSubmitInvoice = {
|
|
141
158
|
invoiceMetadataInput: invoiceMetadataInput,
|
|
142
159
|
more: attachments.length > 0,
|
|
143
160
|
messageId: uuid_1.v4(),
|
|
144
|
-
processingMode: mapi_1.TransactionProcessingMode.Device
|
|
161
|
+
processingMode: mapi_1.TransactionProcessingMode.Device,
|
|
162
|
+
services: services
|
|
145
163
|
// processingMode: TransactionProcessingMode.DeviceRouted
|
|
146
164
|
};
|
|
147
165
|
utils_1.submitInvoice(createSubmitInvoice, props.mapiBaseUrl, chosenCustomerApiKey, "submitInvoice", props.language)
|
|
@@ -273,7 +291,7 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
273
291
|
});
|
|
274
292
|
setChosenCustomerApiKey(props.customers[0].apiKey);
|
|
275
293
|
}
|
|
276
|
-
var
|
|
294
|
+
var _q = react_1.useState(undefined), billingLinesMetadata = _q[0], setBillingLinesMetadata = _q[1];
|
|
277
295
|
var getBillingLines = function (changedValues, allValues) {
|
|
278
296
|
var invoiceLines = allValues.invoice.invoiceLines;
|
|
279
297
|
if (invoiceLines) {
|
|
@@ -354,6 +372,8 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
354
372
|
setIsSubmitDisabled(!token);
|
|
355
373
|
}, hl: props.language }))),
|
|
356
374
|
react_1.default.createElement(antd_1.Row, { style: { width: "100%", padding: "8px" }, justify: "end" },
|
|
375
|
+
react_1.default.createElement(antd_1.Col, null,
|
|
376
|
+
react_1.default.createElement(antd_1.Checkbox, { disabled: sendCopyDisabled, checked: sendCopy, onChange: function (e) { return setSendCopy(e.target.checked); } }, "Send a copy")),
|
|
357
377
|
react_1.default.createElement(antd_1.Col, null,
|
|
358
378
|
react_1.default.createElement(antd_1.Button, { type: "primary", htmlType: "submit", size: "large", disabled: isSubmitDisabled }, intl.formatMessage(translationMessages.createInvoice_Submit))))))));
|
|
359
379
|
};
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"unitOfMeasure_labels_SquareMetre": "Fermetri",
|
|
134
134
|
"unitOfMeasure_labels_CubicMetre": "Rúmmetri",
|
|
135
135
|
"unitOfMeasure_labels_Tonne": "Tonn",
|
|
136
|
-
"unitOfMeasure_labels_KiloWattHour": "
|
|
137
|
-
"unitOfMeasure_labels_One": "
|
|
136
|
+
"unitOfMeasure_labels_KiloWattHour": "Kílóvattstund",
|
|
137
|
+
"unitOfMeasure_labels_One": "Eining",
|
|
138
138
|
"createInvoice_addDocumentLineMsg": "Bætið við a.m.k einnig línu í skrá",
|
|
139
139
|
"createInvoice_selectCustomerMsg": "Viðskiptavinur verður að vera valinn",
|
|
140
140
|
"createInvoice_successfullySubmittedInvoiceMsg": "Sending reiknings tókst",
|