From 92ce6d3589b53ab8ddbf2b5469ff493171aa1c0c Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 7 May 2025 11:15:23 +0330 Subject: [PATCH] fix bug checkbox support --- src/pages/support/Update.tsx | 5 ++--- src/pages/support/components/PlanItem.tsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/support/Update.tsx b/src/pages/support/Update.tsx index 484babc..75bfb49 100644 --- a/src/pages/support/Update.tsx +++ b/src/pages/support/Update.tsx @@ -49,6 +49,7 @@ const UpdatePlan: FC = () => { }, [planData]) const handleFeatureChange = (id: string, value: string | boolean, isEnabled: boolean) => { + console.log(id, value, isEnabled); setFeatures(prevFeatures => prevFeatures.map(feature => feature.featureKey === id ? { ...feature, featureValue: value, isEnabled } : feature @@ -131,8 +132,6 @@ const UpdatePlan: FC = () => { return null } - console.log(formik.errors); - return (
@@ -207,7 +206,7 @@ const UpdatePlan: FC = () => { id={feature.featureKey} label={t(`support.${feature.featureKey}`)} value={feature.featureValue} - checked={feature.featureValue === "true"} + checked={feature.featureValue === "true" || feature.featureValue === true} featureType={feature.featureType} onChange={handleFeatureChange} /> diff --git a/src/pages/support/components/PlanItem.tsx b/src/pages/support/components/PlanItem.tsx index 31b653e..5cc28a8 100644 --- a/src/pages/support/components/PlanItem.tsx +++ b/src/pages/support/components/PlanItem.tsx @@ -14,7 +14,7 @@ interface Props { const PlanItem: FC = ({ id, label, value, checked, featureType, onChange }) => { const handleCheckboxChange = (e: ChangeEvent) => { const newChecked = e.target.checked - onChange(id, value, newChecked) + onChange(id, newChecked, newChecked) } const handleInputChange = (e: ChangeEvent) => {