{if !$product}
   {$product = $body.product}
{/if}

<form method="get" action="{path('kupshop_watchdog_watchdog_add')}" class="product-watchdog"
      data-watchdog="form" {if !$ctrl.logged}data-recaptcha-lazy{/if}>

   {if !$product.variations.variations and !$product.variationId}
      {get_product_info type='is_watchdog' product=$product assign='is_watchdog'}
   {elseif $product.variationId}
      {get_product_info type='is_watchdog' product=$product id_variation=$product.variationId assign='is_watchdog'}
   {/if}

   <input type="hidden" name="id_product" value="{$product.id}">
   <input type="hidden" name="id_variation" value="{$product.variationId}" data-watchdog="variation">

   <div class="watchdog-success" {if !$is_watchdog}style="display: none;"{/if} data-watchdog="success">
      <p>
         {t}Hlídací pes byl úspěšně uložen.{/t}
      </p>

      {if $ctrl.logged}
         <a href="{url s=watchdog IDp=$product.id acn='delete'}" rel="nofollow" data-watchdog="delete">{t}Zrušit hlídání{/t}</a>
         <a href="{url s=category campaign="W"}">{t}Zobrazit hlídané produkty{/t}</a>
      {/if}
   </div>

   <div class="watchdog-loggedout" data-watchdog="loggedout"{if $is_watchdog} style="display: none;"{/if}>
      <h4>{t}Chci být informován{/t}</h4>

      <div class="form-group form-group-check">
         <input type="hidden" name="availability" value="0">
         <label class="custom-control custom-checkbox" for="availability">
            <input type="checkbox" class="custom-control-input" name="availability" id="availability" value="1">
            <span class="custom-control-indicator"></span>
            {t}Až bude produkt skladem{/t}
         </label>
      </div>
      <div class="form-group">
         <label class="custom-control custom-checkbox" for="watchdog-price">
            <input type="checkbox" class="custom-control-input" name="watchdog-price" id="watchdog-price" data-opener="[data-watchdog-price]">
            <span class="custom-control-indicator"></span>
            {t}Až klesne cena produktu pod{/t}
         </label>
      </div>

      {get_contexts currency=1 assign="contexts"}
      {$currency = $contexts.currency->getActive()}

      <div class="opener-content" style="display: none;" data-watchdog-price>
         <div class="form-group">
            <input type="text" name="price" class="form-control" placeholder="{t currency=$currency.symbol}Cena v {currency}{/t}">
         </div>
      </div>

      {if !$ctrl.logged}
         <div class="form-group required">
            <label for="watchdog-email">{t}E-mail{/t}</label>
            <input type="email" name="email" id="watchdog-email" class="form-control" required>
         </div>
      {/if}
      <p>
         {* @formatter:off *}
         {t escape=false urlConsent={url s=page label='consent'} urlPrivacy={url s=page label='privacy_policy'}}
            Odesláním formuláře souhlasím se <a href="{urlConsent}" target="_blank">zpracováním osobních údajů</a> a beru na vědomí <a href="{urlPrivacy}" target="_blank">Zásady zpracování osobních údajů</a>.
         {/t}
         {* @formatter:on *}
      </p>
      <button class="btn btn-primary btn-block" type="submit"
              data-sitekey="{findModule('recaptcha','site_shared')}" data-recaptcha="btn">
         {t}Hlídat produkt{/t}
      </button>
   </div>
</form>
