summaryrefslogtreecommitdiff
path: root/templates/pages/show.mako
blob: 06a9915a57208ffe1b08b61046c16c004b7a42a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<%inherit file="/page.mako" />

% for e in exps:
    % if len(exps) > 1:
        <h2>${get_d(e)}</h2>
    % endif
    % for c in sorted(e.catexps, key = lambda c: c.cat.name):
        <%self:detail name="${c.cat.name}" sum="${c.expense}" set="${c.all}" args="exp">
            <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense | eur}</a>
        </%self:detail>
    % endfor

    <%self:detail name="Constant" sum="${e.constsum}" set="${e.consts}" args="exp">
        <a href=${"/const/%s" % exp.id | url}>${exp.monthly} -- ${exp.description}</a>
    </%self:detail>
    
    <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp" color="#ff2d2d">
        <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense | eur}</a>
    </%self:detail>
    <br/>
% endfor

<% 
    if e.date.month == 1:
        date = "%s/12" % (e.date.year - 1)
    else:
        date = "%s/%s" % (e.date.year, e.date.month - 1)
%>
${self.left_arrow(date, date)}

% if not is_last:
    <% 
        if e.date.month == 13 - len(exps):
            date = "%s/1" % (e.date.year + 1)
        else:
            date = "%s/%s" % (e.date.year, e.date.month + len(exps))
    %>
    ${self.right_arrow(date, date)}
% endif

<%block name="heading">
    % if len(exps) > 1:
        Aktuelle Kosten
    % else:
        Kosten für ${get_d(exps[0])}
    % endif
</%block>

<%def name="get_d(e)">
    ${e.date.year}/${e.date.month}
</%def>

<%block name="js">
    ${parent.js()}
    <script type="text/javascript" src=${"/static/js/show.js" | url}></script>
</%block>

<%def name="detail(name, sum, set, color=None)">
    <div class="detail">
        <img class="mark" src=${"/static/images/closed.png" | url} />
        <%self:colorize fgcolor="${color}">
            <span class="heading">${name}:</span>    <span class="sum">${sum | eur}</span><br/>
        </%self:colorize>
        <div class="details">
            <ul>
                % for exp in set:
                    <li class="expense">${caller.body(exp)}</li>
                % endfor
            </ul>
        </div>
    </div>
</%def>