<?php
/**
 * The admin view file of user module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Yangyang Shi <shiyangyangwork@yahoo.cn>
 * @package     User
 * @version     $Id: admin.html.php 4029 2016-08-26 06:50:41Z liugang $
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../my/view/header.html.php';?>
<?php include '../../common/view/confirmer.html.php';?>
<div id='menuActions'>
  <div class="score">
    <?php foreach($myDepts as $dept) echo sprintf($lang->score->descList->deptScore, $dept->name, $dept->score);?>
  </div>
  <?php
    commonModel::printLink('score', 'giveService', 'mode=manual', $lang->score->giveService, "class='btn btn-secondary confirmer' data-confirmTitle='{$lang->score->tip->confirmGiveServiceTitle}' data-confirmDetail='{$lang->score->tip->confirmGiveServiceDetail}' data-confirmButton='{$lang->confirm}' data-confirming='{$lang->score->giving}'");
    commonModel::printLink('score', 'grantCommon', '', $lang->score->grantCommon, "class='btn btn-primary' data-toggle='modal'");
    commonModel::printLink('score', 'grantBonus', '', $lang->score->grantBonus, "class='btn btn-primary' data-toggle='modal'");
  ?>
</div>
<div class='main-row'>
  <div class='side-col'>
    <div class='panel panel-block'>
      <div class='panel-heading'></div>
      <div class='panel-body'>
        <div id='treeMenuBox'>
          <ul class='tree'>
            <?php foreach($lang->score->grantTypeList as $scoreType => $typeLang):?>
            <li><?php echo html::a($this->createLink('score', 'mygrant', "type={$scoreType}"), $typeLang, $scoreType == $type ? "class='strong'" : '');?></li>
            <?php endforeach;?>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class='main-col'>
    <div class='panel main-table' data-ride='table'>
      <table class='table has-sort-head'>
        <thead>
          <tr class='text-center'>
            <?php $vars = "type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
            <th class='w-60px'><?php commonModel::printOrderLink('id', $orderBy, $vars, $lang->score->id);?></th>
            <th class='w-160px'><?php commonModel::printOrderLink('time', $orderBy, $vars, $lang->score->time);?></th>
            <th class='w-60px'><?php echo $lang->score->before;?></th>
            <th class='w-60px'><?php commonModel::printOrderLink('score', $orderBy, $vars, $lang->score->score);?></th>
            <th class='w-60px'><?php echo $lang->score->after;?></th>
            <th class='w-180px text-left'><?php echo $lang->score->tradeObject;?></th>
            <th class='text-left'><?php echo $lang->score->desc;?></th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($scores as $score):?>
          <?php $rule = zget($rules, $score->rule);?>
          <?php
          if($score->giver == 'system')
          {
              $giver    = $this->lang->score->system;
              $receiver = trim(zget($depts, $score->dept), '/');
          }
          else
          {
              $giver    = trim(zget($depts, $score->dept), '/');
              $receiver = zget($users, $score->receiver);
          }
          ?>
          <tr class='text-center'>
            <td><?php echo $score->id;?></td>
            <td><?php echo $score->time;?></td>
            <td><?php echo $score->before;?></td>
            <td><?php echo $score->score > 0 ? '+' . $score->score : $score->score;?></td>
            <td><?php echo $score->after;?></td>
            <td class='text-left' title="<?php echo $giver . ' -> ' . $receiver;?>"><?php echo $giver . ' -> ' . $receiver;?></td>
            <td class='text-left text-ellipsis' title="<?php echo $score->desc;?>"><?php echo $score->desc;?></td>
          </tr>
          <?php endforeach;?>
        </tbody>
      </table>
      <div class='table-footer'>
        <?php $pager->show();?>
      </div>
    </div>
  </div>
</div>
<?php include '../../common/view/footer.html.php';?>
