]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/templates/mobile/status/index.mako
began work on iphone-targeted web interface
[bluechips.git] / bluechips / templates / mobile / status / index.mako
1 <%inherit file="/mobile/base.mako"/>
2
3 <%!
4   from datetime import date
5 %>
6
7 <div id="tabs">
8   <a id="status" class="selected" href="#">
9     <img src="/icons/dashboard.png" alt="">
10     <span>Dashboard</span>
11   </a>
12   <a id="spend" href="#">
13     <img src="/icons/spend.png" alt="">
14     <span>Expense</span>
15   </a>
16   <a id="transfer" href="#">
17     <img src="/icons/transfer.png" alt="">
18     <span>Transfer</span>
19   </a>
20 </div>
21
22 <div id="tab-status" class="tab">
23   % for message in h.flash.pop_messages():
24     <div class="flash">${message | n}</div>
25   % endfor
26
27   % if len(c.settle) == 0:
28     <p>No need! The books are balanced!</p>
29   % else:
30     <p>To balance the books, the following transfers need to be made:</p>
31
32     <table id="balance">
33       <tr>
34         <th>From</th>
35         <th>To</th>
36         <th>Amount</th>
37       </tr>
38       % for transfer in c.settle:
39         <tr>
40           <td>${transfer[0].name}</td>
41           <td>${transfer[1].name}</td>
42           <td>${transfer[2]}</td>
43         </tr>
44       % endfor
45     </table>
46   % endif
47 </div>
48
49 <div id="tab-spend" class="tab">
50   <form action="${h.url_for(controller='spend', action='update')}" method="post">
51     ${h.auth_token_hidden_field()}
52     <table class="form">
53       <tr>
54         <th><label for="spender_id">Spender</label></th>
55         <td>${h.select('spender_id', [request.environ['user'].id], c.users)}</td>
56       </tr>
57       <tr>
58         <th><label for="amount">Amount</label></th>
59         <td>${h.currency('amount', 0, size=8)}</td>
60       </tr>
61       <tr>
62         <th><label for="date">Date</label></th>
63         <td>${h.text('date', date.today().strftime('%m/%d/%Y'), size=16)}</td>
64       </tr>
65       <tr>
66         <th><label for="description">Description</label></th>
67         <td>${h.text('description')}</td>
68       </tr>
69     </table>
70
71     <p>Change how an expenditure is split up.</p>
72
73     <table class="form">
74       % for ii, user_row in enumerate(c.users):
75         <%
76           user_id, user = user_row
77           if user.resident:
78             percent = 1
79           else:
80             percent = 0
81         %>
82         <tr>
83           <th><label for="shares-${ii}amount">${user.name}</label></th>
84           <td>
85             ${h.text('shares-%d.amount' % ii, percent)}
86             ${h.hidden('shares-%d.user_id' % ii, user.id)}
87           </td>
88         </tr>
89       % endfor
90       <tr>
91         <td colspan="2">
92           ${h.submit(None, 'Submit', class_="submitbutton")}
93         </td>
94       </tr>
95     </table>
96   </form>
97 </div>
98
99 <div id="tab-transfer" class="tab">
100   <form action="${h.url_for(controller='transfer', action='update')}" method="post">
101     ${h.auth_token_hidden_field()}
102     <table class="form">
103       <tr>
104         <th><label for="debtor_id">From</label></th>
105         <td>${h.select('debtor_id', request.environ['user'].id, c.users)}</td>
106       </tr>
107       <tr>
108         <th><label for="creditor_id">To</label></th>
109         <td>${h.select('creditor_id', None, c.users)}</td>
110       </tr>
111       <tr>
112         <th><label for="amount">Amount</label></th>
113         <td>${h.currency('amount', 0, size=8)}</td>
114       </tr>
115       <tr>
116         <th><label for="date">Date</label></th>
117         <td>${h.text('date', date.today().strftime('%m/%d/%Y'), size=16)}</td>
118       </tr>
119       <tr>
120         <th><label for="description">Description</label></th>
121         <td>${h.text('description')}</td>
122       </tr>
123       <tr>
124         <td colspan="2">
125           <input type="submit" value="Submit" />
126         </td>
127       </tr>
128     </table>
129   </form>
130 </div>