<?php
/**
 * The save order record view file of order 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     order
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/common/view/header.modal.html.php';?>
<?php js::set('key', count($details));?>
<?php js::set('money', $trade->money);?>
<?php js::set('detailTip', $lang->trade->detailTip);?>
<form method='post' id='detailList' action='<?php echo inlink('detail', "tradeID={$trade->id}")?>' class='form-table'>
  <table class='table table-bordered'>
    <thead>
      <tr class='text-center'>
        <th class='w-100px'><?php echo $lang->trade->money;?></th>
        <?php if($trade->type == 'in' or $trade->type == 'out'):?>
        <th class='w-200px'><?php echo $lang->trade->category;?></th>
        <?php endif;?>
        <th class='w-200px'><?php echo $lang->trade->handlers;?></th>
        <th><?php echo $lang->trade->desc;?></th>
        <th class='w-80px'></th>
      </tr>
    </thead>
    <tbody>
      <?php foreach($details as $key => $detail):?>
      <tr>
        <td><?php echo html::input("money[{$key}]", $detail->money, "class='form-control'")?></td>
        <?php if($trade->type == 'in' or $trade->type == 'out'):?>
        <td><?php if(isset($categories)) echo html::select("category[{$key}][]", array('') + $categories, $detail->category, "class='form-control chosen'")?></td>
        <?php endif;?>
        <td><?php echo html::select("handlers[{$key}][]", $users, $detail->handlers, "class='form-control chosen' multiple")?></td>
        <td><?php echo html::textarea("desc[{$key}]", $detail->desc, "class='form-control'")?></td>
        <td class='text-center text-middle'>
          <a class='btn btn-mini addDetail'><i class='icon-plus plus'></i></a>
          <a class='btn btn-mini delDetail'><i class='icon-minus minus'></i></a>
        </td>
      </tr>
      <?php endforeach;?>
    </tbody>
  </table>
  <div class='text-center form-actions'><?php echo html::submitButton() . html::commonButton($lang->goback, 'btn btn-back', "data-dismiss='modal'");?></div>
</form>
<table class='hide'>
  <tbody id='hiddenDetail'>  
    <tr>
      <td><?php echo html::input("money[key]", '', "class='form-control'")?></td>
      <?php if($trade->type == 'in' or $trade->type == 'out'):?>
      <td><?php if(isset($categories)) echo html::select("category[key][]", array('') + $categories, '', "class='form-control'")?></td>
      <?php endif;?>
      <td><?php echo html::select("handlers[key][]", $users, $trade->handlers, "class='form-control' multiple")?></td>
      <td><?php echo html::textarea("desc[key]", '', "class='form-control'")?></td>
      <td class='text-center text-middle'>
        <a class='btn btn-mini addDetail'><i class='icon icon-plus'></i></a>
        <a class='btn btn-mini delDetail'><i class='icon icon-minus'></i></a>
      </td>
    </tr>
  </tbody>
</table>
<?php include '../../../sys/common/view/footer.modal.html.php';?>
