<div data-reload="contact-form">
   {if $body.error}
      <div class="alert alert-danger">
         {$body.error}
      </div>
   {/if}

   {include "block.messages.tpl"}

   {if $body.sent}
      <div class="alert alert-success">
         {t}Registrace byla úspěšně odeslána.{/t}
      </div>
   {else}
      <form method="post" action="{path('kupshop_content_contactform_sendform', ['type'=>'bike'])}" data-bike-form>
         <div class="row">
            <div class="col-md-6 col-xxs-12">
               <div class=" form-group required">
                  <label for="name" class="form-control-label">{t}Jméno a příjmení kupujícího{/t}</label>
                  <input type="text" name="name" id="name" class="form-control" value="{$body.data.name}"
                         data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="3">
               </div>
            </div>
            <div class="col-md-6 col-xxs-12">
               <div class="form-group required">
                  <label for="email" class="form-control-label">{t}E-mail kupujícího{/t}</label>
                  <input type="email" name="send_to" id="email" class="form-control" value="{$body.data.email}"
                         data-bv-notempty="true" data-bv-emailaddress-message="{t}Zadejte platnou e-mailovou adresu{/t}">
                  <input type="hidden" name="email" value="{$dbcfg.order_shopkeeper_mail}">
               </div>
            </div>
            <div class="col-md-6 col-xxs-12">
               <div class="form-group required">
                  <label for="brand" class="form-control-label">{t}Značka kola{/t}</label>
                  <input type="text" id="brand" value="{$body.data.brand}" name="brand" class="form-control" data-bv-notempty="true">
               </div>
            </div>
            {*<div class="col-md-6 col-xxs-12">
               <div class="form-group">
                  <label for="imonth" class="form-control-label">{t}Měsíc nákupu{/t}</label>
                  <select name="imonth" id="imonth" class="form-control form-select">
                     {for $i = 1 to 12}
                        <option value="{$i}">{$i}</option>
                     {/for}
                  </select>
               </div>
            </div>*}
            {*{$bikeModels = [
            0 => "Rascal PUNK!",
            1 => "Rascal 14",
            2 => "Rascal 16",
            3 => "Rascal 20",
            4 => "Rascal 24",
            5 => "Rascal 26",
            6 => "Rascal Wild 24",
            7 => "Rascal Wild 26",
            8 => "Rascal Wild 27",
            9 => "Rascal Wild 29",
            10 => "Rascal Rebel 27",
            11 => "Rascal Rebel 29"
            ]}*}
            {$shopType = [
            0 => "{t}Cyklospeciality Brno{/t}",
            1 => "{t}Cyklospeciality Praha{/t}",
            2 => "{t}Cyklospeciality Hradec Králové{/t}",
            3 => "{t}E-shop Cyklospeciality{/t}"
            ]}

            {*<div class="col-md-6 col-xxs-12">
               <div class="form-group">
                  <label for="bike" class="form-control-label">{t}Model{/t}</label>
                  <select name="bike" id="bike" class="form-control form-select">
                     {foreach $bikeModels as $bike}
                        <option value="{$bike}">{$bike}</option>
                     {/foreach}
                  </select>
               </div>
            </div>*}
            <div class="col-md-6 col-xxs-12">
               <div class="form-group required">
                  <label for="bike" class="form-control-label">{t}Model{/t}</label>
                  <input type="text" id="bike" value="{$body.data.bike}" name="bike" class="form-control" data-bv-notempty="true">
               </div>
            </div>
            <div class="col-md-6 col-xxs-12">
               <div class="form-group">
                  <label for="shop" class="form-control-label">{t}Místo nákupu{/t}</label>
                  <select name="shop" id="shop" class="form-control form-select">
                     {foreach $shopType as $type}
                        <option value="{$type}">{$type}</option>
                     {/foreach}
                  </select>
               </div>
            </div>
            <div class="col-md-6 col-xxs-12">
               <div class="form-group required">
                  <label for="frame_no" class="form-control-label">{t}Číslo rámu{/t}</label>
                  <input type="text" id="frame_no" value="{$body.data.message}" name="frame_no" class="form-control" data-bv-notempty="true">
               </div>
            </div>
            <div class="col-md-6 col-xxs-12">
               <div class="form-group">
                  <label for="idate" class="form-control-label">{t}Den nákupu{/t}</label>
                  <input type="date" placeholder="{t}Vyberte datum{/t}" id="idate" value="{$body.data.idate}" name="idate" class="form-control">
                  {*<select name="iyear" id="iyear" class="form-control form-select">
                     {for $i = ($smarty.now|date_format:"%Y" - 2) to $smarty.now|date_format:"%Y"}
                        <option value="{$i}">{$i}</option>
                     {/for}
                  </select>*}
               </div>
            </div>
            <div class="col-lg-4 col-md-6 col-sm-8 col-xxs-12">
               <div class="frame-number-legend">
                  {$frameNoLegend|inline_edit nofilter}
               </div>
            </div>
            <div class="col-xxs-12">
               <div class="form-group">
                  <label for="message" class="form-control-label">{t}Vaše upřesnění{/t}</label>
                  <textarea id="message" value="{$body.data.message}" name="message" class="form-control" rows="4"></textarea>
               </div>
            </div>
            <div class="col-xxs-12">
               <input type="hidden" name="news" value="1">
               <div class="form-group">
                  <label class="custom-control custom-checkbox" for="news">
                     <input type="checkbox" class="custom-control-input" name="news" id="news" value="0">
                     <span class="custom-control-indicator"></span>
                     {t}Nepřeji si dostávat informace o novinkách, slevách a dalších akčních nabídkách.{/t}
                  </label>
               </div>
            </div>
            <div class="col-xxs-12">
               <p class="gdpr-info">{t url={url s=menuitem ID=47} escape=false}Vaše osobní údaje budou zpracovány dle pravidel o <a href="{url}">ochraně osobních údajů</a>.{/t}</p>
            </div>
         </div>

         <div class="send-block">
            <div class="recaptcha-wrapper">
               {include "block.recaptcha.tpl"}
            </div>

            <button class="btn btn-primary btn-send" type="submit" name="Submit" value="{t}Odeslat{/t}">{t}Odeslat{/t}</button>
         </div>
      </form>
      <script>
         wpj.onReady.push(function () {
            $('[data-bike-form]').bootstrapValidator({
               feedbackIcons: {
                  valid: 'fc fc-check',
                  invalid: 'fc fc-remove',
                  validating: 'fc fc-refresh',
               },
            }).on('success.form.bv', function (e) {
               e.preventDefault()
               let $this = $(e.target)
               let $sendTo = $this.find('[name="send_to"]');
               $sendTo.val($sendTo.val() + ',{$dbcfg.order_shopkeeper_mail}');
               wpj.domUtils.reloadPartsFromUrl($this.attr('action'), $this.closest('[data-reload]'), $this.serialize())
            })
         })
      </script>
   {/if}
</div>
