<?php
/**
 * The share view file of budget 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      Gang Liu <liugang@cnezsoft.com>
 * @package     budget
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/common/view/header.modal.html.php';?>
<div class='panel'>
  <form id='ajaxForm' method='post' action='<?php echo inlink('share', "period={$period}&year={$year}&month={$month}&week={$week}&dept={$dept}&amebaAccount={$amebaAccount}");?>'>
    <table class='table table-condensed table-borderless'>
      <thead>
        <tr class='text-center'>
          <th class='w-100px'><?php echo $lang->budget->dept;?></th>
          <th><?php echo $lang->budget->shareRate;?></th>
          <th class='w-80px'><?php echo $lang->actions;?></th>
        </tr>
      </thead>
      <?php $shareRate = json_decode(zget($config->ameba, 'shareRate', ''));?>
      <?php foreach($depts as $deptID => $deptName):?>
      <tr class='text-center text-middle'>
        <td>
          <?php echo $deptName;?>
          <?php echo html::hidden("depts[{$deptID}]", $deptID);?>
        </td>
        <td><?php echo html::input("rates[{$deptID}]", zget($shareRate, $deptID, ''), "id='rate{$deptID}' class='form-control'");?></td>
        <td><a href='javascript:;' class='btn btn-xs delItem'><i class='icon icon-remove'></i></a></td>
      </tr>
      <?php endforeach;?>
      <tr>
        <th class='text-center'><?php echo $lang->budget->total;?></th>
        <td class='text-right'><span id='totalRate'></span></td>
        <td></td>
      </tr>
      <tr>
        <td colspan='3' class='form-actions text-center'><?php echo html::submitButton();?></td>
      </tr>
    </table>
  </form>
</div>
<?php include '../../../sys/common/view/footer.modal.html.php';?>
