<? $i = ( $this -> current_page - 1 ) * 10 + 1;?>
<? foreach ( $this -> products as $product ):?>
  <tr>
    <td>
      <?= $i++;?>
    </td>
    <td>
      <div class="product-image">
        <? if ( $product['images'][0]['src'] ):?>
          <img src="<?= $product['images'][0]['src'];?>" alt="<?= $product['images'][0]['alt'];?>" class="img-responsive">
        <? else:?>
          <img src="/admin/layout/images/no-image.png" alt="Brak zdjęcia" class="img-responsive">
        <? endif;?>
      </div>
      <div class="product-name">
        <a href="/admin/shop_product/product_edit/id=<?= $product['id'];?>">
          <?= $product['languages']['pl']['name'];?>
        </a>
        <a href="#" class="text-muted duplicate-product" product-id="<?= $product['id'];?>">duplikuj</a>
      </div>
      <small class="text-muted"><?= \admin\factory\ShopProduct::product_categories( $product['id'] );?></small>
    </td>
    <td class="text-center">
      <input type="text" class="product-price form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto'];?>" style="max-width: 75px;">
    </td>
    <td class="text-center">
      <input type="text" class="product-price-promo form-control text-right" product-id="<?= $product['id'];?>" value="<?= $product['price_brutto_promo'];?>" style="max-width: 75px;">
    </td>
    <td class="text-center">
      <?= $product['promoted'] ? '<span class="text-success text-bold">tak</span>' : 'nie';?>
    </td>
    <td class="text-center">
      <?= $product['status'] ? 'tak' : '<span class="text-danger text-bold">nie</span>';?>
    </td>
    <td class="text-center">
      <span class="text-muted"><?= (int)\admin\factory\shopProduct::get_product_quantity_list( $product['id'] );?></span>
    </td>
    <td class="text-center">
      <?
        if ( $product['baselinker_product_name'] != "" ) {
          echo "<span title='" . htmlspecialchars( $product['baselinker_product_name'] ) . "'>" . mb_substr( $product['baselinker_product_name'], 0, 25, 'UTF-8' ) . "...</span>";
          echo "<br>";
          echo "<span class='text-danger baselinker-delete-linking' product-id='" . $product['id'] . "'>";
            echo "<i class='fa fa-times'></i>usuń powiązanie";
          echo "</span>";
        } else {
          echo "<span class='text-danger baselinker-product-search' product-id='" . $product['id'] . "'>";
            echo "nie przypisano <i class='fa fa-search'></i>";
          echo "</span>";
        }
      ?>
    </td>
    <td class="text-center">
      <?
        if ( $product['apilo_product_name'] != "" ) {
          echo "<span title='" . htmlspecialchars( $product['apilo_product_name'] ) . "'>" . mb_substr( $product['apilo_product_name'], 0, 25, "UTF-8" ) . "...</span>";
          echo "<br>";
          echo "<span class='text-danger apilo-delete-linking' product-id='" . $product['id'] . "'>";
            echo "<i class='fa fa-times'></i>usuń powiązanie";
          echo "</span>";
        } else {
          echo "<span class='text-danger apilo-product-search' product-id='" . $product['id'] . "'>";
            echo "nie przypisano <i class='fa fa-search'></i>";
          echo "</span>";
        }
      ?>
    </td>
    <td>
      <a href='/admin/shop_product/product_combination/product_id=<?= $product['id'];?>'>kombinacje (<?= \admin\factory\shopProduct::count_product_combinations( $product['id'] );?>)</a>
    </td>
    <td class="text-center">
      <a href='/admin/shop_product/product_edit/id=<?= $product['id'];?>'>edytuj</a>
    </td>
    <td class="text-center">
      <a href='/admin/shop_product/product_unarchive/product_id=<?= $product['id'];?>' class="product-unarchive">przywróć</a>
    </td>
  </tr>
<? endforeach;?>