{extends "../window.tpl"}

{block tabs}
   {windowTab id='flapReview'}
{/block}

{block tabsContent}
   <div id="flapReview" class="tab-pane fade active in boxFlex">
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Produkt</label>
         </div>
         <div class="col-md-10">
            <a href="javascript:nw('product',{$body.product.id})">{$body.product.title}</a>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Hodnocení</label>
         </div>
         <div class="col-md-10">
            {for $i=1 to $body.data.rating}
               <i class="glyphicon glyphicon-star"></i>
            {/for}
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Datum udělení</label>
         </div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[date]" id="date" value="{$body.data.date|format_datetime:"empty"}" maxlength="19" autocomplete="off"/>
             {insert_calendar selector='#date' format='datetime'}
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Jméno</label>
         </div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[name]" value="{$body.data.name}" maxlength="30"/>
         </div>
         <div class="col-md-2 control-label">
            <label>Uživatel</label>
         </div>
         <div class="col-md-4">
            <select name="data[id_user]" class="selecter" data-autocomplete="users" data-preload="users">
               {if !$body.data.id_user}
                  <option value="">-- bez uživatele --</option>
               {else}
                  <option value="{$body.data.id_user}">{$body.data.id_user}</option>
               {/if}
            </select>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Klady</label>
         </div>
         <div class="col-md-10">
            <textarea class="form-control input-sm" name="data[pros]" rows="3" >{$body.data.pros}</textarea>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Zápory</label>
         </div>
         <div class="col-md-10">
            <textarea class="form-control input-sm" name="data[cons]" rows="3" >{$body.data.cons}</textarea>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Shrnutí</label>
         </div>
         <div class="col-md-10">
            <textarea class="form-control input-sm" name="data[summary]" rows="3" >{$body.data.summary}</textarea>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Schváleno</label>
         </div>
         <div class="col-md-10">
            <div class="radio pull-left">
               {foreach KupShop\CatalogBundle\Util\ReviewsUtil::$rank as $key => $rank}
                  <input type="radio" name="data[figure]" value="{$key}" {if $body.data.figure== $key}checked{/if} id="dT{$key}" class="check"/>
                  <label for="dT{$key}">{$rank|translate}</label>
               {/foreach}
            </div>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Zdroj</label>
         </div>
         <div class="col-md-2">
            <select class="selecter" disabled>
               <option selected>{KupShop\CatalogBundle\Util\ReviewsUtil::$sources[$body.data.source]|default:'interní'}</option>
            </select>
         </div>

         <div class="col-md-2">
            {if $body.data.external_id}ID: {$body.data.external_id}{/if}
         </div>

         <div class="col-md-2 control-label">
            <label>Objednávka</label>
         </div>
         <div class="col-md-4">
            <select name="data[id_order]" class="selecter" data-autocomplete="orders" data-preload="orders">
               {if !$body.data.id_order}
                  <option value="">-- bez objednávky --</option>
               {else}
                  <option value="{$body.data.id_order}">{$body.data.id_order}</option>
               {/if}
            </select>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>Odpověď</label>
         </div>
         <div class="col-md-10">
            <textarea class="form-control input-sm" name="data[response]" rows="3">{$body.data.response}</textarea>
         </div>
      </div>

      <div class="form-group">
            <div class="col-md-2 control-label">
               <label>Čas odpovědi</label>
            </div>
            <div class="col-md-4">
               <input class="form-control input-sm" disabled type="text" value="{$body.data.response_time|format_date:'d.m.Y H:i:m'}">
            </div>
      </div>

   </div>
{/block}
