aboutsummaryrefslogtreecommitdiff
path: root/budget/templates/forms.html
blob: 9e5ecd65547fbfee4e185b8b936f5e97bb94aa45 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{% macro input(field, multiple=False, class=None) -%}
      <div class="clearfix">

        {% if field.type != "SubmitField" %}
            {{ field.label }}
        {% endif %}
        <div class="input">
            {% if multiple == True %}
                {{ field(multiple=True, class=class) }}
            {% else %}
                {{ field(class=class) | safe }}
            {% endif %}
            {% if field.description %}
                <span class="help-inline">{{ field.description }}</span>
            {% endif %}
        </div>
      </div> <!-- /clearfix -->
{% endmacro %}

{% macro submit(field, cancel=False, home=False) -%}
    <div class="actions">
        <button type="submit" class="btn primary">{{ field.name }}</button>
        {% if home %}
        <a href="{{ url_for(".remind_password") }}">{{ _("Can't remember the password?") }}</a>
        {% endif %}
        {% if cancel %}
        <button id="cancel-form" type="reset" class="btn">{{ _("Cancel") }}</button>
        {% endif %}
      </div>
{% endmacro %}

{% macro authenticate(form, home=False) %}

    {% include "display_errors.html" %}

    {{ form.hidden_tag() }}
    {{ input(form.id) }}
    {{ input(form.password) }}
    {% if not home %}
    {{ submit(form.submit, home=True) }}
    {% endif %}

{% endmacro %}

{% macro create_project(form, home=False) %}

    {% include "display_errors.html" %}
    {{ form.hidden_tag() }}
    {% if not home %}
    {{ input(form.id) }}
    {% endif %}
    {{ input(form.name) }}
    {{ input(form.password) }}
    {{ input(form.contact_email) }}
    {% if not home %}
    {{ submit(form.submit, home=True) }}
    {% endif %}

{% endmacro %}

{% macro edit_project(form) %}

    {% include "display_errors.html" %}
    {{ form.hidden_tag() }}
    {{ input(form.name) }}
    {{ input(form.password) }}
    {{ input(form.contact_email) }}
    <div class="actions">
        <button class="btn primary">{{ _("Edit the project") }}</button>
        <a id="delete-project" style="color:red; margin-left:10px; cursor:pointer; ">{{ _("delete") }}</a>
    </div>

{% endmacro %}

{% macro add_bill(form, edit=False) %}

    <fieldset>
        <legend>{% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %}</legend>
    {% include "display_errors.html" %}
    {{ form.hidden_tag() }} 
    {{ input(form.date, class="datepicker") }} 
    {{ input(form.what) }} 
    {{ input(form.payer) }} 
    {{ input(form.amount) }} 
    {{ input(form.payed_for) }} 
    </fieldset>
    {{ submit(form.submit, cancel=True) }}

{% endmacro %}

{% macro add_member(form) %}
    {{ form.hidden_tag() }}
    {{ form.name(style="width: 141px;") }}
    <button class="btn">{{ _("Add") }}</button>

{% endmacro %}

{% macro invites(form) %}
    {{ form.hidden_tag() }}
    {{ input(form.emails) }}
    <div class="actions">
        <button class="btn primary">{{ _("Send the invitations") }}</button>
        <a href="{{ url_for(".list_bills") }}">{{ _("No, thanks") }}</a>
    </div>
{% endmacro %}

{% macro create_archive(form) %}
    <fieldset>
        <legend>{{ _("Create an archive") }}</legend>
    {{ form.hidden_tag() }}
    {{ input(form.start_date) }}
    {{ input(form.end_date) }}
    </fieldset>
    <div class="actions">
        <button class="btn">{{ _("Create the archive") }}</button>
    </div>
{% endmacro %}

{% macro remind_password(form) %}

    {% include "display_errors.html" %}
    {{ form.hidden_tag() }}
    {{ input(form.id) }}
    {{ submit(form.submit) }}

{% endmacro %}