Correction enregistrement profil
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,7 +41,7 @@ urlpatterns = [
|
||||
name='deconnexion'
|
||||
),
|
||||
path(
|
||||
'employé/',
|
||||
'gestion-employe/',
|
||||
include("gestion_employe.urls")
|
||||
),
|
||||
path(
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,10 @@ QUOTA_CONGE_ANNUEL = 30
|
||||
NOMBRE_PAGINATION = 8
|
||||
DEBUT_RAPPEL = 60
|
||||
DUREE_FIN_CONTRAT = 90
|
||||
try:
|
||||
EMAIL_ASSISTANTE_DE_DIRECTION = list(Employe.objects.filter(fonction="assistant_direction").values_list('user__email', flat=True))
|
||||
except:
|
||||
pass
|
||||
|
||||
def solde_conge(employe):
|
||||
"""Fonction de calcul du solde de congé restant l'employé"""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.2.13 on 2026-04-17 12:03
|
||||
# Generated by Django 5.2.13 on 2026-07-03 18:13
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.2.13 on 2026-04-17 12:03
|
||||
# Generated by Django 5.2.13 on 2026-07-03 18:13
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
@@ -27,7 +27,7 @@ class Migration(migrations.Migration):
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('matricule', models.CharField(blank=True, max_length=10, null=True, unique=True)),
|
||||
('fonction', models.CharField(blank=True, choices=[('directeur', 'Directeur'), ('assistant_direction', 'Assistante de direction'), ('comptable', 'Comptable'), ('raf', 'RAF'), ('data_manager', 'Data Manager'), ('logisticien', 'Logisticien'), ('post_doctorant', 'Post-Doctorant'), ('qualiticien', 'Qualiticien'), ('technicien_surface', 'Technicien de surface'), ('chauffeur', 'Chauffeur')], max_length=50, null=True)),
|
||||
('fonction', models.CharField(blank=True, choices=[('directeur', 'Directeur'), ('assistant_direction', 'Assistante de direction'), ('assistant_technique_recherche', 'Assistant technique de recherche'), ('comptable', 'Comptable'), ('raf', 'RAF'), ('data_manager', 'Data Manager'), ('logisticien', 'Logisticien'), ('post_doctorant', 'Post-Doctorant'), ('qualiticien', 'Qualiticien'), ('technicien_surface', 'Technicien de surface'), ('chauffeur', 'Chauffeur')], max_length=50, null=True)),
|
||||
('date_embauche', models.DateField(blank=True, null=True)),
|
||||
('adresse', models.CharField(blank=True, max_length=100, null=True)),
|
||||
('telephone', models.CharField(blank=True, max_length=15, null=True)),
|
||||
@@ -48,7 +48,7 @@ class Migration(migrations.Migration):
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('numero_contrat', models.CharField(max_length=100, unique=True)),
|
||||
('type_contrat', models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage')], max_length=50)),
|
||||
('type_contrat', models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage'), ('convention_bourse_entretien', "Convention de bourse d'entretien")], max_length=50)),
|
||||
('date_debut', models.DateField()),
|
||||
('date_fin', models.DateField(blank=True, null=True)),
|
||||
('salaire_mensuel', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Generated by Django 6.0.4 on 2026-04-29 10:42
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gestion_employe', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='contrat',
|
||||
name='type_contrat',
|
||||
field=models.CharField(choices=[('contrat_duree_determinee', 'Contrat à Durée Déterminée'), ('contrat_duree_indeterminee', 'Contrat à Durée Indéterminée'), ('contrat_prestation', 'Contrat de Prestation de Service'), ('contrat_stage', 'Contrat de Stage'), ('convention_bourse_entretien', "Convention de bourse d'entretien")], max_length=50),
|
||||
),
|
||||
]
|
||||
@@ -18,29 +18,34 @@ const tableau_certificat = new Tabulator("#tableau-certificat", {
|
||||
})
|
||||
const enregistrerProfil = $("enregistrerProfil");
|
||||
|
||||
enregistrerProfil.addEventListener("click", (e) => {
|
||||
// enregistrerProfil.addEventListener("click", (e) => {
|
||||
|
||||
const url = $("information-personnelles").dataset.url;
|
||||
const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
// const url = $("information-personnelles").dataset.url;
|
||||
// const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
|
||||
const formData = new FormData();
|
||||
// const formData = new FormData();
|
||||
|
||||
formData.append("nom", $("nom").value);
|
||||
formData.append("prenom", $("prenom").value);
|
||||
formData.append("email", $("email").value);
|
||||
formData.append("telephone", $("telephone").value);
|
||||
formData.append("adresse", $("adresse").value);
|
||||
formData.append("sexe", $("sexe").value);
|
||||
formData.append("date_naissance", $("date_naissance").value);
|
||||
// formData.append("nom", $("nom").value);
|
||||
// formData.append("prenom", $("prenom").value);
|
||||
// formData.append("email", $("email").value);
|
||||
// formData.append("telephone", $("telephone").value);
|
||||
// formData.append("adresse", $("adresse").value);
|
||||
// formData.append("sexe", $("sexe").value);
|
||||
// formData.append("date_naissance", $("date_naissance").value);
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-CSRFToken": csrftoken
|
||||
},
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
.catch(error => console.error("Erreur:", error));
|
||||
});
|
||||
|
||||
// console.log("---------------------------------------------")
|
||||
// console.log("Données du formulaire:", url);
|
||||
// console.log("Données du formulaire:", formData);
|
||||
|
||||
// fetch(url, {
|
||||
// method: "POST",
|
||||
// headers: {
|
||||
// "X-CSRFToken": csrftoken
|
||||
// },
|
||||
// body: formData
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => alert(data.message))
|
||||
// .catch(error => console.error("Erreur:", error));
|
||||
// });
|
||||
@@ -38,7 +38,7 @@
|
||||
</h2>
|
||||
<div id="collapseProfil" class="accordion-collapse" aria-labelledby="headingContrats" data-bs-parent="#accordionInformationEmploye">
|
||||
<div class="accordion-body">
|
||||
<div class="row" id="information-personnelles" data-url="{% url 'gestion_employe:modifier-employe' %}">
|
||||
<form class="row" action = "{% url 'gestion_employe:modifier-employe' %}" method = "POST" enctype = "multipart/form-data" id="information-personnelles" data-url="{% url 'gestion_employe:modifier-employe' %}">
|
||||
{% csrf_token %}
|
||||
<div class="col">
|
||||
<div class="form-group mb-2">
|
||||
@@ -50,19 +50,19 @@
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Matricule :</label>
|
||||
<input type="text" class="form-control" id="matricule" value="{{ employe.matricule|default:'' }}" readonly>
|
||||
<input type="text" class="form-control" id="matricule" name = 'matricule' value="{{ employe.matricule|default:'' }}" readonly>
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Nom :</label>
|
||||
<input type="text" class="form-control" id="nom" value="{{ employe.user.last_name }}">
|
||||
<input type="text" class="form-control" id="nom" name = 'nom' value="{{ employe.user.last_name }}">
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Prénom :</label>
|
||||
<input type="text" class="form-control" id="prenom" value="{{ employe.user.first_name }}">
|
||||
<input type="text" class="form-control" id="prenom" name = 'prenom' value="{{ employe.user.first_name }}">
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Sexe :</label>
|
||||
<select id='sexe' class="form-select">
|
||||
<select id='sexe' name = 'sexe' class="form-select">
|
||||
<option value='h' {% if employe.sexe == 'h' %}selected{% endif %}>Homme</option>
|
||||
<option value='f' {% if employe.sexe == 'f' %}selected{% endif %}>Femme</option>
|
||||
</select>
|
||||
@@ -72,27 +72,27 @@
|
||||
<div class="col">
|
||||
<div class="form-group mb-2">
|
||||
<label>Date de naissance :</label>
|
||||
<input type="date" class="form-control" id="date_naissance" value="{{ employe.date_naissance|date:'Y-m-d' }}">
|
||||
<input type="date" class="form-control" id="date_naissance" name = 'date_naissance' value="{{ employe.date_naissance|date:'Y-m-d' }}">
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Département :</label>
|
||||
<input type="text" class="form-control" id="departement" value="{{ employe.departement.nom|default:'' }}" readonly>
|
||||
<input type="text" class="form-control" id="departement" name = 'departement' value="{{ employe.departement.nom|default:'' }}" readonly>
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Email :</label>
|
||||
<input type="email" class="form-control" id="email" value="{{ employe.user.email|default:'' }}">
|
||||
<input type="email" class="form-control" id="email" name = 'email' value="{{ employe.user.email|default:'' }}">
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Téléphone :</label>
|
||||
<input type="text" class="form-control" id="telephone" value="{{ employe.telephone|default:'' }}">
|
||||
<input type="text" class="form-control" id="telephone" name = 'telephone' value="{{ employe.telephone|default:'' }}">
|
||||
</div>
|
||||
<div class="form-group mb-2">
|
||||
<label>Adresse :</label>
|
||||
<input type="text" class="form-control" id="adresse" value="{{ employe.adresse|default:'' }}">
|
||||
</div>
|
||||
<input type="text" class="form-control" id="adresse" name = 'adresse' value="{{ employe.adresse|default:'' }}">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success d-block m-auto" id="enregistrerProfil">Enregistrer</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Binary file not shown.
@@ -191,25 +191,26 @@ def modifier_employer(request):
|
||||
except Employe.DoesNotExist:
|
||||
return JsonResponse({"message": "Employé non trouvé."})
|
||||
if request.method == "POST":
|
||||
data = json.loads(request.body)
|
||||
user = User.objects.get(username=request.user)
|
||||
user.last_name = data['nom']
|
||||
user.first_name = data['prenom']
|
||||
user.email = data['email']
|
||||
employe.telephone = data['telephone']
|
||||
employe.adresse = data['adresse']
|
||||
employe.sexe = data['sexe']
|
||||
user.last_name = request.POST['nom']
|
||||
user.first_name = request.POST['prenom']
|
||||
user.email = request.POST['email']
|
||||
employe.telephone = request.POST['telephone']
|
||||
employe.adresse = request.POST['adresse']
|
||||
employe.sexe = request.POST['sexe']
|
||||
if request.FILES.get("photo"):
|
||||
employe.photo = request.FILES["photo"]
|
||||
if data['date_naissance']:
|
||||
difference = relativedelta(timezone.now().date(), datetime.strptime(data['date_naissance'], "%Y-%m-%d").date())
|
||||
if request.POST['date_naissance']:
|
||||
difference = relativedelta(timezone.now().date(), datetime.strptime(request.POST['date_naissance'], "%Y-%m-%d").date())
|
||||
if difference.years >= 18:
|
||||
employe.date_naissance = data['date_naissance']
|
||||
employe.date_naissance = request.POST['date_naissance']
|
||||
else:
|
||||
return JsonResponse({"message": "Veuillez entrez une date de naissance correcte."})
|
||||
messages.error(request, "Veuillez entrez une date de naissance correcte.")
|
||||
employe.save()
|
||||
user.save()
|
||||
return JsonResponse({"message": "Profil mis à jour avec succès."})
|
||||
messages.success(request, "Profil mis à jour avec succès.")
|
||||
return redirect("gestion_employe:mon-profil")
|
||||
|
||||
|
||||
def enregistrement_document(request):
|
||||
"""Vue pour permettre à un utilisateur de télécharger et enregistrer des documents liés à son profil"""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.2.13 on 2026-04-17 12:03
|
||||
# Generated by Django 5.2.13 on 2026-07-03 18:13
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
# Generated by Django 5.2.13 on 2026-04-17 12:03
|
||||
# Generated by Django 5.2.13 on 2026-07-03 18:13
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
Reference in New Issue
Block a user