Liste dynamique triable des clients + export CSV/ODS

This commit is contained in:
bohwaz 2021-12-17 13:01:05 +01:00
parent 6db516f5b2
commit 440b2e3e66
3 changed files with 70 additions and 59 deletions

View file

@ -1,65 +1,45 @@
{include file="admin/_head.tpl" title="Clients — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id js=1}
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="clients"}
{form_errors}
{if $list->count()}
{include file="common/dynamic_list_head.tpl"}
<form method="post" action="{$self_url}" class="memberList">
{if !empty($clients)}
<table class="list">
<thead class="userOrder">
{foreach from=$list->iterate() item="row"}
<tr>
{* FIXME
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
<td class="check"><input type="checkbox" title="Tout cocher / décocher" /></td>
{/if}
*}
{foreach from=$champs key="c" item="champ"}
<td>{if $c == "numero"}#{else}{$champ.title}{/if} </td>
<td>{$row.id}</td>
<th><a href="client.php?id={$row.id}">{$row.nom}</a></th>
{foreach from=$row item="value" key="key"}
{if $key == 'id' || $key == 'nom'}
<?php continue; ?>
{/if}
<td>{$value}</td>
{/foreach}
<td></td>
</tr>
</thead>
<tbody>
{foreach from=$clients item="membre"}
<tr>
{* FIXME
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
<td class="check">
{input type="checkbox" name="selected" value=$membre.id default=0}
<td class="actions">
{linkbutton shape="user" href="client.php?id=%d"|args:$row.id label="Fiche client"}
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)}
{linkbutton shape="edit" href="client_modifier.php?id=%d"|args:$row.id label="Modifier"}
{/if}
</td>
{/if}
*}
{foreach from=$champs key="c" item="cfg"}
<td>
{if $c == 'nom'}<a href="{plugin_url file="client.php"}?id={$membre.id}">{/if}
{$membre->$c}
{if $c == 'nom'}</a>{/if}
</td>
{/foreach}
<td class="tabs">
{linkbutton shape="user" href="client.php?id=%d"|args:$membre.id label="Fiche client"}
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)}
{linkbutton shape="edit" href="client_modifier.php?id=%d"|args:$membre.id label="Modifier"}
{/if}
</td>
</tr>
{/foreach}
</tr>
{/foreach}
</tbody>
{* FIXME
{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN)}
{include file="%s/templates/_list_actions.tpl"|args:$plugin_root colspan=count((array)$champs)}
{/if}
*}
</table>
<p class="help">
Export de la liste&nbsp;:
{linkbutton href="?export=csv" label="Export CSV" shape="download"}
{linkbutton href="?export=ods" label="Export tableur" shape="download"}
</p>
{else}
<p class="alert block">
Aucun client trouvé.
</p>
{/if}
</form>
{form_errors}
<form method="post" action="{$self_url}">
<fieldset>