From 042a7f3693bfbe06c85c074fe23fb0506d97c34f Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sat, 31 Jul 2021 19:04:44 +0200 Subject: [PATCH] fix: checkbox cell. --- client/src/components/DataTableCells/CheckBoxFieldCell.js | 5 +++-- client/src/containers/Expenses/ExpenseForm/ExpenseForm.js | 5 +---- client/src/containers/Expenses/ExpenseForm/utils.js | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/client/src/components/DataTableCells/CheckBoxFieldCell.js b/client/src/components/DataTableCells/CheckBoxFieldCell.js index 4cb58ffa1..15772baa2 100644 --- a/client/src/components/DataTableCells/CheckBoxFieldCell.js +++ b/client/src/components/DataTableCells/CheckBoxFieldCell.js @@ -11,7 +11,7 @@ const CheckboxEditableCell = ({ const [value, setValue] = React.useState(initialValue); const onChange = (e) => { - setValue(e.target.value); + setValue(e.target.checked); }; const onBlur = () => { payload.updateData(index, id, value); @@ -24,12 +24,13 @@ const CheckboxEditableCell = ({ return ( - category.amount && - category.index && - category.expense_account_id && - category.landed_cost, + category.amount && category.index && category.expense_account_id, ); const form = { diff --git a/client/src/containers/Expenses/ExpenseForm/utils.js b/client/src/containers/Expenses/ExpenseForm/utils.js index f9d8392c3..c926f9865 100644 --- a/client/src/containers/Expenses/ExpenseForm/utils.js +++ b/client/src/containers/Expenses/ExpenseForm/utils.js @@ -31,7 +31,7 @@ export const defaultExpenseEntry = { amount: '', expense_account_id: '', description: '', - landed_cost: false, + landed_cost: 0, }; export const defaultExpense = {