{% import 'common/thumbnail.html.twig' as thumbnail %}

<div class="PNB header">
  <table>
    <tr>
      <td>
          {% transchoice Total %}
            {0} No results|{1} Result|]1,Inf[ Results
          {% endtranschoice %}
      </td>
    </tr>
  </table>
</div>
<div class="PNB datas">
  <div class="PNB" style="right:10px">
  {% for Basket in Baskets %}
    <div class="result {{ Basket.getArchived ? '' : 'unarchived' }}">
      <a href="{{ path('basket_delete', {basket: Basket.getId()}) }}" class="delete-basket close icon-baseline-close-24px" title="{% trans %}Delete basket{% endtrans %}" style="color:#fff;padding:2px">&nbsp;</a>
      <div class="PNB10 rightBrowserInner">
        <div class="item-table">

            <div class="thumbnail">
              {% set BasketElement = Basket.getElements().first() %}
              {% if BasketElement %}
                {{thumbnail.format(BasketElement.getRecord(app).get_thumbnail(), 150, 106, '', true, false)}}
              {% endif %}
            </div>
            <div class="content">
              <h1 class="title">
                <img class="loader" src="/assets/prod/images/Basket/Browser/loader.gif" />
                {% if Basket.getValidation() is empty or Basket.getValidation().isInitiator(app.getAuthenticatedUser()) %}
                <a href="{{ path('prod_baskets_basket_archive', { 'basket' : Basket.getId(), 'archive' : 1 }) }}" class="archiver archive_toggler" style="display:{{ Basket.getArchived ? 'none' : '' }};">
                  &nbsp;
                </a>
                <a href="{{ path('prod_baskets_basket_archive', { 'basket' : Basket.getId(), 'archive' : 0 }) }}" class="unarchiver archive_toggler" style="display:{{ Basket.getArchived ? '' : 'none' }};">
                 &nbsp;
                </a>
                {% endif %}
                <a class="basket_link" href="{{ path('prod_workzone_basket', { basket : Basket.getId() }) }}">
                    <span>{{ Basket.getName() }}</span>
                <br><span class="basketCount">
                        {{ Basket.getElements().count() }} {{ ' records' }}
                  </span></a>
              </h1>


              {% if Basket.getPusher() %}
              <p>
                {% set user_name = '<a href="/user/' ~ Basket.getPusher().getId() ~ '/" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Basket.getPusher(app).getId() }) ~ '" class="UserTips">' ~ Basket.getPusher(app).getDisplayName() ~ '</a>' %}
                {% trans with {'%user_name%' : user_name} %}Received from %user_name%{% endtrans %}
              </p>
              {% endif %}


              {% if Basket.getValidation() %}
              <p>
                {% set list_participants = '' %}
                {% for Participant in Basket.getValidation().getParticipants() %}

                  {% if list_participants != '' %}
                    {% set list_participants = list_participants ~ ', ' %}
                  {% endif %}

                  {% set list_participants = list_participants ~ '<a class="UserTips" tooltipsrc="' ~ path('prod_tooltip_user', { 'usr_id' : Participant.getUser().getId() }) ~ '"  href="/user/' ~ Participant.getUser().getId() ~ '/">' %}
                  {% set list_participants = list_participants ~ Participant.getUser().getDisplayName() %}
                  {% set list_participants = list_participants ~ '</a>' %}
                {% endfor %}
                {% trans with {'%list_participants%' : list_participants} %}Sent for validation to %list_participants%{% endtrans %}
              </p>
              {% endif %}

            </div>
            <td>

            </td>
        </div>
      </div>
    </div>
    {% endfor %}
    </div>
  </div>
  <div class="PNB footer">
    <table>
      <tr>
        <td>
          {% if Total == 0 %}
            {{ 'No results' | trans }}
          {% elseif Total == 1 %}
            {{ '1 result' | trans }}
          {% else %}
            {% trans with {'%Total%' : Total} %}%Total% results{% endtrans %}
          {% endif %}
        </td>
        <td class="paginator">
          {% if Page - 1  > 0 %}
          <a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page - 1) }) }}" class="result prev_res icon-round-chevron_left-24px">&nbsp;</a>
          {% endif %}
          <span>
            Page {{ Page }} / {{ MaxPage }}
          </span>
          {% if Page + 1  <= MaxPage %}
          <a href="{{ path('prod_workzone_search', { 'Query' : Query, 'Year' : Year, 'Type' : Type, 'Page' : (Page + 1) }) }}" class="result next_res icon-round-chevron_right-24px">&nbsp;</a>
          {% endif %}
        </td>
      </tr>
    </table>
  </div>

