{{#restrict section="config" level="admin" block=true}}{{/restrict}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}}

{{* barre de navigation *}}
{{:include file="/%s/_nav.html"|args:$module.name current="entrees"}}

{{if $_GET.ok}}
	<p class="block confirm">{{$_GET.msg}}</p>
{{elseif $_GET.err}}
        <p class="block error">{{$_GET.msg}}</p>
{{/if}}

<form method="post" action="">
  <fieldset class="entree">
    <legend>Ajouter une entrée pour du </legend>
    {{:linkbutton label="Matériel répertorié" shape="plus" href="repertorie.html?dialog" target="_dialog"}}
    {{:linkbutton label="Matériel non répertorié" shape="plus" href="non_repertorie.html?dialog" target="_dialog"}}
    {{:linkbutton label="Retour de sortie temporaire" shape="plus" href="retour.html?dialog" target="_dialog"}}
  </fieldset>
</form>

{{* lister les entrées *}}
<section class="liste_entrees">
  <h2>Liste des entrées</h2>

  {{#list
    select="
      $$.date AS 'Date' ;
      $$.inputNature AS 'Type' ;
      $$.amount AS 'Nombre' ;
      (SELECT $$.designation
        FROM @TABLE AS b
        WHERE b.key = @TABLE.$$.equipment)
      AS 'Matériel' ;
      $$.comment AS 'Remarques'"
    type="movement"
    direction="entrée"
    order=1}}

    {{:assign var='mvt_key' value=$key}}
      <tr>
        <td>{{$date|date_short}}</td>
        <td>{{$inputNature}}</td>
        <td>{{$amount}}</td>
        <td>{{$col4}}</td> 
        <td>{{$comment}}</td>
        <td class="actions">
        {{:linkbutton
            label="Supprimer"
            href="delete_entree.html?key=%s"|args:$mvt_key
            shape="delete"
            target="_dialog"}}
        {{:linkbutton
            label="Modifier"
            href="modifier_entree.html?key=%s"|args:$mvt_key
            shape="edit"
            target="_dialog"}}
        </td>
      </tr>
  {{/list}}
</section>

{{:admin_footer}}