<?php
/**
 * The view file for view method of feedback module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      Yidong Wang <yidong@cnezsoft.com>
 * @package     feedback
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../../sys/common/view/kindeditor.html.php';?>
<?php js::set('type', $type);?>
<div id='mainTitle' class='clearfix'>
  <div class='btn-toolbar pull-left'>
    <?php if(!isonlybody()):?>
    <?php echo html::a("javascript:history.go(-1);", '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "class='btn btn-back'");?>
    <div class="divider"></div>
    <?php endif;?>
    <div class="page-title">
      <span class="label label-id"><?php echo $issue->id?></span>
      <span class="text" title='<?php echo $issue->title; ?>'><?php echo $issue->title; ?></span>
    </div>
  </div>
</div>
<div class='main-row'>
  <div class='main-col col-8'>
    <div class='panel panel-block'>
      <div class='panel-heading'><strong><?php echo $lang->feedback->desc;?></strong></div>
      <div class='panel-body'>
        <?php echo htmlspecialchars_decode($issue->desc);?>
      </div>
    </div>
    <?php echo $this->fetch('action', 'history', "objectType=feedback&objectID={$issue->id}")?>
    <div class='main-actions'>
      <div class='btn-toolbar'>
        <?php echo html::backButton();?>
        <div class='divider'></div>
        <?php
        $disabled = $issue->status == 'closed' ? 'disabled' : '';
        commonModel::printLink('feedback', 'assignTo', "issueID={$issue->id}", $lang->assign, "data-toggle='modal' class='btn {$disabled}'");
        if($issue->status != 'replied') commonModel::printLink('feedback', 'reply',    "issueID={$issue->id}", $lang->feedback->reply, "data-toggle='modal' class='btn'");
        if($issue->status == 'replied') commonModel::printLink('feedback', 'doubt',    "issueID={$issue->id}", $lang->feedback->doubt, "data-toggle='modal' class='btn'");
        if($issue->status == 'closed')  commonModel::printLink('feedback', 'activate', "issueID={$issue->id}", $lang->activate,        "data-toggle='modal' class='btn'");
        if($issue->status != 'closed')  commonModel::printLink('feedback', 'close',    "issueID={$issue->id}", $lang->close,           "data-toggle='modal' class='btn'");
        ?>
        <div class='divider'></div>
        <?php  
        commonModel::printLink('feedback', 'edit',   "issueID={$issue->id}&type=$type", $lang->edit, "class='btn {$disabled}'");
        commonModel::printLink('feedback', 'delete', "issueID={$issue->id}", $lang->delete, "class='deleter btn'");
        ?>
      </div>
    </div>
  </div>
  <div class='side-col col-4'>
    <div class='panel panel-block'>
      <div class='panel-heading'>
        <strong><?php echo $lang->feedback->legendBasic;?></strong>
      </div>
      <div class='panel-body'>
        <table class='table table-data'>
          <tr>
            <th class='w-80px'><?php echo $lang->feedback->customer?></th>
            <td><?php if(!commonModel::printLink('customer', 'view', "customerID={$issue->customer}", zget($customer, 'name', ''))) echo zget($customer, 'name', '');?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->product?></th>
            <td><?php echo zget($product, 'name', '');?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->contact?></th>
            <td><?php if(!commonModel::printLink('contact', 'view', "contactID={$issue->contact}", zget($contact, 'realname', ''))) echo zget($contact, 'realname', '');?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->status?></th>
            <td><?php echo $lang->feedback->statusList[$issue->status]?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->pri?></th>
            <td><span class='pri pri-<?php echo $issue->pri;?> active'><?php echo $lang->feedback->priList[$issue->pri]?></span></td>
          </tr>
        </table>
      </div>
    </div>
    <div class='panel panel-block'>
      <div class='panel-heading'>
        <strong><?php echo $lang->feedback->legendEffort;?></strong>
      </div>
      <div class='panel-body'>
        <table class='table table-data'>
          <tr>
            <th class='w-80px'><?php echo $lang->feedback->addedBy;?></th>
            <td><?php echo zget($users, $issue->addedBy) . $lang->at . $issue->addedDate;?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->assignedTo;?></th>
            <td><?php if($issue->assignedTo) echo zget($users, $issue->assignedTo) . $lang->at . $issue->assignedDate;?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->transferedBy;?></th>
            <td><?php if($issue->transferedBy) echo zget($users, $issue->transferedBy) . $lang->at . $issue->transferedDate;?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->closedBy;?></th>
            <td><?php if($issue->closedBy) echo zget($users, $issue->closedBy) . $lang->at . $issue->closedDate;?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->closedReason;?></th>
            <td><?php if($issue->closedReason) echo zget($lang->feedback->closedReasonList, $issue->closedReason);?></td>
          </tr>
          <tr>
            <th><?php echo $lang->feedback->editedBy;?></th>
            <td><?php if($issue->editedBy) echo zget($users, $issue->editedBy) . $lang->at . $issue->editedDate;?></td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</div>
<?php include '../../common/view/footer.html.php';?>
