Skip to content

Commit

Permalink
Merge pull request #84 from Domotina/test
Browse files Browse the repository at this point in the history
Entrega 4 Sprint 3
- Reportes Mensuales
- CRUD Neighoborhoods
- Delegados
  • Loading branch information
Andrés Felipe Esguerra Restrepo committed May 6, 2015
2 parents d8758dc + 87c0252 commit e79b22d
Show file tree
Hide file tree
Showing 37 changed files with 1,913 additions and 554 deletions.
Binary file removed central/static/image/Business-Organization-blue.png
Binary file not shown.
Binary file added central/static/image/blue-chart-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 49 additions & 9 deletions central/templates/central_buildings_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,80 @@
{% endblock navbar %}

{% block content %}
<!-- colocar action para el submit -->
<form class="form-horizontal" method="get" action=' '>
{% if create%}
<form class="form-horizontal" method="POST" action='{% url "central_building_create" %}'>
{% else %}
<form class="form-horizontal" method="POST" action='{% url "edit_neighborhood" neigh.pk %}'>
{% endif %}
<fieldset>
{% if create %}
<legend>Create Building/Urbanization</legend>
{% else %}
<legend>Edit Building/Urbanization</legend>
{% endif %}

<div class="form-group">
<label class="col-lg-2 control-label">Name</label>

<div class="col-lg-10">
<input class="form-control" id="name" placeholder="Name" type="text" name="name" required>
<input class="form-control" id="name" placeholder="Name" type="text" name="name" maxlength="100" {% if neigh %} value="{{neigh.name}}"{%endif %} required>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">Address</label>

<div class="col-lg-10">
<input class="form-control" id="address" placeholder="Address" type="text" name="address" required>
<input class="form-control" id="address" placeholder="Address" type="text" name="address" {% if neigh %} value="{{neigh.address}}"{%endif %} required>
</div>
</div>
<div class="form-group" style="height: 35px">
<label for=" " class="col-lg-2 control-label">Type</label>
<label for="type" class="col-lg-2 control-label">Type</label>

<div class="col-lg-10">
<select class="form-control" id="type" name="type" required>
<!-- verificar si es mejor quemar los datos o cargarlos de la tabla para persistir -->
<option selected>Building</option>
<option>Urbanization</option>
{% for type in types %}
{% if neigh %}
{% if type = neigh.type_neighborhood%}
<option value="{{type.pk}}" selected>{{type}}</option>
{% else %}
<option value="{{type.pk}}"> {{type.name|capfirst}}</option>
{% endif %}
{% else %}
<option value="{{type.pk}}"> {{type.name|capfirst}}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label for="owner" class="col-lg-2 control-label">Owner</label>

<div class="col-lg-10">
<select class="form-control" id="owner" name="owner" required>
<option value="0">Select</option>
{% for user in users %}
{% if neigh %}
{% if user = neigh.owner_neigh%}
<option value="{{user.pk}}" selected>{{user}}</option>
{% else %}
<option value="{{user.pk}}"> {{user.username|capfirst}}</option>
{% endif %}
{% else %}
<option value="{{user.pk}}"> {{user.username|capfirst}}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
<br/>
<div class="form-group">
<div style="margin-left: 210px">
{% if create%}
<p style="display: inline"><input type="submit" class="btn btn-primary" value="Create Building/Urbanization"/></p>
<a href='{% url "central_owner_principal" %}' class="btn btn-default">Return</a>
{% else %}
<p style="display: inline"><input type="submit" class="btn btn-primary" value="Edit Building/Urbanization"/></p>
{% endif%}
<a href='{% url "central_building_neigh" %}' class="btn btn-default">Return</a>
</div>
</div>
</fieldset>
Expand Down
56 changes: 29 additions & 27 deletions central/templates/central_buildings_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,74 +14,76 @@
<div>
<h2>Buildings/Urbanizations</h2>
</div>
<!-- En este panel se filtran solo los buildings -->
<p>Only the Neighborhoods that have at least one assigned place are shown.</p>
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">Buildings</h3>
</div>
<!-- if (validar si hay datos) -->
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<!-- se deja para verificar si el filtro se esta haciendo bien -->
<th>Type</th>
<th>Owner</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- se hace recorrido para llenar la tabla -->
{% for urbanization in buildings %}
<tr>
<td></td>
<td></td>
<td></td>
<td>{{ urbanization.name }}</td>
<td>{{ urbanization.address }}</td>
<td>{{ urbanization.type_neighborhood.name }}</td>
<th>{{ urbanization.owner_neigh.username }}</th>
<td>
<a href=' ' class="btn btn-sm btn-default">Edit</a>
<a href=' ' class="btn btn-sm btn-danger">Delete</a>
<a href='{% url "edit_neighborhood" urbanization.pk %}' class="btn btn-sm btn-default">Edit</a>
<a href='{% url "delete_neighborhood" urbanization.pk %}' class="btn btn-sm btn-danger">Delete</a>
</td>
</tr>
{% empty %}
<tr>
<td>No buildings registered.</td>
</tr>
{% endfor%}
</tbody>
</table>
<!-- else si no hay dato -->
<ul class="list-group">
<li class="list-group-item">No buildings registered.</li>
</ul>
</div>
<!-- En este panel se filtran las urbanizations -->
<div class="panel panel-warning">
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">Urbanizations</h3>
</div>
<!-- if (validar si hay datos) -->
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<!-- se deja para verificar si el filtro se esta haciendo bien -->
<th>Type</th>
<th>Owner</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- se hace recorrido para llenar la tabla -->
{% for urbanization in urbanizations %}
<tr>
<td></td>
<td></td>
<td></td>
<td>{{ urbanization.name }}</td>
<td>{{ urbanization.address }}</td>
<td>{{ urbanization.type_neighborhood.name }}</td>
<th>{{ urbanization.owner_neigh.username }}</th>
<td>
<a href=' ' class="btn btn-sm btn-default">Edit</a>
<a href=' ' class="btn btn-sm btn-danger">Delete</a>
<a href='{% url "edit_neighborhood" urbanization.pk %}' class="btn btn-sm btn-default">Edit</a>
<a href='{% url "delete_neighborhood" urbanization.pk %}' class="btn btn-sm btn-danger">Delete</a>
</td>
</tr>
{% empty %}
<tr>
<td>No urbanizations registered.</td>
</tr>
{% endfor%}
</tbody>
</table>
<!-- else si no hay dato -->
<ul class="list-group">
<li class="list-group-item">No urbanizations registered.</li>
</ul>
</div>

<div class="form-group">
<div style="text-align: center">
<a href='{% url "central_home" %}' class="btn btn-default">Return</a>
Expand Down
2 changes: 1 addition & 1 deletion central/templates/central_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<p>Administration Delegates Owners</p>
</a></li>
<li class="btn"><a href='{% url "central_building_neigh" %}'>
<img src='{% static "image/Business-Organization-blue.png" %}' class="img-rounded" style="width: 96px"/>
<img src='{% static "image/blue-chart-icon.png" %}' class="img-rounded" style="width: 96px"/>

<p>Buildings/Neighborhoods</p>
</a></li>
Expand Down
147 changes: 94 additions & 53 deletions central/templates/central_month_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
{% load static %}

{% block title %}
Creation Owner
Monthly Report Generator
{% endblock %}

{% block navbar %}

<li><a href='{% url "central_home" %}'>Home</a></li>
<li><a href='{% url "central_create" %}'>Properties</a></li>
<li><a href='{% url "central_owner_principal" %}'>Owners</a></li>
<li><a href='{% url "central_delegate" %}'>Delegates</a></li>
<li><a href='{% url "central_month_report" %}'>Report</a></li>

{% endblock navbar %}

{% block content %}

<h3>Monthly Report Generator</h3>
<div class="panel panel-primary">
<div class="panel-heading">
Expand All @@ -28,74 +31,112 @@ <h3 class="panel-title">Instructions</h3>

<p>3. Select one or more building/urbanizations that you are interested.</p>

<p>If you want all places registered onn Domotina, then you have no to select one.</p>
<p>If you want all places registered onn Domotina, then you select the option "Select
All".</p>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Configuration of the report</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<div class="form-group" style="height: 35px">
<label for=" " class="col-lg-2 control-label">Select a year </label>

<div class="col-lg-10">
<select class="form-control" id="year" name="year" required>
<!-- cargar años a sostener -->
<option selected>1</option>
<option>2</option>
<option>3</option>
</select>
<form class="form-horizontal" method="post" action='{% url "generate_monthly_report" %}'>
{% csrf_token %}
{% if messages %}
<div class="alert alert-warning" role="alert">
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="row">
<div class="col-md-6">
<div class="form-group" style="height: 35px">
<label for="year" class="col-lg-2 control-label">Select a year </label>

<div class="col-lg-10">
<select class="form-control" id="year" name="year" required>
<script>
var start = new Date().getFullYear();
var end = 2000;
var options = "";
for (var year = start; year >= end; year--) {
options += "<option value='" + year + "'>" + year + "</option>";
}
document.getElementById("year").innerHTML = options;
</script>
</select>
</div>
</div>
</div>
<div class="form-group" style="height: 35px">
<label for=" " class="col-lg-2 control-label">Select a month </label>

<div class="col-lg-10">
<select class="form-control" id="month" name="month" required>
<!-- cargar propietarios -->
<option selected>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>Octuber</option>
<option>November</option>
<option>December</option>
</select>
<div class="form-group" style="height: 35px">
<label for="month" class="col-lg-2 control-label">Select a month </label>

<div class="col-lg-10">
<select class="form-control" id="month" name="month" required>
<!-- cargar propietarios -->
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div>
</div>
<div class="form-group" style="height: 35px">
<label for="month" class="col-lg-2 control-label">Report Output: </label>

<div class="col-lg-10">
<select class="form-control" id="kind" name="kind" required>
<!-- cargar propietarios -->
<option value="1">PDF</option>
<option value="2">Screen</option>
</select>
</div>
</div>
<div style="text-align: center">
<p style="display: inline">
<input type="submit" class="btn btn-primary" value="Generate Report"/>
</p>
<a href='{% url "central_home" %}' class="btn btn-default">Return</a>
</div>
</div>
<div style="text-align: center">
<p style="display: inline"><input type="submit" class="btn btn-primary" value="Generate Report"/>
</p>
<a href='{% url "central_home" %}' class="btn btn-default">Return</a>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for=" ">Select buildings/urbanizations</label>
<!-- cargar properties -->
<div class="col-lg-10">
<select multiple="" class="form-control" id="property" name="property" required>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<div class="col-md-6">
<div class="form-group">
<label for="neighborhood">Select buildings/urbanizations</label>
<!-- cargar properties -->
<div class="col-lg-10">
<select multiple="multiple" class="form-control" id="neighborhood" name="neighborhood"
required>

{% if neighborhoods %}
<option value="0">Select All</option>
{% for n in neighborhoods %}
<option value='{{ n.id }}'>{{n.name}}</option>
{% endfor %}
{% else %}
<option value="-2">No neighborhoods registered</option>
{% endif %}

</select>
</div>
</div>
</div>
</div>
</div>

</form>
</div>
</div>
</div>

{% endblock %}


Expand Down
Loading

0 comments on commit e79b22d

Please sign in to comment.