{{* -*- brindille -*- *}}

{{:admin_header title="Configuration" current="module_equipment"}}

{{* barre de navigation *}}
{{:include file="_nav.html" current="config" subcurrent="typesES"}}

{{if $_GET.ok}}
	<p class="block confirm">Configuration enregistrée.</p>
{{/if}}

{{* lecture config (défaut ou enregistrée) *}}
{{:include file="./_get_config.html" keep="config"}}

{{* types d'entrées *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
	{{:assign var='input_types.%s'|args:$type value=$type}}
{{/foreach}}

{{* types d'entrées qui ne peuvent être supprimées *}}
{{#load type="movement" where="$$.direction='input'" group="$$.input_nature"}}
    {{:assign var="locked_inputs." value=$input_nature}}
{{/load}}

{{* types de sorties *}}
{{#foreach from=$config.output_nature key="label" item="type"}}
	{{:assign var='output_types.%s'|args:$type value=$type}}
{{/foreach}}

{{* types de sorties qui ne peuvent être supprimées *}}
{{#load type="movement" where="$$.direction='output'" group="$$.output_nature"}}
    {{:assign var="locked_outputs." value=$output_nature}}
{{/load}}

<h2>Types d'entrées</h2>
<table class="list">
	<thead>
		<tr>
			<th>Libellé</th>
			<th>Type</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		{{#foreach from=$config.input_nature key="label" item="type"}}
			<tr>
				<td>{{$label}}</td>
				<td>{{$type}}</td>
				<td class="actions">
					{{if ! $locked_inputs|has:$label}}
						{{:linkbutton label="Supprimer" shape="minus" href="config/supprimer_type_mouvement.html?dir=input&mvt=%s"|args:$label target="_dialog"}}
					{{/if}}
						{{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
				</td>
			</tr>
		{{/foreach}}
	</tbody>
</table>

<h2>Types de sorties</h2>
<table class="list">
	<thead>
		<tr>
			<th>Libellé</th>
			<th>Type</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		{{#foreach from=$config.output_nature key="label" item="type"}}
			<tr>
				<td>{{$label}}</td>
				<td>{{$type}}</td>
				<td class="actions">
					{{if ! $locked_outputs|has:$label}}
						{{:linkbutton label="Supprimer" shape="minus" href="config/supprimer_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
					{{/if}}
						{{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
				</td>
			</tr>
		{{/foreach}}
	</tbody>
</table>

{{:admin_footer}}