<style>
    .contact-grade-table {
        border: 1px solid #f0f0f0;
        color: #555;
        vertical-align: middle;
        width: 100%;
        padding: 5px;
    }
</style>

<rt-form id="{{vm.form.name}}" name="{{vm.form.name}}" style="margin-bottom: 45px;" 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}}-{{vm.form.data.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>
            </div>
        </div>
    </div>

    <ul class="nav nav-tabs">
        <li class="active">
            <a ng-click="chooseTab(1)" data-toggle="tab">评级信息</a>
        </li>
        <li>
            <a ng-click="chooseTab(2)" data-toggle="tab">审批流程</a>
        </li>
    </ul>

    <div style="background-color: white; margin-bottom: 20px;padding:15px;" ng-if="vm.tabIndex==1" ng-repeat="product_category in vm.form.data.detailList.productList track by $index">
        <div>
            <p>
                <span class="rt-text-important-02">品种：{{product_category.product_categoryidName}}</span>
                <span class="rt-text-important-01 rt-text-box-right-01">分级评估结果：{{product_category.contact_levelName}}</span>
            </p>
            <p ng-repeat="eval in vm.form.data.detailList.evalScoreList | filter:{eval_type:'1',product_categoryid:product_category.product_categoryid} track by $index">
                <span class="rt-text-important-01">潜力：{{eval.eval_valueName}} / {{eval.eval_score}}分 </span>
            </p>

            <table style="width:100%;table-layout:fixed;">
                <tbody>
                    <tr ng-repeat="item in vm.form.data.detailList.itemScoreList | filter:{eval_type:'1',product_categoryid:product_category.product_categoryid} track by $index">
                        <td class="contact-grade-table" style="text-align: left"><span>{{item.contact_grade_eval_itemIdName}}</span></td>
                        <td class="contact-grade-table" style="text-align: left"><span>{{item.eval_option_selected_name?item.eval_option_selected_name:item.eval_item_value}}</span></td>
                        <td class="contact-grade-table" style="text-align: right"><span>{{item.eval_item_score}}分</span></td>
                    </tr>
                </tbody>
            </table>

            <p style="margin-top: 20px;" ng-repeat="eval in vm.form.data.detailList.evalScoreList | filter:{eval_type:'2',product_categoryid:product_category.product_categoryid} track by $index">
                <span class="rt-text-important-01">处方态度：{{eval.eval_valueName}} / {{eval.eval_score}}分 </span>
            </p>

            <table style="width:100%;table-layout:fixed;">
                <tbody>
                    <tr ng-repeat="item in vm.form.data.detailList.itemScoreList | filter:{eval_type:'2',product_categoryid:product_category.product_categoryid} track by $index">
                        <td class="contact-grade-table" style="text-align: left"><span>{{item.contact_grade_eval_itemIdName}}</span></td>
                        <td class="contact-grade-table" style="text-align: left"><span>{{item.eval_item_value?item.eval_item_value:item.eval_option_selected_name}}</span></td>
                        <td class="contact-grade-table" style="text-align: right"><span>{{item.eval_item_score}}分</span></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div class="tab-content" ng-if="vm.tabIndex==2">
        <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>
</rt-form>