X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=bluechips%2Ftemplates%2Fspend%2Findex.mako;h=d4064cb58e914a3808e6daf92aa5d33de85cf32c;hb=9da57a31985a14a068b7542ada896ede0ff53ab5;hp=dc2f606070dd8a4cd8164164092674fd23ab16d7;hpb=c419902fc831dc8077c74a8e8a88da081dbe4cf0;p=bluechips.git diff --git a/bluechips/templates/spend/index.mako b/bluechips/templates/spend/index.mako index dc2f606..d4064cb 100644 --- a/bluechips/templates/spend/index.mako +++ b/bluechips/templates/spend/index.mako @@ -1,10 +1,7 @@ <%inherit file="/base.mako"/> -<%! - from decimal import Decimal -%> -
+ ${h.auth_token_hidden_field()} @@ -12,7 +9,7 @@ - + @@ -22,6 +19,10 @@ + + + +
${h.currency('amount', c.expenditure.amount, size=8)}${h.currency('amount', c.expenditure.amount, size=8, onkeyup="calcSplit();")}
${h.text('description', c.expenditure.description, size=64)}
${h.text('tags', c.tags, size=64)}

Change how an expenditure is split up. Enter a percentage, or something like a percentage, for each user. They don't have to add to 100.

@@ -30,29 +31,28 @@ % for ii, user_row in enumerate(c.users): <% user_id, user = user_row - try: - percent = c.values['shares-%d.amount' % ii] - except TypeError: - try: - share = [s.share for s in c.expenditure.splits if s.user == user][0] - percent = (Decimal(100) * Decimal(int(share)) / Decimal(int(c.expenditure.amount))).quantize(Decimal("0.001")) - except IndexError: - percent = 0 + percent = c.values['shares-%d.amount' % ii] %> - - - + - ${h.text('shares-%d.amount' % ii, percent)} + ${h.text('shares-%d.amount' % ii, percent, class_="share-text", onkeyup="calcSplit();")} ${h.hidden('shares-%d.user_id' % ii, user.id)} + + 0.00 + % endfor + ${h.submit(None, 'Submit', class_="submitbutton")} + %if c.expenditure.id: + + %endif
+${h.javascript_link('%s/js/calculator.js' % request.script_name)}