<? $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 product-categories"><?= \admin\factory\ShopProduct::product_categories( $product['id'] );?></small>
      <small class="text-muted product-categories">SKU: <?= $product['sku'];?>, EAN: <?= $product['ean'];?></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="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="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>
    <? if ( $this -> baselinker_enabled ):?>
      <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>
    <? endif;?>
    <? if ( $this -> apilo_enabled ):?>
      <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>
    <? endif;?>
    <!-- sellasist -->
    <? if ( $this -> sellasist_enabled ):?>
      <td class="text-center">
        <?
          if ( $product['sellasist_product_name'] != "" ) {
            echo "<span title='" . htmlspecialchars( $product['sellasist_product_name'] ) . "'>" . mb_substr( $product['sellasist_product_name'], 0, 25, "UTF-8" ) . "...</span>";
            echo "<br>";
            echo "<span class='text-danger sellasist-delete-linking' product-id='" . $product['id'] . "'>";
              echo "<i class='fa fa-times'></i>usuń powiązanie";
            echo "</span>";
          } else {
            echo "<span class='text-danger sellasist-product-search' product-id='" . $product['id'] . "'>";
              echo "nie przypisano <i class='fa fa-search'></i>";
            echo "</span>";
          }
        ?>
      </td>
    <? endif;?>
    <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_archive/product_id=<?= $product['id'];?>' class="product-delete">usuń</a>
    </td>
  </tr>
  <? if ( $this -> show_xml_data ):?>
    <tr>
      <td colspan="12">
        <div class="product-xml-data">
          <!-- input nazwa produktu XML -->
          <input type="text" class="form-control product_xml_name" value="<?= $product['languages']['pl']['xml_name'];?>" placeholder="Nazwa produktu XML (PL)" product-id="<?= $product['id'];?>" lang-id="pl">
          <!-- input custom_label_0 -->
          <div class="custom_label_0_container">
            <input type="text" class="form-control custom_label_0" value="<?= $product['custom_label_0'];?>" placeholder="custom_label_0" product-id="<?= $product['id'];?>" label-type="custom_label_0">
            <div class="custom_label_0_suggestions" label-type="custom_label_0"></div>
          </div>
          <!-- input custom_label_1 -->
          <div class="custom_label_1_container">
            <input type="text" class="form-control custom_label_1" value="<?= $product['custom_label_1'];?>" placeholder="custom_label_1" product-id="<?= $product['id'];?>" label-type="custom_label_1">
            <div class="custom_label_1_suggestions" label-type="custom_label_1"></div>
          </div>
          <!-- input custom_label_2 -->
          <div class="custom_label_2_container">
            <input type="text" class="form-control custom_label_2" value="<?= $product['custom_label_2'];?>" placeholder="custom_label_2" product-id="<?= $product['id'];?>" label-type="custom_label_2">
            <div class="custom_label_2_suggestions" label-type="custom_label_2"></div>
          </div>
          <!-- input custom_label_3 -->
          <div class="custom_label_3_container">
            <input type="text" class="form-control custom_label_3" value="<?= $product['custom_label_3'];?>" placeholder="custom_label_3" product-id="<?= $product['id'];?>" label-type="custom_label_3">
            <div class="custom_label_3_suggestions" label-type="custom_label_3"></div>
          </div>
          <!-- input custom_label_4 -->
          <div class="custom_label_4_container">
            <input type="text" class="form-control custom_label_4" value="<?= $product['custom_label_4'];?>" placeholder="custom_label_4" product-id="<?= $product['id'];?>" label-type="custom_label_4">
            <div class="custom_label_4_suggestions" label-type="custom_label_4"></div>
          </div>
        </div>
      </td>
    </tr>
  <? endif;?>
<? endforeach;?>