<?php
/**
 * The personal view file of attend 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      chujilu <chujilu@cnezsoft.com>
 * @package     attend
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('confirmReview', $lang->attend->confirmReview);?>
<div class='panel main-table' data-ride='table'>
  <?php $canBatchReview = ($attends && commonModel::hasPriv('attend', 'batchReview'));?>
  <?php if($canBatchReview):?>
  <form id='batchReviewForm' method='post' action='<?php echo inlink('batchReview', 'status=pass');?>'>
  <?php endif;?>
    <table class='table'>
      <thead>
        <tr class='text-center'>
          <th class='w-90px text-left'>
            <?php if($canBatchReview):?>
            <div class='checkbox-primary check-all' title='<?php echo $this->lang->selectAll;?>'><label></label></div>
            <?php endif;?>
            <?php echo $lang->attend->id;?>
          </th>
          <th class='w-100px'><?php echo $lang->user->dept;?></th>
          <th class='w-100px'><?php echo $lang->attend->account;?></th>
          <th class='w-100px'><?php echo $lang->attend->date;?></th>
          <th class='w-80px'><?php echo $lang->attend->manualIn;?></th>
          <th class='w-80px'><?php echo $lang->attend->manualOut;?></th>
          <th class='w-100px'><?php echo $lang->attend->reason;?></th>
          <th><?php echo $lang->attend->desc;?></th>
          <th class='w-100px'><?php echo $lang->attend->status;?></th>
          <th class='w-100px'><?php echo $lang->actions;?></th>
        </tr>
      </thead>
      <?php foreach($attends as $attend):?>
      <?php if(!isset($users[$attend->account])) continue;?>
      <?php $user = $users[$attend->account];?>
      <tr class='text-center'>
        <td class='text-left'>
          <?php if($canBatchReview):?>
          <div class='checkbox-primary'><input type='checkbox' name='attendIDList[]' value="<?php echo $attend->id;?>" id="attendIDList<?php echo $attend->id;?>">
            <label for="attendIDList<?php echo $attend->id;?>"></label>
          </div>
          <?php endif;?>
          <?php echo $attend->id;?>
        </td>
        <td><?php echo zget($deptList, $user->dept, '');?></td>
        <td><?php echo $user->realname;?></td>
        <td><?php echo formatTime($attend->date, DT_DATE1)?></td>
        <td><?php echo substr($attend->manualIn, 0, 5)?></td>
        <td><?php echo substr($attend->manualOut, 0, 5)?></td>
        <td><?php echo zget($lang->attend->reasonList, $attend->reason)?></td>
        <td><?php echo $attend->desc?></td>
        <td><?php echo zget($lang->attend->statusList, $attend->status)?></td>
        <td>
          <?php
          $canReview = $this->attend->isClickable($attend, 'review');
          if($canReview)
          {
              echo html::a(inlink('review', "attendID={$attend->id}&status=pass"),   $lang->attend->reviewStatusList['pass'],   "class='pass'");
              echo html::a(inlink('review', "attendID={$attend->id}&status=reject"), $lang->attend->reviewStatusList['reject'], "data-toggle='modal'");
          }
          else
          {
              echo html::a('javascript:;', $lang->attend->reviewStatusList['pass'],   "class='disabled'");
              echo html::a('javascript:;', $lang->attend->reviewStatusList['reject'], "class='disabled'");
          }
          ?>
        </td>
      </tr>
      <?php endforeach;?>
    </table>
    <?php if(!$attends):?>
    <div class='table-footer'>
      <div class='pager' style='float: right; clear: none'><?php echo $lang->pager->noRecord;?></div>
    </div>
    <?php endif;?>
    <?php if($canBatchReview):?>
    <div class='table-footer'>
      <div class='checkbox-primary check-all'><label><?php echo $lang->selectAll?></label></div>
      <div class='table-actions btn-toolbar'><?php echo html::a('javascript:;', $lang->attend->reviewStatusList['pass'], "class='btn batchPass'");?>
      <div class='table-statistic'></div>
    </div>
  </form>
  <?php endif;?>
</div>
<?php include '../../common/view/footer.html.php';?>
