Compare commits
28 Commits
a9e708c778
...
modificati
| Author | SHA1 | Date | |
|---|---|---|---|
| a28b177eba | |||
| 415860f233 | |||
| 8503689aa4 | |||
| b03a4214c0 | |||
| d4f4b7d954 | |||
| 489eeb439f | |||
| 5277b7f355 | |||
| 9d9e6c6549 | |||
| 784822478e | |||
| ab87baaa3a | |||
| 6026af5498 | |||
| 91bdd791f1 | |||
| 671072864d | |||
| bb93a853db | |||
| 99434a21e0 | |||
| f6b90e7dd0 | |||
| fcfac71026 | |||
| 34a261a4af | |||
| f0e8b025a4 | |||
| 62b2938c71 | |||
| 06125b0900 | |||
| 0047b1f91c | |||
| 7ee14e7b3f | |||
| d12b014b20 | |||
| d9b45ac364 | |||
| 44faeac222 | |||
| e1436e8f4e | |||
| 4ee7dd9fc7 |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,5 +1,7 @@
|
|||||||
db.sqlite3
|
db.sqlite3
|
||||||
venv/*
|
venv/
|
||||||
media/*
|
media/
|
||||||
|
staticfiles/
|
||||||
|
.env
|
||||||
|
migrations/
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__/
|
|
||||||
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
@@ -1,6 +1,10 @@
|
|||||||
pipeline
|
pipeline
|
||||||
{
|
{
|
||||||
agent any
|
agent any
|
||||||
|
options {
|
||||||
|
// This is required if you want to clean before build
|
||||||
|
skipDefaultCheckout(true)
|
||||||
|
}
|
||||||
|
|
||||||
environment
|
environment
|
||||||
{
|
{
|
||||||
@@ -14,6 +18,7 @@ pipeline
|
|||||||
steps
|
steps
|
||||||
{
|
{
|
||||||
sh 'echo "Debut du pipeline"'
|
sh 'echo "Debut du pipeline"'
|
||||||
|
cleanWs()
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,13 +29,22 @@ pipeline
|
|||||||
sh '''
|
sh '''
|
||||||
cd /var/www/sirh
|
cd /var/www/sirh
|
||||||
echo $SUDO_PASSWORD | sudo -S chown -R jenkins:jenkins /var/www/sirh
|
echo $SUDO_PASSWORD | sudo -S chown -R jenkins:jenkins /var/www/sirh
|
||||||
git pull origin main
|
|
||||||
|
git fetch origin main
|
||||||
|
git reset --hard origin/main
|
||||||
|
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
python manage.py makemigrations
|
python manage.py makemigrations
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
echo $SUDO_PASSWORD | sudo -S rm -r staticfiles
|
||||||
|
python manage.py collectstatic --noinput
|
||||||
|
|
||||||
|
echo $SUDO_PASSWORD | sudo -S chown -R www-data:www-data /var/www/sirh
|
||||||
echo "Deploiement reussi"
|
echo "Deploiement reussi"
|
||||||
|
echo $SUDO_PASSWORD | sudo -S supervisorctl restart sirh
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -150,6 +150,7 @@ MEDIA_ROOT = BASE_DIR / "media"
|
|||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
# Configuration de l'email
|
||||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
EMAIL_HOST = 'ssl0.ovh.net'
|
EMAIL_HOST = 'ssl0.ovh.net'
|
||||||
EMAIL_PORT = 465
|
EMAIL_PORT = 465
|
||||||
|
|||||||
@@ -2,6 +2,21 @@
|
|||||||
{% load tags_personnaliser %}
|
{% load tags_personnaliser %}
|
||||||
|
|
||||||
<div class="col-3 bg-danger d-flex flex-column vh-100 pt-5 sticky-top">
|
<div class="col-3 bg-danger d-flex flex-column vh-100 pt-5 sticky-top">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
{% if user.employe.photo %}
|
||||||
|
<img src="{{ user.employe.photo.url }}"
|
||||||
|
class="rounded-circle"
|
||||||
|
width="100"
|
||||||
|
height="100"
|
||||||
|
style="object-fit:cover;">
|
||||||
|
{% else %}
|
||||||
|
<i class="bi bi-person-circle text-white" style="font-size:60px;"></i>
|
||||||
|
{% endif %}
|
||||||
|
<div class="text-white mt-2 fw-bold fs-5">
|
||||||
|
{{ user.username }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="{% url 'gestion_employe:mon-profil' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
<a href="{% url 'gestion_employe:mon-profil' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
||||||
<i class="bi bi-person-circle"></i> Mon profil
|
<i class="bi bi-person-circle"></i> Mon profil
|
||||||
</a>
|
</a>
|
||||||
@@ -26,15 +41,6 @@
|
|||||||
<a href="{% url 'gestion_salle:reservation-salle' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
<a href="{% url 'gestion_salle:reservation-salle' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
||||||
<i class="bi bi-calendar-check"></i> Réservation
|
<i class="bi bi-calendar-check"></i> Réservation
|
||||||
</a>
|
</a>
|
||||||
{% comment %} <a href="{% url 'rapport-rh' %}" class="text-white fw-bold text-decoration-none mb-2" style="font-size:1.2em">
|
|
||||||
<i class="bi bi-graph-up"></i> Rapports et Statistiques
|
|
||||||
</a> {% endcomment %}
|
|
||||||
{% comment %} <a href="" class="text-white fw-bold text-decoration-none mb-2" style="font-size:1.2em">
|
|
||||||
<i class="bi bi-person-gear"></i> Gestion des Utilisateurs
|
|
||||||
</a> {% endcomment %}
|
|
||||||
{% comment %} <a href="{% url 'gestion_employe:departement' %}" class="text-white fw-bold text-decoration-none mb-2" style="font-size:1.2em">
|
|
||||||
<i class="bi bi-gear"></i> Paramètres
|
|
||||||
</a> {% endcomment %}
|
|
||||||
<a href="{% url 'deconnexion' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
<a href="{% url 'deconnexion' %}" class="text-white fw-bold text-decoration-none mb-4" style="font-size:1.4em">
|
||||||
<i class="bi bi-box-arrow-right"></i> Déconnexion
|
<i class="bi bi-box-arrow-right"></i> Déconnexion
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from gestion_employe.models import Contrat
|
from gestion_employe.models import Contrat, Employe
|
||||||
from gestion_conge.models import Conge
|
from gestion_conge.models import Conge
|
||||||
|
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@ QUOTA_CONGE_ANNUEL = 30
|
|||||||
NOMBRE_PAGINATION = 8
|
NOMBRE_PAGINATION = 8
|
||||||
DEBUT_RAPPEL = 60
|
DEBUT_RAPPEL = 60
|
||||||
DUREE_FIN_CONTRAT = 90
|
DUREE_FIN_CONTRAT = 90
|
||||||
|
EMAIL_ASSISTANTE_DE_DIRECTION = list(Employe.objects.filter(fonction="assistant_direction").values_list('user__email', flat=True))
|
||||||
|
|
||||||
def solde_conge(employe):
|
def solde_conge(employe):
|
||||||
"""Fonction de calcul du solde de congé restant l'employé"""
|
"""Fonction de calcul du solde de congé restant l'employé"""
|
||||||
@@ -32,3 +33,25 @@ def solde_conge(employe):
|
|||||||
"quota_annuel": QUOTA_CONGE_ANNUEL - jours_conges_valider,
|
"quota_annuel": QUOTA_CONGE_ANNUEL - jours_conges_valider,
|
||||||
"nombre_jours_valide": jours_conges_valider
|
"nombre_jours_valide": jours_conges_valider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def envoyer_mail(sujet, message, destinataires):
|
||||||
|
"""Fonction d'envoi de mail"""
|
||||||
|
from django.core.mail import send_mail
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
send_mail(
|
||||||
|
sujet,
|
||||||
|
message,
|
||||||
|
settings.EMAIL_HOST_USER,
|
||||||
|
destinataires,
|
||||||
|
fail_silently=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def destinataire_mail_demande_conges(employe):
|
||||||
|
"""Fonction de récupération des destinataires pour les mails de demande de congés"""
|
||||||
|
if employe.chef:
|
||||||
|
return EMAIL_ASSISTANTE_DE_DIRECTION
|
||||||
|
else:
|
||||||
|
if employe.departement:
|
||||||
|
chefs_departement = Employe.objects.filter(departement=employe.departement, chef=True)
|
||||||
|
return list(chefs_departement.values_list('user__email', flat=True))
|
||||||
|
|||||||
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
@@ -83,7 +83,6 @@ def index(request):
|
|||||||
Q(validation_hierarchique = True) | Q(validation_hierarchique = False)
|
Q(validation_hierarchique = True) | Q(validation_hierarchique = False)
|
||||||
).order_by('-date_demande')
|
).order_by('-date_demande')
|
||||||
|
|
||||||
|
|
||||||
return render(request, 'gestion_conge/index.html', {
|
return render(request, 'gestion_conge/index.html', {
|
||||||
"nombre_conges_valide": nombre_conges_valide,
|
"nombre_conges_valide": nombre_conges_valide,
|
||||||
"nombre_conges_refuse": nombre_conges_refuse,
|
"nombre_conges_refuse": nombre_conges_refuse,
|
||||||
@@ -123,61 +122,71 @@ def demander_conge(request):
|
|||||||
|
|
||||||
conge_obj.save()
|
conge_obj.save()
|
||||||
messages.success(request, "Votre demande de congé a été enregistrée.")
|
messages.success(request, "Votre demande de congé a été enregistrée.")
|
||||||
|
|
||||||
|
fonctions_utilitaire.envoyer_mail(
|
||||||
|
sujet = "Demande de congé",
|
||||||
|
message = f"""Bonjour {employe.user.first_name} {employe.user.last_name}, votre demande de congé a été enregistrée. Veuillez consulter votre profil pour plus de détails.""",
|
||||||
|
destinataires = fonctions_utilitaire.destinataire_mail_demande_conges() + [employe.user.email]
|
||||||
|
)
|
||||||
|
|
||||||
return redirect("gestion_conges:conge")
|
return redirect("gestion_conges:conge")
|
||||||
|
|
||||||
return redirect("gestion_conges:conge")
|
return redirect("gestion_conges:conge")
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def liste_demande_conges(request):
|
def liste_demande_conges(request):
|
||||||
"""Vue de liste des demandes de congés en attente de validation selon le statut de l'utilisateur actuel"""
|
|
||||||
try:
|
try:
|
||||||
employe = Employe.objects.get(user__username = request.user)
|
employe = Employe.objects.get(user=request.user)
|
||||||
except Employe.DoesNotExist:
|
except Employe.DoesNotExist:
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
"success": False,
|
"success": False,
|
||||||
"message": "Votre profil Utilisateur n'est lié à aucun profil Employé. Veuillez contacter l'administrateur."
|
"message": "Profil employé introuvable"
|
||||||
})
|
})
|
||||||
|
|
||||||
try:
|
affectation = Affectation.objects.filter(
|
||||||
affectation = Affectation.objects.get(
|
|
||||||
employe=employe,
|
employe=employe,
|
||||||
date_fin_daffectation__gte=timezone.now().date()
|
date_fin_daffectation__gte=timezone.now().date()
|
||||||
)
|
).first()
|
||||||
except Affectation.DoesNotExist:
|
|
||||||
affectation = None
|
is_direction = employe.user.groups.filter(name='direction').exists()
|
||||||
|
|
||||||
if employe.chef:
|
if employe.chef:
|
||||||
print("chef")
|
|
||||||
conges_en_attente = Conge.objects.filter(
|
conges = Conge.objects.filter(
|
||||||
employe__departement = employe.departement,
|
Q(employe__departement=employe.departement) |
|
||||||
validation_hierarchique = None
|
Q(employe=employe)
|
||||||
).order_by('-date_demande')
|
).order_by('-date_demande')
|
||||||
|
|
||||||
elif affectation and affectation.role == "chef_projet":
|
elif affectation and affectation.role == "chef_projet":
|
||||||
|
|
||||||
employes_du_projet = Affectation.objects.filter(
|
employes_du_projet = Affectation.objects.filter(
|
||||||
projet = affectation.projet,
|
projet=affectation.projet,
|
||||||
date_fin_daffectation__gte = timezone.now().date()
|
date_fin_daffectation__gte=timezone.now().date()
|
||||||
).values('employe')
|
).values_list('employe', flat=True)
|
||||||
|
|
||||||
conges_en_attente = Conge.objects.filter(
|
conges = Conge.objects.filter(
|
||||||
employe__in = employes_du_projet,
|
Q(employe__in=employes_du_projet) |
|
||||||
validation_hierarchique = None
|
Q(employe=employe)
|
||||||
).order_by('-date_demande')
|
).order_by('-date_demande')
|
||||||
|
|
||||||
elif 'direction' in employe.user.groups.values_list('name', flat=True):
|
|
||||||
conges_en_attente = Conge.objects.filter(
|
elif is_direction:
|
||||||
validation_hierarchique = True,
|
|
||||||
validation_direction = None
|
conges = Conge.objects.filter(
|
||||||
).order_by('-date_demande')
|
Q(validation_hierarchique=True) |
|
||||||
|
Q(employe__user__groups__name='direction')
|
||||||
|
).distinct().order_by('-date_demande')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
conges_en_attente = Conge.objects.filter(
|
|
||||||
employe__user__username = request.user
|
conges = Conge.objects.filter(
|
||||||
|
employe=employe
|
||||||
).order_by('-date_demande')
|
).order_by('-date_demande')
|
||||||
|
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
"success": True,
|
"success": True,
|
||||||
"data":[
|
"data": [
|
||||||
{
|
{
|
||||||
**model_to_dict(conge),
|
**model_to_dict(conge),
|
||||||
"prenom_nom": f"{conge.employe.user.first_name} {conge.employe.user.last_name}",
|
"prenom_nom": f"{conge.employe.user.first_name} {conge.employe.user.last_name}",
|
||||||
@@ -186,9 +195,9 @@ def liste_demande_conges(request):
|
|||||||
"type": dict(conge.TYPE_CHOICES).get(conge.type),
|
"type": dict(conge.TYPE_CHOICES).get(conge.type),
|
||||||
"solde_conge": fonctions_utilitaire.solde_conge(conge.employe)["quota_annuel"]
|
"solde_conge": fonctions_utilitaire.solde_conge(conge.employe)["quota_annuel"]
|
||||||
}
|
}
|
||||||
for conge in conges_en_attente]},
|
for conge in conges
|
||||||
safe=False
|
]
|
||||||
)
|
})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def validation_de_conge(request):
|
def validation_de_conge(request):
|
||||||
|
|||||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user