Skip to content

Commit

Permalink
improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Jan 7, 2025
1 parent 46e07ca commit 3cb60f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions itou/templates/apply/process_refuse.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ <h2 class="mb-3 mb-md-4">
$('input[name="reason-refusal_reason"]').change(function() {
manageWarningSection(this.value);
});

// Batch mode field names
manageWarningSection($('input[name="refusal_reason"]:checked').val());
$('input[name="refusal_reason"]').change(function() {
manageWarningSection(this.value);
});
});
</script>
{% endif %}
Expand Down
12 changes: 11 additions & 1 deletion itou/www/apply/views/batch_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django_xworkflows import models as xwf_models

from itou.companies.models import Company
from itou.job_applications import enums as job_applications_enums
from itou.job_applications.models import JobApplication
from itou.utils.auth import check_user
from itou.utils.perms.company import get_current_company_or_404
Expand Down Expand Up @@ -274,15 +275,24 @@ def get_form(self):

def get_context_data(self, **kwargs):
# TODO: provide more info to template to show correct wording
return super().get_context_data(**kwargs) | {
context = super().get_context_data(**kwargs) | {
"job_applications": self.applications,
"can_view_personal_information": True, # SIAE members have access to personal info
"matomo_custom_title": "Candidature refusée",
"matomo_event_name": f"batch-refuse-applications-{self.step}-submit",
"wizard": {"steps": self.steps_info, "form": self.form},
"form": self.form,
"reset_url": self.reset_url,
"RefuseViewStep": RefuseViewStep,
}
if self.step != RefuseViewStep.REASON:
reason_data = self.wizard_session.get("data", {}).get(RefuseViewStep.REASON, {})

if refusal_reason := reason_data.get("refusal_reason"):
context["refusal_reason_label"] = job_applications_enums.RefusalReason(refusal_reason).label
context["refusal_reason_shared_with_job_seeker"] = reason_data.get("refusal_reason_shared_with_job_seeker")

return context

def post(self, request, *args, **kwargs):
if self.form.is_valid():
Expand Down

0 comments on commit 3cb60f9

Please sign in to comment.