{*
* 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
*}
{if isset($product->id)}
  <div id="product-attachements" class="panel product-tab">
    <h3>{$field.label|escape:'htmlall':'UTF-8'}</h3>

    {include file="module:agilemultisellerpro/views/templates/front/_partials/form-fields.tpl"
        field=[
          'name' => 'attachment_name',
          'type' => 'text_lang',
          'required' => false,
          'label' => {l s='Filename' d='Modules.Agilemultisellerpro.Product'},
          'value' => [],
          'maxLength' => 0,
          'errors' => [],
          'autocomplete' => '',
          'isLang' => true
        ]
    }

    {include file="module:agilemultisellerpro/views/templates/front/_partials/form-fields.tpl"
        field=[
          'name' => 'attachment_description',
          'type' => 'html_lang',
          'required' => false,
          'label' => {l s='Description' d='Modules.Agilemultisellerpro.Product'},
          'value' => [],
          'maxLength' => 0,
          'errors' => [],
          'autocomplete' => '',
          'isLang' => true
        ]
    }

    <div class="form-group row">
      <label class="col-md-3 form-control-label" for="attachement_filename">
        {l s='File' d='Modules.Agilemultisellerpro.Product'}:
      </label>

      <div class="col-md-6 js-input-column upload-control-file">
        <input id="attachment_file" name="attachment_file" type="file">
      </div>

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

    <div class="form-group row">
      <label class="col-md-3"></label>

      <div class="col-md-9 js-input-column">
        <div class="row">
          <div class="col-md-6">
            <label class="form-control-label"
              for="selectAttachment1">{l s='Available attachments'  d='Modules.Agilemultisellerpro.Product'}</label>

            <select class="form-control" name="selectAttachment1" id="selectAttachment1" multiple size="4">
              {foreach $field.availableValues.attach1 as $attach}
                <option value="{$attach.id_attachment|intval}">{$attach.name|escape:'htmlall':'UTF-8'}</option>
              {/foreach}
            </select>

            <button class="btn btn-primary btn-block" id="addAttachment" type="button">
              {l s='Add'  d='Modules.Agilemultisellerpro.Product'}&nbsp;<i class="icon-arrow-right"></i>
            </button>
          </div>

          <div class="col-md-6">
            <label class="form-control-label"
              for="selectAttachment2">{l s='Attachments for this product'  d='Modules.Agilemultisellerpro.Product'}</label>

            <select class="form-control" name="arrayAttachments[]" id="selectAttachment2" multiple size="4">
              {foreach $field.availableValues.attach2 as $attach}
                <option value="{$attach.id_attachment|intval}" selected="selected">{$attach.name|escape:'htmlall':'UTF-8'}</option>
              {/foreach}
            </select>

            <button class="btn btn-primary btn-block" id="removeAttachment" type="button">
              {l s='Remove'  d='Modules.Agilemultisellerpro.Product'}&nbsp;<i class="icon-arrow-left"></i>
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
{/if}
