summaryrefslogtreecommitdiff
path: root/templates/pages/show.mako
blob: 4a8f9ffee48d0ecd41ab76bad8a0ffc5c97530a1 (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
74
75
76
77
<%inherit file="/page.mako" />

% for e in exps:
    % if len(exps) > 1:
        <h2>${get_d(e)}</h2>
    % endif
    % for c in e.catexps:
        <%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}</a>
        </%self:detail>
    % endfor

    <%self:detail name="Constant" sum="${e.constsum}" set="${e.consts}" args="exp">
        <a href=${"/const/edit/%s" % exp.id | url}>${exp.monthly} -- ${exp.description}</a>
    </%self:detail>
    
    <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp">
        <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</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)
%>
<a id="left" href=${"/" + date | url}>
    <img src=${"/static/images/arrow_left.png" | url} />
    <span class="navdate">${date}</span>
</a>

% 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))
    %>
    <a id="right" href=${"/" + date | url}>
        <span class="navdate">${date}</span>
        <img src=${"/static/images/arrow_right.png" | url}/>
    </a>
% endif

<%def name="heading()">
    % if len(exps) > 1:
        Current expenses
    % else:
        Expenses for ${get_d(exps[0])}
    % endif
</%def>

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

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

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