@appcorp/stellar-solutions-invoice-module 0.1.36 → 0.1.38
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.
|
@@ -199,8 +199,7 @@ var useInvoiceState = function () {
|
|
|
199
199
|
return (__assign(__assign({}, item), { rowTotal: Number(item.quantity) * Number(item.price) }));
|
|
200
200
|
});
|
|
201
201
|
var updatedProducts = __spreadArray([], data.products, true).map(function (item) { return (__assign(__assign({}, item), { price: item.product.salePrice, id: item.productId, quantity: item.quantity, rowTotal: parseFloat(item.product.salePrice) * parseInt(item.quantity) })); });
|
|
202
|
-
var updatedData = __assign(__assign({}, data), { mode: 'Edit', companyId: data.company.id, services: __spreadArray([], updatedServices, true), products: __spreadArray([], updatedProducts, true) });
|
|
203
|
-
console.log('_>>', updatedData);
|
|
202
|
+
var updatedData = __assign(__assign({}, data), { mode: 'Edit', companyId: data.company.id, services: __spreadArray([], updatedServices, true).filter(function (item) { return item.name; }), products: __spreadArray([], updatedProducts, true).filter(function (item) { return item.productId; }) });
|
|
204
203
|
if ((_b = updatedData === null || updatedData === void 0 ? void 0 : updatedData.company) === null || _b === void 0 ? void 0 : _b.name) {
|
|
205
204
|
dispatch({
|
|
206
205
|
type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
|
|
@@ -354,7 +353,6 @@ var useInvoiceState = function () {
|
|
|
354
353
|
body: JSON.stringify({ id: id }),
|
|
355
354
|
});
|
|
356
355
|
};
|
|
357
|
-
console.log('state', state);
|
|
358
356
|
var handleSubmit = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
359
357
|
var validationResult, validationErrors_1;
|
|
360
358
|
return __generator(this, function (_a) {
|
|
@@ -362,9 +360,8 @@ var useInvoiceState = function () {
|
|
|
362
360
|
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
363
361
|
payload: { disableSaveButton: true },
|
|
364
362
|
});
|
|
365
|
-
console.log('submit', updatedParams);
|
|
366
363
|
try {
|
|
367
|
-
validationResult = validate_1.formValidation === null || validate_1.formValidation === void 0 ? void 0 : validate_1.formValidation.safeParse(__assign({}, updatedParams));
|
|
364
|
+
validationResult = validate_1.formValidation === null || validate_1.formValidation === void 0 ? void 0 : validate_1.formValidation.safeParse(__assign(__assign({}, updatedParams), { products: updatedParams.products.filter(function (item) { return item.id; }), services: updatedParams.services.filter(function (item) { return item.name; }) }));
|
|
368
365
|
if (validationResult === null || validationResult === void 0 ? void 0 : validationResult.error) {
|
|
369
366
|
validationErrors_1 = {};
|
|
370
367
|
validationResult === null || validationResult === void 0 ? void 0 : validationResult.error.errors.forEach(function (err) {
|