{*
* 2007-2024 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author    PrestaShop SA <contact@prestashop.com>
*  @copyright 2007-2024 PrestaShop SA
*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
<div id="product-images" class="panel product-tab">
  <input type="hidden" name="submitted_tabs[]" value="Images" />

  <h3 class="tab" >
    {l s='Images' d='Modules.Agilemultisellerpro.Product'}
    <span class="badge" id="countImage">({$field.availableValues.countImages|intval})</span>
  </h3>

  <div class="row" id="divUploadControl" style="display:{if $field.availableValues.image_number_limit > 0 && count($field.availableValues.images) >= $field.availableValues.image_number_limit}none{/if};">
    <div class="form-group row">
      <label class="col-md-3 form-control-label{if $field.required} required{/if}" for="field-{$field.name|escape:'htmlall':'UTF-8'}">
        {l s='Add a new image' d='Modules.Agilemultisellerpro.Product'}:
      </label>

      <div class="col-md-6 js-input-column upload-control-file">
          <input
            name="qqfile"
            type="file"
            accept="image/png, image/gif, image/jpeg"
          >
      </div>

      <div class="col-md-3">
        <button type="submit" class="btn btn-primary" name="submitTabProduct" value="addImages">
          <i class="icon-upload "></i> <span>{l s='Upload' d='Modules.Agilemultisellerpro.Product'}</span>
        </button >
      </div>
    </div>
  </div>

  <div class="table-responsive">
    <table cellspacing="0" cellpadding="0" class="table tableDnD" id="imageTable">
      <thead>
        <tr class="nodrag nodrop">
          <th>{l s='Image' d='Modules.Agilemultisellerpro.Product'}</th>
		      <th class="fixed-width-lg"><span class="title_box">{l s='Caption' d='Modules.Agilemultisellerpro.Product'}</span></th>
          <th>{l s='Position' d='Modules.Agilemultisellerpro.Product'}</th>
          <th>{l s='Cover' d='Modules.Agilemultisellerpro.Product'}</th>
          <th>{l s='Action' d='Modules.Agilemultisellerpro.Product'}</th>
        </tr>
      </thead>
      <tbody id="imageList">
        {foreach from=$field.availableValues.images item=image}
          <tr id="{$image->id_image|intval}">
            <td style="padding: 4px;">
              <a href="{$link->getImageLink($product->link_rewrite[$id_language_current], (int) $image->id_image, 'large_default')|escape:'htmlall':'UTF-8'}" target="_blank">
                <img src="{$link->getImageLink($product->link_rewrite[$id_language_current], (int) $image->id_image, 'small_default')|escape:'htmlall':'UTF-8'}" alt="{$image->id_image|intval}" title="{$image->id_image|intval}" />
              </a>
            </td>
            <td>
              <a href="#"
                class="editable"
                id="submitUpdateLegends"
                data-type="text"
                data-pk="{$image->id_image|intval}"
                data-url="{$link->getModuleLink('agilemultisellerpro', 'sellerproductdetail', ['id_product'=>$id_product, 'product_menu'=>$product_menu, 'submitTabProduct'=>'updateLegends'], true)|escape:'htmlall':'UTF-8'}"
                data-title="{l s='Caption' d='Modules.Agilemultisellerpro.Product'}"
                title="{if !empty($image->legend[$id_language_current])}{$image->legend[$id_language_current]|escape:'htmlall':'UTF-8'}{else}{$product->name[$id_language_current]|escape:'htmlall':'UTF-8'}{/if}">
                {if !empty($image->legend[$id_language_current])}
                  {$image->legend[$id_language_current]|escape:'htmlall':'UTF-8'}
                {else}
                  {$product->name[$id_language_current]|escape:'htmlall':'UTF-8'}
                {/if}

              </a>
            </td>
            <td id="td_{$image->id_image|intval}" class="pointer dragHandle center positionImage">
              {$image->position|intval}
            </td>
            <td class="center cover">
              <a href="#">
                {if $image->cover}
                  <i class="material-icons btn-outline-success covered" aria-hidden="true">done</i>
                {else}
                  <i class="material-icons btn-outline-danger covered" aria-hidden="true">close</i>
                {/if}
              </a>
            </td>
            <td class="center">
              <a href="#" class="delete_product_image" >
                <i class="material-icons btn-outline-danger" aria-hidden="true">delete</i>
              </a>
            </td>
          </tr>
        {/foreach}
      </tbody>
    </table>
  </div>

  {* <div class="table-responsive"  style="display:none;">

    <table id="lineType">
      <tr id="image_id">
        <td style="padding: 4px;">
          <a href="{$smarty.const._THEME_PROD_DIR_|escape:'htmlall':'UTF-8'}image_path.jpg" target="_blank">
              <img src="{$smarty.const._THEME_PROD_DIR_|escape:'htmlall':'UTF-8'}en-default-small_default.jpg" alt="image_id" title="image_id" />
          </a>
        </td>
		    <td>legend</td>
        <td id="td_image_id" class="pointer dragHandle center positionImage">
          image_position
        </td>
        <td class="center cover">
          <a href="#">
            <img class="covered" src="{$base_dir_ssl|escape:'htmlall':'UTF-8'}img/admin/blank.gif" alt="e" />
          </a>
        </td>
        <td class="center">
          <a href="#" class="delete_product_image" >
            <i class="material-icons btn-outline-danger" aria-hidden="true">close</i>
          </a>
        </td>
      </tr>
    </table>
  </div> *}
</div>
