<?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/datepicker/WdatePicker.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">
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="searchForm">
        <tr>
            <td class="td_bg">
                <span>
                    状态：
                    <select>
                        <option>全部</option>
                        <option>到账</option>
                        <option>挂账</option>
                        <option>完成</option>
                    </select>
                </span>
                <span>时间：<input class="Wdate" name="data" type="Text" onclick="WdatePicker()" value=""></span>
                <span>车牌号：<input name="car_no" type="Text" value="<?= $car_no ?>"></span>
                <span style="margin-left:30px;">
                    <input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
                </span>
            </td>
        </tr>
    </form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" align="center" class="bg_tr">序号</td>
        <td width="50" align="center" align="center" class="bg_tr">报案号</td>
        <td width="50" align="center" align="center" class="bg_tr">车牌号</td>
        <td width="50" align="center" align="center" class="bg_tr">客户姓名</td>
        <td width="50" align="center" align="center" class="bg_tr">进厂日期</td>
        <td width="50" align="center" align="center" class="bg_tr">出厂日期</td>
        <td width="50" align="center" align="center" class="bg_tr">状态</td>
        <td width="50" align="center" align="center" class="bg_tr">结算类型</td>
        <td width="50" align="center" align="center" class="bg_tr">操作</td>
    </tr>
    <?php if($car_list): ?>
        <?php foreach($car_list as $k=>$v): ?>
            <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
                <td width="50" align="center" align="center" class="td_bg"><?= $k + 1 ?></td>
                <td width="50" align="center" align="center" class="td_bg"><?= $v->baoanhao ? $v->baoanhao : '--' ?></td>
                <td width="50" align="center" align="center" class="td_bg"><?= $v->car_no ?></td>
                <td width="50" align="center" align="center" class="td_bg"><?= $v->id_man ?></td>
                <td width="50" align="center" align="center" class="td_bg"><?= $v->enter_the_factory_time ?></td>
                <td width="50" align="center" align="center" class="td_bg"><?= $v->fixCarT->finish_date ?></td>
                <td width="50" align="center" align="center" class="td_bg">会计</td>
                <td width="50" align="center" align="center" class="td_bg"><?= 2 === $v->pay_type ? '自费维修' : '保险理赔' ?></td>
                <td width="50" align="center" align="center" class="td_bg">
                    <a href="javascript:;" class="acc_detail" onclick="itemInfo(<?= $v->id ?>)">
                        <?php if( 2 === $v->examine): ?>
                            <span style="color: green;">[详情]</span>
                        <?php else: ?>
                            <span style="color: red;">[查看]</span>
                        <?php endif; ?>
                        <a/>
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>
</table>
<script>
    $("#search-btn").click(function(){
        var params = $('#searchForm').serialize();
        window.location.href = "/fix-car-finance/list-accounts2?" + params;
    });

    function itemInfo(fixId){
        if(fixId < 1) return false;
        window.location.href = "/fix-car-finance/settle-accounts2?fix_id=" + fixId;
    }
</script>