<?php
/**
 * Created by PhpStorm.
 * User: liuyingjie
 * Date: 2017/7/26
 * Time: 14:53
 */
/**
 * Created by PhpStorm.
 * User: liuyingjie
 * Date: 2017/7/26
 * Time: 14:36
 */
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 edit(id) {
        window.location.href = '/fix-car/last-check-info?id=' + id;
    }
    //删除
    function del(id) {
        if(confirm('是否确认删除?')) {
            $.post('/fix-car/my-list-delete',{id:id},function(obj){
                alert(obj.msg);
                if(obj.success) {
                    window.location.reload();
                }
            },'json');
        }
    }
    $(function(){
        $("#search-btn").click(function(){
            var params = $('#searchForm').serialize();
            window.location.href = "/fix-car/my-list?" + params;
        });
        $('#add-btn').click(function(){
            window.location.href = '/fix-car/my-search';
        });
    });
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="searchForm">
        <tr>
            <td class="td_bg">
                车牌号：<input name="car_no" type="text" value="<?=$car_no?>">
                <input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
                <input type="button" class="act_btn" id="add-btn" name="add-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" align="center" class="bg_tr" nowrap>排序</td>
        <td align="center" align="center" class="bg_tr">车牌号</td>
        <td align="center" align="center" class="bg_tr">被保险人</td>
        <td align="center" align="center" class="bg_tr">联系人</td>
        <td align="center" align="center" class="bg_tr">电话</td>
        <td align="center" align="center" class="bg_tr">提单日期</td>
        <td align="center" align="center" class="bg_tr">提单者</td>
        <td align="center" align="center" class="bg_tr">状态</td>
        <td width="30" align="center" class="bg_tr">操作</td>
    </tr>
    <?php
    foreach($items as $index => $item) {
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg" nowrap><?=$index+1?></td>
            <td align="left" class="td_bg" nowrap><?=$item->car_no?></td>
            <td align="left" class="td_bg" nowrap><?=$item->id_man?></td>
            <td align="left" class="td_bg" nowrap><?=$item->link_man?></td>
            <td align="left" class="td_bg" nowrap><?=$item->link_phone?></td>
            <td align="left" class="td_bg" nowrap><?=$item->submit_date?></td>
            <td align="left" class="td_bg" nowrap><?=$item->user->getShowName()?></td>
            <td align="left" class="td_bg" nowrap><?=$item->getStatus()?></td>
            <td align="center" class="td_bg" nowrap>
                <?php
                if($item->status == 0) {
                    ?>
                    [<a href="javascript:void(0);" onclick="edit(<?= $item->id ?>)">详情</a>]
                                                                                          [<a href="javascript:void(0);" onclick="del(<?= $item->id ?>)">删除</a>]
                    <?php
                }
                ?>
            </td>
        </tr>
        <?php
    }
    ?>
</table>
