<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" src="/js/common.js"></script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="searchForm" method="GET">
        <tr>
            <td class="td_bg">
                <label for="car_no">车牌号：</label>
                <input id="car_no" name="car_no" type="text" size="10" value="<?= $car_no ?>">
                <label for="id_man">被保险人：</label>
                <input name="id_man" id="id_man" type="text" size="10" value="<?= $id_man ?>">
                <label for="id_phone">电话：</label>
                <input name="id_phone" id="id_phone" type="text" size="10" value="<?= $id_phone ?>">
                <label for="link_man">联系人：</label>
                <input name="link_man" id="link_man" type="text" size="10" value="<?= $link_man ?>">
                <label for="link_phone">电话：</label>
                <input name="link_phone" id="link_phone" type="text" size="10" value="<?= $link_phone ?>">
                <label for="status">状态：</label>
                <select name="status" id="status">
                    <option value="-1" <?= '-1' === $status ? 'selected' : '' ?>>全部</option>
                    <option value="0" <?= '0' === $status ? 'selected' : '' ?>>业务提单</option>
                    <option value="1" <?= '1' === $status ? 'selected' : '' ?>>提单审核</option>
                    <option value="2" <?= '2' === $status ? 'selected' : '' ?>>司机接车</option>
                    <option value="3" <?= isset($status) ? ('3' === $status ? 'selected' : '') : 'selected' ?>>前台审核</option>
                    <option value="4" <?= '4' === $status ? 'selected' : '' ?>>查勘定损</option>
                    <option value="5" <?= '5' === $status ? 'selected' : '' ?>>前台派工</option>
                    <option value="6" <?= '6' === $status ? 'selected' : '' ?>>车间维修中</option>
                    <option value="11" <?= '11' === $status ? 'selected' : '' ?>>机电</option>
                    <option value="14" <?= '14' === $status ? 'selected' : '' ?>>总检</option>
                </select>
                <label for="sort_key">排序：</label>
                <select name="sort_key" id="sort_key">
                    <option value="created_at" <?= 'create_at' === $sort_key ? 'selected' : '' ?>>提单日期</option>
                </select>
                <select name="sort_value">
                    <option value="ASC" <?= 'ASC' === $sort_value ? 'selected' : ''?>>顺序</option>
                    <option value="DESC" <?= 'DESC' === $sort_value ? 'selected' : '' ?>>倒序</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="td_bg">
                <label for="start_time">提单日期:</label>
                从<input type="text" size="10" id="start_time" name="start_time" onclick="WdatePicker()" value="<?= $start_time ?>">
                至<input type="text" size="10" name="end_time" onclick="WdatePicker()" value="<?= $end_time ?>">
                <input type="submit" class="act_btn" value="搜索">
                <input type="reset" class="act_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 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->link_man?></td>
            <td align="left" class="td_bg" nowrap><?=$item->car_no?></td>
            <td align="left" class="td_bg" nowrap><?=$item->brand?$item->brand->name:''?></td>
            <td align="left" class="td_bg" nowrap><?=$item->series?$item->series->name:''?></td>
            <td align="left" class="td_bg" nowrap><?=$item->address?></td>
<!--            <td align="left" class="td_bg" nowrap></td>-->
            <td align="left" class="td_bg" nowrap><?=$item->accident_type?></td>
            <td align="left" class="td_bg" nowrap><?=$item->responsibility?></td>
            <td align="left" class="td_bg" nowrap><?=$item->user ? $item->user->getShowName() : ''?></td>
            <td align="left" class="td_bg" nowrap><?=$item->getStatus()?></td>
            <td align="center" class="td_bg" nowrap>
                [<a href="javascript:void(0);" onclick="edit(<?= $item->id ?>,<?=$item->status?>)">详情</a>]
                [<a href="javascript:void(0);" onclick="del(<?= $item->id ?>)">删除</a>]
            </td>
        </tr>
        <?php endforeach; ?>
    <tr>
        <td height="25" colspan="12" align="center" class="td_bg"><?= $page_info ?></td>
    </tr>
</table>
<script type="text/javascript" language="javascript">
    //编辑
    function edit(id,status) {
        window.location.href = '/business-order/front-desk-check-info?id=' + id + '&status=' + status + '&type=2';
    }
</script>
