operation_edit.jinja 4.78 KB
Newer Older
Skia's avatar
Skia committed
1
2
3
4
5
6
7
{% extends "core/base.jinja" %}

{% block title %}
{% trans %}Edit operation{% endtrans %}
{% endblock %}

{% block content %}
Skia's avatar
Skia committed
8
9
10
11
12
13
14
15
<p>
<a href="{{ url('accounting:bank_list') }}">{% trans %}Accounting{% endtrans %}</a> >
<a href="{{ url('accounting:bank_details', b_account_id=object.club_account.bank_account.id) }}">{{object.club_account.bank_account }}</a> >
<a href="{{ url('accounting:club_details', c_account_id=object.club_account.id) }}">{{ object.club_account }}</a> >
<a href="{{ url('accounting:journal_details', j_id=object.id) }}">{{ object.name }}</a> >
{% trans %}Edit operation{% endtrans %}
</p>
<hr>
Skia's avatar
Skia committed
16
17
18
<h2>{% trans %}Edit operation{% endtrans %}</h2>
<form action="" method="post">
    {% csrf_token %}
Skia's avatar
Skia committed
19
    {{ form.non_field_errors() }}
Skia's avatar
Skia committed
20
21
22
23
    {{ form.journal }}
    {{ form.target_id }}
    <p>{{ form.amount.errors }}<label for="{{ form.amount.name }}">{{ form.amount.label }}</label> {{ form.amount }}</p>
    <p>{{ form.remark.errors }}<label for="{{ form.remark.name }}">{{ form.remark.label }}</label> {{ form.remark }}</p>
Skia's avatar
Skia committed
24
25
26
27
28
29
    <p>{{ form.target_type.errors }}<label for="{{ form.target_type.name }}">{{ form.target_type.label }}</label> {{ form.target_type }}</p>
        {{ form.user }}
        {{ form.club }}
        {{ form.club_account }}
        {{ form.company }}
        {{ form.target_label }}
Skia's avatar
Skia committed
30
31
32
33
34
35
36
37
38
    <p>{{ form.date.errors }}<label for="{{ form.date.name }}">{{ form.date.label }}</label> {{ form.date }}</p>
    <p>{{ form.mode.errors }}<label for="{{ form.mode.name }}">{{ form.mode.label }}</label> {{ form.mode }}</p>
    <p>{{ form.cheque_number.errors }}<label for="{{ form.cheque_number.name }}">{{ form.cheque_number.label }}</label> {{
    form.cheque_number }}</p>
    <p>{{ form.invoice.errors }}<label for="{{ form.invoice.name }}">{{ form.invoice.label }}</label> {{ form.invoice }}</p>
    <p>{{ form.simpleaccounting_type.errors }}<label for="{{ form.simpleaccounting_type.name }}">{{
        form.simpleaccounting_type.label }}</label> {{ form.simpleaccounting_type }}</p>
    <p>{{ form.accounting_type.errors }}<label for="{{ form.accounting_type.name }}">{{ form.accounting_type.label }}</label> {{
    form.accounting_type }}</p>
Skia's avatar
Skia committed
39
    <p>{{ form.label.errors }}<label for="{{ form.label.name }}">{{ form.label.label }}</label> {{ form.label }}</p>
Skia's avatar
Skia committed
40
    <p>{{ form.done.errors }}<label for="{{ form.done.name }}">{{ form.done.label }}</label> {{ form.done }}</p>
41
42
43
44
45
46
47
48
49
50
    {% if form.instance.linked_operation %}
    {% set obj = form.instance.linked_operation %}
    <p><strong>{% trans %}Linked operation:{% endtrans %}</strong><br>
    <a href="{{ url('accounting:bank_details', b_account_id=obj.journal.club_account.bank_account.id) }}">
            {{obj.journal.club_account.bank_account }}</a> >
    <a href="{{ url('accounting:club_details', c_account_id=obj.journal.club_account.id) }}">{{ obj.journal.club_account }}</a> >
    <a href="{{ url('accounting:journal_details', j_id=obj.journal.id) }}">{{ obj.journal }}</a> >
{{ obj.number }}
    </p>
    {% endif %}
Skia's avatar
Skia committed
51
52
53
54
55
56
57
58
    <p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
{% endblock %}

{% block script %}
    {{ super() }}
<script>
$( function() {
Skia's avatar
Skia committed
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
        var target_type = $('#id_target_type');
        var user = $('#id_user_wrapper');
        var club = $('#id_club_wrapper');
        var club_account = $('#id_club_account_wrapper');
        var company = $('#id_company_wrapper');
        var other = $('#id_target_label');
        function update_targets () {
            if (target_type.val() == "USER") {
                console.log(user);
                user.show();
                club.hide();
                club_account.hide();
                company.hide();
                other.hide();
            } else if (target_type.val() == "ACCOUNT") {
                club_account.show();
                user.hide();
                club.hide();
                company.hide();
                other.hide();
            } else if (target_type.val() == "CLUB") {
                club.show();
                user.hide();
                club_account.hide();
                company.hide();
                other.hide();
            } else if (target_type.val() == "COMPANY") {
                company.show();
                user.hide();
                club_account.hide();
                club.hide();
                other.hide();
            } else if (target_type.val() == "OTHER") {
                other.show();
                user.hide();
                club.hide();
                club_account.hide();
                company.hide();
            } else {
                company.hide();
                user.hide();
                club_account.hide();
                club.hide();
                other.hide();
            }
        }
        update_targets();
        target_type.change(update_targets);
        } );
Skia's avatar
Skia committed
108
109
110
111
</script>
{% endblock %}