Added few configurations & mores
This commit is contained in:
@@ -25,6 +25,15 @@ interface AdherentFormProps {
|
||||
|
||||
export default function AdherentForm({ adherent, onClose }: AdherentFormProps) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [options, setOptions] = useState<{
|
||||
situation: Array<{ id: string; value: string }>;
|
||||
prescripteur: Array<{ id: string; value: string }>;
|
||||
facturation: Array<{ id: string; value: string }>;
|
||||
}>({
|
||||
situation: [],
|
||||
prescripteur: [],
|
||||
facturation: [],
|
||||
});
|
||||
const [formData, setFormData] = useState({
|
||||
nom: '',
|
||||
prenom: '',
|
||||
@@ -40,6 +49,26 @@ export default function AdherentForm({ adherent, onClose }: AdherentFormProps) {
|
||||
instructions: '',
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
fetchOptions();
|
||||
}, []);
|
||||
|
||||
const fetchOptions = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/settings/adherent-options');
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
setOptions({
|
||||
situation: data.situation || [],
|
||||
prescripteur: data.prescripteur || [],
|
||||
facturation: data.facturation || [],
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du chargement des options:', error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (adherent) {
|
||||
const dateNaissance = new Date(adherent.dateNaissance);
|
||||
@@ -281,11 +310,11 @@ export default function AdherentForm({ adherent, onClose }: AdherentFormProps) {
|
||||
className="w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg text-gray-900 focus:outline-none focus:ring-2 focus:ring-lblue focus:border-transparent appearance-none bg-white"
|
||||
>
|
||||
<option value="">Sélectionner une situation</option>
|
||||
<option value="Actif">Actif</option>
|
||||
<option value="Retraité">Retraité</option>
|
||||
<option value="Chômeur">Chômeur</option>
|
||||
<option value="Étudiant">Étudiant</option>
|
||||
<option value="Autre">Autre</option>
|
||||
{options.situation.map((option) => (
|
||||
<option key={option.id} value={option.value}>
|
||||
{option.value}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
||||
<svg className="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -312,10 +341,11 @@ export default function AdherentForm({ adherent, onClose }: AdherentFormProps) {
|
||||
className="w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg text-gray-900 focus:outline-none focus:ring-2 focus:ring-lblue focus:border-transparent appearance-none bg-white"
|
||||
>
|
||||
<option value="">Sélectionner un prescripteur</option>
|
||||
<option value="Médecin">Médecin</option>
|
||||
<option value="Assistante sociale">Assistante sociale</option>
|
||||
<option value="CCAS">CCAS</option>
|
||||
<option value="Autre">Autre</option>
|
||||
{options.prescripteur.map((option) => (
|
||||
<option key={option.id} value={option.value}>
|
||||
{option.value}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
||||
<svg className="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -342,9 +372,11 @@ export default function AdherentForm({ adherent, onClose }: AdherentFormProps) {
|
||||
className="w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg text-gray-900 focus:outline-none focus:ring-2 focus:ring-lblue focus:border-transparent appearance-none bg-white"
|
||||
>
|
||||
<option value="">Sélectionner un mode de facturation</option>
|
||||
<option value="Direct">Direct</option>
|
||||
<option value="CCAS">CCAS</option>
|
||||
<option value="Autre organisme">Autre organisme</option>
|
||||
{options.facturation.map((option) => (
|
||||
<option key={option.id} value={option.value}>
|
||||
{option.value}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div className="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
||||
<svg className="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
|
||||
Reference in New Issue
Block a user