<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">

        <section class="content-header">
            <h1>
                需求服务管理
                <small>需求服务</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active"></a></li>
            </ol>

        </section>
        <!-- Main content -->
        <section class="content">
            <ul id="myTab" class="nav nav-tabs">
                #if($shiro.hasPermission("qy:workshop:view"))
                <li><a href="#springUrl('/a/workshop/list?meetingId=')$!{meetingId}">
                    人员信息 </a></li>
                #end
                #if($shiro.hasPermission("qy:demand:edit"))
                <li class="active"><a href="#springUrl('/a/demand/form?meetingId=')${meetingId}">需求服务</a></li>
                #end
                #if($shiro.hasPermission("qy:sample:view"))
                <li><a href="#springUrl('/a/sample/list?meetingId=')${meetingId}">样本资料</a></li>
                #end
                #if($shiro.hasPermission("qy:speech:view"))
                <li><a href="#springUrl('/a/speech/list?meetingId=')${meetingId}">演讲嘉宾</a></li>
                #end
                #if($shiro.hasPermission("qy:agenda:view"))
                <li><a href="#springUrl('/a/agenda/list?meetingId=')${meetingId}">会议议程</a></li>
                #end
                #if($shiro.hasPermission("qy:album:view"))
                <li><a href="#springUrl('/a/album/list?meetingId=')${meetingId}">相册图集</a></li>
                #end
                #if($shiro.hasPermission("qy:activ:view"))
                <li><a href="#springUrl('/a/activ/list?meetingId=')${meetingId}">现场活动</a></li>
                #end
                #if($shiro.hasPermission("qy:welcome:edit"))
                <li><a href="#springUrl('/a/welcome/form?meetingId=')${meetingId}">欢迎信</a></li>
                #end
                #if($shiro.hasPermission("qy:takedrive:view"))
                <li><a href="#springUrl('/a/takedrive/list?meetingId=')${meetingId}">试驾车辆</a></li>
                #end
                #if($shiro.hasPermission("qy:templateMessage:edit"))
                <li><a href="#springUrl('/a/templateMessage/list?meetingId=')${meetingId}">模板消息</a></li>
                #end
            </ul>
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="myForm">
                            <div class="box-body">
                                <div class="form-group form-md-line-input">
                                    <input type="checkbox" name="hotel" value="hotel">酒店管理
                                    <input type="checkbox" name="eat" value="eat">餐饮管理
                                    <input type="checkbox" name="relay"  value="hotel">接送管理
                                    <input type="checkbox" name="take"  value="take">试乘试驾
                                    <input type="checkbox" name="factory"  value="factory">工厂参观
                                </div>
                                <div class="form-group form-md-line-input col-md-12">
                                    <label>截止时间</label>
                                    <input type="text" id="close_date" class="form-control pull-right datepicker"
                                           value="$!{closing_date}" required
                                           name="endTimeStr" placeholder="截止时间"
                                           readonly="readonly">
                                </div>

                                <table id ="hotelTable" style="display: none" class="table table-bordered table-striped dataTable no-footer">
                                <thead>
                                <th>酒店名称(CN)</th>
                                <th>酒店名称(EN)</th>
                                <th>酒店地址(CN)</th>
                                <th>酒店地址(EN)</th>
                                <th>入住日期</th>
                                <th>离店日期</th>
                                <th></th>
                                </thead>
                                <tbody>

                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="5 ">
                                        <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="hotelAdd">添加酒店</a></p>
                                    </td>
                                </tr>
                                </tfoot>
                                </table>

                                <table id ="eatTable" style="display: none" class="table table-bordered table-striped dataTable no-footer">
                                    <thead>
                                    <th>餐饮名称(CN)</th>
                                    <th>餐饮名称(EN)</th>
                                    <th></th>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="3">
                                            <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="eatAdd">添加餐饮</a></p>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>


                                <table id ="relayTable" style="display: none" class="table table-bordered table-striped dataTable no-footer">

                                    <thead>
                                    <th>交通方式</th>
                                    <th></th>
                                    <th></th>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <input type="checkbox" name="highbus" value="highbus">高铁
                                            <input type="checkbox" name="plane" value="plane">飞机
                                            <input type="checkbox" name="onedrive"  value="onedrive">自驾
                                            <input type="checkbox" name="other"  value="other">其他
                                        </td>
                                    </tr>
                                </table>

                                <table id="relayhigh" style="display: none" class="table table-bordered table-striped dataTable no-footer">

                                    <thead>
                                        <th>接送站点(CN)</th>
                                        <th>接送站点(EN)</th>
                                        <th></th>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="3">
                                            <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="relayhighAdd">添加高铁站点</a></p>
                                        </td>
                                    </tr>
                                    </tfoot>

                                </table>

                                <table id="relayplane" style="display: none" class="table table-bordered table-striped dataTable no-footer">

                                    <thead>
                                    <th>接送站点(CN)</th>
                                    <th>接送站点(EN)</th>
                                    <th></th>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="3">
                                            <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="relayplaneAdd">添加飞机站点</a></p>
                                        </td>
                                    </tr>
                                    </tfoot>

                                </table>


                                <table id ="takeTable" style="display: none" class="table table-bordered table-striped dataTable no-footer">
                                    <thead>
                                    <th>试驾时间</th>
                                    <th>描述(CN)</th>
                                    <th>描述(EN)</th>
                                    <th></th>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="2">
                                            <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="takeAdd">添加试驾</a></p>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>

                                <table id ="factoryTable" style="display: none" class="table table-bordered table-striped dataTable no-footer">
                                    <thead>
                                    <th>参观时间</th>
                                    <th>描述(CN)</th>
                                    <th>描述(EN)</th>
                                    <th></th>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="2">
                                            <p style="width:100%;text-align:center"><a href="javascript:void(0)" id="factoryAdd">添加工厂</a></p>
                                        </td>
                                    </tr>
                                    </tfoot>
                                </table>



                                <div class="box-footer">
                                    #if($shiro.hasPermission("qy:demand:edit"))
                                    <input class="btn btn-primary" id="save" value="保存" type="submit">
                                    #end
                                </div>
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->

<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="js/jquery.serializejson.js"></script>
<script src="common/js/cfapp.js"></script>
<script>
    var csrfheader = {name:'_csrf_header',value:'${_csrf.headerName}'};
    var csrftoken  = {name:'_csrf',value:'${_csrf.token}'};
</script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
    $().ready(function () {
        Cfapp.init();
        recdTypeAdd.init();


        var dataId = "$!{meetingId}";
        if(dataId && dataId!=""){
            var serviceJson = ${service};
            if(serviceJson!=null && serviceJson!=""){
                    //酒店服务
                if(serviceJson.isHotel=='0'){
                    $("input[name='hotel']").attr("checked",true);
                    hotelAdd(JSON.parse(serviceJson.hotel));
                    $("#hotelTable").show();
                }
                if(serviceJson.isRelay=='0'){  //接送服务
                    $("input[name='relay']").attr("checked",true);
                    var relayJson = JSON.parse(serviceJson.relay);
                    if(relayJson.isHigh=='0'){
                        $("input[name='highbus']").attr("checked",true);
                        relayhighAdd(relayJson.high);
                        $("#relayhigh").show();
                    }
                    if(relayJson.isPlane=='0'){
                        $("input[name='plane']").attr("checked",true);
                        relayplaneAdd(relayJson.plane);
                        $("#relayplane").show();

                    }
                    if(relayJson.isOnedrive=='0'){
                        $("input[name='onedrive']").attr("checked",true);
                    }
                    if(relayJson.isOther=='0'){
                        $("input[name='other']").attr("checked",true);
                    }
                    $("#relayTable").show();
                }
                //餐饮管理
                if(serviceJson.isEat=='0'){
                    $("input[name='eat']").attr("checked",true);
                    eatAdd(JSON.parse(serviceJson.eat));
                    $("#eatTable").show();
                }
                //试乘试驾
                if(serviceJson.isTake=='0'){
                    $("input[name='take']").attr("checked",true);
                    takeAdd(JSON.parse(serviceJson.take));
                    $("#takeTable").show();
                }
                //工厂参观
                if(serviceJson.isfactory=='0'){
                    $("input[name='factory']").attr("checked",true);
                    factoryAdd(JSON.parse(serviceJson.factory));
                    $("#factoryTable").show();
                }
            }
        }

        $('.datepicker').datepicker({
            show: true,
            format: 'yyyy-mm-dd',
            autoclose: true,
            language: 'zh-CN',
            todayBtn: 'linked',
            clearBtn: 'linked'
        });
        //酒店服务
        $("input[name='hotel']").change(function(){
           if($(this).is(':checked')){
                $("#hotelTable").show();
           }else{
                $("#hotelTable").hide();
           }
        })

        function hotelAdd(objArr){
            for(var i = 0;i<objArr.length;i++){
                var obj = objArr[i];
                var html="<tr><td><input type=\"text\" class=\"form-control\"  value='"+obj.title+"' placeholder=\"酒店名称\"></td><td><input value='"+obj.titleEn+"' type=\"text\" class=\"form-control\" placeholder=\"酒店名称英文\"></td>"+
                        "<td><input type=\"text\" class=\"form-control\" value='"+obj.hoteladrress+"' placeholder=\"酒店地址\"></td><td><input value='"+obj.hoteladrressEn+"' type=\"text\" class=\"form-control\" placeholder=\"酒店地址英文\"></td>"+
                        "<td> <input type=\"text\" value='"+obj.startDate+"' data-start = \"$!{star}\" data-end = \"$!{end}\" class=\"form-control pull-right hotelDatePicker\" readonly=\"readonly\"></td><td> <input value='"+obj.endDate+"' data-start = \"$!{star}\" data-end = \"$!{end}\" type=\"text\" class=\"form-control pull-right hotelDatePicker\" readonly=\"readonly\"></td>"+
                        " <td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\" >删除</a></td></tr>";
                $("#hotelTable tbody").append(html);
            }
        }

        function relayhighAdd(objArr){ //高铁站点
            for(var i =0;i<objArr.length;i++){
                var obj = objArr[i];
                var html="<tr><td><input type=\"text\"class=\"form-control\" value='"+obj.highsattion+"' placeholder=\"高铁站点\"></td> <td><input type=\"text\"class=\"form-control\" value='"+obj.highsattionEn+"'  placeholder=\"高铁站点英文\"></td>"+
                        "<td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\">删除</a></td></tr>";
                $("#relayhigh tbody").append(html);
            }
        }

        function relayplaneAdd(objArr){  //飞机站点
            for(var i = 0;i<objArr.length;i++){
                var obj = objArr[i];
                var html="<tr><td><input type=\"text\"class=\"form-control\" value='"+obj.planesattion+"' placeholder=\"飞机站点\"></td> <td><input type=\"text\"class=\"form-control\"value='"+obj.planesattionEn+"'  placeholder=\"飞机站点英文\"></td>"+
                        "<td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\">删除</a></td></tr>";
                $("#relayplane tbody").append(html);
            }
        }

        function eatAdd(objArr){
            for(var i = 0;i<objArr.length;i++){
                var obj= objArr[i];
                var html="<tr><td><input type=\"text\" class=\"form-control\" value='"+obj.eatname+"' placeholder=\"餐饮名称\"></td><td><input type=\"text\" class=\"form-control\" value='"+obj.eatnameEn+"' placeholder=\"餐饮名称英文\"></td>"+
                        "<td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\" >删除</a></td></tr>";
                $("#eatTable tbody").append(html);
            }
        }

        function takeAdd(objArr){
            for(var i = 0;i<objArr.length;i++){
                var obj=objArr[i];
                var html="<tr><td><input type=\"text\" class=\"form-control pull-right datepicker\" value='"+obj.taketime+"' readonly=\"readonly\"> </td> " +
                        "<td><input type=\"text\" class=\"form-control\" value='"+obj.take_des+"' placeholder=\"描述(CN)\"></td>"+
                        "<td><input type=\"text\" class=\"form-control\"  value='"+obj.take_des_en+"' placeholder=\"描述(EN)\"></td>"+
                        "<td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\">删除</a></td> </tr>";
                $("#takeTable tbody").append(html);
            }
        }

        function factoryAdd(objArr){
            for(var i=0;i<objArr.length;i++){
                var obj = objArr[i];
                var html="<tr><td><input type=\"text\" class=\"form-control pull-right datepicker\" value='"+obj.visittime+"' readonly=\"readonly\"> </td> "+
                        "<td><input type=\"text\" class=\"form-control\"  value='"+obj.des+"' placeholder=\"描述(CN)\"></td>"+
                         "<td><input type=\"text\" class=\"form-control\"  value='"+obj.des_en+"' placeholder=\"描述(EN)\"></td>"+
                        "<td><a href=\"javascript:void(0)\" class=\"btn btn-default btn-sm delete\" >删除</a></td></tr>";
                $("#factoryTable tbody").append(html);
            }
        }

        $(".hotelDatePicker").each(function(){
            var start=$(this).attr("data-start");
            var end=$(this).attr("data-end");
            $(this).datepicker({
                show: true,
                format: 'yyyy-mm-dd',
                autoclose: true,
                language: 'zh-CN',
                todayBtn: 'linked',
                clearBtn: 'linked',
                startDate:start,
                endDate:end
            });
        })

        $("#hotelAdd").click(function () {
            var objArr = [];
            var obj = {};
            obj.title="";
            obj.titleEn="";
            obj.hoteladrress="";
            obj.hoteladrressEn ="";
            obj.startDate="";
            obj.endDate="";
            objArr.push(obj);
            hotelAdd(objArr);
            $(".hotelDatePicker").each(function(){
                var start=$(this).attr("data-start");
                var end=$(this).attr("data-end");
                $(this).datepicker({
                    show: true,
                    format: 'yyyy-mm-dd',
                    autoclose: true,
                    language: 'zh-CN',
                    todayBtn: 'linked',
                    clearBtn: 'linked',
                    startDate:start,
                    endDate:end
                });
            })
        })
        
        $("#hotelTable").on("click",".delete",function () {
            $(this).parent().parent().remove();
        })

        //餐饮服务
        $("input[name='eat']").change(function(){
           if($(this).is(':checked')){
                $("#eatTable").show();
           }else{
                $("#eatTable").hide();
           }
        })

        $("#eatAdd").click(function () {
            var objArr = [];
            var obj = {};
            obj.eatname="";
            obj.eatnameEn="";
            objArr.push(obj);
            eatAdd(objArr);

        })

        $("#eatTable").on("click",".delete",function () {
            $(this).parent().parent().remove();
        })

        //接送服务
        $("input[name='relay']").change(function(){
            if($("input[name='relay']").is(":checked")){
                $("#relayTable").show();

            }else{
                $("#relayTable").hide();

            }
        })

        $("#relayTable input[name='highbus']").change(function(){ //高铁
            if($("#relayTable input[name='highbus']").is(":checked")){
                $("#relayhigh").show();

            }else{
                $("#relayhigh").hide();
            }

        })
        //添加高铁站点
        $("#relayhighAdd").click(function(){
            var objArr = [];
            var obj = {};
            obj.highsattion="";
            obj.highsattionEn="";
            objArr.push(obj);
            relayhighAdd(objArr);
        });
        //删除高铁站点
        $("#relayhigh").on("click",".delete",function () {
            $(this).parent().parent().remove();
        });

        $("#relayTable input[name='plane']").change(function(){ //飞机
            if($("#relayTable input[name='plane']").is(":checked")){
                $("#relayplane").show();
            }else{
                $("#relayplane").hide();
            }
        })

        //添加飞机站点
        $("#relayplaneAdd").click(function(){
            var objArr = [];
            var obj = {};
            obj.planesattion="";
            obj.planesattionEn="";
            objArr.push(obj);
            relayplaneAdd(objArr);
        });

        //删除飞机站点
        $("#relayplane").on("click",".delete",function () {
            $(this).parent().parent().remove();
        });

        //试乘试驾
        $("input[name='take']").change(function(){
            if($("input[name='take']").is(":checked")){
                $("#takeTable").show();
            }else{
                $("#takeTable").hide();
            }
        })

        $("#takeAdd").click(function(){
            var objArr = [];
            var obj = {};
            obj.taketime="";
            obj.take_des="";
            obj.take_des_en="";
            objArr.push(obj);
            takeAdd(objArr);

            $('.datepicker').datepicker({
                show: true,
                format: 'yyyy-mm-dd',
                autoclose: true,
                language: 'zh-CN',
                todayBtn: 'linked',
                clearBtn: 'linked'
            });

        });

        $("#takeTable").on("click",".delete",function () {
            $(this).parent().parent().remove();
        });

        //工厂参观
        $("input[name='factory']").change(function(){
            if($("input[name='factory']").is(":checked")){
                $("#factoryTable").show();
            }else{
                $("#factoryTable").hide();
            }
        })

        $("#factoryAdd").click(function(){
            var objArr = [];
            var obj = {};
            obj.visittime="";
            obj.des="";
            obj.des_en="";
            objArr.push(obj);
            factoryAdd(objArr);

            $('.datepicker').datepicker({
                show: true,
                format: 'yyyy-mm-dd',
                autoclose: true,
                language: 'zh-CN',
                todayBtn: 'linked',
                clearBtn: 'linked'
            });

        })

        $("#factoryTable").on("click",".delete",function () {
            $(this).parent().parent().remove();
        });

    });


    var recdTypeAdd = function () {
        var initForm = function () {
            var initFormCtrl = function () {
                bindEvent();
            };
            var bindEvent = function () {

                $("#myForm").validate({
                    rules: {},
                    messages: {},
                    submitHandler: function (form) {
                        //酒店服务
                        var object = {};
                        var staticArray = "1";
                        var isHotel=$("input[name='hotel']").is(":checked");
                        if(isHotel){
                            object.isHotel="0";
                            var hotelArr=[];
                            for(var i =0;i<$("#hotelTable tbody tr").length;i++){
                                var node = $("#hotelTable tbody tr").get(i);
                                var hotelObj = {};
                                hotelObj.title=$(node).find("td:eq(0)").find("input").val();
                                hotelObj.titleEn=$(node).find("td:eq(1)").find("input").val();
                                hotelObj.hoteladrress=$(node).find("td:eq(2)").find("input").val();
                                hotelObj.hoteladrressEn=$(node).find("td:eq(3)").find("input").val();
                                hotelObj.startDate=$(node).find("td:eq(4)").find("input").val();
                                hotelObj.endDate=$(node).find("td:eq(5)").find("input").val();
                                var t1 = new Date($(node).find("td:eq(4)").find("input").val());
                                var t2 = new Date($(node).find("td:eq(5)").find("input").val());
                                if(Date.parse(t2)-Date.parse(t1)<0){
                                    Cfapp.alert({
                                        message: "离店时间早于进店时间",
                                        btntext: "确定",
                                        success: function () {
                                            //location.href = "#springUrl('/a/demand/form?meetingId=')${meetingId}";
                                        }
                                    })
                                    return;
                                }
                                hotelArr.push(hotelObj);
                            }
                            object.hotel= JSON.stringify(hotelArr);
                        }else{
                            object.isHotel=staticArray;
                        }

                        //餐饮服务
                        var isEat = $("input[name='eat']").is(":checked");
                        if(isEat){
                            object.isEat = "0";
                            var eatArr=[];
                            for(var i = 0 ; i<$("#eatTable tbody tr").length; i++){
                                var node = $("#eatTable tbody tr").get(i);
                                var eatObj = {};
                                eatObj.eatname=$(node).find("td:eq(0)").find("input").val();
                                eatObj.eatnameEn=$(node).find("td:eq(1)").find("input").val();
                                eatArr.push(eatObj)
                            }
                            object.eat=JSON.stringify(eatArr);
                        }else{
                            object.isEat = staticArray;
                        }

                        //接送服务
                        var isRelay = $("input[name='relay']").is(":checked");
                        if(isRelay){
                            object.isRelay = "0";
                            var relayArr = {};
                            //默认交通方式全部不选中
                            relayArr.isPlane = "1";
                            relayArr.isHigh = "1";
                            relayArr.isOnedrive = "1";
                            relayArr.isOther = "1";
                            if($("input[name='highbus']").is(":checked")){
                                relayArr.isHigh = "0";
                                var highArr = [];
                                for(var i=0;i<$("#relayhigh tbody tr").length;i++){
                                    var node = $("#relayhigh tbody tr").get(i);
                                    var highObj = {};
                                    highObj.highsattion = $(node).find("td:eq(0)").find("input").val();
                                    highObj.highsattionEn = $(node).find("td:eq(1)").find("input").val();
                                    highArr.push(highObj);
                                }
                                relayArr.high=highArr;
                            }
                            if($("input[name='plane']").is(":checked")){
                                relayArr.isPlane = "0";
                                var planeArr = [];
                                for(var i=0;i<$("#relayplane tbody tr").length;i++){
                                    var node = $("#relayplane tbody tr").get(i);
                                    var planeObj = {};
                                    planeObj.planesattion = $(node).find("td:eq(0)").find("input").val();
                                    planeObj.planesattionEn = $(node).find("td:eq(1)").find("input").val();
                                    planeArr.push(planeObj);
                                }
                                relayArr.plane=planeArr;
                            }



                            if($("input[name='onedrive']").is(":checked")){
                                relayArr.isOnedrive = "0";
                            }
                            if($("input[name='other']").is(":checked")){
                                relayArr.isOther = "0";
                            }


                            object.relay = JSON.stringify(relayArr);
                        }else{
                            object.isRelay = staticArray;
                        }

                        //试乘试驾
                        if($("input[name='take']").is(":checked")){
                            object.isTake = "0";
                            var takeArr = [];
                            for(var i = 0; i < $("#takeTable tbody tr").length; i++){
                                var node = $("#takeTable tbody tr").get(i);
                                var takeObj = {};
                                takeObj.taketime = $(node).find("td:eq(0)").find("input").val();
                                takeObj.take_des = $(node).find("td:eq(1)").find("input").val();
                                takeObj.take_des_en = $(node).find("td:eq(2)").find("input").val();
                                takeArr.push(takeObj)
                            }
                            object.take = JSON.stringify(takeArr);
                        }else{
                            object.isTake = staticArray;
                        }

                        //工厂参观
                        if($("input[name='factory']").is(":checked")){
                            object.isfactory = "0";
                            var factoryArr = [];
                            for(var i = 0; i < $("#factoryTable tbody tr").length; i++){
                                var node = $("#factoryTable tbody tr").get(i);
                                var factoryObj = {};
                                factoryObj.visittime = $(node).find("td:eq(0)").find("input").val();
                                factoryObj.des=$(node).find("td:eq(1)").find("input").val();
                                factoryObj.des_en=$(node).find("td:eq(2)").find("input").val();
                                factoryArr.push(factoryObj)
                            }
                            object.factory = JSON.stringify(factoryArr);
                        }else{
                            object.isfactory = staticArray;
                        }
                        //获得截止日期
                       var closedate = $("#close_date").val();
                        object.service = JSON.stringify(object);
                        object.closetime = closedate;
//                       console.log(object);
                        object.id = "${meetingId}";
                        object._csrfheader = csrfheader.value;
                        object._csrf = csrftoken.value;
                        $("#save").attr("disabled", true);
                        $.ajax({
                            url: "#springUrl('/a/meeting/formData')",
                            type: "post",
                            dataType: "json",
                            data: object,
                            success: function (returnobj) {
                                $("#save").attr("disabled", false);
                                if (returnobj.errorNo == 0) {  //保存成功
                                    Cfapp.alert({
                                        message: "添加成功",
                                        btntext: "确定",
                                        success: function () {
                                            location.href = "#springUrl('/a/demand/form?meetingId=')${meetingId}";
                                        }
                                    });
                                } else {
                                    Cfapp.alert({
                                        message: "创建失败",
                                        btntext: "确定",
                                        success: function () {

                                        }
                                    });
                                }
                            }
                        });
                    }
                })
            }
            initFormCtrl();
        }
        return {

            //main function to initiate the module
            init: function () {
                initForm();
            }

        };
    }();
</script>
</body>
<!-- END BODY -->
</html>