@unimaze/billing 0.21.20 → 0.21.22
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.
|
@@ -186,7 +186,13 @@ var ReferenceIdentifiers = function (props) {
|
|
|
186
186
|
if (fieldDefinition_1) {
|
|
187
187
|
var fieldHandling = null;
|
|
188
188
|
if (fieldDefinition_1.properties.hasOwnProperty("handling") && fieldDefinition_1.properties.handling) {
|
|
189
|
-
|
|
189
|
+
try {
|
|
190
|
+
fieldHandling = JSON.parse(fieldDefinition_1.properties.handling);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
// tslint:disable-next-line:no-console
|
|
194
|
+
console.log(error);
|
|
195
|
+
}
|
|
190
196
|
}
|
|
191
197
|
if (fieldHandling && fieldHandling.shouldBeValidated) {
|
|
192
198
|
fieldProps = __assign(__assign({}, fieldProps), { validateStatus: referenceIdentifierValidateStatus, hasFeedback: true, help: referenceIdentifierValidateStatus === "error" ? props.intl.formatMessage(exports.translationMessages.referenceIdentifiers_values_validation_message) : '' });
|
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.translationMessages = void 0;
|
|
30
30
|
var React = __importStar(require("react"));
|
|
31
31
|
var antd_1 = require("antd");
|
|
32
|
-
var dayjs_1 =
|
|
32
|
+
var dayjs_1 = __importStar(require("dayjs"));
|
|
33
33
|
var form_item_1 = __importDefault(require("../form-item"));
|
|
34
34
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
35
35
|
var react_intl_1 = require("react-intl");
|
|
@@ -113,7 +113,7 @@ var BaseInformation = function (props) {
|
|
|
113
113
|
}, [props.form.getFieldValue(["invoice", "issueDate"])]);
|
|
114
114
|
var getDueDateLimit = function (issueDate, dueDateMinimumOffset) {
|
|
115
115
|
var dueDateLimit;
|
|
116
|
-
if (issueDate) {
|
|
116
|
+
if ((0, dayjs_1.isDayjs)(issueDate)) {
|
|
117
117
|
dueDateLimit = (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days").isAfter(issueDate.startOf("day"))
|
|
118
118
|
? (0, dayjs_1.default)().startOf("day").add(dueDateMinimumOffset, "days")
|
|
119
119
|
: issueDate.startOf("day");
|
|
@@ -223,7 +223,10 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
223
223
|
switch (activeStep) {
|
|
224
224
|
case 0: {
|
|
225
225
|
form.validateFields(formPaths_1.customerFieldPaths, { validateOnly: true })
|
|
226
|
-
.then(function () {
|
|
226
|
+
.then(function () {
|
|
227
|
+
setMissingRequiredDataTooltip(undefined);
|
|
228
|
+
setIsNextStepDisabled(false);
|
|
229
|
+
})
|
|
227
230
|
.catch(function (error) {
|
|
228
231
|
(0, ValidationUtility_1.handleValidationErrors)(error, setMissingRequiredDataTooltip, setIsNextStepDisabled, intl);
|
|
229
232
|
});
|
|
@@ -254,7 +257,10 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
254
257
|
}
|
|
255
258
|
case 3: {
|
|
256
259
|
form.validateFields(formPaths_1.paymentMeansFieldPaths, { validateOnly: true })
|
|
257
|
-
.then(function () {
|
|
260
|
+
.then(function () {
|
|
261
|
+
setIsNextStepDisabled(false);
|
|
262
|
+
setMissingRequiredDataTooltip(undefined);
|
|
263
|
+
})
|
|
258
264
|
.catch(function (error) {
|
|
259
265
|
(0, ValidationUtility_1.handleValidationErrors)(error, setMissingRequiredDataTooltip, setIsNextStepDisabled, intl);
|
|
260
266
|
});
|
|
@@ -267,16 +273,28 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
267
273
|
}
|
|
268
274
|
}, [form, values, activeStep, newLineSaved, referenceIdentifierValidateStatus]);
|
|
269
275
|
var saveFieldValuesToLocalStorage = function () {
|
|
276
|
+
var _a, _b, _c, _d;
|
|
270
277
|
var flatFields = form.getFieldsValue();
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
var objectForLocalStorage = {
|
|
279
|
+
invoice: {
|
|
280
|
+
supplier: __assign({}, (_a = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _a === void 0 ? void 0 : _a.supplier),
|
|
281
|
+
customer: __assign(__assign({}, chosenCustomer), { locationIdentifier: (_c = (_b = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _b === void 0 ? void 0 : _b.customer) === null || _c === void 0 ? void 0 : _c.locationIdentifier }),
|
|
282
|
+
paymentMeans: (_d = flatFields === null || flatFields === void 0 ? void 0 : flatFields.invoice) === null || _d === void 0 ? void 0 : _d.paymentMeans,
|
|
283
|
+
referenceIdentifiers: [{ code: undefined }],
|
|
284
|
+
singleReferenceIdentifier: {
|
|
285
|
+
code: undefined,
|
|
286
|
+
value: undefined,
|
|
287
|
+
},
|
|
288
|
+
invoiceLines: [],
|
|
289
|
+
attachments: {
|
|
290
|
+
file1: { file: undefined, description: undefined },
|
|
291
|
+
file2: { file: undefined, description: undefined },
|
|
292
|
+
file3: { file: undefined, description: undefined },
|
|
293
|
+
},
|
|
294
|
+
issueDate: (0, dayjs_1.default)(),
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
localStorage.setItem("formData", JSON.stringify(objectForLocalStorage));
|
|
280
298
|
};
|
|
281
299
|
var handlePrevStep = function () {
|
|
282
300
|
if (activeStep === 3 && removedInvoiceLine) {
|
|
@@ -309,8 +327,9 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
309
327
|
(0, react_1.useEffect)(function () {
|
|
310
328
|
var savedValues = localStorage.getItem("formData");
|
|
311
329
|
var savedValuesObject = savedValues ? JSON.parse(savedValues) : null;
|
|
312
|
-
if (savedValuesObject)
|
|
330
|
+
if (savedValuesObject) {
|
|
313
331
|
form.setFieldsValue(savedValuesObject);
|
|
332
|
+
}
|
|
314
333
|
}, []);
|
|
315
334
|
(0, react_1.useEffect)(function () {
|
|
316
335
|
setSupplierEmail(form.getFieldValue(["invoice", "supplier", "contact", "electronicMail"]));
|
|
@@ -489,25 +508,16 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
489
508
|
var savedFieldValuesObject = savedFieldValues ? JSON.parse(savedFieldValues) : null;
|
|
490
509
|
var savedChosenCustomer = (_a = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _a === void 0 ? void 0 : _a.customer;
|
|
491
510
|
if (chosenCustomer.name === (savedChosenCustomer === null || savedChosenCustomer === void 0 ? void 0 : savedChosenCustomer.name)) {
|
|
492
|
-
var savedValues = localStorage.getItem("formData");
|
|
493
|
-
var savedValuesObject = savedValues ? JSON.parse(savedValues) : null;
|
|
494
511
|
form.setFieldsValue({
|
|
495
512
|
invoice: {
|
|
496
|
-
referenceIdentifiers: (_b =
|
|
513
|
+
referenceIdentifiers: (_b = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _b === void 0 ? void 0 : _b.referenceIdentifiers,
|
|
497
514
|
customer: {
|
|
498
|
-
locationIdentifier: (_d = (_c =
|
|
515
|
+
locationIdentifier: (_d = (_c = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _c === void 0 ? void 0 : _c.customer) === null || _d === void 0 ? void 0 : _d.locationIdentifier,
|
|
499
516
|
},
|
|
500
|
-
paymentMeans: (_e =
|
|
517
|
+
paymentMeans: (_e = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _e === void 0 ? void 0 : _e.paymentMeans,
|
|
501
518
|
},
|
|
502
519
|
});
|
|
503
520
|
}
|
|
504
|
-
else {
|
|
505
|
-
form.resetFields([
|
|
506
|
-
["invoice", "referenceIdentifiers"],
|
|
507
|
-
["invoice", "customer", "locationIdentifier"],
|
|
508
|
-
["invoice", "paymentMeans"],
|
|
509
|
-
]);
|
|
510
|
-
}
|
|
511
521
|
props.getReceiverRequirements(chosenCustomer.identifier);
|
|
512
522
|
}
|
|
513
523
|
};
|