<?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">
    //详情
    function info(id) {
        window.open('/car/non-info-renewal?id=' + id);
    }

    $(function(){
        $("#search-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/car/non-search?" + params;
        });
    });
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <form id="searchForm">
        <input type="hidden" id="page" name="page" value="<?=$page?>">
        <tr>
            <td class="td_bg">
                车主：<input name="car_man" type="text" value="<?=$car_man?>">
                电话：<input name="phone" type="text" value="<?=$phone?>">
                车牌：<input name="car_no" type="text" value="<?=$car_no?>">
                车型：<input name="car_model" type="text" value="<?=$car_model?>">
            </td>
        </tr>
        <tr>
            <td class="td_bg">
                初登日期：<input name="register_date" type="text" value="<?=$register_date?>" onclick="WdatePicker()">
                保险日期：<input name="insurer_date" type="text" value="<?=$insurer_date?>" onclick="WdatePicker()">
                被保险人：<input name="id_man" type="text" value="<?=$id_man?>">
                <input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
            </td>
        </tr>
    </form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="30" align="center" class="bg_tr" nowrap>序号</td>
        <td width="50" align="center" class="bg_tr" nowrap>车主</td>
        <td width="60" align="center" class="bg_tr" nowrap>车牌号</td>
        <td width="60" align="center" class="bg_tr" nowrap>发动机号</td>
        <td width="60" align="center" class="bg_tr" nowrap>车架号</td>
        <td width="60" align="center" class="bg_tr" nowrap>初登日期</td>
        <td width="60" align="center" class="bg_tr" nowrap>保险日期</td>
        <td width="60" align="center" class="bg_tr" nowrap>位置</td>
        <td width="60" align="center" class="bg_tr" nowrap>业务员</td>
        <td width="30" align="center" class="bg_tr" nowrap>操作</td>
    </tr>
    <?php
    foreach($items as $index => $item) {
        $start_index = ($page - 1) * 20 + $index;
        $order_info = $item->getOrders()->orderBy('id DESC')->one();
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg"n owrap ><?=$start_index + 1?></td>
            <td class="td_bg" nowrap><?=$item->car_man?></td>
            <td class="td_bg" nowrap><?=$item->car_no?></td>
            <td class="td_bg" nowrap><?=$item->engine_no?></td>
            <td class="td_bg" nowrap><?=$item->car_frame_no?></td>
            <td class="td_bg" nowrap><?=$item->register_date?></td>
            <td class="td_bg" nowrap><?=$item->insurer1_date?></td>
            <td class="td_bg" nowrap><?=$item->getLocation()?></td>
            <td class="td_bg" ><?=$item->lib&&$item->lib->user?$item->lib->user->getShowName():''?></td>
            <td align="center" class="td_bg" nowrap>
                [<a href="javascript:void(0);" onclick="info(<?=$item->id?>)">详情</a>]
            </td>
        </tr>
        <?php
    }
    ?>
    <tr >
        <td height="25" colspan="14" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>
