<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
    </div>
    <div class="col-sm-4">
        <form class="input-group">
            <input type="search" placeholder="搜索..." class="form-control" ng-model="vm.view.searchText" />
            <span class="input-group-btn" ng-click="vm.view.search(1)">
                <button type="submit" class="btn btn-default">
                    <i class="fa fa-search"></i>
                </button>
            </span>
        </form>
    </div>
</div>

<div class="box box-primary">
    <div class="box-header with-border" style="cursor: move;">
        <div class="pull-left">
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuViewSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{vm.view.selectedView.ViewName}}
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuViewSelect">
                    <li ng-repeat="view in vm.view.list track by view.Id" ng-click="vm.view.select(view)">
                        <a href="javascript:void(0)">{{view.ViewName}}</a>
                    </li>
                </ul>
            </div>

            <button class="btn btn-default" ng-class="{true:'active',false:'inactive'}[vm.view.isShowSearchList]" ng-click="vm.view.isShowSearchList = !vm.view.isShowSearchList;overHeightTable();">
                <i class="fa fa-filter"></i> 更多筛选
                <i class="fa fa-angle-double-down"></i>
            </button>
        </div>
    </div>
    <div ng-show="vm.view.isShowSearchList" class="box box-widget">
        <!-- form start -->
        <form class="form-horizontal">
            <div class="box-body">
                <div class="form-group" style="padding-left: 20px; margin-bottom: 0px;">
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="" ng-checked="true">所有申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="business_trip">出差申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="absence">请假申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="expense">报销申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="common_application">通用申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="sales_order">订单申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="account_app">机构变更申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="contact_app">医生变更申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="leads">潜在代理商申请</label>
                    </div>
                    <div class="col-sm-1" style="padding-top: 5px;">
                        <input type="radio" name="object_type_name" value="contact_grade_app">医生评级申请</label>
                    </div>
                    <div class="btn-group" class="col-sm-2">
                        <button class="btn btn-primary" ng-click="vm.actions.filterFlowAppropval()">查询</button>
                    </div>
                </div>
            </div>
            <!-- /.box-body -->
        </form>
    </div>
    <div class="nav-tabs-custom">
        <div class="tab-content">
            <rt-data-grid rt-page-record-count="vm.page.recordCount" rt-page-index="vm.page.index" rt-page-size="vm.page.size" rt-get-data="vm.view.search()"
                rt-sort-field="vm.view.sortField" rt-rows="vm.data" rt-selected-ids="vm.view.selectedIds" rt-auto-height="vm.view.autoHeight">
                <table class="table table-condensed table-hover">
                    <thead>
                        <tr>
                            <th>
                                <rt-header-checkbox></rt-header-checkbox>
                            </th>
                            <!-- @@ 视图表头 -->
                            <th rt-field-code="object_type_name">申请类型</th>
                            <th>单号</th>
                            <th ng-if="vm.view.selectedView.Id!='4131E7C2-5CBD-466C-A84B-CFB02590BE32'">提交人</th>
                            <th>提交时间</th>
                            <th>状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in vm.data track by row.Id">
                            <td>
                                <rt-data-checkbox value="{{row.Id}}" />
                            </td>

                            <!-- @@ 视图列表值 -->
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='absence'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit1({id:row.object_id})" ui-sref-opts="{location:true}">请假申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='common_application'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit2({id:row.object_id})" ui-sref-opts="{location:true}">通用申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='business_trip'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit3({id:row.object_id})" ui-sref-opts="{location:true}">出差申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='expense'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit4({id:row.object_id})" ui-sref-opts="{location:true}">报销申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='sales_order'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit5({id:row.object_id})" ui-sref-opts="{location:true}">订单申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='leads'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit6({id:row.object_id})" ui-sref-opts="{location:true}">潜在代理商申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='account_app'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit7({id:row.object_id})" ui-sref-opts="{location:true}">机构变更申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='contact_app'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit8({id:row.object_id})" ui-sref-opts="{location:true}">医生变更申请单</a>
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='sales_region_app'">
                                小区变更申请单
                            </td>
                            <td ng-if="vm.view.type=='default'&&row.object_type_name=='contact_grade_app'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit9({id:row.object_id})" ui-sref-opts="{location:true}">医生评级申请单</a>
                            </td>
                            <td>
                                {{row.object_name}}
                            </td>
                            <td ng-if="vm.view.selectedView.Id!='4131E7C2-5CBD-466C-A84B-CFB02590BE32'">
                                {{row.SubmittedBy.Name}}
                            </td>
                            <td>
                                {{row.CreatedOn| date:'yyyy-MM-dd HH:mm'}}
                            </td>

                            <td ng-if="vm.view.selectedView.Id=='7F122E8B-EA8B-493C-A880-4BB8C83AC055'">
                                等待审批
                            </td>
                            <td ng-if="vm.view.selectedView.Id=='169640B6-B6D7-441A-960D-AEB37E08FEFD'">
                                {{row.approval_result.Name}}
                            </td>
                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'&&row.approval_status.Value == 2">
                                等待{{row.ApprovingBy.Name}}审批
                            </td>
                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'" ng-show="row.approval_status.Value == 3 && row.approval_result.Value == 2">
                                {{row.ApprovedBy.Name}}{{row.approval_result.Name}}{{row.remark!=null && row.remark!=''?"(":""}}{{row.remark}}{{row.remark!=null
                                && row.remark!=''?")":""}}
                            </td>

                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'" ng-show="row.approval_status.Value == 3 && row.approval_result.Value == 3">
                                {{row.ApprovedBy.Name}}{{row.approval_result.Name}}{{row.remark!=null && row.remark!=''?"(":""}}{{row.remark}}{{row.remark!=null
                                && row.remark!=''?")":""}}
                            </td>

                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'" ng-show="row.approval_status.Value == 3 && row.approval_result.Value == 4">
                                {{row.ApprovedBy.Name}}{{row.approval_result.Name}}{{row.remark!=null && row.remark!=''?"(":""}}{{row.remark}}{{row.remark!=null
                                && row.remark!=''?")":""}}
                            </td>

                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'" ng-show="row.approval_status.Value == 3 && row.approval_result.Value == 5">
                                {{row.ApprovedBy.Name}}{{row.approval_result.Name}}{{row.remark!=null && row.remark!=''?"(":""}}{{row.remark}}{{row.remark!=null
                                && row.remark!=''?")":""}}
                            </td>

                            <td ng-if="vm.view.selectedView.Id=='4131E7C2-5CBD-466C-A84B-CFB02590BE32'" ng-show="row.approval_status.Value == 1 && row.approval_result.Value == 5">
                                已撤销{{row.remark!=null && row.remark!=''?"(":""}}{{row.remark}}{{row.remark!=null && row.remark!=''?")":""}}
                            </td>
                        </tr>
                    </tbody>
                </table>
            </rt-data-grid>
        </div>
    </div>
</div>

<div class="sidebar sidebar-right sidebar-animate rt-shadow-border-left content-wrapper" ng-if="vm.view.type=='default'">
    <div ui-view class="content"></div>
</div>