<?php
/**
 * The assign to purchase view file of order module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      Gang Liu <liugang@cnezsoft.com>
 * @package     order
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/common/view/header.modal.html.php';?>
<?php include '../../../sys/common/view/kindeditor.html.php';?>
<?php js::set('checked', false);?>
<div class='panel main-table' data-ride='table' data-fix-header='false'>
  <form method='post' id='ajaxForm' action='<?php echo inlink('assignToPurchase', "id={$order->id}");?>'>
    <table class='table'>
      <thead>
        <tr class='text-middle'>
          <th>
            <?php if($order->products):?>
            <div class='checkbox-primary check-all' title='<?php echo $this->lang->selectAll;?>'>
              <label><?php echo $lang->product->name;?></label>
            </div>
            <?php endif;?>
          </th>
          <th class='w-120px'><?php echo $lang->product->model;?></th>
          <th class='w-100px' ><?php echo $lang->product->unit;?></th>
          <th class='w-100px'><?php echo $lang->order->orderAmount;?></th>
          <th class='w-100px'><?php echo $lang->order->storeAmount;?></th>
          <th class='w-140px'><?php echo $lang->order->purchaseAmount;?></th>
        </tr>
      </thead>
      <tbody>
        <?php foreach($order->products as $orderProduct):?>
        <tr class='text-middle'>
          <td>
            <div class='checkbox-primary'><input type='checkbox' name='products[]' value="<?php echo $orderProduct->product;?>" id="products<?php echo $orderProduct->product;?>">
              <label for="products<?php echo $orderProduct->product;?>"><?php echo $orderProduct->name;?></label>
            </div>
          </td>
          <td><?php echo $orderProduct->model;?></td>
          <td><?php echo $orderProduct->unit;?></td>
          <td><?php echo $orderProduct->amount;?></td>
          <td><?php echo $orderProduct->storeAmount;?></td>
          <td><?php echo html::input('amount[]', $orderProduct->purchaseAmount, "class='form-control'");?></td>
        </tr>
        <?php endforeach;?>
      </tbody>
    </table>
    <?php if($order->products):?>
    <div class='table-footer'>
      <div class='checkbox-primary check-all'><label><?php echo $lang->selectAll?></label></div>
      <div class='table-actions btn-toolbar'>
        <?php echo html::select('assignedTo', $users, '', "class='form-control chosen' data-placeholder='{$lang->order->assignedTo}'");?>
        <?php echo html::submitButton($lang->order->assignToPurchase, 'btn btn-primary');?>
        <?php echo html::hidden('notSelected');?>
      </div>
      <div class='table-statistic'></div>
    </div>
    <?php endif;?>
  </form>
</div>
<?php include '../../../sys/common/view/footer.modal.html.php';?>
