2011-03-10 03:37:21 +01:00
|
|
|
{% extends "layout.html" %}
|
2011-07-29 17:14:33 +02:00
|
|
|
|
2011-08-10 19:23:54 +02:00
|
|
|
{% block js %}
|
2011-08-10 23:55:07 +02:00
|
|
|
// 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;
|
|
|
|
});
|
2011-08-10 19:23:54 +02:00
|
|
|
|
2011-08-10 23:55:07 +02:00
|
|
|
// 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;
|
|
|
|
});
|
2011-08-10 19:23:54 +02:00
|
|
|
|
2011-08-10 23:55:07 +02:00
|
|
|
// ask for confirmation before removing an user
|
|
|
|
$('a.remove').each(function(){
|
|
|
|
$(this).hide();
|
|
|
|
$(this).click(function(){
|
|
|
|
return confirm("are you sure?");
|
2011-08-10 19:23:54 +02:00
|
|
|
});
|
2011-08-10 23:55:07 +02:00
|
|
|
});
|
2011-08-10 19:23:54 +02:00
|
|
|
|
2011-08-10 23:55:07 +02:00
|
|
|
// 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();
|
2011-08-10 19:23:54 +02:00
|
|
|
});
|
|
|
|
{% endblock %}
|
|
|
|
|
2011-07-29 17:14:33 +02:00
|
|
|
{% block top_menu %}
|
|
|
|
<ul>
|
2011-08-09 23:49:09 +02:00
|
|
|
<li><a href="{{ url_for("exit") }}">logout</a></li>
|
2011-07-29 17:14:33 +02:00
|
|
|
</ul>
|
|
|
|
{% endblock %}
|
|
|
|
|
2011-03-10 03:37:21 +01:00
|
|
|
{% block content %}
|
2011-08-09 23:49:09 +02:00
|
|
|
<div id="leftmenu" class="span-6">
|
|
|
|
<ul class="members">
|
2011-08-19 23:44:54 +02:00
|
|
|
{% set balance = g.project.get_balance() %}
|
|
|
|
{% for member in g.project.active_members %}
|
2011-08-09 23:49:09 +02:00
|
|
|
<li class="{{ loop.cycle("even", "odd") }}">
|
2011-08-10 01:05:25 +02:00
|
|
|
<span class="balance {% if balance[member] > 0 %}positive{% elif balance[member] < 0 %}negative{% endif %}">{{ balance[member] }}</span>
|
2011-08-09 23:49:09 +02:00
|
|
|
{{ member.name }}
|
2011-08-19 23:44:54 +02:00
|
|
|
<a class="remove" href="{{ url_for("remove_member", member_id=member.id) }}">delete</a></li>
|
2011-07-23 20:36:13 +02:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
2011-08-19 23:44:54 +02:00
|
|
|
<form action="{{ url_for("add_member") }}" method="post">
|
2011-07-31 23:55:18 +02:00
|
|
|
{{ forms.add_member(member_form) }}
|
|
|
|
</form>
|
2011-07-23 20:36:13 +02:00
|
|
|
</div>
|
2011-08-09 23:49:09 +02:00
|
|
|
<div id="content" class="uniForm span-18 last">
|
2011-08-19 23:44:54 +02:00
|
|
|
<a id="add_bill_button" class="awesome large green button fright" href="{{ url_for('add_bill') }}">Add a bill</a>
|
2011-08-10 19:23:54 +02:00
|
|
|
|
|
|
|
<a id="hide_bill_form" class="awesome button fright" style="display: none;" href="#">Hide form</a>
|
|
|
|
|
2011-08-19 23:44:54 +02:00
|
|
|
<form id="add_bill" action="{{ url_for('add_bill') }}" method="post" style="width: 400px; display: none">{{ forms.add_bill(bill_form) }}</form>
|
2011-07-31 23:55:18 +02:00
|
|
|
|
2011-07-23 20:36:13 +02:00
|
|
|
{% if bills.count() > 0 %}
|
2011-08-10 13:16:46 +02:00
|
|
|
<table class="list_bills">
|
2011-08-05 17:05:33 +02:00
|
|
|
<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>
|
2011-07-23 20:36:13 +02:00
|
|
|
<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>
|
2011-08-19 23:44:54 +02:00
|
|
|
<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>
|
2011-07-23 20:36:13 +02:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2011-03-10 03:37:21 +01:00
|
|
|
|
2011-07-23 20:36:13 +02:00
|
|
|
{% else %}
|
2011-08-19 23:44:54 +02:00
|
|
|
<p>Nothing to list yet. You probably want to <a href="{{ url_for("add_bill") }}">add a bill</a> ?</p>
|
2011-07-23 20:36:13 +02:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2011-03-10 03:37:21 +01:00
|
|
|
{% endblock %}
|