<!--<div class="content-wrapper" ng-if="gUser.emp_first_name === 'Admin'">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6 offset-sm-1 offset-md-2 offset-lg-3 mt-5">
                <div class="alert alert-danger alert-dismissible">
                    <h5><i class="icon fas fa-ban"></i> Alert!</h5>
                    Please login as Hero.
                </div>
            </div>
        </div>
    </div>
</div>-->
<div class="content-wrapper">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-primary">
                        <go-back/>
                        <i class="fas fa-tachometer-alt"></i> {{page.title}}
                    </h1>
                </div>
                <div class="col-sm-6">
                    
                </div>
            </div>
        </div>
    </section>
    <section class="container-fluid">
        <div class="card card-primary card-outline">
            <div class="card-body p-0">
                <div class="btn-group" ng-if="isSuperAdmin==='true'">
                    <button type="button" class="toggle-vis btn btn-{{ !colOptions.comment ? 'dark' : 'default'}}" data-column="11" ng-click="colOptions.comment = !colOptions.comment">Comment <i class="fas fa-{{colOptions.comment ? 'eye-slash' : 'eye'}}"></i></button>
                    <button type="button" class="toggle-vis btn btn-{{ !colOptions.other_comment ? 'dark' : 'default'}}" data-column="12" ng-click="colOptions.other_comment = !colOptions.other_comment">Other Comment <i class="fas fa-{{colOptions.other_comment ? 'eye-slash' : 'eye'}}"></i></button>
                    <button type="button" class="toggle-vis btn btn-{{ !colOptions.questions ? 'dark' : 'default'}}" data-column="11" ng-click="colOptions.questions = !colOptions.questions">Questions <i class="fas fa-{{colOptions.questions ? 'eye-slash' : 'eye'}}"></i></button>
                </div>
                <div class="card bg-light collapsed-card" ng-repeat="schedule in assessmentSchedules" ng-if="schedule.is_overall==true">
                    <div class="card-header p-0 pointer">
                        <div class="row">
                            <div class="bg-info col p-2 ml-2" style="padding: 4px 0px 7px 14px!important"> Assessment: <strong> {{schedule.ae_name}} </strong><span title="Project Manager" ng-if="opts.tab!=='mngr'"> </span></div>
                            <div class="bg-info col" style="margin-right: 7px;">
                                <button type="button" class="btn btn-dark btn-xs float-right" data-widget="collapse"><i class="fas fa-plus"></i></button>
                                
                                <button ng-if="isSuperAdmin=='true'" ng-click="sendMailToManagers(schedule,schedule.ae_id)" class="btn btn-danger btn-xs float-right">Sent mail to managers</button>
                                <button ng-if="isSuperAdmin=='true'" ng-click="sendMail(schedule,schedule.ae_id)" class="btn btn-warning btn-xs float-right">Sent mail to heroes</button>
                                
                            </div>
                        </div>
                    </div>
                    <div class="card-body pt-0 pb-0">
                        <div class="table table-responsive">
                            <table id="" class="table table-bordered table-striped table-sm assessmentDashboard">
                                <thead class="bg-primary">
                                    <tr>                                    
                                        <th><i class="fas fa-user"></i> Hero</th>
                                        <th><i class="fas fa-user"></i> EMP Code</th>
                                        <th><i class="fas fa-user"></i> Hero Reply</th>
                                        <th><i class="fas fa-user-secret"></i>{{ (!empInfoObj.is_assessment_manager) ?' Manager Reply':' Your Reply'}}</th>
                                        <th ng-if="empInfoObj.is_assessment_manager || gUser.is_admin" title="Manager name who submit form after hero submission">Manager</th>
                                        <th>One-to-One</th>
                                        <th>Hero Score</th>
                                        <th>Score</th>
                                        <th>O. Grade</th>
                                        <th>M. Grade</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.comment==false ? 'd-none' : '' }}">M. Comment</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.other_comment==false ? 'd-none' : '' }}">Other Comment</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">New / Additional roles and responsibilities</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">Please provide Overall Rating between (A+, A, B+, B, C) along with your comments</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">Recommendation for designation hike? NOTE - Your recommendation will be considered thoughtfully. However, promotion depends upon various factors like the candidate's eligibility, experience, tenure, overall performance, etc.</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">If yes, please provide your input on why the resource should be promoted to the next level?</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">What additional value resource will bring to the team?</th>
                                        <th ng-if="isSuperAdmin==='true'" class="{{colOptions.questions==false ? 'd-none' : '' }}">What responsibilities will be added to the resource KRA, if promoted?</th>
                                        <th style="width: 175px;"><i class="fas fa-cog"></i> Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-if="!schedule.heroes">
                                        <td colspan="9" class="text-center">No data available in table.</td>
                                    </tr>   
                                    <tr ng-repeat="d in schedule.heroes track by $index">                                    
                                        <td class="text-center"><!--ng-click="goToSelf('heroView',{employeeid:d.id})"-->
                                            <span class="text-blue pointer">{{d.emp_first_name + ' ' + d.emp_last_name}}</span>
                                        </td>
                                        <td class="text-center"><strong>{{d.emp_code}}</strong></td>
                                        <td class="text-center"><span class="text-wrap badge {{d.as_status ? (d.as_status === 'draft' ? 'badge-warning' : 'badge-success') : 'badge-danger'}}">
                                    {{(d.as_status ? (d.as_status) === 'draft' ? 'Saved as Draft' : 'Submited' : 'Not Submitted')}}</span></td>
                                        <td class="text-center"><span class="text-wrap badge {{d.as_manager_status ? (d.as_manager_status === 'draft' ? 'badge-warning' : 'badge-success') : 'badge-danger'}}">
                                    {{(d.as_manager_status ? (d.as_manager_status) === 'draft' ? 'Saved as Draft' : 'Replied' : 'Not Replied')}}</span></td>
                                        <td ng-if="empInfoObj.is_assessment_manager || gUser.is_admin">{{d.mngr_first_name + ' ' + d.mngr_last_name}}</td>
                                        <td class="text-center"><span class="text-wrap badge {{d.one2oneStatus=='yes'?'badge-success':'badge-danger'}}">{{d.one2oneStatus | capitalize}} </span></td>
                                        <td class="text-right"><strong>{{ (!isNaN(d.heroScore)) ? d.heroScore : '-' }}</strong></td>
                                        <td class="text-right"><strong>{{ (!isNaN(d.score)) ? d.score : '-' }}</strong></td>
                                        <td class="text-right"><strong>{{ d.grades[0].overall_grade }}</strong></td>
                                        <td class="text-right"><strong>{{ d.grades[0].mngr_grade }}</strong></td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.comment==false ? 'd-none' : '' }}">{{ d.grades[0].comment }}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.other_comment==false ? 'd-none' : '' }}">{{ d.grades[0].other_comment }}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.additionalRoles}}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.proRating}}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.recommend}}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.inpRes}}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.brnTeam}}</td>
                                        <td ng-if="isSuperAdmin==='true'" class="text-left {{colOptions.questions==false ? 'd-none' : '' }}">{{d.kra}}</td>
                                        <td class="text-center">
                                            <!-- <a href="/overallassessment/manager/reply/{{d.id}}/{{d.as_ae_id}}" ng-if="(d.as_status === 'active' && d.as_manager_status !=='active' && gUser.is_admin===true) || isSuperAdmin=='true' || (empInfoObj.is_assessment_manager && d.as_status === 'active')"
                                                class="btn btn-success btn-xs">
                                                <span>
                                                    <i class="fas {{isSuperAdmin=='true'?'fa-eye':'fa-reply'}}"></i> 
                                                    {{isSuperAdmin=='true'?"View":"Review Form"}}</span>
                                            </a> -->
                                            <a href="/overallassessment/manager/reply/{{d.id}}/{{d.as_ae_id}}" ng-if="d.as_status === 'active' && d.as_manager_status !=='active' && isSuperAdmin==='true'" class="btn btn-success btn-xs">
                                                <i class="fas fa-reply"></i> Review Form
                                            </a>
                                            <a href="/overallassessment/manager/reply/{{d.id}}/{{d.as_ae_id}}" ng-if="d.as_status === 'active' && d.as_manager_status !=='active' && isSuperAdmin!=='true'" class="btn btn-success btn-xs">
                                                <i class="fas fa-reply"></i> Review Form
                                            </a>
                                            <a href="/overallassessment/manager/reply/{{d.id}}/{{d.as_ae_id}}" ng-if="d.as_status === 'active' && d.as_manager_status =='active' && isSuperAdmin==='true'" class="btn btn-success btn-xs">
                                                <i class="fas fa-eye"></i> View
                                            </a>
                                            <a href="/overallassessment/manager/reply/{{d.id}}/{{d.as_ae_id}}" ng-if="d.as_status === 'active' && d.as_manager_status =='active' && isSuperAdmin!=='true'" class="btn btn-success btn-xs">
                                                <i class="fas fa-eye"></i> View
                                            </a>

                                            <button class="btn btn-warning btn-xs" ng-click="reviewButton(d.as_ae_id,d.id)" ng-if="(d.as_status === 'active' && isSuperAdmin==='true')"><i title="Reset reply for hero." class="fas fa-redo"></i> <strong>H</strong></button>
                                            <button class="btn btn-warning btn-xs" ng-click="reviewButtonForManager(d.as_ae_id,d.emp_lm,d.id)" ng-if="d.as_manager_status ==='active' && isSuperAdmin==='true'" ><i title="Reset reply for manager." class="fas fa-redo"></i> <strong>M</strong></button>
                                            <button class="btn btn-warning btn-xs" ng-click="overallCompleteAssessment(d.as_ae_id,d.id)" ng-if="d.as_manager_status ==='active' && isSuperAdmin==='true' && d.grades[0].is_complete==true" ><i title="Reset overall assessment for manager." class="fas fa-redo"></i> <strong>O</strong></button>

                                            <!--<button href="javascript:void(0);" ng-disabled="d.as_status === 'active' && d.as_manager_status =='active'" class="btn btn-info btn-xs">Send FORM to Skip Manager / HR</button>-->
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>

<!-- By Syed Mohd Bilal Rais -->
<!-- Assessment Mails -->
<script type="text/ng-template" id="modelAssessmentScheduleMails2.html">
    <div class="modal-header bg-dark"><strong><i class="{{mInfo.head_icon}}"></i> {{ mInfo.head_title }} | {{data.single.ae_name}} </strong></div>
    <div class="modal-body" id="modal-body">

        <div class="row">
            <div class="form-group col-sm-3"></div>
            <div class="form-group col-sm-2">
                <label for="">Select Mail Template</label>
            </div>
            <div class="form-group col-sm-4">
                <select class="form-control" 
                ng-model="template_name" 
                ng-options="item.key as item.subject for item in allMailTemplates"></select>

            </div>
            <div class="form-group col-sm-3"></div>
            <div class="form-group col-sm-12">
                <table class="table table-bordered table-bordered table-condensed table-sm">
                    <tr>
                        <th><input ng-click="toggleAll()" type="checkbox" ng-model="check"> All</th>
                        <th><label for="mailto">Hero Name</label></th>
                        <th><label for="mailto">Last Reminder Sent</label></th>
                    </tr>
                    <tr ng-if="data.sendmail.length == 0">
                        <td colspan="3">This assessment is not assigned to any hero.</td>
                    </tr>
                    <tr ng-repeat="hero in data.sendmail" ng-if="hero.emp_id != null">
                        <td>
                            <input type="checkbox" ng-model="hero.check" ng-checked="check">
                        </td>
                        <td>{{ (hero.emp_middle_name != null) ? hero.emp_first_name + ' ' + hero.emp_middle_name + ' ' + hero.emp_last_name : hero.emp_first_name + ' ' + hero.emp_last_name}}</td>
                        <td>{{ (hero.id[0].mail=='send') ? hero.timestamp : hero.mail2  }}</td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="modal-footer p-2">
            <button class="btn btn-danger btn-xs" type="button" ng-click="cancel()"><i class="fas fa-times"></i> Cancel</button>
            <button class="btn btn-success btn-xs" type="button" ng-click="send()"><i class="{{mInfo.btn_icon}}"></i> {{mInfo.btn_title}}</button>
        </div>
    </div>
</script>

<script type="text/ng-template" id="modelAssessmentScheduleMailsManagers.html">
    <div class="modal-header bg-dark"><strong><i class="{{mInfo.head_icon}}"></i> {{ mInfo.head_title }} | {{data.single.ae_name}} </strong></div>
    <div class="modal-body" id="modal-body">

        <div class="row">
            <div class="form-group col-sm-3"></div>
            <div class="form-group col-sm-2">
                <label for="">Select Mail Template</label>
            </div>
            <div class="form-group col-sm-4">
                <select class="form-control" 
                ng-model="template_name" 
                ng-options="item.key as item.subject for item in allMailTemplates"></select>

            </div>
            <div class="form-group col-sm-3"></div>
            <div class="form-group col-sm-12">
                <table class="table table-bordered table-bordered table-condensed table-sm">
                    <tr>
                        <th><input ng-click="toggleAll()" type="checkbox" ng-model="check"> All</th>
                        <th><label for="mailto">Hero Name</label></th>
                        <th><label for="mailto">Last Reminder Sent</label></th>
                    </tr>
                    <tr ng-if="data.sendmail.length == 0">
                        <td colspan="3">This assessment is not assigned to any hero.</td>
                    </tr>
                    <tr ng-repeat="hero in data.sendmail" ng-if="hero.emp_id != null">
                        <td>
                            <input type="checkbox" ng-model="hero.check" ng-checked="check">
                        </td>
                        <td>{{ (hero.emp_middle_name != null) ? hero.emp_first_name + ' ' + hero.emp_middle_name + ' ' + hero.emp_last_name : hero.emp_first_name + ' ' + hero.emp_last_name}}</td>
                        <!-- <td>{{ (hero.id[0].mail=='send') ? hero.timestamp : hero.mail2 }}</td> -->
                        <td>{{ (!hero.id) ? hero.timestamp : (hero.id[0].mail!='send' && hero.mail2) ? hero.mail2 : (hero.id[0].mail!='send'  && !hero.mail2) ? 'Not Send' : hero.timestamp }}</td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="modal-footer p-2">
            <button class="btn btn-danger btn-xs" type="button" ng-click="cancel()"><i class="fas fa-times"></i> Cancel</button>
            <button class="btn btn-success btn-xs" type="button" ng-click="send()"><i class="{{mInfo.btn_icon}}"></i> {{mInfo.btn_title}}</button>
        </div>
    </div>
</script>