<?php
/**
 * The detail 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      Gang Liu <liugang@cnezsoft.com>
 * @package     attend 
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../../sys/common/view/treeview.html.php';?>
<?php $lang->attend->abbrStatusList['rest'] = '';?>
<div id='menuActions'>
  <?php commonModel::printLink('attend', 'exportDetail', "date=$currentYear$currentMonth", $lang->attend->export, "class='iframe btn btn-primary'")?>
</div>
<div class='main-row'>
  <div class='side-col col-3'>
    <div class='panel'>
      <div class='panel-heading'><strong><?php echo $currentYear . ($this->app->clientLang != 'en' ? $lang->year : '') . $lang->attend->detail;?></strong></div>
      <div class='panel-body'>
        <div class='row'>
          <?php 
          $lastmonth = $currentYear == date('Y') ? date('m') : 12;
          for($month = 1; $month <= $lastmonth; $month++)
          {
              $class = $month == $currentMonth ? 'btn-primary' : '';
              $month = $month < 10 ? '0' . $month : $month;
              echo "<div class='col-xs-3 monthDIV'>" . html::a(inlink('detail', "date=$currentYear$month"), $month . ($this->app->clientLang != 'en' ? $lang->month : ''), "class='btn btn-mini $class'") . '</div>';
          }
          ?>
        </div>
      </div>
    </div>
    <div class='panel'>
      <div class='panel-heading'><strong><?php echo $lang->attend->search;?></strong></div>
      <div class='panel-body'>
        <form id='searchForm' method='post' action='<?php echo inlink('detail');?>'>
          <div class='form-group'>
            <div class='input-group'>
              <span class='input-group-addon'><?php echo $lang->user->dept;?></span>
              <?php echo html::select('dept', $deptList, $dept, "class='form-control chosen'");?>
            </div>
          </div>
          <div class='form-group'>
            <div class='input-group'>
              <span class='input-group-addon'><?php echo $lang->attend->user;?></span>
              <?php echo html::select('account', $userList, $account, "class='form-control chosen'");?>
            </div>
          </div>
          <div class='form-group'>
            <div class='input-group'>
              <span class='input-group-addon'><?php echo $lang->attend->date;?></span>
              <?php echo html::input('date', $date, "class='form-control form-month'");?>
            </div>
          </div>
          <div class='form-group'><?php echo html::submitButton($lang->attend->search);?></div>
        </form>
      </div>
    </div>
  </div>
  <div class='main-col col-9'>
    <div class='panel' data-ride='table'>
      <div class='panel-heading text-center'>
        <strong><?php echo $fileName;?></strong>
      </div>
      <div class='panel-body'>
        <table class='table table-bordered'>
          <thead>
            <tr class='text-center'>
              <th class='w-100px'><?php echo $lang->user->dept;?></th>
              <th class='w-100px'><?php echo $lang->attend->user;?></th>
              <th class='w-90px'><?php echo $lang->attend->date;?></th>
              <th class='w-80px'><?php echo $lang->attend->dayName;?></th>
              <th><?php echo $lang->attend->status;?></th>
              <th class='w-90px'><?php echo $lang->attend->signIn;?></th>
              <th class='w-90px'><?php echo $lang->attend->signOut;?></th>
              <th class='w-90px'><?php echo $lang->attend->ip;?></th>
            </tr>
          </thead>
          <?php foreach($attends as $attend):?>
          <tr class='text-center'>
            <td><?php echo $attend->dept;?></td>
            <td><?php echo $attend->realname;?></td>
            <td><?php echo formatTime($attend->date, DT_DATE1);?></td>
            <td><?php echo $attend->dayName;?>
            <td class='text-left c-name'><?php echo empty($attend->desc) ? $attend->status : $attend->desc;?></td>
            <td><?php echo $attend->signIn;?></td>
            <td><?php echo $attend->signOut;?></td>
            <td><?php echo $attend->ip;?></td>
          </tr>
          <?php endforeach;?>
        </table>
      </div>
    </div>
  </div>
</div>
<?php include '../../common/view/footer.html.php';?>
