<div id="flapWarehouse" class="tab-pane fade in boxFlex">
   {printDateBar barName='Warehouse' graphs=['Warehouse']}
    <div style="float: right">
    </div>
    <div class="row bottom-space" id="users_content">
       {if $tab.data.userData}
        <div class="col-md-6">
            <div>
                <div class="panel panel-default panel-sm">
                    <div class="panel-heading">
                        <a class="help-tip" style="position:relative; float:right; margin-top: 5px;" data-toggle="tooltip"
                           title="{'userStats'|translate}">
                            <i class="bi bi-question-circle"></i>
                        </a>
                        <h3 class="panel-title">{'userStats'|translate}</h3>
                    </div>
                    <table class="table">
                        <tr>
                            <th style="10%">{'login'|translate}</th>
                            <th style="75%">{'count_points'|translate}</th>
                        </tr>
                        {foreach $tab.data.userData as $item}
                            <tr style="background-color: #f9f9f9; border-top: 2px solid #ddd !important; ">
                                <td>{$item.login}</td>
                                <td>{$item.score}</td>
                            </tr>
                        {/foreach}
                    </table>
                </div>
            </div>
        </div>
       <div class="col-md-6">
          <div>
             <div class="panel panel-default panel-sm">
                <div class="panel-heading">
                   <h3 class="panel-title">Statistika balení</h3>
                </div>
                <table class="table">
                   <tr>
                      <th style="10%">{'login'|translate}</th>
                      <th style="75%">Počet balíků</th>
                   </tr>
                   {foreach $tab.data.packingData as $item}
                      <tr style="background-color: #f9f9f9; border-top: 2px solid #ddd !important; ">
                         <td>{$item.login}</td>
                         <td>{$item.score}</td>
                      </tr>
                   {/foreach}
                </table>
             </div>
          </div>
       </div>
       {/if}
    </div>

   <div class="row bottom-space" data-display-area="warehouse">
      <div class="col-md-6">
         {printIntervalBar barName='Warehouse'}
         <div class="well graph" id="warehouse">

         </div>
      </div>

      <div class="col-md-6">
         <div class="well graph" id="warehousePacking">

         </div>
      </div>
   </div>

</div>

<script type="application/javascript">
    {block onready append}
    {literal}

    function getWarehouseGraph(interval){
       showGraphsArea($(this));
       reloadDivWarehouse();
       renderWarehouseGraph(interval);
    }

    function reloadDivWarehouse() {
        var from = $(document).find('[name=fromWarehouse]').val(),
            to = $(document).find('[name=toWarehouse]').val();

       reloadDiv('#users_content', {
           type: 'stats',
           fromWarehouse: from,
           toWarehouse: to,
       }, 'editform');
    }

    function renderWarehouseGraph(interval){
        var from = $(document).find('[name=fromWarehouse]').val(),
        to = $(document).find('[name=toWarehouse]').val();

        reloadGraph('#warehouse', {
          typegraph:"warehouse",
          acn:'getWarehouseGraph',
          fromWarehouse: from,
          toWarehouse: to,
          intervalWarehouse: interval
       },'editform');

       reloadGraph('#warehousePacking', {
          typegraph:"warehouse",
          acn:'getWarehouseGraph',
          fromWarehouse: from,
          toWarehouse: to,
          intervalWarehouse: interval,
          packing: true
       },'editform');
    }

    {/literal}
    {/block}
</script>
