{extends "../window.tpl"}

{block js}
   {$smarty.block.parent}
{/block}
{block tabs}
   {windowTab id='flapUser' label="{'flapUser'|translate:'users'}"}
   {windowTab id='flapInvoice' label="{'flapInvoice'|translate:'users'}"}
   {windowTab id='flapDelivery' label="{'flapDelivery'|translate:'users'}"}
   {if $body.acn=="edit"}
      {windowTab id='flapStats' label="{'flapStats'|translate:'users'}"}

      {windowTab id='flapGroups' label="{'flapGroups'|translate:'users'}"}
   {/if}
{/block}

{block title}
   {if $body.data.name}
      {$body.data.name} {$body.data.surname} |
   {/if}

   {if $body.acn == "edit"}
      {'titleEdit'|translate:'users'}
   {elseif $body.acn =="add"}
      {'titleAdd'|translate:'users'}
   {else}
      {$body.acn|translate:'users'}
   {/if}
{/block}

{block tabsContent}
   {get_contexts country=1 currency=1 assign='contexts'}

   <div id="flapUser" class="tab-pane fade active in boxStatic">
      <legend>{'flapSettings'|translate:'users'}</legend>
      {block 'email-row'}
         <div class="form-group row-flex">
            <div class="col-md-2 control-label"><label>{'email'|translate:'users'}</label></div>
            <div class="col-md-4">
               <input type="text" class="form-control input-sm" name="data[email]" size="30" maxlength="100" value="{$body.data.email}" autocomplete="off">
            </div>

            {if findRight('USR_IMPERSONATE') && !empty($body.data.id)}
               <div class="col-md-4">
                  <a href="{path('kupshop_user_impersonate_impersonateuser', ['id' => $body.data.id])}" target="_blank" style="position: relative; padding-right: 15px;">{'impersonate'|translate:'users'}
                     <span class="help-tip" data-toggle="tooltip" title="" data-original-title="{'impersonate_hint'|translate:'users'} {$body.data.email}" style="margin-top: -3px;"><i
                                class="bi bi-question-circle"></i></span></a>

               </div>
            {/if}
         </div>
      {/block}

      <div class="form-group">
         <div class="col-md-2 control-label"><label>
               {if $body.acn == "add"}{"password"|translate:'users'}{else}{"newPassword"|translate:'users'}{/if}</label>
         </div>
         <div class="col-md-4">
            <input type="password" class="form-control input-sm" name="data[password]" size="20" maxlength="40" value="" autocomplete="new-password">
            {if $body.data.passw == ""}<span class="text-danger">{'noPassword'|translate:'users'}</span>{else}<span
                    class="text-success">{'okPassword'|translate:'users'}</span>{/if}
         </div>
         <div class="col-md-4">
            <button type="submit" class="btn btn-success" name="acn" value="emailChangePass"
                    onclick="return confirm('{sprintf(translate('sendPasswordLinkTooltip'), $body.data.email)}');"
                    title="{if $body.data.figure == 'N'}Uživatel musí být aktivní pro tuto funkci
                           {elseif $body.data.passw == ""}Nejprve vyplňte všechny údaje a zvolte OK{else}Odeslat zákazníkovi e-mail s odkazem na změnu hesla{/if}"
                    {if !$body.data.id or $body.data.figure == 'N'}disabled{/if}>{'sendPasswordLink'|translate:'users'}
            </button>
            <script>
               $(document).ready(function() {
                  $('input[name="data[figure]"]').change(function() {
                     if ($(this).is(':checked')) {
                        $('button[value="emailChangePass"]').prop('disabled', false);
                     } else {
                        $('button[value="emailChangePass"]').prop('disabled', true);
                     }
                  });
               });
            </script>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'figure'|translate:'users'}</label></div>
         <div class="col-md-3">
            {print_toggle name="figure"}
         </div>
         {block 'get-news'}
            <div class="col-md-2 control-label"><label>{'getNews'|translate:'users'}</label></div>
            <div class="col-md-1">
               {print_toggle name="get_news"}
            </div>
         {/block}
         <div class="col-md-3">
            <small class="help-block no-margin">
               <input type="hidden" id="date_unsubscribe" value="{$body.data.date_unsubscribe|format_datetime:'admin'}"/>
               <input type="hidden" id="date_subscribe" value="{$body.data.date_subscribe|format_datetime:'admin'}">
               {* GDPR sranda - get_news neznamená plný souhlas s NL, date_subscribe k tomu ještě nesmí být null *}
               {if $body.data.date_subscribe == null and $body.data.get_news == "Y"}
                  {$msg = {'legitimateInterest'|translate:'users'}}
               {else}
                  {$msg = '-'}
               {/if}
                  {'date_subscribe'|translate:'users'}: {$body.data.date_subscribe|format_datetime:'admin'|default:$msg}<br>
                  {'date_unsubscribe'|translate:'users'}: {$body.data.date_unsubscribe|format_datetime:'admin'|default:"-"}
            </small>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label two-lines"><label>{'gender'|translate:'users'}</label></div>
         <div class="col-md-4">
            <select name="data[gender]" class="selecter">
               <option value="0">{'unspecified'|translate:'users'}</option>
               <option value="M" {if $body.data.gender == 'M'}selected{/if}>{'genderM'|translate:'users'}</option>
               <option value="F" {if $body.data.gender == 'F'}selected{/if}>{'genderF'|translate:'users'}</option>
            </select>
         </div>
      </div>

      <div class="form-group">
         <div class="col-md-2 control-label">
            <label>{'birthdate'|translate:'users'}</label>
         </div>
         <div class="col-md-4">
            <input id="dateBirth" type="text" class="form-control input-sm" name="data[birthdate]"
                   value="{$body.data.birthdate|format_date:"admin"}">
             {insert_calendar selector='#dateBirth' format='date'}
         </div>
      </div>


      {if findModule('eshop_delivery')}
      <div class="form-group">
         <div class="col-md-2 control-label two-lines"><label>{'preferredTransport'|translate:'users'}</label></div>
         <div class="col-md-4">
            <select name="data[prefer_transport]" class="selecter">
               <option value="">{'unspecified'|translate:'users'}</option>
               {foreach from=$body.delivery_type item=dt key=key}
                  <option value="{$dt.id}" {if $body.data.prefer_transport == $dt.id}selected{/if}>{$dt.payment}-{$dt.delivery}</option>
               {/foreach}
            </select>
         </div>
      </div>
      {/if}

      {if findModule('currencies')}
         <div class="form-group">
            <div class="col-md-2 control-label"><label>{'currency'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$selectedCurrency = $body.data.currency}
               {if !$selectedCurrency}
                  {$selectedCurrency = $contexts.currency->getDefaultId()}
               {/if}
               <select name="data[currency]" class="selecter">
                  {foreach $cfg.Currencies as $key => $currency}
                     <option value="{$key}" {if $selectedCurrency == $key}selected{/if}>{$currency.name} - {$currency.symbol}</option>
                  {/foreach}
               </select>
            </div>
         </div>
      {/if}

      {ifModule TRANSLATIONS}
         <div class="form-group">
            <div class="col-md-2 control-label"><label>{'language'|translate:'users'}</label></div>
            <div class="col-md-4">
               <select name="data[id_language]" class="selecter">
                  <option value="null">{'null'|translate:'users'}</option>
                  {foreach $body.languages as $key => $language}
                     <option value="{$key}" {if $body.data.id_language == $key}selected{/if}>{if $language->getName()}{$language->getName()} - {/if}{$key}</option>
                  {/foreach}
               </select>
            </div>
         </div>
      {/ifModule}

      {if $module.PRICE_LEVELS}
         {block user_price_level}
            <div class="form-group">
               <div class="col-md-2 control-label"><label>{'priceLevel'|translate:'users'}</label></div>
               <div class="col-md-5">
                  <div class="input-group">
                     <select name="data[dealer_price_level]" class="selecter"
                             data-autocomplete="priceLevels" data-preload="priceLevels">
                        <option value="0" selected>{'priceLevelStandard'|translate:'users'}</option>
                        {if $body.data.dealer_price_level}
                           <option value="{$body.data.dealer_price_level}" selected>{$body.data.dealer_price_level}</option>
                        {/if}
                     </select>
                     <div class="input-group-btn">
                        <a href="javascript:nw('pricelevels', '')" class="btn btn-primary btn-sm addProduct" title="Přidat novou cenovou hladinu">
                           <i class="glyphicon glyphicon-plus"></i>
                        </a>
                     </div>
                  </div>
                  <span class="help-block">{'priceLevelNote'|translate:'users'}</span>
               </div>
            </div>
         {/block}
      {/if}

      {ifModule PRICELISTS}
         {block user_price_list}
            <div class="form-group">
               <div class="col-md-2 control-label"><label>{'priceList'|translate:'users'}</label></div>
               <div class="col-md-5">
                  <div class="input-group">
                     <select name="data[id_pricelist]" class="selecter">
                        <option value="0">{'noPriceList'|translate:'users'}</option>
                        {foreach $body.priceLists as $priceList}
                           <option value="{$priceList.id}" {if $body.data.id_pricelist == $priceList.id}selected{/if}>{$priceList.name}</option>
                        {/foreach}
                     </select>
                     <div class="input-group-btn">
                        <a href="javascript:nw('pricelist', '')" class="btn btn-primary btn-sm addProduct" title="Přidat nový ceník">
                           <i class="glyphicon glyphicon-plus"></i>
                        </a>
                     </div>
                  </div>
                  <span class="help-block">{'priceListNote'|translate:'users'}</span>
               </div>
            </div>
         {/block}
      {/ifModule}

      {ifmodule SALESMAN}
         <div class="form-group">
            <div class="col-md-2 control-label"><label>{'salesman'|translate:'users'}</label></div>
            <div class="col-md-5">
               <div class="input-group">
                  <select name="data[id_salesman]" class="selecter" data-autocomplete="salesman" data-preload="salesman" data-autocomplete-empty="1">
                     {if $body.data.id_salesman}
                        <option value="{$body.data.id_salesman}"></option>
                     {/if}
                  </select>
                  <div class="input-group-btn">
                     <a href="javascript:nw('Salesman', '')" class="btn btn-primary btn-sm addProduct" title="Přidat nového obchodního zástupce">
                        <i class="glyphicon glyphicon-plus"></i>
                     </a>
                  </div>
               </div>
            </div>
         </div>
      {/ifmodule}

      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'note'|translate:'users'}
               <a class="help-tip" data-toggle="tooltip" title="" data-original-title="Zobrazí se v detailu objednávky tohoto uživatele. Příklad užití: 'Neposílat na dobírku'."><i
                          class="bi bi-question-circle"></i></a>
            </label>
         </div>
         <div class="col-md-5">
            <textarea class="form-control input-sm" name="data[note]">{$body.data.note}</textarea>
         </div>
      </div>

      {if findModule('api')}
         <legend>B2B API</legend>
         <div class="form-group">
            <div class="col-md-2 control-label"><label>Aktivováno API</label></div>
            <div class="col-md-2">
               {print_toggle name="api"}
            </div>
         </div>
      {/if}

      {block "shop-spec"}
      {/block}
   </div>
   <div id="flapInvoice" class="tab-pane fade active in boxStatic">
      <legend>{'sectionInvoiceData'|translate:'users'}</legend>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'name'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[name]" size="30" maxlength="150" value="{$body.data.name}">
         </div>
         <div class="col-md-2 control-label"><label>{'surname'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[surname]" value="{$body.data.surname}" maxlength="50">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'firm'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-company-name" name="data[firm]" value="{$body.data.firm}" maxlength="100">
         </div>
         <div class="col-md-2 control-label"><label>{'phone'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[phone]" size="20" maxlength="20" value="{$body.data.phone}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'street'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-address-street-and-number smartform-company-address-street-and-number" name="data[street]" size="30" maxlength="100" value="{$body.data.street}">
         </div>
         <div class="col-md-2 control-label"><label>{'custom_address'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[custom_address]" size="30" maxlength="100" value="{$body.data.custom_address}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'city'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-address-city smartform-company-address-city" name="data[city]" size="30" maxlength="50" value="{$body.data.city}">
         </div>
         <div class="col-md-2 control-label"><label>{'zip'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-address-zip smartform-company-address-zip" name="data[zip]" maxlength="10" value="{$body.data.zip}" onKeyPress="checkInputData('int')">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'state'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[state]" value="{$body.data.state}" maxlength="100">
         </div>
         <div class="col-md-2 control-label"><label>{'country'|translate:'users'}</label></div>
         <div class="col-md-4">
            {$selectedCountry = $body.data.country}
            {if !$selectedCountry}
               {$selectedCountry = $contexts.country->getActiveId()}
            {/if}
            <select class="selecter" name="data[country]" data-smartform-instance="invoice">
               {foreach $contexts.country->getAll() as $country}
                  <option value="{$country->getId()}" {if $country->getId() == $selectedCountry}selected{/if}>
                     {$country->getName()}
                  </option>
               {/foreach}
            </select>
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'ico'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-company-registration-number" name="data[ico]" maxlength="20" value="{$body.data.ico}">
         </div>
         <div class="col-md-2 control-label"><label>{'dic'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-invoice smartform-company-vat-number" name="data[dic]" maxlength="20" value="{$body.data.dic}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'shop_due_days'|translate:'settings'}</label></div>
         <div class="col-md-4">
            <div class="input-group">
               <input type="text" class="form-control input-sm" name="data[due_days]" maxlength="3"
                      value="{$body.data.due_days}" placeholder="{$dbcfg.shop_due_days}">
               <span class="input-group-addon">{'Day'|translate:'settings'}</span>
            </div>
         </div>
         <div class="col-md-2 control-label"><label>{'copy_email'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[copy_email]" value="{$body.data.copy_email}">
         </div>
      </div>
      {block "invoice-flap"}

      {/block}
   </div>
   <div id="flapDelivery" class="tab-pane fade active in boxStatic">
      <script type="text/javascript">
         function copyFromInvoice() {
            var $form = $('form');
            var copy = ['name', 'surname', 'firm', 'street', 'city', 'zip', 'country', 'phone', 'email'];
            for (index in copy) {
               var item = copy[index];
               $form.find('[name=data\\[delivery_' + item + '\\]]').val($form.find('[name=data\\[' + item + '\\]]').val());
            }
         }
      </script>
      <legend>{'sectionDeliveryData'|translate:'users'}</legend>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'name'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[delivery_name]" value="{$body.data.delivery_name}" maxlength="20">
         </div>
         <div class="col-md-2 control-label"><label>{'surname'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[delivery_surname]" value="{$body.data.delivery_surname}" maxlength="50">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'firm'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-delivery smartform-company-name" name="data[delivery_firm]" value="{$body.data.delivery_firm}" maxlength="100">
         </div>
         <div class="col-md-2 control-label"><label>{'phone'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[delivery_phone]" size="20" maxlength="20" value="{$body.data.delivery_phone}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'street'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-delivery smartform-company-address-street-and-number smartform-address-street-and-number" name="data[delivery_street]" value="{$body.data.delivery_street}" maxlength="100">
         </div>
         <div class="col-md-2 control-label"><label>{'custom_address'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[delivery_custom_address]" size="30" maxlength="100"
                   value="{$body.data.delivery_custom_address}">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'city'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-delivery smartform-company-address-city smartform-address-city" name="data[delivery_city]" value="{$body.data.delivery_city}" maxlength="50">
         </div>
         <div class="col-md-2 control-label"><label>{'zip'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm smartform-instance-delivery smartform-company-address-zip smartform-address-zip" name="data[delivery_zip]" onkeypress="checkInputData('int');" value="{$body.data.delivery_zip}"
                   maxlength="10">
         </div>
      </div>
      <div class="form-group">
         <div class="col-md-2 control-label"><label>{'state'|translate:'users'}</label></div>
         <div class="col-md-4">
            <input type="text" class="form-control input-sm" name="data[delivery_state]" value="{$body.data.delivery_state}" maxlength="100">
         </div>
         <div class="col-md-2 control-label"><label>{'country'|translate:'users'}</label></div>
         <div class="col-md-4">
            {$selectedCountry = $body.data.delivery_country}
            <select class="selecter" name="data[delivery_country]" data-smartform-instance="delivery">
                <option value="">Nevyplněno</option>
               {foreach $contexts.country->getAll() as $country}
                  <option value="{$country->getId()}" {if $country->getId() == $selectedCountry}selected{/if}>
                     {$country->getName()}
                  </option>
               {/foreach}
            </select>
         </div>
      </div>
      <div class="form-group">
      <div class="col-md-2 control-label">
         <label>{'email'|translate:'users'}</label>
      </div>
      <div class="col-md-4">
         <input type="text" class="form-control input-sm" name="data[delivery_email]" value="{$body.data.delivery_email}" maxlength="100">
      </div>
         </div>
      <div class="form-group">
         <div class="col-md-3 col-md-offset-2">
            <input type="button" class="btn btn-block btn-sm" value="{'submitCopyInvoiceData'|translate:'users'}" onclick="copyFromInvoice()">
         </div>
      </div>

      {ifmodule USER_ADDRESSES}
         <div class="row">
            <div class="col-xs-3">
               <div class="wpj-form-group">
                  <a href="javascript:nw('UserAddresses', 0, 'id_user={$body.data.id}')" class="btn btn-success btn-block"><span
                        class="bi bi-plus-lg m-r-1"></span>{'buttonAddAddress'|translate:"UserAddresses"}</a>
               </div>
            </div>
         </div>
         <div class="row boxFlex box" style="min-height: 600px">
            <iframe class="on-demand boxFlex" src=""
                    data-src="launch.php?s=list.php&type=UserAddresses&id_user={$body.data.id}"></iframe>
         </div>
      {/ifmodule}
   </div>
   {if $body.acn=="edit"}
      <div id="flapStats" class="tab-pane fade active in boxStatic">
         <legend>{'sectionStats'|translate:'users'} {$body.data.email}</legend>

         <div class="form-group form-group-flex">
            <label class="col-md-2 control-label">{'statReg'|translate:'users'}</label>
            <div class="col-md-4">
               {$body.data.date_reg_days} {'statDays'|translate:'users'}
            </div>
         </div>

         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'statCountFavourites'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$body.favorites}
            </div>
         </div>

         {if $module.WATCHDOG}
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'countWatchdogProducts'|translate:'users'} ({$body.countWatchdogProducts})</label></div>
            <div class="col-md-4">
                <a href="javascript:nw('list', 'Watchdog', 'email={$body.data.email}')" ><span>{'showWatchdogProducts'|translate:'users'} </span></a>
            </div>
         </div>
         {/if}
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'dateReg'|translate:'users'}</label></div>
            <div class="col-md-4">
               <input type="text" class="form-control input-sm" id="date_reg" size="19" maxlength="19"
                      value="{$body.data.date_reg|format_datetime:'admin'}" readonly><input type="hidden" name="data[date_reg]" value="{$body.data.date_reg}" autocomplete="off">
               {*   {insert_calendar selector='#date_reg' format='datetime'}*}
            </div>
         </div>

         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'dateLogged'|translate:'users'}</label></div>
            <div class="col-md-4">
               <input type="text" class="form-control input-sm" id="date_logged" size="19" maxlength="19"
                      value="{$body.data.date_logged|format_datetime:'admin'}" readonly autocomplete="off">
               {*{insert_calendar selector='#date_logged' format='datetime'}*}
            </div>
         </div>

         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'dateUpdated'|translate:'users'}</label></div>
            <div class="col-md-4">
               <input type="text" class="form-control input-sm" id="date_updated" value="{$body.data.date_updated|format_datetime:'admin'}" readonly>
            </div>
         </div>

         <h1 class="h4 main-panel-title">Objednávky</h1>

          <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'statCountOrders'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$body.orders.pocet}

               {if $body.orders.pocet > 0}
                  <a href="javascript:nw('userOrders', '{$body.data.id}');" class="btn btn-xs" style="margin-left: 10px;">
                     {'userOrders'|translate:'users'} &nbsp; <span class="glyphicon glyphicon-list-alt"></span>
                  </a>
               {/if}
            </div>
         </div>

         {if $body.orders.cena_celkem > 0}
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'statCountOrdersPrice'|translate:'users'}</label></div>
               <div class="col-md-4">
                  {$body.orders.cena_celkem|format_price}
               </div>
            </div>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'statCountOrdersPriceAVG'|translate:'users'}</label></div>
               <div class="col-md-4">
                  {$body.orders.average_price|format_price}
               </div>
            </div>
         {/if}

         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'statCountOrdersPriceYear'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$body.cena_celkem|format_price}
            </div>
         </div>
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'lastYearOrdersPrice'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$body.lastYearOrdersPrice|format_price}
            </div>
         </div>
         <div class="form-group form-group-flex">
            <div class="col-md-2 control-label"><label>{'allOrdersPrice'|translate:'users'}</label></div>
            <div class="col-md-4">
               {$body.allOrdersPrice|format_price}
            </div>
         </div>

         {ifmodule SALES}
            <h1 class="h4 main-panel-title">Prodejky</h1>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'statCountSales'|translate:'users'}</label></div>
               <div class="col-md-4">
                  {$body.sales.count}

                  {if $body.sales.count > 0}
                     <a href="javascript:nw('list', 'Sales', 'userId={$body.data.id}');" class="btn btn-xs" style="margin-left: 10px;">
                        {'userSales'|translate:'users'} &nbsp; <span class="glyphicon glyphicon-list-alt"></span>
                     </a>
                  {/if}
               </div>
            </div>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'statCountSalesPriceYear'|translate:'users'}</label></div>
               <div class="col-md-4">
                   {$body.sales.current_year_total_price|format_price}
               </div>
            </div>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'lastYearSalesPrice'|translate:'users'}</label></div>
               <div class="col-md-4">
                   {$body.sales.last_year_total_price|format_price}
               </div>
            </div>
            <div class="form-group form-group-flex">
               <div class="col-md-2 control-label"><label>{'allSalesPrice'|translate:'users'}</label></div>
               <div class="col-md-4">
                   {$body.sales.total_price|format_price}
               </div>
            </div>
         {/ifmodule}
      </div>
      <div id="flapGroups" class="tab-pane fade boxFlex">
         {include "window/users.groups.tpl"}
      </div>
   {/if}

   {include '../utils/smartform.tpl'}
{/block}
