{extends_parent}

{block "main"}
   <main class="main main-sellers">
      <div class="container">
         <div class="row">
            <div class="col-xl-10 col-xl-offset-1 col-xs-12">
               <div class="sellers-header">
                  {include "components/breadcrumbs.tpl" home="{t}Úvodní strana{/t}"}
                  <h1>{$view->getTitle()}</h1>
               </div>
               {get_contexts country=1 assign='contexts'}
               {$countries = $contexts.country->getSupported()}
               {get_sellers groupBy='country' assign='grouped_sellers'}
               {foreach $grouped_sellers as $country => $sellers}
                  <div class="region-wrapper" data-seller-region>
                     <div class="region-header">
                        <span class="country-flag" style="background-image: url('/common/static/images/flags/{$country|lower}.svg')"></span>
                        <p class="title h3">{$countries[$country].name}</p>
                     </div>
                     <div class="row-sellers">
                        {foreach $sellers as $seller}
                           <div class="seller-item">
                              {if $seller.photos}
                                 <a href="{path('shop_seller_seller_detail', ['id_seller' => $seller.id])}">
                                    {foreach $seller.photos|array_slice:0:1 as $photo}
                                       <div class="img">
                                          {$photo_dimensions = $cfg.Photo.types["seller_thumb"].size}
                                          <img src="{get_photo photo=$photo size=18}" class="img-responsive" alt="{$seller.title}"
                                               width="{$photo_dimensions[0]}" height="{$photo_dimensions[1]}" loading="lazy">
                                       </div>
                                    {/foreach}
                                 </a>
                              {/if}
                              <div class="seller-text">
                                 <div>
                                    <p class="uptitle">{$seller.data.city_short}</p>
                                    <p class="title h4">{$seller.title}</p>
                                    <div class="email-wrapper">
                                       {if $seller.phone}
                                          <p><a href="tel:{$seller.phone}">{$seller.phone}</a></p>
                                       {/if}
                                       {if $seller.email}
                                          <p><a href="mailto:{$seller.email}">{$seller.email}</a></p>
                                       {/if}
                                    </div>
                                    <a href="{path('shop_seller_seller_detail', ['id_seller' => $seller.id])}" class="btn btn-secondary">
                                       {t}Detail prodejny{/t}
                                    </a>
                                 </div>
                              </div>
                           </div>
                        {/foreach}
                     </div>
                  </div>
               {/foreach}
            </div>
         </div>
      </div>
   </main>
{/block}

{block onready}{/block}
