Skip to content

Commit

Permalink
www: Add job_seeker page
Browse files Browse the repository at this point in the history
  • Loading branch information
tonial authored and xavfernandez committed Aug 13, 2024
1 parent 02af778 commit c549ed5
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 20 deletions.
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
path("geiq/", include("itou.www.geiq_views.urls")),
path("institutions/", include("itou.www.institutions_views.urls")),
path("invitations/", include("itou.www.invitations_views.urls")),
path("job-seekers/", include("itou.www.job_seekers_views.urls")),
path("prescribers/", include("itou.www.prescribers_views.urls")),
path("search/", include("itou.www.search.urls")),
path("company/", include("itou.www.companies_views.urls")),
Expand Down
9 changes: 9 additions & 0 deletions itou/eligibility/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.utils import timezone

from itou.eligibility.enums import AdministrativeCriteriaLevel, AuthorKind
from itou.job_applications.enums import SenderKind


class CommonEligibilityDiagnosisQuerySet(models.QuerySet):
Expand Down Expand Up @@ -76,6 +77,14 @@ def criteria_can_be_certified(self):
and self.administrative_criteria.certifiable().exists()
)

def get_author_kind_display(self):
if self.sender_kind == SenderKind.PRESCRIBER and (
not self.sender_prescriber_organization or not self.sender_prescriber_organization.is_authorized
):
return "Orienteur"
else:
return SenderKind(self.sender_kind).label


class AdministrativeCriteriaQuerySet(models.QuerySet):
def level1(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="alert alert-info" role="status">
<div class="row">
<div class="col-auto pe-0">
<i class="ri-information-line ri-xl text-info"></i>
</div>
<div class="col">
<p>
<b>Aide à l'accompagement GEIQ</b>
</p>
<p>
{% if diagnosis.author_prescriber_organization %}
Ce diagnostic émis par un prescripteur habilité vous donnera droit en cas d’embauche,
{% else %}
Les critères que vous avez sélectionnés vous donnent droit en cas d’embauche,
{% endif %}
à une aide financière de l’État s’élevant à <b>{{ diagnosis.allowance_amount }} €</b> (sous réserve de la contractualisation initialement prévue et de l’enveloppe disponible).
</p>
</div>
</div>
</div>
21 changes: 1 addition & 20 deletions itou/templates/apply/includes/geiq/geiq_diagnosis_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,7 @@ <h4>Situation administrative du candidat</h4>
<b>Durée de validité du diagnostic :</b> du {{ diagnosis.created_at|date:"d/m/Y" }} au {{ diagnosis.expires_at|date:"d/m/Y" }}.
</p>
{% if request.user.is_employer %}
<div class="alert alert-info" role="status">
<div class="row">
<div class="col-auto pe-0">
<i class="ri-information-line ri-xl text-info"></i>
</div>
<div class="col">
<p>
<b>Aide à l'accompagement GEIQ</b>
</p>
<p>
{% if diagnosis.author_prescriber_organization %}
Ce diagnostic émis par un prescripteur habilité vous donnera droit en cas d’embauche,
{% else %}
Les critères que vous avez sélectionnés vous donnent droit en cas d’embauche,
{% endif %}
à une aide financière de l’État s’élevant à <b>{{ diagnosis.allowance_amount }} €</b> (sous réserve de la contractualisation initialement prévue et de l’enveloppe disponible).
</p>
</div>
</div>
</div>
{% include "apply/includes/geiq/geiq_diagnosis_allowance_alert.html" with diagnosis=eligibility_diagnosis only %}
{% endif %}
{% elif request.user.is_employer %}
{# Existing GEIQ, diagnosis but no allowance #}
Expand Down
38 changes: 38 additions & 0 deletions itou/templates/job_seekers_views/details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends "layout/base.html" %}
{% load matomo %}
{% load str_filters %}
{% load format_filters %}

{% block title %}Profil de {{ job_seeker.get_full_name }} {{ block.super }}{% endblock %}

{% block title_content %}<h1>{{ job_seeker.get_full_name }}</h1>{% endblock %}

{% block title_prevstep %}
{% include "layout/previous_step.html" with back_url=back_url only %}
{% endblock %}

{% block content %}
<section class="s-section">
<div class="s-section__container container">
<div class="row">
<div class="col-12 {% if approval %}col-lg-8 order-2 order-lg-1{% endif %}">
<h2>Informations</h2>
<div class="c-box mb-3 mb-lg-5">
{% include "apply/includes/job_seeker_info.html" with job_seeker=job_seeker job_application=None with_matomo_event=True can_view_personal_information=can_view_personal_information can_edit_personal_information=can_edit_personal_information request=request csrf_token=csrf_token SenderKind=SenderKind only %}
</div>
{% if iae_eligibility_diagnosis %}
{% include "job_seekers_views/includes/eligibility_diagnosis.html" with eligibility_diagnosis=iae_eligibility_diagnosis kind="IAE" only %}
{% endif %}
{% if geiq_eligibility_diagnosis %}
{% include "job_seekers_views/includes/eligibility_diagnosis.html" with eligibility_diagnosis=geiq_eligibility_diagnosis kind="GEIQ" with_details=request.user.is_employer only %}
{% endif %}
</div>
{% if approval %}
<div class="col-12 col-lg-4 order-1 order-lg-2 mt-lg-6">
{% include "approvals/includes/box.html" with approval=approval only %}
</div>
{% endif %}
</div>
</div>
</section>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

<div class="c-box mb-3 mb-lg-5">
<div class="d-flex justify-content-between">
<div class="mb-3">
{% if kind == "IAE" %}
<h3 class="mb-0">Diagnostic IAE</h3>
{% else %}
<h3 class="mb-0">Diagnostic public prioritaire GEIQ</h3>
{% endif %}
<span class="text-success">Valide du {{ eligibility_diagnosis.created_at|date:"d/m/Y" }} au {{ eligibility_diagnosis.expires_at|date:"d/m/Y" }}</span>
</div>
<div>
<span class="badge badge-base rounded-pill bg-success-lighter text-success">
<i class="ri-check-line" aria-hidden="true"></i>
{% if kind == "IAE" %}
Éligible à l’IAE
{% else %}
Éligible public prioritaire GEIQ
{% endif %}
</span>
</div>
</div>
<div class="row">
<div class="col-6">
<p>
<small>Confirmé par</small>
<br>
<strong>{{ eligibility_diagnosis.author.get_full_name }}
{% if eligibility_diagnosis.author_siae %}({{ eligibility_diagnosis.author_siae.display_name }}){% endif %}
{% if eligibility_diagnosis.author_prescriber_organization %}
({{ eligibility_diagnosis.author_prescriber_organization.display_name }})
{% endif %}
</strong>
</p>
<p>
<small>Type</small>
<br>
<strong>{{ eligibility_diagnosis.get_author_kind_display }}</strong>
</p>
</div>
<div class="col-6">
<small>Critère administratifs selectionés</small>
<br>
{# Keep ordering from manager (level then ui_rank) #}
{% for criteria in eligibility_diagnosis.administrative_criteria.all %}
<strong>{{ criteria.name }}</strong>
<br>
{% endfor %}
</div>
</div>
{% if kind == "GEIQ" %}
{% if with_details %}
{% include "apply/includes/geiq/geiq_diagnosis_allowance_alert.html" with diagnosis=eligibility_diagnosis only %}
{% endif %}
{% endif %}
</div>
Empty file.
10 changes: 10 additions & 0 deletions itou/www/job_seekers_views/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.urls import path

from . import views


app_name = "job_seekers_views"

urlpatterns = [
path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), name="details"),
]
48 changes: 48 additions & 0 deletions itou/www/job_seekers_views/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic import DetailView

from itou.companies.enums import CompanyKind
from itou.eligibility.models.geiq import GEIQEligibilityDiagnosis
from itou.eligibility.models.iae import EligibilityDiagnosis
from itou.users.models import User


class JobSeekerDetailView(LoginRequiredMixin, UserPassesTestMixin, DetailView):
model = User
queryset = User.objects.select_related("jobseeker_profile").prefetch_related()
template_name = "job_seekers_views/details.html"
slug_field = "public_id"
slug_url_kwarg = "public_id"
context_object_name = "job_seeker"

def test_func(self):
return self.request.user.is_authenticated and self.request.user.can_view_personal_information(
self.get_object()
)

def get_context_data(self, **kwargs):
geiq_eligibility_diagnosis = None
if self.request.user.is_prescriber or self.request.current_organization.kind == CompanyKind.GEIQ:
geiq_eligibility_diagnosis = GEIQEligibilityDiagnosis.objects.valid_diagnoses_for(
self.object,
for_geiq=self.request.current_organization if self.request.user.is_employer else None,
).first()

approval = None
iae_eligibility_diagnosis = None
if self.request.user.is_prescriber or self.request.current_organization.is_subject_to_eligibility_rules:
approval = self.object.approvals.valid().first()
iae_eligibility_diagnosis = EligibilityDiagnosis.objects.last_considered_valid(
self.object,
for_siae=self.request.current_organization if self.request.user.is_employer else None,
)

return super().get_context_data(**kwargs) | {
"geiq_eligibility_diagnosis": geiq_eligibility_diagnosis,
"iae_eligibility_diagnosis": iae_eligibility_diagnosis,
"matomo_custom_title": "Détail candidat",
"approval": approval,
# already checked in test_func because the user name is displayed in the title
"can_view_personal_information": True,
"can_edit_personal_information": self.request.user.can_edit_personal_information(self.object),
}

0 comments on commit c549ed5

Please sign in to comment.