<?php
/**
 * The view file of effort module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      Tingting Dai <daitingting@xirangit.com>
 * @package     effort 
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php if(helper::isAjaxRequest()):?>
<?php include '../../../sys/common/view/header.modal.html.php';?>
<?php else:?>
<?php include '../../../sys/my/view/header.html.php';?>
<?php endif;?>
<div class='main-row'>
  <div class='main-col'>
    <div class='panel'>
      <table class='table table-form' id='effort'> 
        <tbody>
          <tr>
            <th class='w-80px'><?php echo $lang->effort->account;?></th>
            <td><?php echo zget($users, $effort->account);?></td>
          </tr>  
          <tr>
            <th class='rowhead'><?php echo $lang->effort->date;?></th>
            <td><?php echo date(DT_DATE1, strtotime($effort->date));?></td>
          </tr>  
          <tr>
            <th class='rowhead'><?php echo $lang->effort->consumed;?></th>
            <td><?php if(isset($effort->consumed)) echo $effort->consumed . ' ' . $lang->effort->hour;?></td>
          </tr>  
          <?php if($effort->objectType == 'task'):?>
          <tr>
            <th class='rowhead'><?php echo $lang->effort->left;?></th>
            <td><?php if(isset($effort->consumed)) echo $effort->left . ' ' . $lang->effort->hour;?></td>
          </tr>
          <?php endif;?>
          <tr>
            <th class='rowhead'><?php echo $lang->effort->objectType;?></th>
            <td>
              <?php
              echo $lang->effort->objectTypeList[$effort->objectType];
              if($work)
              {
                  $class  = $effort->objectType == 'todo' ? 'loadInModal' : '';
                  $module = ((strpos(',order,customer,contract,', ",$effort->objectType,") !== false) ? 'crm.' : (($effort->objectType == 'task') ? 'oa.' : '')) . $effort->objectType;
                  echo html::a($this->createLink($module, 'view', "objectID={$effort->objectID}"), ' #' . $effort->objectID . ' ' .$work[$effort->objectID], "class='objectLink $class'");
              }
              ?>
            </td>
          </tr>  
          <tr>
            <th class='rowhead'><?php echo $lang->effort->work;?></th>
            <td><?php echo $effort->work;?></td>
          </tr>  
        </tbody>
      </table>
    </div>
    <?php echo $this->fetch('action', 'history', "objectType=effort&objectID={$effort->id}");?>
    <div class='main-actions text-center'>
      <div class='btn-toolbar'>
        <?php
        echo html::a('#', $lang->goback, "class='btn btn-back' data-dismiss='modal'");
        echo "<div class='divider'></div>";

        if($effort->account == $app->user->account)
        {
            commonModel::printLink('effort', 'edit', "effortID=$effort->id", $lang->edit, "class='btn ajaxEdit'");
            commonModel::printLink('effort', 'delete', "effortID=$effort->id", $lang->delete, "class='btn deleter'");
        }
        ?>
      </div>
    </div>
  </div>
</div>
<?php if(helper::isAjaxRequest()):?>
<?php include '../../../sys/common/view/footer.modal.html.php';?>
<?php else:?>
<script>
$('#menu li').removeClass('active').find('a[href*=effort][href*=all]').parent().addClass('active');
</script>
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
<?php endif;?>
