
{% extends '@ajax-layout/layout.twig' %}

{% block body %}



	<div class="modal-body clearfix">
	
		<div id="code-gestion">
			

			<div id="treeview" class="treeview">
			</div>
			<div class="border-top">
				<button class="button principal button_right" onclick="choixUO('{{ post.input }}', '{{ post.divCode }}');">{{ 'Valider'|trad }}</button>
			</div>

		
    		<script>

                $('#treeview').treeview({
                    'data': {{ treeCG | json }},
                    'showTags': false,
                    'levels': 1,
                    'enableLinks': true,
                });

                function choixUO(input, idInputCS)
                {
					//alert(',jg');
                	id= $('#treeview li.node-selected').find('a').attr('href').substr(1);
                	idSplit = id.split(separateur);
                	
                	if(input)
                	{
                    	$('#input_'+input).val(idSplit[0]);
                    	$('#text_'+input).val(idSplit[1]+' ('+idSplit[0]+')');
                	}
                	
                	if(idInputCS)
                	{
                		$('#'+idInputCS).val(idSplit[0]);
                	}
                	desactivePopup();
               	}

            </script>
			<style>
				.node-treeview:hover .imagePoint {
					  opacity: 0.7;
				}

				.imagePoint {
					  opacity: 0;
				}
			</style>
		</div>
    </div>

{% endblock %}