{% extends "main/layout.html" %}
{% block content %}
<div class="breadcrumb-holder">
	<div class="container-fluid">
		<ul class="breadcrumb">
			<li class="breadcrumb-item"><a href="{% url 'hr-scho-list' %}">LISTA BOLSO ESTUDO</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">
                    <center>
                        <h3>{{ legend|upper }}</h3>
                    </center>
                </div>
				<div class="card-body">
					
                    <table class="table table-sm table-bordered">
                        <tr>
                            <th>Plano</th> <th>Tipu</th><th>Fatin</th><th>Universidade</th><th>Nasaun</th>
                        </tr>
                        <tr>
                            <td>{{ schol.subject }}</td>
                            <td>{{ schol.type }}</td>
                            <td>{{ schol.place }}</td>
                            <td>{{ schol.university.name }}</td>
                            <td>{{ schol.country.name }}</td>
                        </tr>
                        <tr>
                            <th colspan="2">Tinan</th>
                            <th>Data Hahu</th>
                            <th>Data Remata</th>
                            <th>Anekso Pareser</th>
                        </tr>
                        <tr>
                            <td colspan="2">{{schol.year}}</td>
                            <td>{{schol.start_date}}</td>
                            <td>{{schol.end_date}}</td>
                            <td>
                                {% if schol.file %}
                                  <a href="{{schol.file.url}}" class="btn btn-sm btn-info" target="_blank"><i class="fa fa-file-pdf"></i></a>
                                {% endif %}
                            </td>
                        </tr>
                    </table>
                    <hr class="border-primary"/>
                    <center>
                        <h4>FUNSIONARIU SIRA NEBE TUIR BOLSO ESTUDO</h4>
                    </center>
                    {% if schol.is_lock == False %}
                        <a class="btn btn-sm btn-info mb-1" href="{% url 'hr-scho-emp-add' schol.hashed %}">Aumenta <i class="fa fa-plus"></i></a>
                        <a class="btn btn-sm btn-danger mb-1" href="{% url 'hr-scho-lock' schol.hashed %}">Chave <i class="fa fa-lock"></i></a>
                    {% else %}
                        
                            <div class="alert alert-success">Chave Ona</div>
                        
                    {% endif %}
                    <table class="table table-sm">
                        <tr>
                            <th>Nu.</th>
                            <th>Naran</th>
                            <th>Unidade/Ekipa</th>
                            <th>Pojisaun</th>
                            <th>Periodu Servisu</th>
                            <th>#</th>
                        </tr>
                        {% for obj in objects %}
                        <tr>
                            <td>{{ forloop.counter }}</td>
                            <td><a href="{% url 'hr-scho-emp-detail' schol.hashed obj.hashed %}">{{ obj.emp }}</a></td>
                            <td>{% if obj.emp.curempdivision.unit %}{{ obj.emp.curempdivision.unit.name }}{% else %}{{ obj.emp.curempdivision.department.name }}{% endif %}</td>
                            <td>{{ obj.emp.curempposition.position.name }}</td>
                            <td>
                                {% if obj.emp.contract.all.0.end_date %}
                                    {{ obj.emp.contract.all.0.start_date|date:"d/m/Y" }} - 
                                    {{ obj.emp.contract.all.0.end_date|date:"d/m/Y" }}
                                  
                                {% else %}
                                    Indeterminable
                                {% endif %}
                            </td>
                            <td>
                            {% if schol.is_lock == False %}
                                <a class="btn btn-sm btn-info" href="{% url 'hr-scho-emp-update' schol.hashed obj.hashed %}"><i class="fa fa-pen-to-square"></i></a>
                                <a class="btn btn-sm btn-danger" href="{% url 'hr-scho-emp-delete' schol.hashed obj.hashed %}"><i class="fa fa-trash"></i></a>
                            {% else %}
                                {% if obj.is_update == False %}
                                
                                    <a class="btn btn-sm btn-success mb-1" href="{% url 'hr-scho-emp-update-att' schol.hashed obj.pk %}">Update Absensia <i class="fa fa-refresh"></i></a>
                                {% else %}
                                    <a class="btn btn-sm btn-success disabled mb-1" href="#">Absensia Update Ona <i class="fa fa-check"></i></a>

                                {% endif %}
                            {% endif %}
                            </td>
                        </tr>
                        {% endfor %}
                        
                    </table>
                    
				</div> <!--end card-body-->
			</div> <!--end card-->
		</div> <!--end col-->
	</div> <!--end row-->
</div>
{% endblock %}
{% block scripts %}
{% endblock %}