
<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" ng-if="gUser.emp_first_name !== 'Admin'">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-olive">
                        <go-back/>
                        <i class="fas fa-file-alt"></i> {{createButton.heading}}
                    </h1>
                </div>
                <div class="col-sm-6">
                    <div class="btn-group pull-right" role="group">
                        <button type="button" ng-if="opts.tab==='hero'" class="btn {{opts.hideManagerInfo ? 'btn-default' : 'btn-success'}}" ng-click="opts.hideManagerInfo=!opts.hideManagerInfo">
                            <i class="fas {{opts.hideManagerInfo ? 'fa-eye-slash' : 'fa-eye'}}"></i> {{opts.hideManagerInfo ? 'Hide' : 'Show'}} Manager Info
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main content -->
    <section class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <div class="card card-primary card-outline card-outline-tabs">
                    <table class="table table-bordered table-sm p-0 m-0">
                        <tr>
                            <td><strong>Name:</strong><br>{{empInfo.emp_first_name + ' ' + empInfo.emp_middle_name + ' ' + empInfo.emp_last_name}} <span class="badge badge-danger">{{empInfo.emp_code}}</span></td>
                            <td><strong>DOJ:</strong><br>{{empInfo.emp_doj | date:'dd MMM yyyy'}}</td>
                            <td><strong>Location:</strong><br>{{empInfo.emp_location}}</td>
                            <td><strong>Department:</strong><br>{{empInfo.emp_department}}</td>
                            <td colspan="2"><strong>Manager Name:</strong><br>{{empInfo.lm_fn + ' ' + empInfo.lm_mn + ' ' + empInfo.lm_ln}} <span class="badge badge-danger">{{empInfo.lm_code}}</span></td>
                            <td colspan="2"><strong>Manager Name:</strong><br>{{empInfo.pm_fn + ' ' + empInfo.pm_mn + ' ' + empInfo.pm_ln}} <span class="badge badge-danger">{{empInfo.pm_code}}</span></td>
                        </tr>
                    </table>
                    <div class="card-body p-1">
                        <div class="card bg-light" ng-repeat="schedule in currentAssessmentSchedule">
                            <div class="card-header p-0 pointer" ng-click="schedule.open=!schedule.open">
                                <div class="row">
                                    <div class="bg-info col p-2 ml-2"> Assessment: <strong> {{schedule.ae_name}} </strong><span title="Project Manager" ng-if="opts.tab!=='mngr'"> </span> </div>
                                    <div class="bg-info col"><i class="m-2 fas pull-right {{schedule.open ? 'fa-chevron-up':'fa-chevron-down'}}"></i></div>
                                </div>
                            </div>
                            <div class="card-footer p-1 pr-3" ng-if="schedule.open">
                                <button type="button" ng-click="Save(false,schedule)" class="savebtn btn btn-success btn-xs float-right ml-2" title="Cannot be undone"><i class="fas {{createButton.icon}}"></i> {{createButton.text}}</button>
                                <button type="button" ng-click="Save(true,schedule)" class=" savebtn btn btn-info btn-xs float-right" id="savebtn"><i class="fas {{createButton.icon}}"></i> {{createButton.text}} as Draft</button>
                            </div>

                            <div class="card-body pt-0 pb-0" ng-if="schedule.open">
                                <div class="card card-success" ng-repeat="diary in schedule.diaries" ng-if="diary.imngr===opts.tab && diary.projectid !==116">
                                    <div class="card-header card-success p-0 pointer" ng-click="diary.open=!diary.open">
                                        <div class="row">
                                            <div class="col p-2 ml-2 mt-1"> Project: <strong> {{diary.proj_name}} </strong><span title="Project Manager"> - <u>{{diary.mngr_name | titlecase}}</u></span> | Total score : <span ng-repeat="x in diary.data track by $index" if-ng="x.as_manager_status!='active'"><span ng-init="$parent.sum=sum+x.total"><strong>{{ ($index==0) ? sum : '' }}</strong></span></span></div>
                                            <div class="col"><i class="m-2 fas pull-right {{diary.open ? 'fa-chevron-up':'fa-chevron-down'}}"></i></div>
                                        </div>
                                    </div>
                                    <div class="card-body p-0" ng-if="diary.open">
                                        <div ng-repeat="d in diary.data" class="mt-1">
                                            <label class="col-sm-12 alert alert-dark p-1"><i class="fas fa-chevron-right"></i> {{$index + 1}}. {{d.aq_name}}</label>
                                            <div class="col-sm-12 input-group">
                                                <!-- {{ sum -- d.as_answer}} -->
                                                <div class="col-sm-1"><label class="badge badge-success pointer alert p-2"> You: </label></div>

                                                <div class="col-sm-3" ng-if="d.aq_type === 'dropdown' || d.aq_type === 'dropdown_scale'"><select ng-model="d.as_answer" ng-options="ag.key as (ag.value) for ag in d.aq_options" ng-disabled="opts.tab!=='hero'||d.as_manager_status==='active'||d.as_status==='active'" tabindex="{{($parent.$index+1)+($index+1)}}" class="form-control custom-select"></select></div>
                                                <div class="{{d.aq_comment ? 'col-sm-3' : 'col-sm-7'}}" ng-if="d.aq_type === 'shortanswer' || d.aq_type === 'longanswer' || d.aq_type === 'verylonganswer'"><textarea ng-disabled="d.as_status==='active'" ng-model="d.as_answer" class="form-control" rows="2" placeholder="Enter your response..."></textarea></div>
                                                <div class="col-sm-3" ng-if="d.aq_type === 'number' || d.aq_type === 'num_range'"><input ng-model="d.as_answer" type="number" min="{{d.aq_options.min}}" ng-disabled="d.as_status==='active'" max="{{d.aq_options.max}}" step="{{d.aq_options.step}}" class="form-control" value="{{d.as_answer}}" placeholder="{{d.aq_options.min && d.aq_options.max ? 'Enter between ' + d.aq_options.min + ' to ' + d.aq_options.max : 'Enter any number'}}"/></div>
                                                <div ng-if="d.aq_type === 'tf'">
                                                    <div class="form-check">
                                                        <input class="form-check-input" name="{{d.aq_type+$index}}" type="radio" id="{{'t'+$index}}" ng-model="d.as_answer"/>
                                                        <label class="form-check-label" for="{{'t'+$index}}">True</label>
                                                    </div>
                                                    <div class="form-check">
                                                        <input class="form-check-input" name="{{d.aq_type+$index}}" type="radio" id="{{'f'+$index}}" ng-model="d.as_answer"/>
                                                        <label class="form-check-label" for="{{'f'+$index}}">False</label>
                                                    </div>
                                                </div>
                                                <div class="col-sm-4" ng-if="d.aq_comment"><textarea ng-disabled="opts.tab!=='hero'||d.as_manager_status==='active'||d.as_status==='active'" tabindex="{{($parent.$index+1)+($index+2)}}" ng-model="d.as_comments" rows="2" class="form-control" placeholder="Enter  your comment"></textarea></div>
                                                
                                                <div class="col-sm-4"></div>
                                            </div>

                                            <div class="col-sm-12 input-group" ng-if="opts.hideManagerInfo && d.aq_manager_reply">
                                                <div class="col-sm-1"><label class="badge badge-info pointer alert p-2">Manager:</label></div>
                                                <div class="col-sm-3" ng-if="d.aq_type === 'dropdown' || d.aq_type === 'dropdown_scale'"><select ng-disabled="opts.tab!=='mngr'" class="form-control custom-select" ng-model="d.as_manager_answer" ng-options="ag.key as (ag.value) for ag in d.aq_options"></select></div>
                                                <div class="col-sm-3" ng-if="d.aq_type === 'shortanswer' || d.aq_type === 'longanswer' || d.aq_type === 'verylonganswer'"><textarea ng-disabled="opts.tab!=='mngr'" ng-model="d.as_manager_answer" class="form-control" rows="2" placeholder="Enter your response..."></textarea></div>
                                                <div class="col-sm-3" ng-if="d.aq_type === 'number' || d.aq_type === 'num_range'"><input ng-disabled="opts.tab!=='mngr'" ng-model="d.as_manager_answer" type="number" min="{{d.aq_options.min}}" max="{{d.aq_options.max}}" step="{{d.aq_options.step}}" class="form-control" placeholder="{{d.aq_options.min && d.aq_options.max ? 'Enter between ' + d.aq_options.min + ' to ' + d.aq_options.max : 'Enter any number'}}"/></div>
                                                <div ng-if="d.aq_type === 'tf'">
                                                    <div class="form-check">
                                                        <input ng-disabled="opts.tab!=='mngr'" class="form-check-input" name="{{d.aq_type+$index}}" type="radio" id="{{'t'+$index}}" ng-model="d.as_manager_answer"/>
                                                        <label class="form-check-label" for="{{'t'+$index}}">True</label>
                                                    </div>
                                                    <div class="form-check">
                                                        <input ng-disabled="opts.tab!=='mngr'" class="form-check-input" name="{{d.aq_type+$index}}" type="radio" id="{{'f'+$index}}" ng-model="d.as_manager_answer"/>
                                                        <label class="form-check-label" for="{{'f'+$index}}">False</label>
                                                    </div>
                                                </div>
                                                <div class="col-sm-4" ng-if="d.aq_comment"><textarea ng-readonly="opts.tab!=='mngr'" ng-model="d.as_manager_comments" rows="2" class="form-control" placeholder="Enter the manager comment"></textarea></div>
                                            </div>
                                        </div>
                                    </div>

                                    
                                 

                                </div>
                            </div>

                            <div class="card-footer p-1 pr-3" ng-if="schedule.open">
                                <button type="button" ng-click="Save(false,schedule)" class="savebtn btn btn-success btn-xs float-right ml-2" title="Cannot be undone"><i class="fas {{createButton.icon}}"></i> {{createButton.text}}</button>
                                <button type="button" ng-click="Save(true,schedule)" class=" savebtn btn btn-info btn-xs float-right" id="savebtn"><i class="fas {{createButton.icon}}"></i> {{createButton.text}} as Draft</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
