1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00
ihatemoney_ynh/budget/templates/list_bills.html
Alexis Metaireau 28a3abf96d No need anymore to pass the project_id to the urls.
The project is now directly added to the context local g object, and injected on the fly into the urls that need it.

This commits also add ideas found while reading the flask documentation. The project can be enhanced in many ways, some ideas are stated there.
2011-08-19 23:44:54 +02:00

86 lines
2.9 KiB
HTML

{% extends "layout.html" %}
{% block js %}
// display the form when clicking on the "add bill" button
$('#add_bill_button').click(function(){
$('#add_bill').show(200);
$(this).hide();
$('#hide_bill_form').show();
return false;
});
// and provide a mechanism to hide it back
$('#hide_bill_form').click(function(){
$('#add_bill').hide(200);
$(this).hide();
$('#add_bill_button').show();
return false;
});
// ask for confirmation before removing an user
$('a.remove').each(function(){
$(this).hide();
$(this).click(function(){
return confirm("are you sure?");
});
});
// display the remove button on mouse over (and hide them per default)
$('.members li').hover(function(){
$(this).children('a.remove').show();
}, function(){
$(this).children('a.remove').hide();
});
{% endblock %}
{% block top_menu %}
<ul>
<li><a href="{{ url_for("exit") }}">logout</a></li>
</ul>
{% endblock %}
{% block content %}
<div id="leftmenu" class="span-6">
<ul class="members">
{% set balance = g.project.get_balance() %}
{% for member in g.project.active_members %}
<li class="{{ loop.cycle("even", "odd") }}">
<span class="balance {% if balance[member] > 0 %}positive{% elif balance[member] < 0 %}negative{% endif %}">{{ balance[member] }}</span>
{{ member.name }}
<a class="remove" href="{{ url_for("remove_member", member_id=member.id) }}">delete</a></li>
{% endfor %}
</ul>
<form action="{{ url_for("add_member") }}" method="post">
{{ forms.add_member(member_form) }}
</form>
</div>
<div id="content" class="uniForm span-18 last">
<a id="add_bill_button" class="awesome large green button fright" href="{{ url_for('add_bill') }}">Add a bill</a>
<a id="hide_bill_form" class="awesome button fright" style="display: none;" href="#">Hide form</a>
<form id="add_bill" action="{{ url_for('add_bill') }}" method="post" style="width: 400px; display: none">{{ forms.add_bill(bill_form) }}</form>
{% if bills.count() > 0 %}
<table class="list_bills">
<thead><tr><th>When?</th><th>Who paid?</th><th>For what?</th><th>Owers</th><th>How much?</th><th>Actions</th></tr></thead>
<tbody>
{% for bill in bills %}
<tr class="{{ loop.cycle("odd", "even") }}">
<td>{{ bill.date }}</td>
<td>{{ bill.payer }}</td>
<td>{{ bill.what }}</td>
<td>{% for ower in bill.owers %}{{ ower.name }} {% endfor %}</td>
<td>{{ bill.amount }} ({{ bill.pay_each() }} each)</td>
<td><a href="{{ url_for("edit_bill", bill_id=bill.id) }}">edit</a>
<a href="{{ url_for("delete_bill", bill_id=bill.id) }}">delete</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>Nothing to list yet. You probably want to <a href="{{ url_for("add_bill") }}">add a bill</a> ?</p>
{% endif %}
</div>
{% endblock %}