Skip to content

Commit

Permalink
apply: Handle inward transfer on company search
Browse files Browse the repository at this point in the history
  • Loading branch information
tonial committed Jul 13, 2024
1 parent 2cd2622 commit 449aa04
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
41 changes: 41 additions & 0 deletions itou/templates/apply/process_inward_transfer.html
Original file line number Diff line number Diff line change
@@ -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 %}
<h1>Confirmation du transfer</h1>
{% endblock %}


{% block content %}
<section class="s-section-twocolumns s-section">
<div class="container">
<div class="row">
<div class="col-12">
<div class="c-form">
<div class="col-12 p-0">
<p>
Êtes-vous sûr de vouloir transférer la candidature de <b>{{ job_app_to_tranfer.job_seeker.get_full_name }}</b> dans la structure suivante ?
</p>
{% include "companies/includes/_company_info.html" with company=company extra_box_class="mb-3 mb-lg-5" only %}
</div>

<form method="post" action="{% url 'apply:transfer' job_application_id=job_app_to_transfer.id %}">
{% csrf_token %}

<input type="hidden" name="target_company_id" value="{{ company.pk }}" />
<input type="hidden" name="back_url" value="{{ back_url }}" />

{% itou_buttons_form primary_label="Confirmer" secondary_url=back_url reset_url=reset_url show_mandatory_fields_mention=False %}
</form>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
5 changes: 5 additions & 0 deletions itou/www/apply/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
process_views.JobApplicationOutwardTransferStepEndView.as_view(),
name="job_application_outward_transfer_step_end",
),
path(
"<uuid:job_application_id>/siae/transfer/<int:company_pk>",
process_views.JobApplicationInwardTranferView.as_view(),
name="job_application_inward_transfer",
),
path(
"<uuid:job_application_id>/siae/prior-action/add",
process_views.add_or_modify_prior_action,
Expand Down
35 changes: 35 additions & 0 deletions itou/www/apply/views/process_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 449aa04

Please sign in to comment.