fix bug checkbox support

This commit is contained in:
hamid zarghami
2025-05-07 11:15:23 +03:30
parent 5852dd8fc4
commit 92ce6d3589
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -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 (
<div className='mt-4'>
@@ -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}
/>
+1 -1
View File
@@ -14,7 +14,7 @@ interface Props {
const PlanItem: FC<Props> = ({ id, label, value, checked, featureType, onChange }) => {
const handleCheckboxChange = (e: ChangeEvent<HTMLInputElement>) => {
const newChecked = e.target.checked
onChange(id, value, newChecked)
onChange(id, newChecked, newChecked)
}
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {