{extends "../frame.tpl"}

{block "css-entry" append}
   {encore_entry_link_tags entry='board' build='admin'}
{/block}

{block "content"}
   <div class="board-main">
      <div class="board-left">
         <h1>{'adminTitle'|translate}</h1>

         <div data-infopanel-wrapper></div>
{*          <div class="alert alert-redesign">
             <span class="bi bi-info-circle-fill"></span>
             <p><strong>{'adminRedesignTitle'|translate}</strong> {'adminRedesignText'|translate}</p>
          </div>*}

         {block "custom-content"}{/block}
         {if {find_right name="MAIN_STAT"}}
            <div class="row bottom-space index-stats">
               <div class="col-lg-2 col-md-4 col-sm-6">
                  <div class="well">
                     <span class="fc icons_stats"></span>
                     <div>
                        <p>{'revenue'|translate}</p>
                        <h3>{$stats.today_price|format_price}</h3>
                     </div>
                  </div>
               </div>
               <div class="col-lg-2 col-md-4 col-sm-6">
                  <div class="well">
                     <span class="fc icons_date"></span>
                     <div>
                        <p>{'todayOrders'|translate}</p>
                        <h3>{$stats.today_orders}</h3>
                     </div>
                  </div>
               </div>
               <div class="col-lg-2 col-md-4 col-sm-6">
                  <div class="well">
                     <span class="fc icons_list"></span>
                     <div>
                        <p>{'openOrders'|translate}</p>
                        <h3>{$stats.unfinished_orders}</h3>
                     </div>
                  </div>
               </div>
               <div class="col-lg-2 col-md-4 col-sm-6">
                  <div class="well">
                     <span class="fc icons_folder"></span>
                     <div>
                        <p>{'productsStats'|translate nofilter}</p>
                        <h3>{$stats.total_products}</h3>
                     </div>
                  </div>
               </div>

               <div class="col-lg-4 col-md-8 col-sm-12">
                  <div class="well">
                     <span class="fc icons_alert"></span>
                     <h3>{'events'|translate}</h3>
                     {if {find_right name="ACTIVITY_LOG_SHOW"}}
                        <div class="events">
                           {if $stats.errors_critical}
                              <a href="javascript:nf('launch.php?s=menu.php&type=reportActivities', 'launch.php?s=list.php&type=reportActivities&filter[severity]=error&acn=resetErrorDate')"
                                 class="event event-critical"><span
                                         class="fc icons_danger"></span> {$stats.errors_critical} {'critical'|translate}</a>
                           {/if}
                           {if $stats.errors_recommendation}
                              <a href="javascript:nf('launch.php?s=menu.php&type=reportActivities', 'launch.php?s=list.php&type=reportActivities&filter[severity]=recommendation&filter[dateFrom]={strtotime('yesterday')|date_format:"%Y-%m-%d"}')"
                                 class="event event-recommended"><span class="fc icons_info"></span>{$stats.errors_recommendation}
                                 {'recommendations'|translate}</a>
                           {/if}

                           {$admin = getAdminUser()}

                           {if $admin['date_check_error']}
                              {$date_reset = strtotime($admin['date_check_error'])|date_format:"%Y-%m-%d %H:%m:%S"}
                           {else}
                              {$date_reset = strtotime('yesterday')|date_format:"%Y-%m-%d"}
                           {/if}

                           {if $stats.errors_sync}
                              <a href="javascript:nf('launch.php?s=menu.php&type=reportActivities', 'launch.php?s=list.php&type=reportActivities&filter[type]=sync&filter[severity]=error&filter[dateFrom]={$date_reset}')"
                                 class="event event-sync"><span class="fc icons_sync"></span>{$stats.errors_sync} {'sync'|translate}</a>
                           {/if}
                           {if !$stats.errors_critical and !$stats.errors_recommendation and !$stats.errors_sync}
                              <span class="m-l-2">{'noEvents'|translate}</span>
                           {/if}
                        </div>
                     {/if}
                  </div>
               </div>
            </div>
         {/if}
         <div class="row bottom-space">
            <div class="col-md-4">
               <div class="panel panel-default">
                  <div class="panel-heading">
                     <div class="row">
                        <div class="col-md-2 col-sm-2 icon">
                           <span class="glyphicon glyphicon-folder-close"></span>
                        </div>
                        <div class="col-md-10">
                           <h3>{'items'|translate}</h3>
                        </div>
                     </div>
                  </div>
                  <div class="panel-body">
                     <div class="row">
                        {if findRight('PROD_')}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&amp;type=products', 'launch.php?s=list.php&amp;type=products')"
                                 class="btn btn-block btn-primary">{'products'|translate}</a>
                           </div>
                        {/if}
                        {if {find_right name="SEC_ADD"} || {find_right name="SEC_EDIT"} || {find_right name="SEC_ERASE"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=sections', 'launch.php?s=list.php&type=sections')"
                                 class="btn btn-block">{'sections'|translate}</a>
                           </div>
                        {/if}
                        {if {find_right name="PRODCR"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=producers', 'launch.php?s=list.php&type=producers')"
                                 class="btn btn-block">{'producers'|translate}</a>
                           </div>
                        {/if}
                     </div>
                  </div>
               </div>
            </div>
            <div class="col-md-4">
               <div class="panel panel-default">
                  <div class="panel-heading">
                     <div class="row">
                        <div class="col-md-2 col-sm-2 icon">
                           <span class="glyphicon glyphicon glyphicon-shopping-cart"></span>
                        </div>
                        <div class="col-md-10">
                           <h3>{'orders'|translate}</h3>
                        </div>
                     </div>
                  </div>
                  <div class="panel-body">
                     <div class="row">
                        {if {find_right name="ORDER_ADD"} || {find_right name="ORDER_EDIT"} || {find_right name="ORDER_ERASE"} || {find_right name="ORDER_READ"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=orders', 'launch.php?s=list.php&type=orders')"
                                 class="btn btn-block btn-primary">{'orders'|translate}</a>
                           </div>
                            {if {find_right name="ORDER_ADD"}}
                               <div class="col-md-4 col-sm-4">
                                  <a href="javascript:nw('orders', 0, 'flap_next=3')"
                                     class="btn btn-block">{'newOrder'|translate}</a>
                               </div>
                            {/if}
                        {/if}
                        {if {find_right name="USR_ADD"} || {find_right name="USR_EDIT"} || {find_right name="USR_ERASE"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=users', 'launch.php?s=list.php&type=users')"
                                 class="btn btn-block">{'users'|translate}</a>
                           </div>
                        {/if}
                     </div>
                  </div>
               </div>
            </div>
            <div class="col-md-4">
               <div class="panel panel-default">
                  <div class="panel-heading">
                     <div class="row">
                        <div class="col-md-2 col-sm-2 icon">
                           <span class="glyphicon glyphicon-picture"></span>
                        </div>
                        <div class="col-md-10">
                           <h3>{'content'|translate}</h3>
                        </div>
                     </div>
                  </div>
                  <div class="panel-body">
                     <div class="row">
                        {if findModule('sliders') and {find_right name="SLIDERS"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=sliders', 'launch.php?s=list.php&type=sliders')"
                                 class="btn btn-block">{'banners'|translate}</a>
                           </div>
                        {/if}
                        {if findModule('articles') and {find_right name="ART_EDIT"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=articles', 'launch.php?s=list.php&type=articles')"
                                 class="btn btn-block">{'articles'|translate}</a>
                           </div>
                        {/if}
                        {if findModule('html_pages') and {find_right name="HTML_EDIT"}}
                           <div class="col-md-4 col-sm-4">
                              <a href="javascript:nf('launch.php?s=menu.php&type=pages', 'launch.php?s=list.php&type=pages')"
                                 class="btn btn-block">{'pages'|translate}</a>
                           </div>
                        {/if}
                     </div>
                  </div>
               </div>
            </div>
         </div>
         <div class="row">
            <div class="col-lg-8 col-xs-12">
               <div class="panel panel-default">
                  <div class="panel-body">
                     <h4 class="has-icon"><span class="fc icons_phone"></span><span>{'customerCare'|translate}</span></h4>
                     <div class="row">
                        <div class="col-sm-6 col-md-3 col-xs-12">
                           <a href="https://napoveda.wpjshop.cz/" class="btn btn-light btn-lg btn-block" target="_blank"
                              rel="noreferrer">
                              <span class="fc icons_help"></span>
                              {'helpSite'|translate}
                           </a>
                        </div>
                        <div class="col-sm-6 col-md-3 col-xs-12">
                           <a href="https://trello.com/b/Ps4RTFMx/kupshop-roadmap-live" class="btn btn-light btn-lg btn-block"
                              target="_blank" rel="noreferrer">
                              <span class="fc icons_roadmap"></span>
                              {'roadmap'|translate}
                           </a>
                        </div>
                        {if {find_right name="CLIENT_SECTION"}}
                           <div class="col-sm-6 col-md-3 col-xs-12">
                              <a href="{$links.klient}" class="btn btn-light btn-lg btn-block" target="_blank" rel="noreferrer">
                                 <span class="fc icons_users"></span>
                                 {'clientSection'|translate}
                              </a>
                           </div>
                        {/if}
                        <div class="col-sm-6 col-md-3 col-xs-12">
                           <div class="nl-login-wrapper">
                              <a href="https://trello.com/b/Ps4RTFMx/kupshop-roadmap-live" class="btn btn-light btn-lg btn-block"
                                 target="_blank" rel="noreferrer">
                              </a>
                              <p>
                                 <span class="fc icons_message"></span>
                                 <span>
                                 <strong>{'nlHistory'|translate}</strong>
                                 <a href="https://www.wpj.cz/prihlaseni-k-newsletteru/" target="_blank" rel="noreferrer">({'nlSignup'|translate})</a>
                                 </span>
                              </p>
                           </div>
                        </div>
                     </div>
                     <div class="row">
                        <div class="col-md-6 col-xs-12 customer-care">
                           <img src="/admin/static/images/patrik-jakl.jpg" alt="" loading="lazy" width="77" height="77">
                           <div class="d-flex">
                              <p><span class="h4">Patrik Jakl</span><br>
                                 <span class="text-muted">{'support'|translate}</span>
                              </p>

                              <p>498 100 222 <a href="mailto:wpj@wpj.cz" target="_parent">wpj@wpj.cz</a><br>
                                 <span class="text-muted">Po–Pá: 8:00–16:00</span>
                              </p>
                           </div>
                        </div>
                        <div class="col-md-6 col-xs-12 customer-care">
                           <img src="/admin/static/images/nonstop-dohled.jpg" alt="" loading="lazy" width="77" height="77">
                           <div class="d-flex">
                              <p><span class="h4">{'supportNonstop'|translate}</span><br>
                                 <span class="text-muted">
                                    {'supportNonstopText'|translate}
                                    <a class="help-tip" data-toggle="tooltip" title="" data-original-title="{'supportNonstopTooltip'|translate}">
                                       <i class="bi bi-info-circle"></i>
                                    </a>
                                 </span>
                              </p>

                              <p>775 134 686<br>
                                 <span class="text-muted">Po–Pá: 16:00–8:00</span><br>
                                 <span class="text-muted">So-Ne: nonstop</span>
                              </p>
                           </div>
                        </div>
                        {* <div class="col-md-6 col-xs-12 customer-care">
                            <img src="/admin/static/images/zakaznicka-verka.jpg" alt="" loading="lazy">
                            <div class="d-flex">
                               <p class="h4 d-flex">Věra Štemberová</p>

                               <p>498 100 222 <a href="mailto:wpj@wpj.cz" target="_parent">wpj@wpj.cz</a><br>
                                  <span class="text-muted">Po–Pá: 8:00–16:00</span>
                               </p>
                            </div>
                         </div>*}
                        {*<div class="col-md-6 col-xs-12 customer-care">
                           <img src="/admin/static/images/zakaznicka-pepe.jpg" alt="" loading="lazy">
                           <div class="d-flex">
                              <p><span class="h4">Josef Špiroch</span><br>
                                 <span class="text-muted">{'manager'|translate}</span>
                              </p>

                              <p><a href="mailto:spiroch@wpj.cz" target="_parent">spiroch@wpj.cz</a></p>
                           </div>
                        </div>*}
                     </div>
                  </div>
               </div>
            </div>
            <div class="col-lg-4 col-xs-12">
               <div class="panel panel-default index-changelog">
                  <div class="panel-body" id="changelog" {if $deploy_time}data-deploytime="{$deploy_time}"{/if}>
                     <h4 class="has-icon">
                        <span class="fc icons_update"></span>
                        <span>{'lastChanges'|translate}</span>
                        <span class="changes-count" data-changes-count>
                           <span class="fc icons_alert"></span>
                           <a href="javascript:nf('', 'launch.php?s=board.php&type=changelog');"><span data-count></span></a>
                        </span>

                        <button class="btn btn-light" data-nav="prev" disabled><span class="fc icons_caret-left"></span></button>
                        <button class="btn btn-light" data-nav="next"><span class="fc icons_caret-right"></span></button>
                     </h4>
                     <div class="slides">
                        <a href="javascript:nf('', 'launch.php?s=board.php&type=changelog');" class="btn">Changelog</a>
                        <div class="slides-inner" data-template></div>
                     </div>

                     <script id="changelogTemplate" type="text/x-dot-template">
                        {literal}
                           {{? it.length > 0}}
                           {{~it :item :index}}
                           <div data-slide="{{= index + 1 }}" class="{{? index==0 }}active{{?}} {{? new Date('{/literal}{$changelog_time}{literal}') < new Date(item.date) }}changed{{?}}">
                              <div class="descr">
                                 <h5 data-title>{{= item.title}}</h5>
                                 {{= item.descr || ""}}
                              </div>
                              <div class="news-footer">
                                 <span class="date">{{= new Date(item.date)).toLocaleString('cs-CZ', {day: 'numeric', month: 'long'} }}</span>
                                 <span class="type type-{{= item.type[0].toLowerCase() }}">{{= item.type }}</span>
                              </div>
                           </div>
                           {{~}}
                           {{?}}
                        {/literal}
                     </script>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
{/block}

{block "js-onready" append}
   {encore_entry_script_tags entry='board' build='admin'}
{/block}
