Skip to content

Commit

Permalink
wip: y'a plus qu'a ordonner ça
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenKorr committed Dec 3, 2024
1 parent 9eb0a1a commit cfc65f2
Show file tree
Hide file tree
Showing 10 changed files with 2,058 additions and 1,072 deletions.
2 changes: 1 addition & 1 deletion itou/templates/apply/submit/application/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1 class="flex-grow-1">{% include 'apply/includes/_submit_title.html' %}</h1>
<p>
Dernière actualisation du profil : {{ job_seeker.last_checked_at|date }} à {{ job_seeker.last_checked_at|time }}
{% if can_view_personal_information and not request.user.is_job_seeker %}
<a class="btn btn-link" href="{% url "job_seekers_views:update_job_seeker_step_1" company_pk=siae.pk job_seeker_public_id=job_seeker.public_id %}">Vérifier le profil</a>
<a class="btn btn-link" href="{{ update_job_seeker_url }}">Vérifier le profil</a>
{% endif %}
{% if new_check_needed %}<i class="ri-information-line ri-xl text-warning"></i>{% endif %}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>
<div class="c-box my-4">
<h2>
Informations personnelles
<a class="btn btn-outline-primary float-end" href="{% url "job_seekers_views:update_job_seeker_step_1_for_hire" company_pk=siae.pk job_seeker_public_id=job_seeker.public_id %}">Mettre à jour</a>
<a class="btn btn-outline-primary float-end" href="{{ update_job_seeker_url }}">Mettre à jour</a>
</h2>

{% include "apply/includes/profile_infos.html" %}
Expand Down
2 changes: 1 addition & 1 deletion itou/www/apply/views/process_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ class JobApplicationExternalTransferStep3View(ApplicationOverrideMixin, Applicat
form_class = TransferJobApplicationForm

def dispatch(self, request, *args, **kwargs):
if request.user.is_authenticated and not self.apply_session.exists():
if request.user.is_authenticated and self.apply_session.get("selected_jobs", None) is None:
return HttpResponseRedirect(
reverse(
"apply:job_application_external_transfer_step_2",
Expand Down
32 changes: 32 additions & 0 deletions itou/www/apply/views/submit_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,27 @@ def setup(self, request, *args, **kwargs):
job_seeker_session.set("job_seeker", {"pk": self.job_seeker.pk})
self.apply_session.set("job_seeker_session_name", job_seeker_session.name)

def update_job_seeker_session_config(self, new_config):
job_seeker_session = SessionNamespace(self.request.session, self.apply_session.get("job_seeker_session_name"))
if not job_seeker_session.exists():
job_seeker_session.init(
{
"config": {
"reset_url": self.get_reset_url(),
},
"apply": {"company_pk": self.company.pk},
}
)
job_seeker_session.set("config", new_config)

def get_update_job_seeker_url(self):
view_name = (
"job_seekers_views:update_job_seeker_step_1_for_hire"
if self.hire_process
else "job_seekers_views:update_job_seeker_step_1"
)
return reverse(view_name, kwargs={"session_uuid": self.apply_session.get("job_seeker_session_name")})

def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"job_seeker": self.job_seeker,
Expand All @@ -232,6 +253,7 @@ def get_context_data(self, **kwargs):
not self.request.user.is_job_seeker
and self.job_seeker.last_checked_at < timezone.now() - JOB_SEEKER_INFOS_CHECK_PERIOD
),
"update_job_seeker_url": self.get_update_job_seeker_url(),
}

def get_previous_applications_queryset(self):
Expand Down Expand Up @@ -428,6 +450,16 @@ def setup(self, request, *args, **kwargs):
data=request.POST or None,
)

if self.job_seeker:
self.update_job_seeker_session_config(
{
"reset_url": reverse(
"apply:application_jobs",
kwargs={"company_pk": self.company.pk, "job_seeker_public_id": self.job_seeker.public_id},
)
}
)

def get_next_url(self):
# dispatching to IAE or GEIQ eligibility
path_name = (
Expand Down
62 changes: 54 additions & 8 deletions itou/www/job_seekers_views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,54 @@
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/1",
"<uuid:session_uuid>/hire/update/1",
views.UpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/2",
"<uuid:session_uuid>/hire/update/2",
views.UpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/3",
"<uuid:session_uuid>/hire/update/3",
views.UpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/end",
"<uuid:session_uuid>/hire/update/end",
views.UpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end_for_hire",
kwargs={"hire_process": True},
),
# TODO(ewen): deprecated URLs
# path(
# "<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/1",
# views.DeprecatedUpdateJobSeekerStep1View.as_view(),
# name="update_job_seeker_step_1_for_hire",
# kwargs={"hire_process": True},
# ),
# path(
# "<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/2",
# views.DeprecatedUpdateJobSeekerStep2View.as_view(),
# name="update_job_seeker_step_2_for_hire",
# kwargs={"hire_process": True},
# ),
# path(
# "<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/3",
# views.DeprecatedUpdateJobSeekerStep3View.as_view(),
# name="update_job_seeker_step_3_for_hire",
# kwargs={"hire_process": True},
# ),
# path(
# "<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/end",
# views.DeprecatedUpdateJobSeekerStepEndView.as_view(),
# name="update_job_seeker_step_end_for_hire",
# kwargs={"hire_process": True},
# ),
path(
"<int:company_pk>/hire/<uuid:job_seeker_public_id>/check-infos",
views.CheckJobSeekerInformationsForHire.as_view(),
Expand All @@ -110,25 +135,46 @@
),
# Job seeker check/updates
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/1",
"<uuid:session_uuid>/update/1",
views.UpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/2",
"<uuid:session_uuid>/update/2",
views.UpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/3",
"<uuid:session_uuid>/update/3",
views.UpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/end",
"<uuid:session_uuid>/update/end",
views.UpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end",
),
# TODO(ewen): deprecated URLs
# path(
# "<int:company_pk>/update/<uuid:job_seeker_public_id>/1",
# views.DeprecatedUpdateJobSeekerStep1View.as_view(),
# name="update_job_seeker_step_1",
# ),
# path(
# "<int:company_pk>/update/<uuid:job_seeker_public_id>/2",
# views.DeprecatedUpdateJobSeekerStep2View.as_view(),
# name="update_job_seeker_step_2",
# ),
# path(
# "<int:company_pk>/update/<uuid:job_seeker_public_id>/3",
# views.DeprecatedUpdateJobSeekerStep3View.as_view(),
# name="update_job_seeker_step_3",
# ),
# path(
# "<int:company_pk>/update/<uuid:job_seeker_public_id>/end",
# views.DeprecatedUpdateJobSeekerStepEndView.as_view(),
# name="update_job_seeker_step_end",
# ),
# Common
path(
"<int:company_pk>/create/<uuid:job_seeker_public_id>/check-infos",
Expand Down
Loading

0 comments on commit cfc65f2

Please sign in to comment.