from django import forms
from .models import *
from Scolarite.models import AgentScolarite


# TODO: ETUDIANT
class EtudiantAddForm(forms.Form):
    nce = forms.CharField(required=True)
    nom = forms.CharField(required=True)
    prenoms = forms.CharField(required=True)
    sexe = forms.ChoiceField(choices=(("M", "M"), ("F", "F")),required=True)
    datenaiss = forms.CharField(required=True)
    lieunaiss = forms.CharField(required=True)
    phone = forms.CharField(required=True)
    email = forms.EmailField(required=True)
    ufr = forms.CharField(required=True)
    niveau = forms.CharField(required=True)
    password = forms.CharField(required=True)
    password2 = forms.CharField(required=True)

class EtudiantEditForm(forms.ModelForm):
    class Meta:
        model = Etudiant
        fields =('nce','nom','prenoms','sexe','datenaiss','lieunaiss','phone','email','role')

#TODO: ENSEIGNANT
class EnseignantAddForm(forms.Form):
    nom = forms.CharField(required=True)
    prenoms = forms.CharField(required=True)
    sexe = forms.ChoiceField(choices=(("M", "M"), ("F", "F")),required=True)
    datenaiss = forms.CharField(required=True)
    lieunaiss = forms.CharField(required=True)
    phone = forms.CharField(required=True)
    email = forms.EmailField(required=True)
    ufr = forms.CharField(required=True)
    grade = forms.CharField(required=True)
    password = forms.CharField(required=True)
    password2 = forms.CharField(required=True)
    is_ufr_dg = forms.ChoiceField(choices=((0, "Simple Enseignant"), (1, "Directeur D'UFR"), (2, "Responsable Pédagogique"), (3, "Vice Président"), (4, "Président")),required=True)
    specialite = forms.CharField(required=True)
    statut = forms.ChoiceField(choices=(("Permanent", "Permanent"), ("Vacataire", "Vacataire"),("Contatuel", "Contatuel")), required=True)

class EnseignantEditForm(forms.ModelForm):
    class Meta:
        model = Enseignant
        fields =('nom','prenoms','sexe','datenaiss','lieunaiss','phone','email','grade','add_programme','ufr')


class AddEnseignantUFRForm(forms.ModelForm):
    class Meta:
        model = EnseignantUfr
        fields = ('ufr',)

class DelEnseignantUFRForm(forms.Form):
    ufrid = forms.CharField()


class AgAddForm(forms.ModelForm):
    password = forms.CharField(required=True)
    password2 = forms.CharField(required=True)

    class Meta:
        model =AgentScolarite
        fields =('nom','prenoms','sexe','datenaiss','lieunaiss','phone','email')


class AgEditform(forms.ModelForm):
    class Meta:
        model = AgentScolarite
        fields =('nom','prenoms','sexe','datenaiss','lieunaiss','phone','email')


class CsvUploadForm(forms.ModelForm):
    ufr = forms.CharField()
    niveau = forms.CharField()
    annee = forms.CharField()
    class Meta:
        model = Csv
        fields = ('file_name', 'ufr')


#TODO: PERSONNEL
class PersonnelAddForm(forms.ModelForm):
    nom = forms.CharField(required=True)
    prenoms = forms.CharField(required=True)
    sexe = forms.ChoiceField(choices=(("M", "M"), ("F", "F")),required=True)
    datenaiss = forms.CharField(required=True)
    lieunaiss = forms.CharField(required=True)
    phone = forms.CharField(required=True)
    email = forms.EmailField(required=True)
    password = forms.CharField(required=True)
    password2 = forms.CharField(required=True)
    #statut = forms.ChoiceField(choices=(("Permanent", "Permanent"), ("Vacataire", "Vacataire"),("Contatuel", "Contatuel")), required=True)
    class Meta:
        model = Personnel
        fields = ('resposabilite','prise_de_fonction','regime')


class PersonnelEditForm(forms.ModelForm):
    class Meta:
        model = Personnel
        fields =('nom','prenoms','sexe','datenaiss','lieunaiss','phone','email','resposabilite','prise_de_fonction','regime')


class AddServiceForm(forms.ModelForm):
    class Meta:
        model = PersonnelService
        fields = '__all__'