{% if categories %}
<div class="container">
  <nav id="menu" class="navbar">
    <div class="navbar-header"><span id="category" class="visible-xs">{{ text_category }}</span>
      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav">
        {% for category in categories %}
        {% if category.children %}
        <li class="dropdown grandchild{{ loop.index }}">
          <!-- <a href="{{ category.href }}" class="dropdown-toggle" data-toggle="dropdown">{{ category.name }}</a> -->
          <a href="{{ category.href }}" class="dropdown-toggle" data-toggle="">{{ category.name }}</a>
          <div class="dropdown-menu">
            <div class="dropdown-inner row"> {% for children in category.children|batch(category.children|length / category.column|round(1, 'ceil')) %}
              <div class="col-sm-12 ch-menu-col">
                <ul class="list-unstyled row ch-menu">
                  {% for child in children %}
                  <li class="col-sm-6 ch-menuli">
                    <a href="{{ child.href }}" class="grandchildren">{{ child.name }}</a>
                    {% if child.children %}
                            <ul class="grandchildmenu" style="">
                                {% for children in child.children %}
                                    <li><a href="{{ children.href }}">{{ children.name }}</a></li>
                                {% endfor %}
                            </ul>
                        {% endif %}
                  </li>
                  {% endfor %}
                </ul>
              </div>
              {% endfor %}</div>
            {#<a href="{{ category.href }}" class="see-all">{{ text_all }} {{ category.name }}</a>#} </div>
        </li>
        {% else %}
        <li><a href="{{ category.href }}">{{ category.name }}</a></li>
        {% endif %}
        {% endfor %}
      </ul>
    </div>
  </nav>
</div>
{% endif %}
