import {useEffect, useState} from "react";
import {getCategoryFormBirthDate, getCatName} from "../utils/Tools.js";
import {useCountries} from "../hooks/useCountries.jsx";
export function BirthDayField({inti_date, inti_category, required = true}) {
const [date, setDate] = useState(inti_date)
const [category, setCategory] = useState(inti_category)
const [canUpdate, setCanUpdate] = useState(false)
useEffect(() => {
const b = category !== getCategoryFormBirthDate(new Date(date))
if (b !== canUpdate)
setCanUpdate(b)
}, [date, category])
const updateCat = _ => {
setCategory(getCategoryFormBirthDate(new Date(date)))
}
return <>
Date de naissance
setDate(e.target.value)}/>
>
}
export function OptionField({name, text, values, value, disabled = false}) {
return
}
export function RoleList({name, text, value, disabled = false}) {
return
}
export function CountryList({name, text, value, values = undefined, disabled = false}) {
const country = useCountries('fr')
const [value_, setValue] = useState(value)
if (values === undefined) {
values = {...country}
}
return
}
export function TextField({name, text, value, placeholder, type = "text", disabled = false, required = true, ttip = null}) {
return
}
export function CheckField({name, text, value, row = false}) {
return <>{
row ?
:
}
>
}
export const Checkbox = ({label, value, onChange}) => {
const handleChange = () => {
onChange(!value);
};
return
};