diff --git a/itou/templates/apply/process_inward_transfer.html b/itou/templates/apply/process_inward_transfer.html new file mode 100644 index 00000000000..7d4c304458b --- /dev/null +++ b/itou/templates/apply/process_inward_transfer.html @@ -0,0 +1,41 @@ +{% extends "layout/base.html" %} +{% load buttons_form %} + +{% block title %} + Transférer une candidature vers une autre structure + {{ block.super }} +{% endblock %} + +{% block content_title %} + {% include "apply/includes/job_application_outward_transfer_progress.html" with job_app_to_transfer=job_app_to_transfer progress=progress only %} +

Confirmation du transfer

+{% endblock %} + + +{% block content %} +
+
+
+
+
+
+

+ Êtes-vous sûr de vouloir transférer la candidature de {{ job_app_to_tranfer.job_seeker.get_full_name }} dans la structure suivante ? +

+ {% include "companies/includes/_company_info.html" with company=company extra_box_class="mb-3 mb-lg-5" only %} +
+ +
+ {% csrf_token %} + + + + + {% itou_buttons_form primary_label="Confirmer" secondary_url=back_url reset_url=reset_url show_mandatory_fields_mention=False %} +
+
+
+
+
+
+{% endblock %} diff --git a/itou/www/apply/urls.py b/itou/www/apply/urls.py index 3200728f71e..3569511ed7b 100644 --- a/itou/www/apply/urls.py +++ b/itou/www/apply/urls.py @@ -280,6 +280,11 @@ process_views.JobApplicationOutwardTransferStepEndView.as_view(), name="job_application_outward_transfer_step_end", ), + path( + "/siae/transfer/", + process_views.JobApplicationInwardTranferView.as_view(), + name="job_application_inward_transfer", + ), path( "/siae/prior-action/add", process_views.add_or_modify_prior_action, diff --git a/itou/www/apply/views/process_views.py b/itou/www/apply/views/process_views.py index b9526ea9e12..128b8404b0f 100644 --- a/itou/www/apply/views/process_views.py +++ b/itou/www/apply/views/process_views.py @@ -629,6 +629,17 @@ def setup(self, request, *args, **kwargs): class JobApplicationOutwardTransferStep2View(ApplicationOverrideMixin, ApplicationJobsView): + def dispatch(self, request, *args, **kwargs): + if self.company in request.organizations: + # This is not an outward transfer + return HttpResponseRedirect( + reverse( + "apply:job_application_inward_transfer", + kwargs={"job_application_id": self.job_application.pk, "company_pk": self.company.pk}, + ) + ) + return super().dispatch(request, *args, **kwargs) + def get_initial(self): return {"selected_jobs": self.request.GET.get("job_description_id")} @@ -704,6 +715,30 @@ def get_context_data(self, **kwargs): return super().get_context_data(**kwargs) | {"transfered_job_app": True} +class JobApplicationInwardTranferView(TemplateView): + template_name = "apply/process_inward_transfer.html" + + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + + if request.user.is_authenticated: + self.job_application = get_object_or_404( + JobApplication.objects.is_active_company_member(request.user).select_related( + "job_seeker", "to_company" + ), + pk=kwargs["job_application_id"], + ) + self.company = get_object_or_404(Company.objects.with_has_active_members(), pk=kwargs["company_pk"]) + + def get_context_data(self, **kwargs): + return super().get_context_data(**kwargs) | { + "job_app_to_transfer": self.job_application, + "company": self.company, + "progress": 75, + "reset_url": reverse("apply:details_for_company", kwargs={"job_application_id": self.job_application.pk}), + } + + @login_required @require_POST def send_diagoriente_invite(request, job_application_id):