<rt-form id="{{vm.form.name}}" name="{{vm.form.name}}" novalidate>
    <div class="row rt-margin-bottom-before-box">
        <div class="col-sm-2">
            <button class="btn btn-link" type="button" id="btnClose" ng-click="vm.form.hide()">
                        <i class="fa fa-sign-out"></i> 关闭
                    </button>
        </div>
        <div class="col-sm-10">
            <div class="pull-right" ng-if="vm.form.isFlowApprover">
                <rt-button id="btnApprove" rt-style="link" rt-title="同意" rt-icon="floppy-o" ng-click="vm.form.flowApprove()">
                </rt-button>
                <rt-button id="btnReject" rt-style="link" rt-title="拒绝" rt-icon="floppy-o" ng-click="vm.form.flowReject()">
                </rt-button>
                <rt-button id="btnTransmit" rt-style="link" rt-title="转发" rt-icon="floppy-o" ng-click="vm.form.flowTransmit()">
                </rt-button>
            </div>

            <div class="pull-right" ng-if="vm.form.isFlowSubmitter">
                <rt-button id="btnRecall" rt-style="link" rt-title="撤销" rt-icon="floppy-o" ng-click="vm.form.flowRecall()">
                </rt-button>
            </div>

            <div class="pull-right" ng-if="vm.form.data.approval_result=='5'">
                <rt-button id="btnResubmit" rt-style="link" rt-title="重新提交" rt-icon="floppy-o" ng-click="vm.form.reSubmit()">
                </rt-button>
            </div>
        </div>
    </div>
    <div class="nav-tabs-custom">
        <div class="tab-content">
            <div>
                <p>
                    <span class="rt-text-important-02">{{vm.form.data.contactId.Name==null?vm.form.data.contact_info.name:vm.form.data.contactId.Name}}-{{vm.form.data.contact_info.accountid.Name}}</span>
                    <span class="rt-text-weak-02 rt-text-box-right-01" ng-style="{color:(vm.form.data.approval_result==='1'||vm.form.data.approval_result==='4')?'#0099ff':((vm.form.data.approval_result==='2')?'#33bc98':'red')}">{{vm.form.data.approval_resultName}}</span>
                </p>
                <p>
                    <span class="rt-text-weak-02">单号：{{vm.form.data.code}}</span>
                </p>
                <p>
                    <span class="rt-text-weak-02">申请类型：{{vm.form.data.app_type.Name}}</span>
                </p>
            </div>
        </div>
    </div>

    <!-- 新增联系人-->
    <ul class="nav nav-tabs" ng-if="vm.form.data.app_type.Value==='10'">
        <li class="active">
            <a ng-click="chooseTab(1)" data-toggle="tab">基本信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(3)" data-toggle="tab">权限信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(4)" data-toggle="tab">审批流程</a>
        </li>
    </ul>

    <!-- 变更联系人信息-->
    <ul class="nav nav-tabs" ng-if="vm.form.data.app_type.Value==='20'">
        <li class="active">
            <a ng-click="chooseTab(2)" data-toggle="tab">差异信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(1)" data-toggle="tab">基本信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(5)" data-toggle="tab">医生分级</a>
        </li>
        <li>
            <a ng-click="chooseTab(4)" data-toggle="tab">审批流程</a>
        </li>
    </ul>

    <!-- 申请权限-->
    <ul class="nav nav-tabs" ng-if="vm.form.data.app_type.Value==='30'">
        <li class="active">
            <a ng-click="chooseTab(3)" data-toggle="tab">权限信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(4)" data-toggle="tab">审批流程</a>
        </li>
    </ul>

    <!-- 基本信息 -->
    <div class="nav-tabs-custom" ng-if="vm.tabIndex==1" style="margin-bottom:45px;">
        <div class="viewlist">
            <table class="table table-hover">
                <tbody>
                    <tr>
                        <td>医生名称</td>
                        <td>
                            {{vm.form.data.contact_info.name}}
                        </td>
                    </tr>
                    <tr>
                        <td>科室名称</td>
                        <td>
                            {{vm.form.data.contact_info.departmentid.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>移动电话</td>
                        <td>
                            {{vm.form.data.contact_info.mobiletelephone}}
                        </td>
                    </tr>
                    <tr>
                        <td>座机</td>
                        <td>
                            {{vm.form.data.contact_info.telephone}}
                        </td>
                    </tr>
                    <tr>
                        <td>传真</td>
                        <td>
                            {{vm.form.data.contact_info.fax}}
                        </td>
                    </tr>
                    <tr>
                        <td>邮件</td>
                        <td>
                            {{vm.form.data.contact_info.mailaddress}}
                        </td>
                    </tr>
                    <tr>
                        <td>QQ号</td>
                        <td>
                            {{vm.form.data.contact_info.qq}}
                        </td>
                    </tr>
                    <tr>
                        <td>微信号</td>
                        <td>
                            {{vm.form.data.contact_info.wechat}}
                        </td>
                    </tr>
                    <tr>
                        <td>家庭电话</td>
                        <td>
                            {{vm.form.data.contact_info.familytel}}
                        </td>
                    </tr>
                    <tr>
                        <td>家庭地址</td>
                        <td>
                            {{vm.form.data.contact_info.address}}
                        </td>
                    </tr>
                    <tr>
                        <td>性别</td>
                        <td>
                            {{vm.form.data.contact_info.gendercode.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>生日</td>
                        <td>
                            {{vm.form.data.contact_info.birthdate|date:'yyyy-MM-dd'}}
                        </td>
                    </tr>
                    <tr>
                        <td>毕业学校</td>
                        <td>
                            {{vm.form.data.contact_info.college}}
                        </td>
                    </tr>
                    <tr>
                        <td>最高学历</td>
                        <td>
                            {{vm.form.data.contact_info.bachelor.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>是否为KOL</td>
                        <td>
                            {{vm.form.data.contact_info.isKOL?'是':'否'}}
                        </td>
                    </tr>
                    <tr>
                        <td>是否为药事委员会成员</td>
                        <td>
                            {{vm.form.data.contact_info.isPAC?'是':'否'}}
                        </td>
                    </tr>
                    <tr>
                        <td>其他社会职务</td>
                        <td>
                            {{vm.form.data.contact_info.socialfunction}}
                        </td>
                    </tr>
                    <tr>
                        <td>处方潜力</td>
                        <td>
                            {{vm.form.data.contact_info.rx_potential.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>处方态度</td>
                        <td>
                            {{vm.form.data.contact_info.rx_attitude.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>婚姻状况</td>
                        <td>
                            {{vm.form.data.contact_info.familystatuscode.Name}}
                        </td>
                    </tr>
                    <tr>
                        <td>家庭成员情况</td>
                        <td>
                            {{vm.form.data.contact_info.spousename}}
                        </td>
                    </tr>
                    <tr>
                        <td>身份证号码</td>
                        <td>
                            {{vm.form.data.contact_info.idcard}}
                        </td>
                    </tr>
                    <tr>
                        <td>是否科室实际负责人</td>
                        <td>
                            {{vm.form.data.contact_info.is_department_manager?'是':'否'}}
                        </td>
                    </tr>
                    <tr>
                        <td>是否为讲者</td>
                        <td>
                            {{vm.form.data.contact_info.is_speaker?'是':'否' }}
                        </td>
                    </tr>
                    <tr>
                        <td>讲者级别</td>
                        <td>
                            {{vm.form.data.contact_info.speaker_level}}
                        </td>
                    </tr>
                    <tr>
                        <td>专业方向</td>
                        <td>
                            {{vm.form.data.contact_info.professional}}
                        </td>
                    </tr>
                    <tr>
                        <td>工作经历</td>
                        <td>
                            {{vm.form.data.contact_info.work_experience}}
                        </td>
                    </tr>
                    <tr>
                        <td>进修经历</td>
                        <td>
                            {{vm.form.data.contact_info.training_experience}}
                        </td>
                    </tr>
                    <tr>
                        <td>个人荣誉</td>
                        <td>
                            {{vm.form.data.contact_info.honour}}
                        </td>
                    </tr>
                    <tr>
                        <td>对产品的看法</td>
                        <td>
                            {{vm.form.data.contact_info.personal_product_desc}}
                        </td>
                    </tr>
                    <tr>
                        <td>主要专著和文献</td>
                        <td>
                            {{vm.form.data.contact_info.books}}
                        </td>
                    </tr>
                    <tr>
                        <td>业务专长及个人爱好</td>
                        <td>
                            {{vm.form.data.contact_info.personnalmark}}
                        </td>
                    </tr>
                    <tr>
                        <td>标签</td>
                        <td style="white-space:normal">
                            {{vm.form.data.contact_info.contact_tag|toTagString}}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <!-- 差异信息-->
    <div class="nav-tabs-custom" ng-if="vm.tabIndex==2" style="margin-bottom:45px;">
        <div class="viewlist">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>字段名</th>
                        <th>变更前</th>
                        <th>变更后</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.form.data.contact_info_diff">
                        <td>
                            {{row.diffParam.Name}}
                        </td>
                        <td ng-if="row.diffParam.Value!='contact_tag'">
                            {{row.oldValue}}
                        </td>
                        <td ng-if="row.diffParam.Value!='contact_tag'">
                            {{row.newValue}}
                        </td>
                        <td ng-if="row.diffParam.Value=='contact_tag'" style="white-space:normal">
                            {{row.oldValue|toTagString}}
                        </td>
                        <td ng-if="row.diffParam.Value=='contact_tag'" style="white-space:normal">
                            {{row.newValue|toTagString}}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <!-- 权限信息-->
    <div class="nav-tabs-custom" ng-if="vm.tabIndex==3" style="margin-bottom:45px;">
        <div class="viewlist">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>小区</th>
                        <th>代表</th>
                        <th>部门</th>
                        <th>品种</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.form.data.account_region_diff">
                        <td>
                            {{row.sales_regionidname}}
                        </td>
                        <td>
                            {{row.owneridname}}
                        </td>
                        <td>
                            {{row.buidname}}{{row.bigdepartidname}}{{row.businessunitidname}}
                        </td>
                        <td>
                            {{row.product_categoryidname}}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <!-- 审批流程-->
    <div class="tab-content" ng-if="vm.tabIndex==4">
        <section id="cd-timeline" class="cd-container">
            <div ng-if="vm.form.approverList.length > 0">
                <div class="cd-timeline-block rt-flow-item">
                    <div class="cd-timeline-icon text-center" style="color:white;" ng-style="{{vm.form.getAvatarColor(3)}};">
                        {{vm.form.getAvatarName2(vm.form.approverList[0].SubmittedBy.Name)}}
                    </div>
                    <div class="cd-timeline-content" style="padding:10px;">
                        <p class="username-01">
                            {{vm.form.approverList[0].SubmittedBy.Name}}
                        </p>
                        <p class="status-02">
                            发起申请
                        </p>
                        <p class="datetime">
                            {{vm.form.approverList[0].CreatedOn | date:'yyyy-MM-dd HH:mm'}}
                        </p>
                    </div>
                </div>
            </div>
            <div ng-repeat="user in vm.form.approverList">
                <div class="cd-timeline-block rt-flow-item">
                    <div class="cd-timeline-icon text-center" style="color:white;" ng-style="{{vm.form.getAvatarColor($index)}};">
                        {{vm.form.getAvatarName2(user.OwnerId.Name)}}
                    </div>
                    <div class="cd-timeline-content" style="padding:10px;">
                        <p class="username-01" ng-show="user.approval_status.Value != 1">
                            {{user.OwnerId.Name}}
                        </p>
                        <p class="username-02" ng-show="user.approval_status.Value == 1">
                            {{user.OwnerId.Name}}
                        </p>
                        <p class="status-01" ng-show="user.approval_status.Value == 2">
                            审批中
                        </p>
                        <p class="status-02" ng-show="user.approval_status.Value == 3 && user.approval_result.Value == 2">
                            {{user.approval_result.Name}}{{user.remark!=null && user.remark!=''?"(":""}}{{user.remark}}{{user.remark!=null && user.remark!=''?")":""}}
                        </p>

                        <p class="status-03" ng-show="user.approval_status.Value == 3 && user.approval_result.Value == 3">
                            {{user.approval_result.Name}}{{user.remark!=null && user.remark!=''?"(":""}}{{user.remark}}{{user.remark!=null && user.remark!=''?")":""}}
                        </p>

                        <p class="status-02" ng-show="user.approval_status.Value == 3 && user.approval_result.Value == 4">
                            {{user.approval_result.Name}}{{user.remark!=null && user.remark!=''?"(":""}}{{user.remark}}{{user.remark!=null && user.remark!=''?")":""}}
                        </p>

                        <p class="datetime" ng-show="user.approval_result.Value == 4">
                            {{user.ModifiedOn | date:'yyyy-MM-dd HH:mm'}}
                        </p>

                        <p class="status-03" ng-show="user.approval_status.Value == 3 && user.approval_result.Value == 5">
                            {{user.approval_result.Name}}{{user.remark!=null && user.remark!=''?"(":""}}{{user.remark}}{{user.remark!=null && user.remark!=''?")":""}}
                        </p>

                        <p class="datetime" ng-show="user.approval_status.Value == 3">
                            {{user.ApprovedOn | date:'yyyy-MM-dd HH:mm'}}
                        </p>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- 医生分级-->
    <div class="nav-tabs-custom" ng-if="vm.tabIndex==5" style="margin-bottom:45px;">
        <div class="viewlist">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>等级</th>
                        <th>品类</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.form.data.contact_info.contactGradeList track by $index">
                        <td>
                            {{$index + 1}}
                        </td>
                        <td>
                            {{row.contact_level.Name}}
                        </td>
                        <td>
                            {{row.product_category.Name}}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</rt-form>