<?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) {
        var params = $('#searchForm').serialize();
        window.location.href = '/insurer/send-mng-edit?id=' + id + '&back_params=' + encodeURIComponent(params);
    }
    $(function(){
        $("#search-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/insurer/send-mng?" + 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?>" style="width: 100px;">
                电话:<input name="phone" type="text" value="<?=$phone?>" style="width: 100px;">
                车牌:<input name="car_no" type="text" value="<?=$car_no?>" style="width: 100px;">
                送单日期:<input name="send_date" type="text" value="<?=$send_date?>" onclick="WdatePicker()" style="width:100px;">
                <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="3" cellspacing="1" class="table">
    <tr>
        <td width="40" align="center" class="bg_tr" nowrap>序号</td>
        <td width="60" 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="80" align="center" class="bg_tr" nowrap>送单地址</td>
        <td width="150" align="center" class="bg_tr" nowrap>送单备注</td>
        <td width="80" align="center" class="bg_tr" nowrap>商业起保时间</td>
        <td width="60" align="center" class="bg_tr" nowrap>配送次数</td>
        <td width="80" 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;
        $op_user = $item->getUsers()->where('type_id=2')->one();
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg" nowrap><?=$index+1?></td>
            <td class="td_bg" nowrap><?=$item->car_no?></td>
            <td class="td_bg" nowrap><?=MyLib::substr_cut($item->id_man,10)?></td>
            <td class="td_bg" nowrap><?=$item->company?$item->company->name:''?></td>
            <td class="td_bg" nowrap><?=$item->send_date?></td>
            <td class="td_bg" align="center" nowrap><?=$item->direction1?$item->direction1->name:''?></td>
            <td class="td_bg" nowrap><?php
                $address = $item->city1?$item->city1->name:'';
                $address .= $item->district1?$item->district1->name:'';
                $address .= $item->send_address1;
                echo MyLib::substr_cut($address,30);
                ?>
            </td>
            <td class="td_bg" nowrap><?=MyLib::substr_cut($item->remark,20)?></td>
            <td class="td_bg" nowrap><?=$item->insurer1_begin_date?></td>
            <td class="td_bg" align="center" ><?=$item->send_times?></td>
            <td class="td_bg" nowrap><?=$item->insurer2_begin_date?></td>
            <td class="td_bg" nowrap><?=$item->user?$item->user->getShowName():''?>&nbsp;</td>
            <td class="td_bg" nowrap><?=$op_user && $op_user->user ? $op_user->user->getShowName():''?></td>
            <td class="td_bg" nowrap><?=$item->status->name?></td>
            <td class="td_bg" nowrap><?=$item->lock?$item->lock->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="16" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>