{process_pagedata}
{assign var='page_lang' value=$cgsimple->get_root_alias()}
{content assign='continut'}

{Portfolio action="categories" sortby="category_name" allrow='categories'}

{if isset($este_articol)}
<!-- START - ELSEIF $este_articol -->
{global_content name='header'}

    {$continut}

<!-- END - ELSEIF $este_articol -->
{elseif isset($este_categorie) and $este_categorie === true}
<!-- Start - ELSEIF $este_categorie -->

{* Getting the category info by searching in the last item the cat id *}
{foreach from=$categories item=cat}
  {if $items[0]->category_id === $cat.category_id}
    {if 'en' === $page_lang }
      {assign var='ArticleTitle' value=$cat.category_name}
      {assign var='metadescription' value=$cat.meta_desc_cat}
      {assign var='detail_keywords' value=$cat.meta_key_cat}
      {assign var='category_name' value=$cat.category_name}
    {else}
      {assign var='ArticleTitle' value=$cat.category_name}
      {assign var='metadescription' value=$cat.meta_desc_cat_ro}
      {assign var='detail_keywords' value=$cat.meta_key_cat_ro}
      {assign var='category_name' value=$cat.category_name}
    {/if}
  {/if}
{/foreach}

{global_content name='header'}

  <!-- START CONTENT -->
  <div class="content_page pbottom100">
    <div class="text">
      <div class="container">
      <h1>{$category_name}</h1>
        <div class="row">
          <div class="col-md-12 work">
              <ul id="myTab" class="nav nav-tabs nav-tabs-responsive" role="tablist">
              </ul>
              <div role="tabpanel" class="tab-pane fade in active" id="featured" aria-labelledby="featured-tab">
              {if $page_lang == 'ro'}
                {Portfolio summarytemplate='mansory' category=$category_name detailpage='portofoliu' sortby="random"}
              {else}
                {Portfolio summarytemplate='mansory' category=$category_name detailpage='work' sortby="random"}
              {/if}
              </div><!-- ./tab-pane -->
          </div><!-- ./work -->
        </div> <!-- ./ROW -->
      </div><!-- ./container -->
    </div><!-- ./text -->
  </div><!-- ./content_page -->

  <!-- END CONTENT -->
<!-- END - ELSEIF $este_categorie -->
{else}

{global_content name='header'}

<!-- Start Work Page -->

  <!-- START CONTENT -->
  <div class="content_page pbottom100">
    <div class="text">
      <div class="container">
        <div class="row">
          <div class="col-md-12 work">
{$continut}
{global_content name='modal_lets_chat'}
<!-- ============================================================================== -->
    <div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs">
      <ul id="myTab" class="nav nav-tabs nav-tabs-responsive" role="tablist">
        <li role="presentation" class="next">
          <a href="#design" role="tab" id="design-tab" data-toggle="tab" aria-controls="design">
            <span class="text">{if $page_lang == 'ro'}Dupa Categorie{else}by Design Type{/if}</span>
          </a>
        </li>
        <li role="presentation" class="next">
          <a href="#industry" role="tab" id="industry-tab" data-toggle="tab" aria-controls="industry">
            <span class="text">{if $page_lang == 'ro'}Dupa Industrie{else}by Industry{/if}</span>
          </a>
        </li>
        <li role="presentation" class="next">
          <a href="#brand" role="tab" id="brand-tab" data-toggle="tab" aria-controls="brand">
            <span class="text">{if $page_lang == 'ro'}Dupa Brand{else}by Brand{/if}</span>
          </a>
        </li>
        <li role="presentation" class="active">
          <a href="#featured" id="featured-tab" role="tab" data-toggle="tab" aria-controls="featured" aria-expanded="true">
            <span class="text">{if $page_lang == 'ro'}Recomandate{else}Featured{/if}</span>
          </a>
        </li>
      </ul>
<div id="myTabContent" class="tab-content">
        <!-- ============ Featured -->
        <div role="tabpanel" class="tab-pane fade in active" id="featured" aria-labelledby="featured-tab">
          {if $page_lang == 'ro'}
            {Portfolio summarytemplate='mansory' category=$category_name detailpage='portofoliu' sortby="random"}
          {else}
            {Portfolio summarytemplate='mansory' category=$category_name detailpage='work' sortby="random"}
          {/if}
        </div>



        <!-- ============ By BRAND -->
        <div role="tabpanel" class="tab-pane fade" id="brand" aria-labelledby="brand-tab">
          
          {if !empty($categories)}
            {assign var='first_letter' value=''}

            {foreach from=$categories item=cat1}
              {if $first_letter === $cat1.category_name|substr:0:1} {continue} {/if}
              {assign var='first_letter' value=$cat1.category_name|substr:0:1}
              <div class="row">
                  <div class="title">
                      {$first_letter|upper}
                  </div>
                  <div class="content">
                    <ul class='workk'>
                        {foreach from=$categories item=categ name='foo'}
                            {if $categ.category_name|substr:0:1 === $first_letter and $categ.count > 0}
                              <li><a href="{$categ.url}">{$categ.category_name}</a></li>
                            {else if $categ.category_name|substr:0:1 === $first_letter}
                              <li>{$categ.category_name}</li>
                            {/if} 
                        {/foreach}
                    </ul>
                  </div> <!-- content -->
              </div><!-- ./ROw -->
            {/foreach}
            {/if}
        </div>


        <!-- ============ By Industry -->
        <div role="tabpanel" class="tab-pane fade" id="industry" aria-labelledby="industry-tab">
          {portfolio_by_industry assign='industries'}

          {if !empty($industries)}

            {foreach from=$industries item=industry}

              {assign 'has_item' value=false}
              {foreach from=$categories item=cat_test}
                {if $industry.value === $cat_test.industry} {assign 'has_item' value=true} {/if}
              {/foreach}

              {if true === $has_item}
              <div class="row">
                <div class="title">
                  {$industry.title}
                </div>
                <div class="content">
                  <ul class='workk'>
                  {foreach from=$categories item=cat_industry}
                    {if $industry.value === $cat_industry.industry}
                      {if $cat_industry.count > 0}
                        <li><a href="{$cat_industry.url}">{$cat_industry.category_name}</a></li>
                      {else}
                        <li>{$cat_industry.category_name}</li>
                      {/if}
                    {/if}
                  {/foreach}
                  </ul>
                </div>
              </div><!-- ./row -->
              {/if}
            {/foreach}

          {/if}
        </div> <!-- ./By industry -->

        <!-- ============ By Design Type -->
        <div role="tabpanel" class="tab-pane fade" id="design" aria-labelledby="design-tab">
          {portfolio_by_design_type assign='design_types'}
            {if !empty($design_types)}
            {foreach from=$design_types item=dtype}
{if $page_lang == 'ro'}
                {Portfolio detailpage='portofoliu' filter_9_equal=$dtype.value allrow='items_design'}
{else}
                {Portfolio detailpage='work' filter_9_equal=$dtype.value allrow='items_design'}
{/if}
                  {if !empty($items_design)}
                    <h3>
                      {$dtype.title}
                    </h3>
                    <div>
                      <ul class='mansory list-unstyled'>
                        <div class="grid-sizer"></div>
                          {foreach from=$items_design item=item_dtype}
                            <div class="item">
                                <div class="well"> 
                                  <a href="{$item_dtype->link}" title="{$item_dtype->title}">
                                    <img src="{$item_dtype->file_location}/{$item_dtype->fields.featured_image.value}" alt="{$item_dtype->title}" title="{$item_dtype->title}">
                                    <div class="hover_mansory">
                                      <div class="details">
                                        <strong>{$item_dtype->category_name}</strong>
                                        {if $page_lang == 'en'}
                                          <span>{$item_dtype->title}</span>
                                        {else}
                                          {if !empty($item_dtype->title_ro)}
                                          <span>{$item_dtype->title_ro}</span>
                                          {else}
                                          <span>{$item_dtype->title}</span>
                                          {/if}
                                        {/if}
                                      </div>
                                    </div>
                                  </a>
                                </div>
                            </div>
                        {/foreach}
                      </ul>
                    </div>
                  {/if}
            {/foreach}
          {/if}
        </div> <!-- ./By design type -->

      </div>
    </div>
<!-- ============================================================================== -->
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- END CONTENT -->

<!-- END Work Page -->
{/if}

  {global_content name='footer'}