fix bug checkbox support
This commit is contained in:
@@ -49,6 +49,7 @@ const UpdatePlan: FC = () => {
|
|||||||
}, [planData])
|
}, [planData])
|
||||||
|
|
||||||
const handleFeatureChange = (id: string, value: string | boolean, isEnabled: boolean) => {
|
const handleFeatureChange = (id: string, value: string | boolean, isEnabled: boolean) => {
|
||||||
|
console.log(id, value, isEnabled);
|
||||||
setFeatures(prevFeatures =>
|
setFeatures(prevFeatures =>
|
||||||
prevFeatures.map(feature =>
|
prevFeatures.map(feature =>
|
||||||
feature.featureKey === id ? { ...feature, featureValue: value, isEnabled } : feature
|
feature.featureKey === id ? { ...feature, featureValue: value, isEnabled } : feature
|
||||||
@@ -131,8 +132,6 @@ const UpdatePlan: FC = () => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(formik.errors);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-4'>
|
<div className='mt-4'>
|
||||||
@@ -207,7 +206,7 @@ const UpdatePlan: FC = () => {
|
|||||||
id={feature.featureKey}
|
id={feature.featureKey}
|
||||||
label={t(`support.${feature.featureKey}`)}
|
label={t(`support.${feature.featureKey}`)}
|
||||||
value={feature.featureValue}
|
value={feature.featureValue}
|
||||||
checked={feature.featureValue === "true"}
|
checked={feature.featureValue === "true" || feature.featureValue === true}
|
||||||
featureType={feature.featureType}
|
featureType={feature.featureType}
|
||||||
onChange={handleFeatureChange}
|
onChange={handleFeatureChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ interface Props {
|
|||||||
const PlanItem: FC<Props> = ({ id, label, value, checked, featureType, onChange }) => {
|
const PlanItem: FC<Props> = ({ id, label, value, checked, featureType, onChange }) => {
|
||||||
const handleCheckboxChange = (e: ChangeEvent<HTMLInputElement>) => {
|
const handleCheckboxChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
const newChecked = e.target.checked
|
const newChecked = e.target.checked
|
||||||
onChange(id, value, newChecked)
|
onChange(id, newChecked, newChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user