<%@ page import="com.fadu.app.util.SystemCache" %>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery-ui.css"/>
<link rel="stylesheet" href="${contextPath}/static/assets/css/ui.jqgrid.css"/>

<style>
    .hr-line-dashed {
        background-color: #ffffff;
        border-top: 1px dashed #e7eaec;
        color: #ffffff;
        height: 1px;
        margin: 20px 0;
    }
</style>
<script>
    $(function(){

    });
    function openTable(table){
        $("#"+table).modal("toggle");
    }
    function setCity(obj){
        var val = obj.value;
        var sec = document.getElementById('cityId');
        sec.innerHTML = "<option value=''>全部</option>";
        if(val != ''){
            //ajax
            $.getJSON("${contextPath}/util/getCitysByProvince?provinceId="+val,function(result){
                $.each(result, function(i, v){
                    sec.innerHTML+="<option value='"+v.value+"'>"+v.name+"</option>";
                });
            });
        }
    }
</script>
    <%--添加律师信息窗口--%>
<div id="mod-add" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
        <form id="AddForm">
            <div class="modal-content">
                <div class="modal-header no-padding">
                    <div class="table-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            <span class="white">&times;</span>
                        </button>
                        新增律师好友关系
                    </div>
                </div>
                <div class="modal-body" style="overflow-y: scroll;">
                    <div id="mod-add-tip" class="red clearfix"></div>
                    <div class="form-group">
                        <label for="mod-add-lawyerTel">律师手机号</label>
                        <input type="text"  id="mod-add-lawyerTel" class="form-control" />
                    </div>
                    <div class="form-group">
                        <label for="mod-add-userPhone">客户经理手机号</label>
                        <input type="text"  id="mod-add-userPhone" class="form-control" />
                    </div>
                    <div class="form-group">
                        <label for="mod-add-interactiveState">互动状态</label>
                        <select class="form-control" id="mod-add-interactiveState">
                            <option value="0" selected>未激活</option>
                            <option value="1">已激活</option>
                            <option value="2">已加微信</option>
                            <option value="3">已删微信</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="mod-add-registeredState">注册状态</label>
                        <select class="form-control" id="mod-add-registeredState">
                            <option value="0" selected>未注册</option>
                            <option value="1">已注册</option>
                        </select>
                    </div>
                <div class="modal-footer no-margin-top">
                    <div class="text-center">
                        <button id="mod-add-submit" type="button" class="btn btn-sm btn-primary">
                            <i class="ace-icon fa fa-floppy-o bigger-160"></i>
                            保存
                        </button>
                        <button class="btn btn-sm" data-dismiss="modal">
                            <i class="ace-icon fa fa-share bigger-160"></i>
                            取消
                        </button>
                    </div>
                </div>
                </div>
            </div><!-- /.modal-content -->
        </form>
    </div><!-- /.modal-dialog -->
</div>

<div id="MyDiv" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header no-padding">
                    <div class="table-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            <span class="white">&times;</span>
                        </button>
                        导入律师好友关系
                    </div>
                </div>
                <div class="modal-body" style="overflow-y: scroll;">
                    <div id="mod-add-tip2" class="red clearfix"></div>
                    <form name="xx" action="${contextPath}/sbdx/lawyer/importSbdxLawyer"
                          method="post" enctype="multipart/form-data" id="formId"
                          class="pageForm required-validate" >
                        <div id="upload">
                            <div>
                                <span for="excelFile">选择文件：</span>
                                <a class="a-upload" id="up1">
                                    <input id="excelFile" type="file" name="filename">
                                </a>
                                <span class="showFileName"></span>
                                <span class="fileerrorTip"></span>
                            </div>
                        </div>
                    </form>
                    <div class="form-group">
                        <div class="modal-footer no-margin-top">
                            <div class="text-center">
                                <button onclick="javasrcipt:_submit(); "  type="button" class="btn btn-sm btn-primary">
                                    <i class="ace-icon fa fa-floppy-o bigger-160"></i>
                                    开始导入
                                </button>
                                <button  onclick="CloseDiv()" class="btn btn-sm" data-dismiss="modal">
                                    <i class="ace-icon fa fa-share bigger-160"></i>
                                    取消
                                </button>
                        </div>
                    </div>
                </div>
            </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
</div>
<div class="well well-sm">
    省：<select id="provinceId" onchange="setCity(this)">
    <option selected value="" >全部</option>
    <% for(String s: SystemCache.provinceMap.keySet()){ %>
    <option value="<%=s %>" ><%=SystemCache.getProvinceName(s) %></option>
    <%} %>
</select>
    市：<select id="cityId">
</select>
    &nbsp;
    互动状态：
    <select id="interactiveState">
    <option value="" selected>互动状态</option>
    <option value="0">未激活</option>
    <option value="1">已激活</option>
        <option value="2">已加微信</option>
        <option value="3">已删微信</option>
</select>
    <input type="text" class="input-sm" placeholder="搜索关键字" id="keyword"/>
    <button type="button" class="btn btn-purple btn-sm" id="searchd">
        <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
        查找
    </button>
        <button type="button" class="btn btn-danger btn-sm"  onclick='add()'>
            <span class="ace-icon fa fa-edit icon-on-right bigger-110"></span>
            添加律师好友信息
        </button>
    <button type="button" class="btn btn-purple btn-sm" id="daoruWeChat">
        导入律师好友信息
    </button>

</div>





<%--律师详细--%>
<div id="modal-table" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 1000px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <input type="hidden" id="sbdxLawyerId" value="">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                     律师详细
                </div>
            </div>
            <div class="modal-body" id="modal-table-body1">
<%--                <p> <button class="btn btn-white" onclick="openTable('modal-table-getFeedbackRecord')" id="addInquiry"type="button">保存</button></p>--%>
            </div>
        </div>
    </div>
</div>
<%--添加新的询价--%>
<div id="modal-table-addInquiry" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加新的询价
                </div>
            </div>
            <div class="modal-body" id="modal-table-body" style="text-align: center">
                <div class="row">
<%--                    <div class="form-group col-sm-6">--%>
<%--                        <label for="mod-add-saveInquiryCourt">输入法院：</label>--%>
<%--                        <input type="text"  id="mod-add-saveInquiryCourt" class="form-control" />--%>
<%--                    </div>--%>

                    <div class="form-group col-sm-6">
                        输入法院：<input type="text" id="mod-add-saveInquiryCourt">
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-6">
                        输入保全金额：<input type="number" id="price">
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="addInquiry()" type="button">保存</button>
                    </div>
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="openTable('modal-table-addInquiry')" type="button">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%--添加询价跟进记录--%>
<div id="modal-table-addInquiryRecord" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加跟进记录
                </div>
            </div>
            <div class="modal-body" id="modal-table-body"  style="text-align: center">
                <input type="hidden" value="" id="inquiryId">
                <div class="row">
                    <div class="form-group col-sm-12">
                        <textarea placeholder="输入跟进详情" id="recordText" style="width: 400px;height: 100px" ></textarea>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="saveInquiryRecord()" type="button">保存</button>
                    </div>
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="openTable('modal-table-addInquiryRecord')" type="button">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%--查看询价跟进记录--%>
<div id="modal-table-getInquiryRecord" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    查看跟进记录
                </div>
            </div>
            <div class="modal-body" id="modal-table-bodyShow"  style="text-align: center">

            </div>
        </div>
    </div>
</div>

<%--查看询价或反馈详情--%>
<div id="modal-table-getInquiryRecord" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    查看
                </div>
            </div>
            <div class="modal-body" id="modal-table-bodyShow"  style="text-align: center">

            </div>
        </div>
    </div>
</div>


<%--添加新的反馈--%>
<div id="modal-table-addFeedback" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加新的反馈
                </div>
            </div>
            <div class="modal-body" id="modal-table-body" style="text-align: center">
                <div class="row">
                    <div class="form-group col-sm-9">
                        选择业务类型：<select id="type">
                        <option value="0" selected>诉讼保全</option>
                        <option value="1">法律咨询</option>
                        </select>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-12">
                        <textarea placeholder="输入律师反馈" id="feedback" style="width: 400px;height: 100px" ></textarea>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="addFeedback()" type="button">保存</button>
                    </div>
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="openTable('modal-table-addFeedback')" type="button">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%--添加反馈跟进记录--%>
<div id="modal-table-addFeedbackRecord" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    添加跟进记录
                </div>
            </div>
            <div class="modal-body" id="modal-table-body"  style="text-align: center">
                <input type="hidden" value="" id="feedbackId">
                <div class="row">
                    <div class="form-group col-sm-12">
                        <textarea placeholder="输入跟进详情" id="recordText2" style="width: 400px;height: 100px" ></textarea>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="saveFeedbackRecord()" type="button">保存</button>
                    </div>
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="openTable('modal-table-addFeedbackRecord')" type="button">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<%--修改询价跟进状态--%>
<div id="modal-table-updateInquiryRecord" class="modal fade" tabindex="-1" data-backdrop="static">
    <div class="modal-dialog" style="min-width: 500px;">
        <div class="modal-content">
            <div class="modal-header no-padding">
                <div class="table-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        <span class="white">&times;</span>
                    </button>
                    查看跟进记录
                </div>
            </div>
            <div class="modal-body" id="modal-table-body"  style="text-align: center">

                <div class="row">
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white"onclick="openTable('modal-table-updateInquiryRecord')" type="button">确定</button>
                    </div>
                    <div class="form-group col-sm-6">
                        <button class="btn btn-white" onclick="openTable('modal-table-updateInquiryRecord')" type="button">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-xs-12">
        <table id="grid-table"></table>

        <div id="grid-pager"></div>

        <script type="text/javascript">
            var $path_base = "${contextPath}/static";//in Ace demo this will be used for editurl parameter
        </script>

        <!-- PAGE CONTENT ENDS -->
    </div><!-- /.col -->
</div>
<!-- /.row -->

<%--<div id="modal-table" class="modal fade" tabindex="-1" data-backdrop="static">--%>
<%--    <div class="modal-dialog" style="min-width: 920px;">--%>
<%--        <div class="modal-content">--%>
<%--            <div class="modal-header no-padding">--%>
<%--                <div class="table-header">--%>
<%--                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">--%>
<%--                        <span class="white">&times;</span>--%>
<%--                    </button>--%>
<%--                    公司详情--%>
<%--                </div>--%>
<%--            </div>--%>
<%--            <div class="modal-body" id="modal-table-body">--%>

<%--            </div>--%>
<%--        </div>--%>
<%--    </div>--%>
<%--</div>--%>





<!-- 阿里云OSS -->
<script type="text/javascript" src="${contextPath}/static/js/contract/promise-6.1.0.js"></script>
<script type="text/javascript" src="http://gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js"></script>
<script type="text/javascript" src="${contextPath}/static/js/contract/ace.fileinput.js"></script>
<script type="text/javascript" src="${contextPath}/static/js/contract/uuid.js"></script>
<script type="text/javascript" src="${contextPath}/static/js/contract/picupload.js?v=2"></script>
<script type="text/javascript" src="${contextPath}/static/assets/js/lazyload/jquery.lazyload.js"></script>
<!-- page specific plugin scripts -->
<script type="text/javascript">
    var bucket = '${oss_bucket_b}';
    var contextPath = '${contextPath}';
    var logoUrl = '${oss_bucket_b_url}';
    var logoThum = '${oss_bucket_b_url_img}';
    var myGrid = null;
    var url_b = '${duowenapp_b}';
    var scripts = [null, "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js", "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js",
        "${contextPath}/static/js/contract/promise-6.1.0.js",
        "http://gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js",
        "${contextPath}/static/js/contract/ace.fileinput.js",
        "${contextPath}/static/js/contract/uuid.js",
        "${contextPath}/static/js/contract/picupload.js",
        "${contextPath}/static/assets/js/lazyload/jquery.lazyload.js",
        "${contextPath}/static/js/network.js",
        "${contextPath}/static/assets/js/date-time/bootstrap-datepicker.js",
        null];

    var hiddenModalBody = '';
    $(function () {
        hiddenModalBody += '<div class="row">'
            + '<label class="col-sm-2 control-label">公司LOGO:</label>'
            + '<div class="col-sm-2 text-right" id="company-Logo"></div>'
            + '<label class="col-sm-2 control-label">公司宣传图:</label>'
            + '<div class="col-sm-2 text-right" id="company-Pic"></div>'
            + '<label class="col-sm-2 control-label">公司营业执照:</label>'
            + '<div class="col-sm-2 text-right" id="company-Cert"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label">保函样式:</label>'
            + '<div class="col-sm-2 text-right" id="company-Example1"></div>'
            + '<label class="col-sm-2 control-label">保单样式:</label>'
            + '<div class="col-sm-2 text-right" id="company-Example2"></div>'
            + '<label class="col-sm-2 control-label">合同/投保单:</label>'
            + '<div class="col-sm-2 text-right" id="company-Example3"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label">诉讼前申请文件:</label>'
            + '<div class="col-sm-2 text-right" id="company-SuitBefore"></div>'
            + '<label class="col-sm-2 control-label">诉讼中申请文件:</label>'
            + '<div class="col-sm-2 text-right" id="company-SuitAfter"></div>'
            + '<label class="col-sm-2 control-label">客服电话:</label>'
            + '<div class="col-sm-2 text-right" id="company-Tel"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label">公司简介:</label>'
            + '<div class="col-sm-10 text-right" id="company-Info"></div>'
            + '</div>'
            + '<div class="hr-line-dashed"></div>';
        hiddenModalBody += '<div class="row">'
            + '<div class="col-sm-12 text-left"><h5>服务承诺</h5></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label">审核承诺:</label>'
            + '<div class="col-sm-2 text-right" id="company-CheckTime"></div>'
            + '<label class="col-sm-2 control-label">确认收款承诺:</label>'
            + '<div class="col-sm-2 text-right" id="company-ConfirmTime"></div>'
            + '<label class="col-sm-2 control-label">出函承诺:</label>'
            + '<div class="col-sm-2 text-right" id="company-SendTime"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-3 control-label">发票(保单)配送方式:</label>'
            + '<div class="col-sm-3 text-right" id="company-Deliver2"></div>'
            + '<label class="col-sm-6 control-label"></label>'
            + '</div>'
            + '<div class="hr-line-dashed"></div>';
        hiddenModalBody += '<div class="row">'
            + '<div class="col-sm-12 text-left"><h5>保费比例</h5></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label no-padding-right">房产:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s101"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">银行账户类:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s102"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">土地使用权:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s103"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label no-padding-right">非上市公司股权:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s104"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">应收债权:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s105"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">车辆:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s201"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label no-padding-right">船舶:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s202"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">不易腐朽损坏货物:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s203"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">机器设备:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s204"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label no-padding-right">商标专利:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s205"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">上市公司股票:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s301"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">非固定收益基金账户:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s302"></div>'
            + '</div>'
            + '<div class="row">'
            + '<label class="col-sm-2 control-label no-padding-right">易腐朽损坏货物:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-s303"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">诉讼前折扣:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-suitBefore"></div>'
            + '<label class="col-sm-2 control-label no-padding-right">诉讼中折扣:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-suitAfter"></div>'
            + '</div>'
            + '<div class="row" id="modalBodyLastDiv">'
            + '<label class="col-sm-2 control-label no-padding-right">最低保费:</label>'
            + '<div class="col-sm-2 text-right no-padding-left" id="company-minFee"></div>'
            + '<label class="col-sm-8 control-label"></label>'
            + '</div>';
    });

    //导入提交表单
    function _submit() {
        //遍历所的有文件
        var files = document.getElementsByName("filename");
        if (files[0].value === "") {
            alert("上传有误，请检查是否上传文件或者检查文件类型！!");
            return false;
        }else{
            $('#formId').submit();
        }
    }

    //导入框显示
    $("#daoruWeChat").click(function () {
        var file = document.getElementById("excelFile");
        // for IE, Opera, Safari, Chrome
        if (file.outerHTML) {
            file.outerHTML = file.outerHTML;
        } else { // FF(包括3.5)
            file.value = "";
        }
        $(".showFileName").html("");
        $(".fileerrorTip").html("");
        $("#MyDiv").modal("toggle");
    });

    function showdetail(id) {
        var html = "";
        $("#modal-table-body1").html("");
        console.log(id);
        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/getSbdxLawyerDetail",
            type: "post",
            data: {
                'lawyerId': id
            },
            success: function (ret) {
                //基本信息
                var user = ret.lawyerVO;
                //询价信息
                var lawyerInquiry = ret.lawyerInquiryVOList;
                //反馈信息
                var lawyerFeedback = ret.lawyerFeedbackVOList;
                $("#sbdxLawyerId").val(user.id);
                //基本信息
                html += '<div class="col-sm-12 text-left" style="margin-bottom: 15px;color: #555;height: 30px;background-color:#55555542; "><strong>基本信息</strong></div>';
                html += '<div class="form-group col-sm-3">律师姓名：'+notNull(user.realName)+'</div>';
                html += '<div class="form-group col-sm-3">手机号：'+notNull(user.lawyerPhone)+'</div>';
                html += '<div class="form-group col-sm-3">省：'+notNull(user.province)+'</div>';
                html += '<div class="form-group col-sm-3">市：'+notNull(user.city)+'</div></div>';
                html += '<div class="row"><div class="form-group col-sm-3">注册状态：<select id="selector"><option value="0">未注册</option><option value="1">已注册</option>  </select></div>';
                html += '<div class="form-group col-sm-3">客户经理微信号昵称：'+user.weChatOperator+'</div>';
                html += '<div class="form-group col-sm-3">客户经理微信号：'+user.weChatNum+'</div>';
                html += '<div class="form-group col-sm-3">互动状态：<select id="selectinteractiveState"><option value="0">未激活</option><option value="1">已激活</option> <option value="2">已加微信</option><option value="3">已删微信</option> </select></div></div>';
                html += '<div class="row">';
                html += '<button class="btn btn-primary btn-white checkbox-inline btnSty" type="button" onclick="updateSbdxLawyer(\'' + user.id + '\')">保存</button></div>';
                //诉保业务管理
                html += '<div class="row">';
                html += '<div class="col-sm-12 text-left" style="margin-bottom: 15px;color: #555;height: 30px;background-color:#55555542; "><strong>诉保业务管理</strong></div></div>';
                html += '<div class="row"><div class="form-group col-sm-12" style="border-bottom: solid #ccc;">诉保提交单数：'+user.orderCount+'</div></div>';

                    html += '<div class="row">';
                    html += '<div class="form-group col-sm-12" >';
                    html += '<table class="tab" border="1" style="width: 900px;">' +
                        '<tr style="background-color: #ccc"><th>询价时间</th><th>法院</th><th>保全金额</th><th>跟进状态</th><th>最新跟进时间</th><th>最新跟进详细</th><th>操作</th></tr>';
                    for(var i = 0;i<lawyerInquiry.length;i++){
                        html += '<tr><td>'+notNull(lawyerInquiry[i].date)+'</td><td>'+notNull(lawyerInquiry[i].courtName)+'</td><td>'+notNull(lawyerInquiry[i].price)+'</td><td>'+notNull(lawyerInquiry[i].followStateValue)+'</td><td>'+notNull(lawyerInquiry[i].creteFollowDate)+'</td><td>'+notNull(lawyerInquiry[i].recoding)+'</td><td><button  onclick="showFollow(\'' + lawyerInquiry[i].id + '\',0)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>添加跟进记录</button>&nbsp;<button  onclick="getFollow(\'' + lawyerInquiry[i].id + '\',0)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>查看跟进记录</button>&nbsp;<button  onclick="updateState(\'' + lawyerInquiry[i].id + '\',\'' + lawyerInquiry[i].followState + '\',0)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>修改跟进状态</button></td></tr>';
                    }
                    html +='</table></div></div>';

                html += '<div class="row">';
                html += '<button class="btn btn-primary btn-white checkbox-inline btnSty" type="button" onclick="saveInquiry(\'' + user.id + '\')">添加新的询价</button></div>';

                //律师反馈管理
                html += '<div class="row">';
                html += '<div class="col-sm-12 text-left" style="margin-bottom: 15px;color: #555;height: 30px;background-color:#55555542; "><strong>律师反馈管理</strong></div></div>';

                html += '<div class="row">';
                html += '<div class="form-group col-sm-12" >';
                html += '<table class="tab" border="1" style="width: 900px;">' +
                    '<tr style="background-color: #ccc"><th>反馈时间</th><th>业务类型</th><th>问题描述</th><th>跟进状态</th><th>最新跟进时间</th><th>最新跟进详细</th><th>操作</th></tr>';
                for(var i = 0;i<lawyerFeedback.length;i++){
                    html += '<tr><td>'+notNull(lawyerFeedback[i].date)+'</td><td>'+notNull(lawyerFeedback[i].typeValue)+'</td><td>'+notNull(lawyerFeedback[i].description)+'</td><td>'+notNull(lawyerFeedback[i].followStateValue)+'</td><td>';
                        if(typeof(lawyerFeedback[i].creteFollowDate) == "undefined"){
                            html += '未录入';
                        }else{
                            html +=notNull(lawyerFeedback[i].creteFollowDate);
                        }
                    html +=  '</td><td>'+notNull(lawyerFeedback[i].recoding)+'</td><td><button  onclick="showFollow(\'' + lawyerFeedback[i].id + '\',1)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>添加跟进记录</button>&nbsp;<button  onclick="getFollow(\'' + lawyerFeedback[i].id + '\',1)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>查看跟进记录</button>&nbsp;<button  onclick="updateState(\'' + lawyerFeedback[i].id + '\',\'' + lawyerFeedback[i].followState + '\',1)" class="btn btn-minier btn-info"><i class="ace-icon fa fa-pencil-square-o"></i>修改跟进状态</button></td></tr>';
                }
                html +='</table></div></div>';

                html += '<div class="row">';
                html += '<button class="btn btn-primary btn-white checkbox-inline btnSty" type="button" onclick="saveFeedbcak(\'' + user.id + '\')">添加新的反馈</button></div>';


                $("#modal-table").modal("toggle");
                $("#modal-table-body1").html(html);
                if(user.registeredState) {
                    $("#selector").find("option").eq(1).attr("selected",true);
                }

                if(user.interactiveState){
                    $("#selectinteractiveState").find("option").eq(parseInt(user.interactiveState)).attr("selected",true);
                }
                $(".btnSty").css("margin-bottom","5px");
                $(".btnSty").css("margin-left","20px");
                $(".tab td").css("text-align","center");
                $(".tab th").css("text-align","center");
            }
        });
        // var url = "home#page/sbdxLawyerDetails?companyId="+companyId+"&name="+name;
        // window.open(url, "_blank");
    }



    $('#mod-sb-addButton').click(function (event) {
        $("#mod-service-sb").modal("toggle");
    });

    $('#mod-ps-addButton').click(function (event) {
        $("#mod-service-ps").modal("toggle");
    });




    //修改跟进状态
    function updateState(id,state,type){
        if(state == 0){
            //跟进中
            if (confirm("确认要将状态改为跟进结束吗？")) {
                $.ajax({
                    dataType: "json",
                    url: "${contextPath}/sbdx/lawyer/updaeSbdxLawyerState",
                    type: "post",
                    data: {
                        id: id,
                        state: 1,
                        type: type
                    },
                    complete: function (ret) {
                        var ret = eval("(" + ret.responseText + ")");
                        if (ret.success) {
                            alert("操作成功");
                            $("#modal-table").modal("toggle");
                            myGrid.trigger("reloadGrid");
                        } else {
                            alert(ret.message);
                        }
                    }
                });
            }
        }else{
            //跟进结束
            if (confirm("确认要将状态改为跟进中吗？")) {
                $.ajax({
                    dataType: "json",
                    url: "${contextPath}/sbdx/lawyer/saveSbdxLawyerFollow",
                    type: "post",
                    data: {
                        id: id,
                        state: 0,
                        type: type
                    },
                    complete: function (ret) {
                        var ret = eval("(" + ret.responseText + ")");
                        if (ret.success) {
                            alert("操作成功");
                            $("#modal-table").modal("toggle");
                            myGrid.trigger("reloadGrid");
                        } else {
                            alert(ret.message);
                        }
                    }
                });
            }
        }
    }
    //添加反馈跟进记录
    function saveFeedbackRecord(){
        var feedbackId = $("#feedbackId").val();
        var recordText = $("#recordText2").val();
        if(!recordText){
            alert("请输入跟进详情");
            return;
        }
        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/saveSbdxLawyerFollow",
            type: "post",
            data: {
                fkId: feedbackId,
                recording: recordText,
                type: 1
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert("添加成功");
                    $("#recordText2").val("");
                    $("#feedbackId").val("");
                    $("#modal-table-addFeedbackRecord").modal("toggle");
                    $("#modal-table").modal("toggle");
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });
    }

    //添加询价跟进记录
    function saveInquiryRecord(){
        var inquiryId = $("#inquiryId").val();
        var recordText = $("#recordText").val();
        if(!recordText){
            alert("请输入跟进详情");
            return;
        }
        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/saveSbdxLawyerFollow",
            type: "post",
            data: {
                fkId: inquiryId,
                recording: recordText,
                type: 0
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert("添加成功");
                    $("#recordText").val("");
                    $("#inquiryId").val("");
                    $("#modal-table-addInquiryRecord").modal("toggle");
                    $("#modal-table").modal("toggle");
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });
    }

    //查看跟进记录
    function getFollow(id,type){
        var html = '';
        $("#modal-table-bodyShow").html("");

        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/getSbdxLawyerFollow",
            type: "post",
            data: {
                fkId: id,
                type: type
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                $("#modal-table-getInquiryRecord").modal("toggle");
                for(var r = 0;r < ret.length; r++){
                    html += '<div class="row"><div class="form-group col-sm-6">'+ret[r].createDate+'&nbsp;'+ret[r].recording+'</div></div>';
                }
                $("#modal-table-bodyShow").html(html);
            }
        });
    }

    //显示添加跟进记录页面
    function showFollow (id,type){
        if(type == 0){
            //添加询价跟进记录
            $("#modal-table-addInquiryRecord").modal("toggle");
            $("#inquiryId").val(id);
        }else{
            //添加反馈跟进记录
            $("#modal-table-addFeedbackRecord").modal("toggle");
            $("#feedbackId").val(id);
        }
    }

    function CloseDiv() {
        $("#MyDiv").modal("toggle");
    }

    //添加反馈
    function addFeedback(){
        //业务类型
        var type =$("#type").val();
        //律师反馈
        var feedback = $("#feedback").val();
        if(!feedback){
            alert("请输入律师反馈");
            return;
        }
        var sbdxLawyerId = $("#sbdxLawyerId").val();
        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/saveSbdxLawyerFeedback",
            type: "post",
            data: {
                sbdxLawyerId: sbdxLawyerId,
                type: type,
                description: feedback
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert("添加成功");
                    $("#type").val("");
                    $("#feedback").val("");
                    $("#modal-table-addFeedback").modal("toggle");
                    $("#modal-table").modal("toggle");
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });


    }

    //添加询价
    function addInquiry(){
        //法院
        var court = $("#mod-add-saveInquiryCourt").val();
        //保全金额
        var price = $("#price").val();
        if(!court){
            alert("法院不能为空");
            return;
        }
        if(!price){
            alert("保全金额不能为空");
            return;
        }
        var sbdxLawyerId = $("#sbdxLawyerId").val();

        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/saveSbdxLawyerInquiry",
            type: "post",
            data: {
                sbdxLawyerId: sbdxLawyerId,
                price: price,
                court: court
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    alert("添加成功");
                    $("#mod-add-saveInquiryCourt").val("");
                    $("#price").val("");
                    $("#modal-table-addInquiry").modal("toggle");
                    $("#modal-table").modal("toggle");
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });


    }

    //显示添加询价页面
    function saveInquiry(){
        $("#modal-table-addInquiry").modal("toggle");
    }

    //显示添加反馈页面
    function saveFeedbcak() {
        $("#modal-table-addFeedback").modal("toggle");
    }

    function updateSbdxLawyer(lawyerId){
        //注册状态
        var registeredState = $("#selector").val();
        //互动状态
        var interactiveState = $("#selectinteractiveState").val();

        $.ajax({
            dataType: "json",
            url: "${contextPath}/sbdx/lawyer/updateSbdxLawyer",
            type: "post",
            data: {
                lawyerId: lawyerId,
                registeredState: registeredState,
                interactiveState: interactiveState
            },
            complete: function (ret) {
                var ret = eval("(" + ret.responseText + ")");
                if (ret.success) {
                    $("#modal-table").modal("toggle");
                    myGrid.trigger("reloadGrid");
                } else {
                    alert(ret.message);
                }
            }
        });
    }

    function notNull(str){
        if(str){
            return str;
        }else{
            return "未录入"
        }
    }

    function add() {
        $("#AddForm")[0].reset();
        $("#mod-add-tip").html('');
        $("#mod-add").modal("toggle");
    }


    function isNotNaturalNumber(obj) {
        var reg = /^[0-9]+$/;
        return !reg.test(obj);
    }

    function isNotNumber(obj) {
        var reg = /^(\-|\+)?\d+(\.\d+)?$/;
        return !reg.test(obj);
    }


    //自动补全客户经理手机号;
    $(document).ready(function($) {
        $.fn.typeahead.Constructor.prototype.blur = function() {
            var that = this;
            /*console.log(that);*/
            setTimeout(function () { that.hide() }, 250);
            /*alert("hahah")*/
        };

        $("#mod-add-userPhone").typeahead({
            source: function (query, process) {
                return $.ajax({
                    url: '${contextPath}/sys/ssdbOrder/getSbdxUser',
                    type: 'post',
                    data: {keyword: query},
                    success: function (result) {
                        var ret = eval("(" + result + ")");
                        var arr1 = new Array();
                        for (var i = 0;i<ret.length;i++){
                            var obj = new Object();
                            obj.name =  ret[i].username;
                            obj.phone = ret[i].userPhone;
                            arr1.push("{\"name\" :\""+obj.name+"\",\"phone\":\""+obj.phone+"\"}");
                        }
                        //var jsonObj =  JSON.parse(arr);
                        //console.log(arr1);
                        process(arr1);
                    }
                });
            },
            highlighter: function (obj) {
                var item = JSON.parse(obj);
                console.log(item);
                var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
                return (item.name+""+item.phone).replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
                    return '<strong>' + match + '</strong>'
                });
            },
            updater: function (obj) {
                var item = JSON.parse(obj);
                return item.phone;
            }

        });
    });

    //自动补全法院;
    $(document).ready(function($) {
        $.fn.typeahead.Constructor.prototype.blur = function() {
            var that = this;
            setTimeout(function () { that.hide() }, 250);
        };

        $('#mod-add-saveInquiryCourt').typeahead({
            source: function(query, process) {
                var parameter = {keyword : query};
                $.post('${contextPath}/sys/ssdbOrder/getCourtName', parameter, function (data) {
                    var ret = eval("(" + data + ")");
                    console.log(ret);
                    /*alert(ret);*/
                    process(ret);

                });
            }
        });
    });

    //自动补全律师手机号;
    $(document).ready(function($) {
        $.fn.typeahead.Constructor.prototype.blur = function() {
            var that = this;
            /*console.log(that);*/
            setTimeout(function () { that.hide() }, 250);
            /*alert("hahah")*/
        };

        $("#mod-add-lawyerTel").typeahead({
            source: function (query, process) {
                return $.ajax({
                    url: '${contextPath}/sys/ssdbOrder/getlawyerTel',
                    type: 'post',
                    data: {keyword: query},
                    success: function (result) {
                        var ret = eval("(" + result + ")");
                        var arr1 = new Array();
                        for (var i = 0;i<ret.length;i++){
                            var obj = new Object();
                            obj.name =  ret[i].realName;
                            obj.phone = ret[i].mobile;
                            arr1.push("{\"name\" :\""+obj.name+"\",\"phone\":\""+obj.phone+"\"}");
                        }
                        //var jsonObj =  JSON.parse(arr);
                        //console.log(arr1);
                        process(arr1);
                    }
                });
            },
            highlighter: function (obj) {
                var item = JSON.parse(obj);
                console.log(item);
                var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
                return (item.name+""+item.phone).replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
                    return '<strong>' + match + '</strong>'
                });
            },
            updater: function (obj) {
                var item = JSON.parse(obj);
                return item.phone;
            }

        });


        $("#mod-add-saveInquiryLawyerPhone").typeahead({
            source: function (query, process) {
                return $.ajax({
                    url: '${contextPath}/sys/ssdbOrder/getlawyerTel',
                    type: 'post',
                    data: {keyword: query},
                    success: function (result) {
                        var ret = eval("(" + result + ")");
                        var arr1 = new Array();
                        for (var i = 0;i<ret.length;i++){
                            var obj = new Object();
                            obj.name =  ret[i].realName;
                            obj.phone = ret[i].mobile;
                            arr1.push("{\"name\" :\""+obj.name+"\",\"phone\":\""+obj.phone+"\"}");
                        }
                        //var jsonObj =  JSON.parse(arr);
                        //console.log(arr1);
                        process(arr1);
                    }
                });
            },
            highlighter: function (obj) {
                var item = JSON.parse(obj);
                console.log(item);
                var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
                return (item.name+""+item.phone).replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
                    return '<strong>' + match + '</strong>'
                });
            },
            updater: function (obj) {
                var item = JSON.parse(obj);
                return item.phone;
            }

        });


    });

    var scripts = [null, "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js", "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js", null]
    $('.page-content-area').ace_ajax('loadScripts', scripts, function () {

        $("#up1").on("change","input[type='file']",function(){
            var filePath=$(this).val();
            //alert(filePath);
            if(filePath.indexOf("xlsx")!==-1){
                $(".fileerrorTip").html("").hide();
                var arr=filePath.split('\\');
                var fileName=arr[arr.length-1];
                $(".showFileName").html(fileName);
            }else{
                $(".showFileName").html("");
                $(".fileerrorTip").html("上传有误！请上传后缀名为xlsx的文件").show();
                return false
            }
        });

        $("#mod-add-submit").on("click", function (e) {
            //律师手机号
            var lawyerPhone = $("#mod-add-lawyerTel").val();
            //客户经理手机号
            var userPhone = $("#mod-add-userPhone").val();
            if(!lawyerPhone){
                alert("请输入律师手机号!");
                return;
            }
            if(!userPhone){
                alert("请输入客户经理手机号");
                return;
            }
            //互动状态
            var interactiveState = $("#mod-add-interactiveState").val();
            //注册状态
            var registeredState = $("#mod-add-registeredState").val();
            $.ajax({
                dataType: "json",
                url: "${contextPath}/sbdx/lawyer/saveSbdxLawyer",
                type: "post",
                data: {
                    lawyerPhone: lawyerPhone,
                    userPhone: userPhone,
                    interactiveState: interactiveState,
                    registeredState: registeredState
                },
                complete: function (ret) {
                    var ret = eval("(" + ret.responseText + ")");
                    if (ret.success) {
                        $("#mod-add").modal("toggle");
                        myGrid.trigger("reloadGrid");
                    } else {
                        alert(ret.message);
                    }
                }
            });

        });



        // inline scripts related to this page
        jQuery(function ($) {
            var grid_selector = "#grid-table";
            var pager_selector = "#grid-pager";

            // resize to fit page size
            $(window).on('resize.jqGrid', function () {
                $(grid_selector).jqGrid('setGridWidth', $(".page-content").width());
            })
            // resize on sidebar collapse/expand
            var parent_column = $(grid_selector).closest('[class*="col-"]');
            $(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
                if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
                    // setTimeout is for webkit only to give time for DOM changes and then redraw!!!
                    setTimeout(function () {
                        $(grid_selector).jqGrid('setGridWidth', parent_column.width());
                    }, 0);
                }
            });

            myGrid = jQuery(grid_selector).jqGrid({
                subGrid: false,
                url: "${contextPath}/sbdx/lawyer/getSbdxLawyer",
                datatype: "json",
                height: '99%',
                colModel: [
                    {
                        name: 'realName',
                        label: '律师姓名',
                        width: 100
                    },{
                        name: 'lawyerPhone',
                        label: '手机号',
                        width: 150
                    },{
                        name: 'province',
                        label: '省',
                        width: 70
                    },
                    {
                        name: 'city',
                        label: '市',
                        width: 70
                    }, {
                        name: 'registeredValue',
                        label: '注册状态',
                        width: 100
                    }, {
                        name: 'weChatOperator',
                        label: '客户经理微信号昵称',
                        width: 100
                    }, {
                        name: 'weChatNum',
                        label: '客户经理微信号',
                        width: 100
                    }, {
                        name: 'interactiveValue',
                        label: '互动状态',
                        width: 100
                    },{
                        name: 'orderCount',
                        label: '诉保提交单数',
                        width: 100
                    },{
                        name: 'inquiryFollowState',
                        label: '诉保询价跟进状态',
                        width: 100
                    },{
                        name: 'feebackFollowState',
                        label: '律师反馈跟进状态',
                        width: 100
                    },{
                        name: 'id',
                        index: '',
                        label: '操作',
                        width: 100,
                        editable: false,
                        search: false,
                        sortable: false,
                        formatter: optionFormatter
                    }],
                //scroll : 1, // set the scroll property to 1 to enable paging with scrollbar - virtual loading of records
                sortname: "name",
                sortorder: "asc",
                viewrecords: true,
                rowNum: 10,
                rowList: [10, 20, 30],
                pager: pager_selector,
                altRows: true,
                //toppager : true,
                //multiselect : true,
                //multikey : "ctrlKey",
                //multiboxonly : true,
                loadComplete: function () {
                    var table = this;
                    setTimeout(function () {
                        //styleCheckbox(table);
                        //updateActionIcons(table);
                        updatePagerIcons(table);
                        enableTooltips(table);
                    }, 0);
                },
                //editurl : "${contextPath}/sys/ssdbCompany/saveCompany",
                //caption : "用户管理列表",
                //autowidth : true,

            });

            function optionFormatter(cellvalue, options, cell) {
                var template = "";
                template += "&nbsp;<button data-toggle='modal'  onclick='showdetail(\""+cell.id+"\")' class='btn btn-minier btn-info'><i class='ace-icon fa fa-pencil-square-o'></i>查看律师详情</button>";
                return template;
            }
            function checkHours(cellvalue, options, rowObject) {
                var checkDays =  rowObject.checkDays;
                var checkHours =  rowObject.checkHours;
                if(checkDays == 0){
                    return checkHours + "个工作时";
                }else{
                    return checkDays + "个工作日";
                }
            }
            function sendHours (cellvalue, options, rowObject) {
                var sendDays =  rowObject.sendDays;
                var sendHours =  rowObject.sendHours;
                if(sendDays == 0){
                    return sendHours + "个工作时";
                }else{
                    return sendDays + "个工作日";
                }
            }
            function defaultState(cellvalue, options, rowObject) {
                switch (cellvalue) {
                    case 0:
                        return "未认证";
                    case 1:
                        return "<font color='red'>" + "申请中" + "</font>";
                        break;
                    case 2:
                        return "认证失败";
                        break;
                    case 3:
                        return "认证成功";
                        break;
                    default:
                        return "错误";
                        break;
                }
            }

            function defaultCommision(cellvalue, options, rowObject) {
                return parseInt(cellvalue * 100) + "%";
            }

            function defaultCommisionLawyer(cellvalue, options, rowObject) {
                return parseInt(cellvalue * 100) + "%";
            }

            $("#searchd").click(function () {
                var keyword = encodeURI(encodeURI($("#keyword").val()));
                var interactiveState = $("#interactiveState").val();
                var provinceId = $("#provinceId").val();
                var cityId = $("#cityId").val();
                myGrid.setGridParam({
                    postData: {'realName': keyword, 'provinceId':provinceId,'cityId':cityId,'interactiveState':interactiveState},
                    url: '${contextPath}/sbdx/lawyer/getSbdxLawyer',
                    page: 1
                }).trigger('reloadGrid');
            });

            $(window).triggerHandler('resize.jqGrid');// trigger window resize to make the grid get the correct size

            jQuery(grid_selector).jqGrid('navGrid', pager_selector, {
                edit: false,
                editicon: 'ace-icon fa fa-pencil blue',
                add: false,
                addicon: 'ace-icon fa fa-plus-circle purple',
                del: false,
                delicon: 'ace-icon fa fa-trash-o red',
                search: false,
                searchicon: 'ace-icon fa fa-search orange',
                refresh: false,
                refreshicon: 'ace-icon fa fa-refresh blue',
                view: false,
            });

            // replace icons with FontAwesome icons like above
            function updatePagerIcons(table) {
                var replacement = {
                    'ui-icon-seek-first': 'ace-icon fa fa-angle-double-left bigger-140',
                    'ui-icon-seek-prev': 'ace-icon fa fa-angle-left bigger-140',
                    'ui-icon-seek-next': 'ace-icon fa fa-angle-right bigger-140',
                    'ui-icon-seek-end': 'ace-icon fa fa-angle-double-right bigger-140'
                };
                $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () {
                    var icon = $(this);
                    var $class = $.trim(icon.attr('class').replace('ui-icon', ''));

                    if ($class in replacement)
                        icon.attr('class', 'ui-icon ' + replacement[$class]);
                });
            }

            function enableTooltips(table) {
                $('.navtable .ui-pg-button').tooltip({
                    container: 'body'
                });
                $(table).find('.ui-pg-div').tooltip({
                    container: 'body'
                });
            }

            // var selr = jQuery(grid_selector).jqGrid('getGridParam','selrow');

            $(document).one('ajaxloadstart.page', function (e) {
                $(grid_selector).jqGrid('GridUnload');
                $('.ui-jqdialog').remove();
            });

            $("#mod-cr-addButton").on("click", function (e) {
                document.getElementById('mod-add1-form').reset();
                $('#mod-add1').modal('toggle');
            });

            $("#mod-ncr-addButton").on("click", function (e) {
                document.getElementById('mod-add2-form').reset();
                $('#mod-add2').modal('toggle');
            });

            $("#mod-add1-submit").on("click", function (e) {
                submitRateInterval();
            });

            $("#mod-add2-submit").on("click", function (e) {
                addSpecialRateInterval();
            });

            $("#modal-customRate-submit").on("click", function (e) {
                submitCustomRate();
            });

            $('#mod-cr-pcSel').change(function () {
                var v = $(this).children('option:selected').val();
                $('#mod-cr-pcInputHid').val(v);
            });
        });
    });






</script>
