<?php
/**
 * The edit view file of task 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      Tingting Dai <daitingting@xirangit.com>
 * @package     task
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.modal.html.php';?>
<?php include '../../common/view/editor.html.php';?>
<form method='post' id='copyForm' enctype='multipart/form-data' action="<?php echo $this->createLink('task', 'copy', "taskID={$task->id}&from=$from")?>">
  <table class='table table-form table-data w-p80'>
    <tr>
      <th class='w-80px'><?php echo $lang->task->name?></th>
      <td class='w-p50'>
        <div class='input-group'>
          <?php echo html::input('name', $task->name, "class='form-control'");?>
          <span class='input-group-addon '><?php echo $lang->task->pri;?></span>
          <?php echo html::select('pri', $lang->task->priList, $task->pri, "class='form-control'");?>
        </div>
      </td><td></td>
    </tr>
    <tr>
      <th class='w-80px'><?php echo $lang->task->assignedTo;?></th>
      <td class='w-p40'>
        <div class='input-group'>
          <?php echo html::select('assignedTo', $members, $task->assignedTo, "class='form-control'");?>
          <?php echo html::input('teamMember', '', "class='form-control team-group hidden' readonly");?>
          <span class='input-group-addon'>
            <label class='checkbox-inline'>
              <input type='checkBox' name='multiple' value='1' <?php echo empty($task->team) ? '' : 'checked'?>/>
              <?php echo $lang->task->multipleAB;?>
            </label>
          </span>
        </div>
      </td><td></td>
    </tr>
    <tr class='team hidden'>
      <th class='w-80px'><?php echo $lang->task->team;?></th>
      <td colspan="2">
        <table class='table table-detail table-condensed table-borderless'>
          <?php foreach($task->team as $member):?>
          <tr>
            <td><?php echo html::select("team[]", $members, $member->account, "class='form-control chosen'")?></td>
            <td class='w-120px'><?php echo html::input("role[]", $member->role, "class='form-control' placeholder='{$lang->project->role}'")?></td>
            <td class='w-130px'>
              <div class='input-group'>
                <?php echo html::input("teamEstimate[]", $member->estimate, "class='form-control text-center' placeholder='{$lang->task->estimateAB}'")?>
                <span class='input-group-addon'><?php echo $lang->task->hour?></span>
              </div>
            </td>
            <td class='w-90px'>
              <a href='javascript:;' class='btn btn-move-up btn-sm'><i class='icon-arrow-up'></i></a>
              <a href='javascript:;' class='btn btn-move-down btn-sm'><i class='icon-arrow-down'></i></a>
            </td>
          </tr>
          <?php endforeach;?>
          <?php for($i = 0; $i < 3; $i++):?>
          <tr>
            <td><?php echo html::select("team[]", $members, '', "class='form-control chosen'")?></td>
            <td class='w-120px'><?php echo html::input("role[]", '', "class='form-control' placeholder='{$lang->project->role}'")?></td>
            <td class='w-130px'>
              <div class='input-group'>
                <?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->estimateAB}'")?>
                <span class='input-group-addon'><?php echo $lang->task->hour?></span>
              </div>
            </td>
            <td class='w-90px'>
              <a href='javascript:;' class='btn btn-move-up btn-sm'><i class='icon-arrow-up'></i></a>
              <a href='javascript:;' class='btn btn-move-down btn-sm'><i class='icon-arrow-down'></i></a>
            </td>
          </tr>
          <?php endfor;?>
        </table>
      </td>
    </tr>
    <tr>
      <th><?php echo $lang->task->estimate;?></th>
      <td>
        <div class='input-group'>
          <?php echo html::input('estimate', $task->estimate, "class='form-control'")?>
          <span class='input-group-addon '><?php echo $lang->task->deadline;?></span>
          <?php echo html::input('deadline', formatTime($task->deadline), "class='form-control form-date'");?>
        </div>
      </td><td></td>
    </tr>
    <tr>
      <th><?php echo $lang->task->desc?></th>
      <td colspan='2'><?php echo html::textarea('desc', $task->desc, "class='form-control'");?></td>
    </tr>
    <tr>
      <th><?php echo $lang->task->mailto;?></th>
      <td colspan='2'><?php echo html::select('mailto[]', $users, $task->mailto, "class='form-control chosen' multiple data-placeholder='{$lang->task->mailtoPlaceholder}'");?></td>
    </tr>
    <?php if(commonModel::hasPriv('file', 'upload')):?>
    <tr>
      <th><?php echo $lang->files;?></th>
      <td colspan='2'><?php echo $this->fetch('file', 'buildForm')?></td>
    </tr>
    <?php endif;?>
    <tr>
      <th></th>
      <td colspan='2' class='form-actions'>
      <?php echo html::hidden('kanbanRegion', $task->kanbanRegion);?>
      <?php echo html::hidden('kanbanLane', $task->kanbanLane);?>
      <?php echo html::hidden('kanbanColumn', $task->kanbanColumn);?>
      <?php echo html::submitButton();?>
      </td>
    </tr>
  </table>
</form>
<?php include '../../common/view/footer.modal.html.php';?>
