<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
    $(function(){
        $("#save-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#priceForm").serialize();
                $.post('/finance/gift-price-save',params,function(obj){
                    alert(obj.msg);
                    $('#back-btn').click();
                },'json');
            }
        });
        $("#back-btn").click(function(){
            window.location.href = "/finance/pay-list?year=<?=$year?>&month=<?=$month?>";
        });
    });
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <form id="searchForm">
        <tr>
            <td class="td_bg" align="right">
                <?=$year?>年<?=$month?>月
                &nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="act_btn" id="save-btn" name="save-btn" value="保存价格">
                <input type="button" class="act_btn" id="back-btn" name="back-btn" value="返回">
            </td>
        </tr>
    </form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" class="bg_tr">序号</td>
        <td width="80%" align="center" class="bg_tr">名称</td>
        <td width="100" align="center" class="bg_tr">价格</td>
    </tr>
    <form id="priceForm">
    <?php
    foreach($items as $index => $item) {
        $start_index = $index;
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg"nowrap ><?=$start_index+1?></td>
            <td class="td_bg" nowrap><?=$item->gift->name?></td>
            <td class="td_bg" nowrap><input type="text" name="prices[<?=$item->id?>]" value="<?=$item->price?>"></td>
        </tr>
        <?php
    }
    ?>
    </form>
</table>
