<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>

<style>
    #dialog {
        position: fixed;
        left: 26%;
        top: 10%;
        background: #FFFFFF;
        border: 1px solid #333333;
        padding: 10px;
        width: 500px;
        z-index: 1000;
    }
    #img-box {
        position: fixed;
        left: 0%;
        top: 0%;
        background: #FFFFFF;
        border: 1px solid #333333;
        padding: 10px;
        width: 90%;
        height: 80%;
        z-index: 1000;
        overflow-y: scroll;
    }

    #img-box ul li {
        list-style: none;
        float: left;
        padding: 10px;
    }

    #img-box ul li, #img-box ul li img {
        width: 200px;
        height: 100px;
    }

    #img-box ul li i {
        position: absolute;
        cursor: pointer;
    }

    .active-bg {
        background: #F5F5F5;
    }

    .mask-layer {
        position: absolute;
        top: 0px;
        filter: alpha(opacity=60);
        background-color: #777;
        z-index: 10;
        left: 0px;
        opacity: 0.5;
        -moz-opacity: 0.5;
        width: 100%;
        height: 3000px;
    }

    .add-title > h3 {
        float: left;
        cursor: pointer;
    }
</style>
<div style="width:98%; margin: 0 auto;color:#1E5494">
    <h3 onclick="show('list1')">维修信息<span id="list1_title">▲</span></h3>
</div>
<form id="theFrm">
<input type="hidden" id="id" name="id" value="<?= $info->id ?>">
<input type="hidden" name="car_id" value="<?= $info->car_id ?>">
<div id="list1" style="display: none">
        <!--    车辆信息begin    -->
        <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
            <tr>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    车牌号
                </td>
                <td height="25" class="td_bg" nowrap>
                    <input name="car_no" type="text" id="car_no"
                           value="<?= $info->car_no ?>"
                           style="width:100px;"/>
                </td>
                <td width="100" height="25" class="bg_tr">发动机号</td>
                <td height="25" class="td_bg">
                    <input name="engine_no" type="text" id="engine_no"
                           value="<?= $info->engine_no ?>" style="width:100px;"/>
                </td>
                <td width="100" height="25" class="bg_tr">车架号</td>
                <td height="25" class="td_bg">
                    <input name="car_frame_no" type="text" id="car_frame_no"
                           value="<?= $info->car_frame_no ?>" style="width:100px;"/>
                </td>
                <td width="100" height="25" class="bg_tr">新车购置价</td>
                <td height="25" class="td_bg">
                    <input name="new_price" type="text" id="new_price""
                           value="<?= $info->new_price ?>" style="width:100px;"/>
                </td>
            </tr>
            <tr>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>品牌</td>
                <td height="25" class="td_bg">
                    <select id="brand_id" name="brand_id">
                        <option value="">---请选择---</option>
                        <?php foreach ($brand_items as $item): ?>
                            <option value="<?= $item->id ?>" <?= $info->brand_id == $item->id ? 'selected' : '' ?>><?= $item->name ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>车系
                </td>
                <td height="25" class="td_bg">
                    <select name="series_id" id="series_id">
                        <option value="">---请选择---</option>
                        <?php foreach ($series_items as $item): ?>
                            <option value="<?= $item->id ?>" <?= $info->series_id == $item->id ? 'selected' : '' ?>><?= $item->name ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>排量</td>
                <td height="25" class="td_bg">
                    <select name="displacement_id" id="displacement_id">
                        <option value="">---请选择---</option>
                        <?php foreach ($displacement_items as $item): ?>
                            <option value="<?= $item->id ?>" <?= $info->displacement_id == $item->id ? 'selected' : '' ?>><?= $item->name ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>年款</td>
                <td height="25" class="td_bg">
                    <input type="text" id="car_year" name="car_year"
                           onclick="WdatePicker({dateFmt:'yyyy'})" readonly
                           value="<?= $info->car_year ?>" style="width:100px;">
                </td>
            </tr>
            <tr>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    联系人
                </td>
                <td height="25" class="td_bg">
                    <input name="link_man" type="text" id="company"
                           value="<?= $info->link_man ?>"
                           style="width:100px;"/>
                </td>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    电话
                </td>
                <td height="25" class="td_bg" colspan="5">
                    <input type="text" name="link_phone" value="<?= $info->link_phone ?>">
                </td>
            </tr>
            <tr>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>被保险人</td>
                <td height="25" class="td_bg">
                    <input name="id_man" type="text" id="company"
                           value="<?= $info->id_man ?>"
                           style="width:100px;"/>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>电话</td>
                <td height="25" class="td_bg">
                    <input type="text" name="id_phone" value="<?= $info->id_phone ?>">
                </td>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    事故类型
                </td>
                <td height="25" class="td_bg">
                    <select name="accident_type" id="accident_type">
                        <option value="单方" <?= "单方" === $info->accident_type ? 'selected' : '' ?>>单方</option>
                        <option value="双方" <?= "双方" === $info->accident_type ? 'selected' : '' ?>>双方</option>
                        <option value="多方" <?= "多方" === $info->accident_type ? 'selected' : '' ?>>多方</option>
                        <option value="自费维修" <?= "自费维修" === $info->accident_type ? 'selected' : '' ?>>自费维修</option>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr">
                    责任
                </td>
                <td height="25" class="td_bg">
                    <select name="responsibility" id="responsibility">
                        <option value="全责" <?= "全责" === $info->responsibility ? 'selected' : '' ?>>全责</option>
                        <option value="无责" <?= "无责" === $info->responsibility ? 'selected' : '' ?>>无责</option>
                        <option value="主要责任" <?= "主要责任" === $info->responsibility ? 'selected' : '' ?>>主要责任</option>
                        <option value="次要责任" <?= "次要责任" === $info->responsibility ? 'selected' : '' ?>>次要责任</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>保险公司</td>
                <td height="25" class="td_bg">
                    <select name="company" id="company">
                        <option value="1" <?= '1' === $info->company ? 'selected' : '' ?>>人保</option>
                        <option value="2" <?= '2' === $info->company ? 'selected' : '' ?>>平安</option>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>商业保单号</td>
                <td height="25" class="td_bg">
                    <input type="text" name="insurer1_no" value="<?= $info->insurer1_no ?>">
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>交强保单号</td>
                <td height="25" class="td_bg">
                    <input type="text" name="insurer2_no" value="<?= $info->insurer2_no ?>">
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>险项</td>
                <td height="25" class="td_bg">
                    <input type="text" name="insurer_type" value="<?= $info->insurer_type ?>">
                </td>
            </tr>
        </table>
        <!--    end    -->
        <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
            <tr>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    接车日期
                </td>
                <td height="25" class="td_bg">
                    <input name="receive_date" type="text" id="receive_date"
                           value="<?= $info->receive_date ?>" readonly
                           onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})"/>
                </td>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    交车方式
                </td>
                <td height="25" class="td_bg">
                    <select name="receive_type" id="receive_type">
                        <option value="">--请选择--</option>
                        <option value="上门接车" <?= $info->receive_type === '上门接车' ? 'selected' : '' ?>>上门接车</option>
                        <option value="客户自送" <?= $info->receive_type === '客户自送' ? 'selected' : '' ?>>客户自送</option>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr">代步车</td>
                <td height="25" class="td_bg">
                    <select name="replace_car_id">
                        <option value="0">--请选择--</option>
                        <option value="1" <?= 1 === $info->replace_car_id ? 'selected' : '' ?>>不需要</option>
                        <option value="2" <?= 2 === $info->replace_car_id ? 'selected' : '' ?>>京A74110</option>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>接车司机</td>
                <td height="25" class="td_bg">
                    <select name="driver_id">
                        <option value="0">请选择</option>
                        <?php
                        foreach ($driver_items as $item) {
                            echo '<option value="' . $item->id . '"';
                            if ($item->id == $info->driver_id)
                                echo ' selected ';
                            echo '>' . $item->getShowName() . '</option>';
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>方位</td>
                <td height="25" class="td_bg">
                    <select name="direction_id" id="direction_id">
                        <option value="">请选择</option>
                        <?php foreach ($direction_items as $item): ?>
                            <option value="<?= $item->id ?>" <?= $info->direction_id == $item->id ? 'selected' : '' ?>><?= $item->name ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>范围</td>
                <td height="25" class="td_bg">
                    <select name="range_id" id="range_id">
                        <option value="">请选择</option>
                        <?php foreach ($range_items as $item): ?>
                            <option value="<?= $item->id ?>" <?= $info->range_id == $item->id ? 'selected' : '' ?>><?= $item->name ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
                <td width="100" height="25" class="bg_tr"><span
                            style="color:#ff0000">*</span>
                    地址
                </td>
                <td colspan="3" height="25" class="td_bg">
                    <input name="address" type="text" id="address"
                           value="<?= $info->address ?>"
                           style="width:80%;"/>
                </td>
            </tr>
        </table>
</div>
<div style="clear: both"></div>
<div style="width:98%; margin: 0 auto;color:#1E5494">
    <h3 onclick="show('list2')">司机接车<span id="list2_title">▼</span></h3>
</div>
<div id="list2">
    <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
        <tr>
            <td rowspan="2" class="bg_tr" align="center" valign="center">
                交接物品
            </td>
            <td width="50" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>行驶本
            </td>
            <td class="td_bg">
                <input type="radio" name="driving_this" value="0" <?= $info->driving_this === 0 ? 'checked' : '' ?>>
                无
                <input type="radio" name="driving_this" value="1" <?= $info->driving_this === 1 ? 'checked' : '' ?>>
                原件
                <input type="radio" name="driving_this" value="2" <?= $info->driving_this === 2 ? 'checked' : '' ?>>
                复印件
            </td>
            <td width="200" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>驾驶本
            </td>
            <td class="td_bg">
                <input type="radio" name="driver_licesne" value="0" <?= $info->driver_licesne === 0 ? 'checked' : '' ?>>
                无
                <input type="radio" name="driver_licesne" value="1" <?= $info->driver_licesne === 1 ? 'checked' : '' ?>>
                原件
                <input type="radio" name="driver_licesne"
                       value="2" <?= $info->driver_licesne === 2 ? 'checked' : '' ?>>
                复印件
            </td>
            <td width="80" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>身份证
            </td>
            <td class="td_bg">
                <input type="radio" name="identity_card_paper" value="0" <?= $info->identity_card_paper === 0 ? 'checked' : '' ?>> 无
                <input type="radio" name="identity_card_paper" value="1" <?= $info->identity_card_paper === 1 ? 'checked' : '' ?>> 原件
                <input type="radio" name="identity_card_paper"
                       value="2" <?= $info->identity_card_paper === 2 ? 'checked' : '' ?>> 复印件
            </td>
        </tr>
        <tr>
            <td width="50" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>车钥匙
            </td>
            <td class="td_bg">
                <input type="radio" name="car_key" value="0" <?= $info->car_key === 0 ? 'checked' : '' ?>> 无
                <input type="radio" name="car_key" value="1" <?= $info->car_key === 1 ? 'checked' : '' ?>> 一副
                <input type="radio" name="car_key" value="2" <?= $info->car_key === 2 ? 'checked' : '' ?>> 二副
            </td>
            <td width="200" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>保险单
            </td>
            <td class="td_bg">
                <input type="radio" name="policy_of_insurance" value="0" <?= $info->policy_of_insurance === 0 ? 'checked' : '' ?>> 无
                <input type="radio" name="policy_of_insurance" value="1" <?= $info->policy_of_insurance === 1 ? 'checked' : '' ?>> 原件
                <input type="radio" name="policy_of_insurance"
                       value="2" <?= $info->policy_of_insurance === 2 ? 'checked' : '' ?>> 复印件
            </td>
            <td width="80" align="center" class="bg_tr" nowrap><span
                        style="color:#ff0000">*</span>交警证明
            </td>
            <td class="td_bg">
                <input type="radio" name="police_to_prove" value="0" <?= $info->police_to_prove === 0 ? 'checked' : '' ?>> 无
                <input type="radio" name="police_to_prove" value="1" <?= $info->police_to_prove === 1 ? 'checked' : '' ?>> 原件
                <input type="radio" name="police_to_prove"
                       value="2" <?= $info->police_to_prove === 2 ? 'checked' : '' ?>> 复印件
            </td>
        </tr>
        <tr>
            <td class="bg_tr" align="center" valign="center">随车物品</td>
            <td class="td_bg" colspan="6">
                <input type="checkbox" name="follow_car_items[]" value="1" <?= strpos($info->follow_car_items, '1') !== false ? 'checked' : '' ?>> 备胎
                <input type="checkbox" name="follow_car_items[]"
                       value="2" <?= strpos($info->follow_car_items, '2') !== false ? 'checked' : '' ?>> 工具
                <input type="checkbox" name="follow_car_items[]"
                       value="3" <?= strpos($info->follow_car_items, '3') !== false ? 'checked' : '' ?>> 警告牌
                <input type="checkbox" name="follow_car_items[]"
                       value="4" <?= strpos($info->follow_car_items, '4') !== false ? 'checked' : '' ?>> 灭火器
            </td>
        </tr>
    </table>
    <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"
           style="table-layout: fixed;">
        <tr>
            <td width="100" height="25" class="bg_tr"><span style="color:#ff0000">*</span>接车里程数
            </td>
            <td height="25" class="td_bg">
                <input type="text" id="receive_mileage" name="receive_mileage"
                       value="<?= $info->receive_mileage ?>">
            </td>
            <td width="100" height="25" class="bg_tr"><span
                        style="color:#ff0000">*</span>接车油表数
            </td>
            <td height="25" class="td_bg">
                <select name="receive_oil" id="receive_oil">
                    <option value="">--请选择--</option>
                    <option value="1/2" <?= '1/2' === $info->receive_oil ? 'selected' : '' ?>>1/2</option>
                    <option value="2/2" <?= '2/2' === $info->receive_oil ? 'selected' : '' ?>>2/2</option>
                    <option value="1/3" <?= '1/3' === $info->receive_oil ? 'selected' : '' ?>>1/3</option>
                    <option value="2/3" <?= '2/3' === $info->receive_oil ? 'selected' : '' ?>>2/3</option>
                    <option value="3/3" <?= '3/3' === $info->receive_oil ? 'selected' : '' ?>>3/3</option>
                </select>
            </td>
            <td width="100" height="25" class="bg_tr">预计出厂时间</td>
            <td height="25" class="td_bg" colspan="3">
                <input type="text" id="finish_date" name="finish_date" value="<?= $info->finish_date ?>"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})">
            </td>
        </tr>
    </table>
    <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"
           style="table-layout: fixed;">
        <tr>
            <td width="100" height="25" class="bg_tr">备注</td>
            <td colspan="7" height="25" class="td_bg" align="left">
                                                    <textarea name="sys_remark" id="sys_remark"
                                                              style="width: 600px;"><?= $info->remark ?></textarea>
            </td>
        </tr>
    </table>
</div>
</form>
<div style="clear: both"></div>
<div style="width:98%; margin: 0 auto;color:#1E5494">
    <input type="button" class="act_btn" onclick="webUploader(2,<?= $info->id ?>)" value="图片上传">
    <input type="button" class="act_btn" onclick="openImgDialog(<?= $info->id ?>,2)" value="查看图片">
    <input type="button" id="item-adda" class="ACT_btn" value="清单添加" onclick="location.href='/store-room/get-tree?car_price=<?= $info->new_price ?>&id=<?= $info->id ?>'">
</div>
<div id="web-up"></div>
<div id="divBox"></div>
<div style="clear: both"></div>
<div style="width:98%; margin: 0 auto;color:#1E5494">
    <h3 onclick="show('list7')">操作记录<span id="list7_title">▲</span></h3>
</div>
<div id="list7" style="display: none;">
    <?= $this->render('logs-view',['log_items'=>$log_items]) ?>
</div>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <tr>
        <td class="td_bg" align="center">
            <textarea name="result" id="result" cols="30" rows="10" style="display: none"></textarea>
            <?php if (2 === $info->status): ?>
                <input type="button" class="ACT_btn js-insert-btn" value="提交">
                <input type="button" class="ACT_btn js-update-btn" value="保存">
            <?php endif; ?>
            <input id="back-btn" type="button" class="ACT_btn" value="返回">
        </td>
    </tr>
</table>
<!--对话框begin-->
<div id="dialog" style="display: none">
</div>
<!--end-->
<!--遮罩层 begin-->
<div class="mask-layer" style="display: none">
</div>
<!--end-->
<!-- 图片弹窗 -->
<div id="img-box" style="display: none"></div>
<!-- end -->
<script type="text/javascript" language="javascript" src="/js/common.js"></script>
<script type="text/javascript" language="javascript">
    maskInit();
    fixCarSave('<?=$info->status?>');
    fixCarAdd('备注',<?= $info->status + 1 ?>);
    maskLayerBodyClick();
    //返回按钮
    $('#back-btn').click(function () {
        window.location.href = "/business-order/driver-list";
    });
    //打印接车单
    $('#print-btn').click(function () {
        window.open('/fix-car/print-receive?id=<?=$info->id?>');
    });
    //清单列表
    refreshItemList(<?= $info->id ?>,13);
</script>