Skip to content

Commit

Permalink
Handle employee record creation while user is filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag committed May 2, 2024
1 parent 6900e0f commit 1fac86f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
21 changes: 21 additions & 0 deletions itou/templates/employee_record/includes/list_form_fields.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% load django_bootstrap5 %}
{% load list_filters %}
<div id="employee-records-list-filters" class="c-aside-filters__card__body"{% if request.htmx %} hx-swap-oob="true"{% endif %}>
<fieldset>
<legend>Statut</legend>
<div class="form-group">
{% for status, badge in form.status|zip:badges %}
<div class="d-flex mb-2">
<div class="flex-grow-1">{{ status }}</div>
<div>
<span class="badge rounded-pill badge-xs {{ badge.1 }}">{{ badge.0 }}</span>
</div>
</div>
{% endfor %}
</div>
</fieldset>
<fieldset>
<legend>Par candidat</legend>
{% bootstrap_field filters_form.job_seekers show_label=False %}
</fieldset>
</div>
1 change: 1 addition & 0 deletions itou/templates/employee_record/includes/list_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ <h3 class="h4 m-0">{{ counter }} résultat{{ counter|pluralizefr }}</h3>
</div>
{% if request.htmx %}
{% include "employee_record/includes/list_status_help.html" with request=request status=form.status.value only %}
{% include "employee_record/includes/list_form_fields.html" %}
{% endif %}
25 changes: 2 additions & 23 deletions itou/templates/employee_record/list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% extends "layout/base.html" %}
{% load static %}
{% load list_filters %}
{% load django_bootstrap5 %}

{% block title %}Fiches salarié ASP - {{ request.current_organization.display_name }} {{ block.super }}{% endblock %}

Expand Down Expand Up @@ -66,27 +64,8 @@ <h2 class="h3">Nous transférons vos fiches salarié à l'ASP afin de vous faire
</button>
<div class="c-aside-filters__card collapse show" id="asideFiltersCollapse">
<form hx-get="{% url 'employee_record_views:list' %}" hx-trigger="change delay:.5s" hx-indicator="#employee-records-container" hx-target="#employee-records-container" hx-swap="outerHTML" hx-push-url="true">
<div class="c-aside-filters__card__body">
<fieldset>
<legend>Statut</legend>
<div class="form-group">
{% for status, badge in form.status|zip:badges %}
<div class="d-flex mb-2">
<div class="flex-grow-1">{{ status }}</div>
<div>
<span class="badge rounded-pill badge-xs {{ badge.1 }}">{{ badge.0 }}</span>
</div>
</div>
{% endfor %}
</div>
</fieldset>
{# Job seeker filter #}
<fieldset>
<legend>Par candidat</legend>
{% bootstrap_field filters_form.job_seekers show_label=False %}
</fieldset>
</div>
{# Filled via jQuery #}
{% include "employee_record/includes/list_form_fields.html" %}
{# Filled via jQuery. Does not need reloading with HTMX, its content is static. #}
{{ form.order.as_hidden }}
</form>
</div>
Expand Down

0 comments on commit 1fac86f

Please sign in to comment.