<?php
use yii\web\View;

$this->title = $car_info->car_no.'的保单';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?=$this->title?></title>
    <link href="/js/lib/datepicker/css/bootstrap.css" rel="stylesheet">
    <link href="/js/lib/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
    <link href="/css/base.css" rel="stylesheet">
    <link href="/css/pages/edit.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <div id="inner-hd">
        <div class="crumbs">
            <i class="crumbs-arrow"></i>
            <a href="javascript:;" class="crumbs-label"><?=$this->title?></a>
        </div>
    </div>
    <div id="inner-bd">
        <div class="button-group">
            <div class="button current save-btn">
                <i class="iconfont">&#xe76a;</i>
                <span class="button-label">保存</span>
            </div>
            <div class="button back-btn">
                <i class="iconfont">&#xe600;</i>
                <span class="button-label">返回</span>
            </div>
        </div>
        <div class="tab-wraper">
            <ul class="tab">
                <li name="price" class="current"><a href="javascript:;">险种报价</a></li>
                <li name="order"><a href="javascript:;">保单信息</a></li>
            </ul>
        </div>
        <form id="theFrm" method="post" action="/sales-mng/sales-orders-save">
            <input type="hidden" name="id" value="<?=$info->id?>">
            <input type="hidden" name="car_id" value="<?=$car_info->id?>">
            <input name="_csrf" type="hidden" id="_csrf" value="<?=Yii::$app->request->csrfToken ?>">
            <div class="price">
                <table class="kv-table">
                    <tbody>
                    <tr>
                        <td class="kv-content" valign="top" style="padding: 10px;width:auto;">
                            <table class="grid">
                                <thead>
                                <tr>
                                    <th>险种</th>
                                    <th>代码</th>
                                    <th>内容</th>
                                    <th>不计免赔</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                foreach($insurer_type_items as $item) {
                                    ?>
                                    <tr>
                                        <td><?=$item->name?></td>
                                        <td><?=$item->code?></td>
                                        <td><?php
                                        if($item->content != '') {
                                            echo '<select>';
                                            $tmp_items = explode(',',$item->content);
                                            foreach($tmp_items as $tmp_item) {
                                                echo '<option>'.$tmp_item.'</option>';
                                            }
                                            echo '</select>';
                                        } else {
                                            echo '<input type="text">';
                                        }
                                            ?></td>
                                        <td><?php
                                        if($item->has_nopay) {
                                            echo '<input type="checkbox">';
                                        }
                                            ?></td>
                                    </tr>
                                    <?php
                                }
                                ?>
                                </tbody>
                            </table>
                        </td>
                        <td class="kv-content" valign="top" style="padding: 10px;width:auto; vertical-align: top;">
                            <table class="grid">
                                <tbody>
                                <tr>
                                    <td>商业保费</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>交强保费</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>车船税</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>总保费</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>优惠</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>电销应收</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>报价备注</td>
                                    <td><input type="text"></td>
                                </tr>
                                <tr>
                                    <td>核保备注</td>
                                    <td><input type="text"></td>
                                </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="order">
                <table class="kv-table">
                    <tbody>
                    <tr>
                        <td class="kv-label">车牌号</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="car_no" name="car_no" value="">
                        </td>
                        <td class="kv-label">发动机号</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="factory_model" name="factory_model" value="">
                        </td>
                        <td class="kv-label">车架号</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="car_model" name="car_model" value="">
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">车主</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="engine_no" name="engine_no" value="">
                        </td>
                        <td class="kv-label">被保险人</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="car_frame_no" name="car_frame_no" value="">
                        </td>
                        <td class="kv-label">证件号码</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="car_frame_no" name="car_frame_no" value="">
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">联系人</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="engine_no" name="engine_no" value="">
                        </td>
                        <td class="kv-label">联系电话</td>
                        <td class="kv-content">
                            <input style="width:85%;" type="text" id="car_frame_no" name="car_frame_no" value="">
                        </td>
                        <td class="kv-label">付款方式</td>
                        <td class="kv-content">
                            <select>
                                <option value="0">---请选择---</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">商业日期</td>
                        <td colspan="2" class="kv-content">
                            <input style="width:100px;" type="text" id="register_date" name="register_date" value="">
                            <input style="width:100px;" type="text" id="register_date" name="register_date" value="">
                        </td>
                        <td class="kv-label">交强日期</td>
                        <td colspan="2" class="kv-content">
                            <input style="width:100px;" type="text" id="register_date" name="register_date" value="">
                            <input style="width:100px;" type="text" id="register_date" name="register_date" value="">
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">送单地址</td>
                        <td colspan="5" class="kv-content">
                            <input style="width:85%;" type="text" id="engine_no" name="engine_no" value="">
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">赠品</td>
                        <td colspan="5" class="kv-content">
                            <input style="width:85%;" type="text" id="engine_no" name="engine_no" value="">
                        </td>
                    </tr>
                    <tr>
                        <td class="kv-label">备注</td>
                        <td colspan="5" class="kv-content">
                            <textarea style="width:97%; height: 50px;" name="remark" id="remark"></textarea>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </form>
        </form>
    </div>

    <div id="inner-ft">
        <br>
        <br>
    </div>
</div>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/global.js"></script>
<script type="text/javascript" src="/js/jquery.select.js"></script>
<script type="text/javascript" src="/js/jquery.pagination.js"></script>
<script type="text/javascript" src="/js/lib/layer/layer.js"></script>
<script type="text/javascript" src="/js/common.js"></script>

<script type="text/javascript" src="/js/lib/datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="/js/lib/datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('select').select();
        $('.save-btn').click(function(){
            var params = $('#theFrm').serialize();
            var url = $('#theFrm').attr('action');
            $.post(url,params,function(obj){
                if(obj.success) {
                    alert(obj.msg);
                    window.location.href =  '/sales-mng/sales-orders?car_id=<?=$car_info->id?>';
                } else {
                    alert(obj.msg);
                }
            },'json');
        });
        $('.back-btn').click(function(){
            window.history.go(-1);
        });
        $("#register_date").datepicker({
            "language":"zh-CN",
            "format": 'yyyy-mm-dd'
        })
        $(".date .iconfont").click(function(){
            $(this).prev().trigger("focus");
        });
        $(".tab > li").click(function(){
            $(".tab > li").removeClass("current");
            $(this).addClass("current");
            $(".price,.order").hide();
            $("." + $(".tab >li.current").attr("name")).show();
        });
        $('.order').hide();
    });
</script>
</body>
</html>
