]> asedeno.scripts.mit.edu Git - bluechips.git/blobdiff - bluechips/templates/mobile/status/index.mako
Right align total debit/credit on status pages
[bluechips.git] / bluechips / templates / mobile / status / index.mako
index 08069e1b67bf341297fbfcbe8deb3ee3f86dbdb1..55dc7929cdec29a3c807d7d8ca00348c2240191a 100644 (file)
@@ -1,29 +1,8 @@
 <%inherit file="/mobile/base.mako"/>
 
-<%!
-  from datetime import date
-%>
-
-<div id="tabs">
-  <a id="status" class="selected" href="#">
-    <img src="/icons/dashboard.png" alt="">
-    <span>Dashboard</span>
-  </a>
-  <a id="spend" href="#">
-    <img src="/icons/spend.png" alt="">
-    <span>Expense</span>
-  </a>
-  <a id="transfer" href="#">
-    <img src="/icons/transfer.png" alt="">
-    <span>Transfer</span>
-  </a>
-</div>
+${self.tabs('status')}
 
 <div id="tab-status" class="tab">
-  % for message in h.flash.pop_messages():
-    <div class="flash">${message | n}</div>
-  % endfor
-
   % if len(c.settle) == 0:
     <p>No need! The books are balanced!</p>
   % else:
         <tr>
           <td>${transfer[0].name}</td>
           <td>${transfer[1].name}</td>
-          <td>${transfer[2]}</td>
+          <td class="amount">${transfer[2]}</td>
         </tr>
       % endfor
-    </table>
-  % endif
-</div>
-
-<div id="tab-spend" class="tab">
-  <form action="${h.url_for(controller='spend', action='update')}" method="post">
-    ${h.auth_token_hidden_field()}
-    <table class="form">
-      <tr>
-        <th><label for="spender_id">Spender</label></th>
-        <td>${h.select('spender_id', [request.environ['user'].id], c.users)}</td>
-      </tr>
-      <tr>
-        <th><label for="amount">Amount</label></th>
-        <td>${h.currency('amount', 0, size=8)}</td>
-      </tr>
-      <tr>
-        <th><label for="date">Date</label></th>
-        <td>${h.text('date', date.today().strftime('%m/%d/%Y'), size=16)}</td>
-      </tr>
-      <tr>
-        <th><label for="description">Description</label></th>
-        <td>${h.text('description')}</td>
-      </tr>
-    </table>
-
-    <p>Change how an expenditure is split up.</p>
-
-    <table class="form">
-      % for ii, user_row in enumerate(c.users):
-        <%
-          user_id, user = user_row
-          if user.resident:
-            percent = 1
-          else:
-            percent = 0
-        %>
+      % if c.net != 0:
         <tr>
-          <th><label for="shares-${ii}amount">${user.name}</label></th>
-          <td>
-            ${h.text('shares-%d.amount' % ii, percent)}
-            ${h.hidden('shares-%d.user_id' % ii, user.id)}
-          </td>
+          <th colspan="2">
+            % if c.net > 0:
+              The group owes you:
+            % elif c.net < 0:
+              You owe the group:
+            % endif
+          </th>
+          <th class="amount">${abs(c.net)}</th>
         </tr>
-      % endfor
-      <tr>
-        <td colspan="2">
-          ${h.submit(None, 'Submit', class_="submitbutton")}
-        </td>
-      </tr>
-    </table>
-  </form>
-</div>
-
-<div id="tab-transfer" class="tab">
-  <form action="${h.url_for(controller='transfer', action='update')}" method="post">
-    ${h.auth_token_hidden_field()}
-    <table class="form">
-      <tr>
-        <th><label for="debtor_id">From</label></th>
-        <td>${h.select('debtor_id', request.environ['user'].id, c.users)}</td>
-      </tr>
-      <tr>
-        <th><label for="creditor_id">To</label></th>
-        <td>${h.select('creditor_id', None, c.users)}</td>
-      </tr>
-      <tr>
-        <th><label for="amount">Amount</label></th>
-        <td>${h.currency('amount', 0, size=8)}</td>
-      </tr>
-      <tr>
-        <th><label for="date">Date</label></th>
-        <td>${h.text('date', date.today().strftime('%m/%d/%Y'), size=16)}</td>
-      </tr>
-      <tr>
-        <th><label for="description">Description</label></th>
-        <td>${h.text('description')}</td>
-      </tr>
-      <tr>
-        <td colspan="2">
-          <input type="submit" value="Submit" />
-        </td>
-      </tr>
+      % endif
     </table>
-  </form>
+  % endif
 </div>
+${self.spendForm()}
+${self.transferForm()}