@unimaze/billing 0.21.21 → 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");
|
|
@@ -273,16 +273,28 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
273
273
|
}
|
|
274
274
|
}, [form, values, activeStep, newLineSaved, referenceIdentifierValidateStatus]);
|
|
275
275
|
var saveFieldValuesToLocalStorage = function () {
|
|
276
|
+
var _a, _b, _c, _d;
|
|
276
277
|
var flatFields = form.getFieldsValue();
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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));
|
|
286
298
|
};
|
|
287
299
|
var handlePrevStep = function () {
|
|
288
300
|
if (activeStep === 3 && removedInvoiceLine) {
|
|
@@ -315,8 +327,9 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
315
327
|
(0, react_1.useEffect)(function () {
|
|
316
328
|
var savedValues = localStorage.getItem("formData");
|
|
317
329
|
var savedValuesObject = savedValues ? JSON.parse(savedValues) : null;
|
|
318
|
-
if (savedValuesObject)
|
|
330
|
+
if (savedValuesObject) {
|
|
319
331
|
form.setFieldsValue(savedValuesObject);
|
|
332
|
+
}
|
|
320
333
|
}, []);
|
|
321
334
|
(0, react_1.useEffect)(function () {
|
|
322
335
|
setSupplierEmail(form.getFieldValue(["invoice", "supplier", "contact", "electronicMail"]));
|
|
@@ -495,25 +508,16 @@ var CreateInvoiceConstructor = function (props) {
|
|
|
495
508
|
var savedFieldValuesObject = savedFieldValues ? JSON.parse(savedFieldValues) : null;
|
|
496
509
|
var savedChosenCustomer = (_a = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _a === void 0 ? void 0 : _a.customer;
|
|
497
510
|
if (chosenCustomer.name === (savedChosenCustomer === null || savedChosenCustomer === void 0 ? void 0 : savedChosenCustomer.name)) {
|
|
498
|
-
var savedValues = localStorage.getItem("formData");
|
|
499
|
-
var savedValuesObject = savedValues ? JSON.parse(savedValues) : null;
|
|
500
511
|
form.setFieldsValue({
|
|
501
512
|
invoice: {
|
|
502
|
-
referenceIdentifiers: (_b =
|
|
513
|
+
referenceIdentifiers: (_b = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _b === void 0 ? void 0 : _b.referenceIdentifiers,
|
|
503
514
|
customer: {
|
|
504
|
-
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,
|
|
505
516
|
},
|
|
506
|
-
paymentMeans: (_e =
|
|
517
|
+
paymentMeans: (_e = savedFieldValuesObject === null || savedFieldValuesObject === void 0 ? void 0 : savedFieldValuesObject.invoice) === null || _e === void 0 ? void 0 : _e.paymentMeans,
|
|
507
518
|
},
|
|
508
519
|
});
|
|
509
520
|
}
|
|
510
|
-
else {
|
|
511
|
-
form.resetFields([
|
|
512
|
-
["invoice", "referenceIdentifiers"],
|
|
513
|
-
["invoice", "customer", "locationIdentifier"],
|
|
514
|
-
["invoice", "paymentMeans"],
|
|
515
|
-
]);
|
|
516
|
-
}
|
|
517
521
|
props.getReceiverRequirements(chosenCustomer.identifier);
|
|
518
522
|
}
|
|
519
523
|
};
|