prepare thirdparty index template

This commit is contained in:
Mathieu Jaumotte 2021-07-16 09:52:54 +02:00
parent 08e396195c
commit d2c631ae20
3 changed files with 105 additions and 59 deletions

View File

@ -48,4 +48,12 @@ div.chill_contact {
content: '\f095';
}
}
}
}
div.thirdparty-list {
label.counter {
float: right;
span {
font-weight: bold;
}
}
}

View File

@ -3,64 +3,101 @@
{% block title 'List of third parties'|trans %}
{% block content %}
<div class="col-10 centered">
<h1>{{ 'List of third parties'|trans }}</h1>
{% if third_parties|length == 0 %}
<p class="chill-no-data-statement">{{ 'No third parties'|trans }}</p>
{% else %}
<table>
<thead>
<tr>
<th style="width: 35px;"></th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Category'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for tp in third_parties %}
<tr>
<th>{{ (tp.active ? '<i class="fa fa-check chill-green">' : '<i class="fa fa-times chill-red">')|raw }}</th>
<td>{{ tp.name }}</td>
{% set types = [] %}
{% for t in tp.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<td>{{ types|join(', ') }}</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_update', { 'thirdparty_id': tp.id }) }}" class="btn btn-update"></a>
</li>
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': tp.id }) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="thirdparty-list my-5">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{% if third_parties|length < pagination.getTotalItems %}
{{ chill_pagination(pagination) }}
{% endif %}
<h1>{{ 'List of third parties'|trans }}</h1>
{% endif %}
{% if third_parties|length == 0 %}
<p class="chill-no-data-statement">{{ 'No third parties'|trans }}</p>
{% else %}
{% if is_granted('CHILL_3PARTY_3PARTY_CREATE') %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_new') }}" class="btn btn-create">
{{ "New third party"|trans }}
</a>
{% endif %}
<nav class="filter-actions border border-secondary my-4 p-3">
filter nav
</nav>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<label class="counter">
<span>xxx</span> {{ 'third parties'|trans }}
</label>
<table class="table table-striped table-hover align-middle">
<thead>
<tr>
<th class="chill-pink" style="width: 35px;"></th>
<th class="chill-pink">{{ 'Name'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink">{{ 'Category'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink">{{ 'Address'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink"></th>
</tr>
</thead>
<tbody>
{% for tp in third_parties %}
<tr>
<th>{{ (tp.active ? '<i class="fa fa-check chill-green">' : '<i class="fa fa-times chill-red">')|raw }}</th>
<td>{{ tp.name }}</td>
{% set types = [] %}
{% for t in tp.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<td>{{ types|join(', ') }}</td>
<td>
{{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_update', { 'thirdparty_id': tp.id }) }}" class="btn btn-update"></a>
</li>
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': tp.id }) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if third_parties|length < pagination.getTotalItems %}
{{ chill_pagination(pagination, 'long') }}
{% endif %}
{% endif %}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<select class="form-select" aria-label="itemsPerPage">
<option value="20">20 / page</option>
<option value="50">50 / page</option>
<option value="100">100 / page</option>
</select>
</li>
{% if is_granted('CHILL_3PARTY_3PARTY_CREATE') %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_new') }}" class="btn btn-create">
{{ "New third party"|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,5 +1,6 @@
Third party: Tiers
Third parties: Tiers
third parties: tiers
name: Nom
telephone: Téléphone
adress: Adresse
@ -11,7 +12,7 @@ thirdparty.No_phonenumber: Aucun numéro de téléphone
thirdparty.No_email: Aucun email
thirdparty.No_comment: Aucun commentaire
New third party: Nouveau tiers
New third party: Ajouter un nouveau tiers
Show third party %name%: Tiers "%name%"
Create third party: Créer un tiers
Update third party %name%: Mettre à jour "%name%"
@ -28,4 +29,4 @@ No third parties: Aucun tiers
# ROLES
CHILL_3PARTY_3PARTY_CREATE: Ajouter un Tiers
CHILL_3PARTY_3PARTY_SHOW: Voir un Tiers
CHILL_3PARTY_3PARTY_UPDATE: Modifier un Tiers
CHILL_3PARTY_3PARTY_UPDATE: Modifier un Tiers