  <div class="l-center">
    <div class="l-sort clearfix noselect">
      <div class="l-unit-toolbar__buttonstrip">
        <a class="ui-button cancel" id="btn-back" href="/list/user/"><i class="fas fa-arrow-left status-icon blue"></i> <?=__('Back')?></a>
        <a href="/add/package/" id="btn-create" class="ui-button cancel" title="<?=__('Add Package')?>"><i class="fas fa-plus-circle status-icon green"></i> <?=__('Add Package')?></a>
    </div>
      <ul class="context-menu sort-order animated fadeIn" style="display:none;">
        <li entity="sort-date" sort_as_int="1"><span class="name active"><?=__('Date')?> <i class="fas fa-sort-amount-down"></i></span><span class="up"><i class="fas fa-sort-amount-up"></i></span></li>
        <li entity="sort-name"><span class="name"><?=__('Package Name')?> <i class="fas fa-sort-amount-down"></i></span><span class="up"><i class="fas fa-sort-amount-up"></i></span></li>
      </ul>
      <div class="l-sort-toolbar clearfix">
        <table>
          <tr>
            <td class="sort-by">
                <?=__('sort by');?>: <span><b><?=__('Date')?> <i class="fas fa-sort-amount-down"></i></b></span>
            </td>
            <td>
              <form action="/bulk/package/" method="post" id="objects">
                <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
                <div class="l-select">
                  <select class="" name="action">
                    <option value=""><?=__('apply to selected')?></option>
                    <option value="delete"><?=__('delete')?></option>
                  </select>
                </div>
                <button type="submit" class="l-sort-toolbar__filter-apply" value=""><i class="fas fa-arrow-right"></i></button>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>

  <div class="l-separator"></div>

  <div class="l-center units animated fadeIn">
      <div class="table-header"> 
          <div class="l-unit__col l-unit__col--right">
                <div class="clearfix l-unit__stat-col--left super-compact">
                  <input id="toggle-all" type="checkbox" name="toggle-all" value="toggle-all" onChange="checkedAll('objects');">
                </div>
                <div class="clearfix l-unit__stat-col--left wide-2"><b><?php print __('Package');?></b></div>
                <div class="clearfix l-unit__stat-col--left compact-3 text-right"><b>&nbsp;</b></div>
                <div class="clearfix l-unit__stat-col--left text-center compact"><b><i class="fas fa-terminal" title="<?php print __('Shell');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center compact"><b><i class="fas fa-hdd" title="<?php print __('Disk');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center compact"><b><i class="fas fa-exchange-alt" title="<?php print __('Bandwidth');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-globe-americas" title="<?php print __('Web Domains');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-link" title="<?php print __('Web Aliases');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-atlas" title="<?php print __('DNS Domains');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-globe" title="<?php print __('DNS Records');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-mail-bulk" title="<?php print __('Mail Domains');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-inbox" title="<?php print __('Mail Accounts');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-database" title="<?php print __('Databases');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-clock" title="<?php print __('Cron Jobs');?>"></i></b></div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact"><b><i class="fas fa-file-archive" title="<?php print __('Backups');?>"></i></b></div>
           </div>
        </div>

    <?php
      foreach ($data as $key => $value) {
        ++$i;
        if ($data[$key]['SUSPENDED'] == 'yes') {
          $status = 'suspended';
          $spnd_action = 'unsuspend' ;
          $spnd_confirmation = 'UNSUSPEND_USER_CONFIRMATION' ;
        } else {
          $status = 'active';
          $spnd_action = 'suspend' ;
          $spnd_confirmation = 'SUSPEND_USER_CONFIRMATION' ;
        }
    ?>

    <div class="l-unit  <? if($status == 'suspended') echo 'l-unit--suspended'; if($_SESSION['favourites']['USER'][$key] == 1) echo ' l-unit--starred';?>" v_section="user"
v_unit_id="<?=$key?>" sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=$key?>"
sort-bandwidth="<?=$data[$key]['U_BANDWIDTH']?>" sort-disk="<?=$data[$key]['U_DISK']?>" sort-star="<? if($_SESSION['favourites']['USER'][$key] == 1) echo '1'; else echo '0'; ?>">
      <div class="l-unit__col l-unit__col--right">
        <div class="clearfix l-unit__stat-col--left super-compact">
          <input id="check<?=$i?>" class="ch-toggle" type="checkbox" name="user[]" value="<?=$key?>">
        </div>
            <div class="clearfix l-unit__stat-col--left wide-2"><b><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>"><?=$key?></b></a></div>
            <!-- START QUICK ACTION TOOLBAR AREA -->
            <div class="clearfix l-unit__stat-col--left text-right compact-3">
                  <div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
                      <div class="actions-panel clearfix">
                        <div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
                        <div class="actions-panel__col actions-panel__edit" key-action="href"><a href="/copy/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>"><i class="fas fa-clone status-icon teal status-icon dim"></i></a></div>
                        <div class="actions-panel__col actions-panel__delete shortcut-delete" key-action="js">
                          <a id="delete_link_<?=$i?>" class="data-controls do_delete">
                            <i class="fas fa-trash status-icon red status-icon dim do_delete"></i>
                            <input type="hidden" name="delete_url" value="/delete/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" />
                            <div id="delete_dialog_<?=$i?>" class="confirmation-text-delete hidden" title="<?=__('Confirmation')?>">
                              <p class="confirmation"><?=__('DELETE_PACKAGE_CONFIRMATION',$key)?></p>
                            </div>
                          </a>
                        </div>
                      </div>
                    </div>
            </div>
            <!-- END QUICK ACTION TOOLBAR AREA -->
            <div class="clearfix l-unit__stat-col--left text-center compact">
              <? if($data[$key]['SHELL'] == 'nologin'){ ?>
                <i class="fas fa-minus-circle status-icon large"></i>
              <? } else {?>
                <i class="fas fa-check-circle status-icon green large"></i>
              <? } ?>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center compact">
              <?php if (preg_match('/[a-z]/i', $data[$key]['DISK_QUOTA'])): ?>
                <b>&infin;</b>
              <?php else: ?>
                  <b><?=humanize_usage_size($data[$key]['DISK_QUOTA'])?></b> <span class="text-small"><?=humanize_usage_measure($data[$key]['DISK_QUOTA'])?></span>
              <?php endif; ?>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center compact">
                <? if($data[$key]['WEB_DOMAINS'] == 'unlimited'){ ?>
                  <b>&infin;</b>
                <? } else {?>
                  <b><?=humanize_usage_size($data[$key]['BANDWIDTH'])?></b> <span class="text-small"><?=humanize_usage_measure($data[$key]['BANDWIDTH'])?></span>
                <? } ?>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
              <span class="jump-top badge gray raised">
                <? if($data[$key]['WEB_DOMAINS'] == 'unlimited'){ ?>
                  <b>&infin;</b>
                <? } else {?>
                 <b><?=$data[$key]['WEB_DOMAINS']?></b>
                <? } ?>
              </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['WEB_ALIASES'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['WEB_ALIASES']?></b>
                  <? } ?>
                </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['DNS_DOMAINS'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['DNS_DOMAINS']?></b>
                  <? } ?>
                </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['DNS_RECORDS'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['DNS_RECORDS']?></b>
                  <? } ?>
                </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['MAIL_DOMAINS'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['MAIL_DOMAINS']?></b>
                  <? } ?>
                </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['MAIL_ACCOUNTS'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['MAIL_ACCOUNTS']?></b>
                  <? } ?>
                </span>
            </div>
            <div class="clearfix l-unit__stat-col--left text-center super-compact">
                <span class="jump-top badge gray raised">
                  <? if($data[$key]['DATABASES'] == 'unlimited'){ ?>
                    <b>&infin;</b>
                  <? } else {?>
                   <b><?=$data[$key]['DATABASES']?></b>
                  <? } ?>
                </span>
              </div>
              <div class="clearfix l-unit__stat-col--left text-center super-compact">
                  <span class="jump-top badge gray raised">
                    <? if($data[$key]['CRON_JOBS'] == 'unlimited'){ ?>
                      <b>&infin;</b>
                    <? } else {?>
                     <b><?=$data[$key]['CRON_JOBS']?></b>
                    <? } ?>
                  </span>
                </div>
                <div class="clearfix l-unit__stat-col--left text-center super-compact">
                  <span class="jump-top badge gray raised">
                    <? if($data[$key]['BACKUPS'] == 'unlimited'){ ?>
                      <b>&infin;</b>
                    <? } else {?>
                     <b><?=$data[$key]['BACKUPS']?></b>
                    <? } ?>
                  </span>
                </div>
        </div>
       </div>
    <?}?>
  </div>

  <div id="vstobjects">
      <div class="l-separator visible"></div>
  <div class="l-center">
      <div class="l-unit-ft">
        <table class='data'></table>
        <div class="data-count l-unit__col l-unit__col--right clearfix">
          <?php
          if ( $i == 1) {
            echo __('1 package');
          } else {
            echo __('%s packages',$i);
          }
        ?>
        </div>
    </div>
  </div>
</div>
