{% extends "main/layout.html" %}
{% block content %}
<div class="breadcrumb-holder">
    <div class="container-fluid">
        <ul class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'c-eval-list' %}">LISTA AVALIASAUN</a></li>
            <li class="breadcrumb-item active">{{ legend|upper }}</li>
        </ul>
    </div>
</div>
<div class="container-fluid"><br/>
    <div class="row">
        <div class="col-sm-12">
            <div class="card shadow-lg border-info rounded">
                <div class="card-header border-primary text-center">
                    <h2>{{ legend|upper }}</h2>
                </div>
                <div class="card-body">
                    {% if eval.is_finish == False %}
                    {% if eval.is_lock == False %}
                    <a class="btn btn-sm btn-info" href="{% url 'c-eval-update' eval.hashed %}">Hadia <i class="fa fa-edit"></i></a>
                    <a class="btn btn-sm btn-danger" href="{% url 'c-eval-remove' eval.hashed %}">Hapaga <i class="fa fa-trash"></i></a>
                    <a class="btn btn-sm btn-warning" href="{% url 'c-eval-lock' eval.hashed %}">Xavi <i class="fa fa-lock"></i></a>
                    <a class="btn btn-sm btn-info" href="{% url 'c-eval-refresh' eval.hashed %}" title="Refresh">Refresh <i class="fa fa-refresh"></i></a>
                    {% else %}
                    <a class="btn btn-sm btn-warning" href="{% url 'c-eval-unlock' eval.hashed %}">Loke <i class="fa fa-unlock"></i></a>
                    <a class="btn btn-sm btn-primary" href="{% url 'c-eval-finish' eval.hashed %}">Termina <i class="fa fa-check"></i></a>
                    {% endif %}
                    {% endif %}
                    <a class="btn btn-sm btn-info" href="{% url 'eval-self-list' %}" target="_blank">Self Assesment <i class="fa fa-user"></i></a>
                    <hr/>
                    <div class="row">
                        <div class="col-sm-6">
                            <table class="table table-sm table-bordered table-striped">
                                <tr>
                                    <th width="30%">Evaluator</th><td>{{ zuri.employee }}</td>
                                </tr>
                                <tr>
                                    <th width="30%">Position</th><td>{{ zuri.position }}</td>
                                </tr>
                            </table>
                        </div><!--end col-->
                        <div class="col-sm-6">
                            <table class="table table-sm table-bordered table-striped">
                                <tr>
                                    <th width="30%">Evaluated</th><td>{{ eval.employee }}</td>
                                </tr>
                                <tr>
                                    <th width="30%">Position</th><td>{{ eval.position }}</td>
                                </tr>
                            </table>
                        </div><!--end col-->
                    </div><!--end row-->                 
                    
                    <table class="table table-sm table-bordered">
                        <tr>
                            <th width="30%">Period under evaluation</th>
                            <td>{{ eval.start_date|date:"M Y" }} to {{ eval.end_date|date:"M Y" }}</td>
                        </tr>
                    </table>
                    <div class="card">
                        <div class="card-header">GLOBAL PERFORMANCE ASSESMENT</div>
                        <div class="card-body">
                            <div class="row">
                                <div class="col-sm-6">
                                    <table class="table table-sm table-bordered table-striped">
                                        <tr align="center"><th colspan="3">Scores</th></tr>
                                        <tr>
                                            <th>Individual Objective</th><td>{{ eval.score_a }}</td>
                                        </tr>
                                        <tr>
                                            <th>Professional Behavior</th><td>{{ eval.score_b }}</td>
                                        </tr>
                                        <tr>
                                            <th>Total</th><td>{{ eval.total }}</td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="col-sm-6">
                                    <table class="table table-sm table-bordered table-striped">
                                        <tr align="center"><th colspan="3">Qualifikasaun</th></tr>
                                        <tr>
                                            <th>Outstanding</th><td>{% if finalscore.a %}{{ finalscore.a }}{% endif %}</td>
                                        </tr>
                                        <tr>
                                            <th>Exceeds job requirements</th><td>{% if finalscore.b %}{{ finalscore.b }}{% endif %}</td>
                                        </tr>
                                        <tr>
                                            <th>Meets job requirements</th><td>{% if finalscore.c %}{{ finalscore.c }}{% endif %}</td>
                                        </tr>
                                        <tr>
                                            <th>Needs Improvements</th><td>{% if finalscore.d %}{{ finalscore.d }}{% endif %}</td>
                                        </tr>
                                        <tr>
                                            <th>Unsatisfactory</th><td>{% if finalscore.e %}{{ finalscore.e }}{% endif %}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div><!--end row-->
                        </div>
                    </div><!--end card-->
                    
                    <hr/>
                    <div class="row">
                        <div class="col-sm-12">
                            <h2 align="center">PARAMETERS OF THE EVALUATION</h2>
                        </div><!--end col-->
                    </div><!--end row-->
                    <hr/>
                    <div class="row">
                        <div class="col-sm-12">                            
                            <div class="card shadow-lg border-info rounded">
                                <div class="card-header bg-steel"><h4>A. INDIVIDUAL OBJECTIVES</h4></div>
                                <div class="card-body">
                                    {% if eval.is_lock == False %}
                                    <a class="btn btn-sm btn-info mb-1" href="{% url 'c-eval-import_a' eval.hashed %}">Import <i class="fa fa-download"></i></a>
                                    {% endif %}
                                    <table class="table table-sm table-bordered">
                                        <tr>
                                            <td colspan="3">Gaoal description<br/>Determination of the Measurement Indicator (s) and Overcoming Crieteria</td>
                                            <td>1</td><td>2</td><td>3</td><td>4</td><td>5</td>
                                            <th>#</th>
                                        </tr>
                                        {% for obj_a in obj_as %}
                                        <tr>
                                            <th rowspan="3">{{ forloop.counter }}</th>
                                            <th>Goals/Activities</th>
                                            <td>{{ obj_a.parameter.name }}</td>
                                            <td rowspan="3">
                                                {% if obj_a.choice.score == 1 %}{{ obj_a.choice.score }}{% endif %}
                                                {% if obj_a.comments %}{{ obj_a.comments|safe }}{% endif %}
                                            </td>
                                            <td rowspan="3">
                                                {% if obj_a.choice.score == 2 %}{{ obj_a.choice.score }}{% endif %}
                                                {% if obj_a.comments %}{{ obj_a.comments|safe }}{% endif %}
                                            </td>
                                            <td rowspan="3">
                                                {% if obj_a.choice.score == 3 %}{{ obj_a.choice.score }}{% endif %}
                                                {% if obj_a.comments %}{{ obj_a.comments|safe }}{% endif %}
                                            </td>
                                            <td rowspan="3">
                                                {% if obj_a.choice.score == 4 %}{{ obj_a.choice.score }}{% endif %}
                                                {% if obj_a.comments %}{{ obj_a.comments|safe }}{% endif %}
                                            </td>
                                            <td rowspan="3">
                                                {% if obj_a.choice.score == 5 %}{{ obj_a.choice.score }}{% endif %}
                                                {% if obj_a.comments %}{{ obj_a.comments|safe }}{% endif %}
                                            </td>
                                            <td rowspan="3">
                                                <a class="btn btn-sm btn-info" href="{% url 'c-eval-update_a' eval.id obj_a.hashed %}"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>Measuring Indicator (s)</th>
                                            <td>{{ obj_a.parameter.measure }}</td>
                                        </tr>
                                        <tr>
                                            <th>Criteria for Overcoming Indicator (s)</th>
                                            <td>{{ obj_a.parameter.criteria }}</td>
                                        </tr>
                                        {% endfor %}
                                        <tr align="center">
                                            <th colspan="3">Score of Paramenter</th><td colspan="6">{{ sum_a }}</td>
                                        </tr>
                                    </table>
                                    <a class="btn btn-sm btn-info mb-1" href="{% url 'c-evaldate-update1' evaldate.id %}">Aletera Data <i class="fa fa-edit"></i></a>
                                    <table class="table table-sm">
                                        <tr>
                                            <td>The Evaluator</td><td>{{ evaldate.date_a_1 }}</td><td>{{ zuri.employee }}</td>
                                        </tr>
                                        <tr>
                                            <td>The Evaluated</td><td>{{ evaldate.date_a_2 }}</td><td>{{ eval.employee }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div><!--end col-->
                    </div><!--end row-->
                    
                    <div class="row">
                        <div class="col-sm-12">                            
                            <div class="card shadow-lg border-info rounded">
                                <div class="card-header bg-steel"><h4>B. PROFESSIONAL BEHAVIOR</h4></div>
                                <div class="card-body">
                                    {% if eval.is_lock == False %}
                                    <a class="btn btn-sm btn-info mb-1" href="{% url 'c-eval-import_b' eval.hashed %}">Import <i class="fa fa-download"></i></a>
                                    {% endif %}
                                    <table class="table table-sm table-bordered">
                                        <tr>
                                            <td>Nu.</td>
                                            <td>Area</td>
                                            <td>Indicators</td>
                                            <td>1</td><td>2</td><td>3</td><td>4</td><td>5</td>
                                            <th>#</th>
                                        </tr>
                                        {% for obj_b in obj_bs %}
                                        <tr>
                                            <th>{{ forloop.counter }}</th>
                                            <td>{{ obj_b.parameter.area }}</td>
                                            <td>{{ obj_b.parameter.indicator|safe }}</td>
                                            <td>
                                                {% if obj_b.choice.score == 1 %}{{ obj_b.choice.score }}{% endif %}
                                                {% if obj_b.comments %}{{ obj_b.comments|safe }}{% endif %}
                                            </td>
                                            <td>
                                                {% if obj_b.choice.score == 2 %}{{ obj_b.choice.score }}{% endif %}
                                                {% if obj_b.comments %}{{ obj_b.comments|safe }}{% endif %}
                                            </td>
                                            <td>
                                                {% if obj_b.choice.score == 3 %}{{ obj_b.choice.score }}{% endif %}
                                                {% if obj_b.comments %}{{ obj_b.comments|safe }}{% endif %}
                                            </td>
                                            <td>
                                                {% if obj_b.choice.score == 4 %}{{ obj_b.choice.score }}{% endif %}
                                                {% if obj_b.comments %}{{ obj_b.comments|safe }}{% endif %}
                                            </td>
                                            <td>
                                                {% if obj_b.choice.score == 5 %}{{ obj_b.choice.score }}{% endif %}
                                                {% if obj_b.comments %}{{ obj_b.comments|safe }}{% endif %}
                                            </td>
                                            <td>
                                                <a class="btn btn-sm btn-info" href="{% url 'c-eval-update_b' eval.id obj_b.hashed %}"><i class="fa fa-edit"></i></a>
                                            </td>
                                        </tr>
                                        {% endfor %}
                                        <tr align="center">
                                            <th colspan="2">Score of Paramenter</th><td colspan="6">{{ sum_b }}</td>
                                        </tr>
                                    </table>
                                    <a class="btn btn-sm btn-info mb-1" href="{% url 'c-evaldate-update2' evaldate.id %}">Aletera Data <i class="fa fa-edit"></i></a>
                                    <table class="table table-sm">
                                        <tr>
                                            <td>The Evaluator</td><td>{{ evaldate.date_b_1 }}</td><td>{{ zuri.employee }}</td>
                                        </tr>
                                        <tr>
                                            <td>The Evaluated</td><td>{{ evaldate.date_b_2 }}</td><td>{{ eval.employee }}</td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div><!--end col-->
                    </div><!--end row-->
                </div> <!--end card-body-->
            </div> <!--end card-->
        </div> <!--end col-->
    </div> <!--end row-->
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
    $(document).ready(function() {
        $('#example').DataTable();
    } );
</script>
{% endblock %}