{# This file is not used ! #}

{% macro renderCategoryValue(categoryValue, subcategoriesCount) %}

{% set activeChildrenCount = 0 %}
{% for optionValue in categoryValue.children %}
	{% if optionValue.option.displayInInfoBar %}
		{% set activeChildrenCount = activeChildrenCount + 1 %}
	{% endif %}
{% endfor %}	
{% set displayThisCategoryValue = activeChildrenCount > 0 %}

{% set displayThisCategoryValue = categoryValue.category.name and activeChildrenCount > 0 
																	or categoryValue.category.isRootCategory %}
{% if displayThisCategoryValue %}
	<div class="category-wrapper">
	{% if subcategoriesCount > 1 %}
		<div class="category-name">{{ categoryValue.category.name }}</div>
	{% endif %}
{% endif %}

{% for optionValue in categoryValue.children %}
	{% if optionValue.option.displayInInfoBar %}
		{% set displayFirstCategoryInline = not categoryValue.category.enableDescription 
											and optionValue.children.length > 0 
											and optionValue.children[0].isLastCategoryDepth 
											and not optionValue.children[0].category.enableDescription %}
		<!-- <div>{{ optionValue.option.name }} : {{ optionValue.children.length }}, {{ optionValue.children[0].isLastCategoryDepth }}</div> -->
		{% set colWidth = 's6 m5' if (option.enableDescription or categoryValue.category.enableDescription) else 's12' %}
		<div class='row'>
			<span class="option-value col {{ colWidth }}">

				{% set iconClass = optionValue.option.icon if optionValue.option.icon else 'gogo-icon-angle-right' %}	
				{% set iconColorId = optionValue.option.id if optionValue.option.icon else '' %}	
				{% if iconClass %}    
					<span class="icon {{ iconClass }} gogo-color-as" option-id={{ iconColorId }} ></span>
				{% endif %}
					
				<span class="option-name {{ optionValue.diff }}" option-id={{ optionValue.option.id }} >
					{{ optionValue.option.nameShort }}
				</span> 

				{% if displayFirstCategoryInline %}
					<span class="inline-option">(
						{% for suboptionValue in optionValue.children[0].children %} 
							<span class="{{ suboptionValue.diff }}">{{ suboptionValue.option.name }} {% if not loop.last %}, {% endif %}</span> 
						{% endfor %})
					</span>
				{% endif %}

			</span>
			{% if option.enableDescription or categoryValue.category.enableDescription %}
				<span class="col s6 m7 option-description"><span class="{{ optionValue.diff }}">{{ optionValue.description|safe }}</span></span>
			{% endif %}
		</div>
  	{% endif %}

	{% set subcategoriesCount = optionValue.children.length %}
	{% if displayFirstCategoryInline %}{% set subcategoriesCount = subcategoriesCount - 1 %}{% endif %}

	{% for subcategory in optionValue.children %}

		{% if not (loop.first and displayFirstCategoryInline) %}
			{{ renderCategoryValue(subcategory, subcategoriesCount) }}
		{% endif %}

	{% endfor %} 
	
{% endfor %} 

{% if displayThisCategoryValue %}
	<!-- div end for category-wrapper -->
	</div>
{% endif %}

{% endmacro %}