@appcorp/stellar-solutions-invoice-module 0.1.37 → 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,7 +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) });
|
|
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; }) });
|
|
203
203
|
if ((_b = updatedData === null || updatedData === void 0 ? void 0 : updatedData.company) === null || _b === void 0 ? void 0 : _b.name) {
|
|
204
204
|
dispatch({
|
|
205
205
|
type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
|
|
@@ -353,7 +353,6 @@ var useInvoiceState = function () {
|
|
|
353
353
|
body: JSON.stringify({ id: id }),
|
|
354
354
|
});
|
|
355
355
|
};
|
|
356
|
-
console.log('state', state);
|
|
357
356
|
var handleSubmit = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
358
357
|
var validationResult, validationErrors_1;
|
|
359
358
|
return __generator(this, function (_a) {
|
|
@@ -361,9 +360,8 @@ var useInvoiceState = function () {
|
|
|
361
360
|
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
362
361
|
payload: { disableSaveButton: true },
|
|
363
362
|
});
|
|
364
|
-
console.log('submit', updatedParams);
|
|
365
363
|
try {
|
|
366
|
-
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; }) }));
|
|
367
365
|
if (validationResult === null || validationResult === void 0 ? void 0 : validationResult.error) {
|
|
368
366
|
validationErrors_1 = {};
|
|
369
367
|
validationResult === null || validationResult === void 0 ? void 0 : validationResult.error.errors.forEach(function (err) {
|