{% extends 'main/layout.html' %}
{% block title %}{{title}}{% endblock title %}
{% block content %}
{% if group == 'admin' %}
{% include 'report/sidebar.html' %}
{% else %}
{% include 'development/sidebar.html' %}
{% endif %}
<section class="section-container">
  <!-- Page content-->
  <div class="content-wrapper">
    <div class="content-heading d-flex justify-content-between">
      <div>
        {{title}}<small>
          <ol class="breadcrumb mt-3">
            {% if group == 'admin' %}
            <li class="breadcrumb-item"><a href="{% url 'report:report-dashboard' %}">Varanda</a></li>
            <li class="breadcrumb-item"><a href="{% url 'report_development:report-development-dashboard' %}">Dezenvolvimentu</a>
              {% else %}
            <li class="breadcrumb-item"><a href="{% url 'development:dashboard-development' %}">Varanda</a></li>
            <li class="breadcrumb-item"><a href="{% url 'development:activity-list' %}">Lista Atividade</a></li>
            {% endif %}
            <li class="breadcrumb-item active" aria-current="page">{{title}}</li>
          </ol>
        </small>
      </div>
      <div>
              {% ifequal user.groups.all.0.name 'admin' %}
              <div class="bg-danger p-2">
              <small class="text-white">Admin Nasional MAE</small>
              </div>
              {% endifequal %}
              {% ifequal user.groups.all.0.name 'xefe' %}
              <div class="bg-warning p-2">
              <small class="text-white"> Xefe Suku {{user.employeeuser.employee.village}}</small>
              </div>
              {% endifequal %}
              {% ifequal user.groups.all.0.name 'sec' %}
              <div class="bg-warning p-2">
              <small class="text-white"> Secretariado Suku {{user.employeeuser.employee.village}}</small>
              </div>
              {% endifequal %}
            </div>
    </div>
    <div class="row">
      <div class="col-xl-12">
        {% comment %} START PAGE {% endcomment %}

        {% if messages %}
            {% for message in messages %} 
                <div id="divmessage" class="alert alert-{{ message.tags }} alert-dismissable">
                  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                  {{message}}
                </div>
            {% endfor %}
        {% endif %}

<div class="row">
  <!-- Blog Content-->
  <div class="col-xl-12">
    <div class="card card-default">
      {% comment %}
      <div class="card-header">Informasaun Atividade</div>
      {% endcomment %}
      <div class="card-body">
        <div class="row">
          <div class="col-lg-6">
            <p class="lead bb">
              Informasaun Atividade
              {% comment %} <a href="{% url 'development:activity-edit' objects.hashed %}"><button class="mb-1 btn btn-info" type="button">Altera</button></a> {% endcomment %}
              {% if group == 'sec' %}
              <a href="{% url 'development:activity-edit' objects.hashed %}" class="btn btn-labeled btn-info mb-2 ml-2" type="button">
                <span class="btn-label"><i class="fa fa-edit"></i></span>
                Altera Atividade
              </a>
              {% endif %}
            </p>
            <form class="form-horizontal">
              <div class="form-group row">
                <div class="col-md-4">Naran Atividae</div>
                <div class="col-md-8"><strong>{{objects.name}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Fatin</div>
                <div class="col-md-8"><strong>{{objects.place}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Data Atividade</div>
                <div class="col-md-8"><strong>{{objects.date|date:"d-M-Y"}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Tinan</div>
                <div class="col-md-8"><strong>{{objects.year}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Munisípiu</div>
                <div class="col-md-8"><strong>{{objects.municipality}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Postu Adm.</div>
                <div class="col-md-8"><strong>{{objects.administrativepost}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Suku</div>
                <div class="col-md-8"><strong>{{objects.village}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Partisipasaun</div>
                <div class="col-md-8"><strong>{{objects.participation}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Benefísiu</div>
                <div class="col-md-8"><strong>{{objects.benefit}}</strong></div>
              </div>
              <div class="form-group row">
                <div class="col-md-4">Observasaun</div>
                <div class="col-md-8"><strong>{{objects.obs}}</strong></div>
              </div>
            </form>
          </div>
          <div class="col-lg-6">
            <p class="lead bb">
              Informasaun Fundus
              {% if group == 'sec' %}
              <a href="{% url 'development:activity-add1-fund1' objects.hashed %}" class="btn btn-labeled btn-info mb-2 ml-2" type="button">
                <span class="btn-label"><i class="fa fa-plus"></i></span>
                Aumenta Fundus
              </a>
              {% endif %}
            </p>
            <div class="table-responsive"> 
              <table class="table table-striped table-bordered table-hover">
                {% comment %} <thead>
                  <tr>
                  </tr>
                </thead> {% endcomment %}
                <tbody>
                  <tr>
                    <th>
                      {% comment %} <td class="text-center text-bold">Nu.</td> {% endcomment %}
                      <th class="text-center text-bold">Fundus</th>
                      <th class="text-center text-bold">Naran</th>
                      <th class="text-center text-bold">Ajuda Material</th>
                      <th class="text-center text-bold">Orsamentu</th>
                      {% if group == 'sec' %}
                      <th class="text-center text-bold">Asaun</th>
                      {% endif %}
                    </th>
                  </tr>
                  {% for d in result %}
                  <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{d.fund}}</td>
                    <td>{{d.name}}</td>
                    {% if d.material == None %}
                    <td>--</td>
                    {% else %}
                    <td>{{d.material}}</td>
                    {% endif %}
                    <td>$ {{d.amount}}</td>
                    {% if group == 'sec' %}
                    {% if d.fund == 'Nasional' %}
                    <td><a href="{% url 'development:fundnational-project-edit' d.hashed %}" title="Hadia"><i class="fa fa-edit"></i></a></td>
                    {% elif d.fund == 'Municipio' %}
                    <td><a href="{% url 'development:fundmunicipality-project-edit' d.hashed %}" title="Hadia"><i class="fa fa-edit"></i></a></td>
                    {% elif d.fund == 'Kontribuisaun Komunidade' %}
                    <td><a href="{% url 'development:fundcommunity-activity-edit' d.hashed %}" title="Hadia"><i class="fa fa-edit"></i></a></td>
                    {% elif d.fund == 'Ajensia' %}
                    <td><a href="{% url 'development:fundagency-activity-edit' d.hashed %}" title="Hadia"><i class="fa fa-edit"></i></a></td>
                    {% endif %}
                    {% endif %}
                  </tr>
                  {% endfor %}
                  <tr>
                    <td colspan="4" style="text-align:center;">Total</td>
                    <td colspan="3">$ {{total}}</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <!-- END table-responsive-->
          </div>
        </div>
         <hr>
              <div class="form-group row">
                <div class="col-md-12"><h3>Aneksu Imagen Ba Atividate "{{objects.name}}" 
                  {% if group == 'sec' or group == 'xefe' %}
                  <a href="{% url 'development:activity-add-image' objects.hashed %}" class="btn btn-labeled btn-info mb-2 ml-2" type="button">
                <span class="btn-label"><i class="fa fa-plus"></i></span>
                Adisiona Imajen</a>
                {% endif %}
              </h3></div><hr>
                {% for obj in imageactivity %}
                <div class="col-md-6"><img src="{{ obj.image.url }}" style="width: 45%; padding: 5px; ;"></div>
                {% endfor %}
              </div>
      </div>
    </div>
    <!-- Blog Sidebar 
  -->
    {% comment %}
    <div class="col-xl-4">
      <div class="row">
        <div class="col-12">
          <!-- Search-->
          <div class="card card-default">
            <div class="card-header">
              <div class="bb">
                <h4 class="text-md mt-3">FUNDUS</h4>
                <p class="d-flex">
                  <span
                    ><small class="mr-1">Kria husi: <a class="ml-1" href="">{{objects.user}}</a></small
                    ><small class="mr-1">{{objects.datetime}}</small></span
                  >
                </p>
              </div>
            </div>
            <div class="card-body">
              <form class="form-horizontal">
                <div class="input-group">
                  <input class="form-control" type="text" placeholder="Search for..." /><span class="input-group-btn"
                    ><button class="btn btn-secondary" type="button"><em class="fa fa-search"></em></button
                  ></span>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    {% endcomment %}
  </div>
{% comment %} END PAGE {% endcomment %}
      </div>
    </div>
  </div>
</section>
<!-- Page footer-->
{% include 'main/footer.html' %}
  {% endblock content %}
</div>
