<?php 
/**
 * The setting view of contract module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      Xiying Guan <guanxiying@xirangit.com>
 * @package     contract 
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../common/view/header.html.php';?>
<?php js::set('mode', 'setting');?>
<div class='panel'>
  <div class='panel-heading'>
    <strong><?php echo $lang->contract->code;?></strong>
  </div>
  <div class='panel-body'>
    <form method='post' id='ajaxForm'>
      <table class='table table-form w-450px'>
        <?php
        foreach($config->contract->codeFormat as $unit):
        $value = '';
        if(!isset($lang->contract->codeUnitList[$unit]))
        {
            $value = $unit; 
            $unit  = 'fix';
        }
        $hideInput = $unit != 'fix';
        ?>
        <tr>
          <td>
            <div class='input-cell<?php echo $hideInput ? '' : ' input-group w-p100'; ?>'>
              <?php echo html::select('unit[]', $lang->contract->codeUnitList, $unit, "class='form-control unit'");?>
              <span class='input-group-addon fix-border fix-padding'></span>
              <?php echo html::input('unit[]', $value, "class='form-control input-cell-addon'");?>
            </div>
          </td>
          <td class='w-100px'>
            <a href='javascript:;' class='btn addItem'><i class='icon-plus'></i></a>
            <a href='javascript:;' class='btn delItem'><i class='icon-remove'></i></a>
          </td>
        </tr>
        <?php endforeach;?>
        <tr>
          <td>
            <div class='input-cell'>
              <?php echo html::select('unit[]', $lang->contract->codeUnitList, '', "class='form-control unit'");?>
              <span class='input-group-addon fix-border fix-padding'></span>
              <?php echo html::input('unit[]', '', "class='form-control input-cell-addon'");?>
            </div>
          </td>
          <td class='w-100px'>
            <a href='javascript:;' class='btn addItem'><i class='icon-plus'></i></a>
            <a href='javascript:;' class='btn delItem'><i class='icon-remove'></i></a>
          </td>
        </tr>
        <tr><td class='form-actions' colspan='2'><?php echo html::submitButton();?></td></tr>
      </table>
    </form>
  </div>
</div>
<?php
$select = html::select('unit[]', $lang->contract->codeUnitList, '', "class='form-control unit'");
$input  = html::input('unit[]', '', "class='form-control input-cell-addon'");
$itemRow = <<<EOT
    <tr>
      <td>
        <div class='input-cell'>
          {$select}
          <span class='input-group-addon fix-border fix-padding'></span>
          {$input}
        </div>
      </td>
      <td class='w-100px'>
        <a href='javascript:;' class='btn addItem'><i class='icon-plus'></i></a>
        <a href='javascript:;' class='btn delItem'><i class='icon-remove'></i></a>
      </td>
    </tr>
EOT;

js::set('itemRow', $itemRow);
?>
<?php include '../../../common/view/footer.html.php';?>
