2016-08-24 17:50:22 +00:00
{% extends "core/base.jinja" %}
{% block title %}
2024-07-23 22:16:31 +00:00
{% trans %} Edit operation {% endtrans %}
2016-08-24 17:50:22 +00:00
{% endblock %}
{% block content %}
2024-07-23 22:16:31 +00:00
<div id="accounting">
2017-10-09 11:58:18 +00:00
<p>
2024-07-23 22:16:31 +00:00
<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 %}
2016-12-29 00:08:08 +00:00
</p>
2017-10-09 11:58:18 +00:00
<hr>
<h2> {% trans %} Edit operation {% endtrans %} </h2>
<form action="" method="post">
2024-07-23 22:16:31 +00:00
{% csrf_token %}
{{ form .non_field_errors ( ) }}
{{ 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>
<br />
<strong> {% trans %} Warning: if you select <em>Account</em>, the opposite operation will be created in the target account. If you don't want that, select <em>Club</em> instead of <em>Account</em>. {% endtrans %} </strong>
<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 }}
<span id="id_need_link_full"><label> {{ form .need_link .label }} </label> {{ form .need_link }} </span>
<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> {{
2017-10-09 11:58:18 +00:00
form.cheque_number }}</p>
2024-07-23 22:16:31 +00:00
<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> {{
2017-10-09 11:58:18 +00:00
form.accounting_type }}</p>
2024-07-23 22:16:31 +00:00
<p> {{ form .label .errors }} <label for=" {{ form .label .name }} "> {{ form .label .label }} </label> {{ form .label }} </p>
<p> {{ form .done .errors }} <label for=" {{ form .done .name }} "> {{ form .done .label }} </label> {{ form .done }} </p>
{% if form .instance .linked_operation %}
2017-10-09 11:58:18 +00:00
{% set obj = form .instance .linked_operation %}
<p><strong> {% trans %} Linked operation: {% endtrans %} </strong><br>
2024-07-23 22:16:31 +00:00
<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> >
n° {{ obj .number }}
2017-10-09 11:58:18 +00:00
</p>
2024-07-23 22:16:31 +00:00
{% endif %}
<p><input type="submit" value=" {% trans %} Save {% endtrans %} " /></p>
2017-10-09 11:58:18 +00:00
</form>
2024-07-23 22:16:31 +00:00
{% endblock %}
2016-08-24 17:50:22 +00:00
2024-07-23 22:16:31 +00:00
{% block script %}
{{ super ( ) }}
<script>
2017-10-09 11:58:18 +00:00
$( function() {
2024-07-23 22:16:31 +00:00
var target_type = $('#id_target_type');
2024-10-21 11:26:11 +00:00
var user = $('user-ajax-select');
var club = $('club-ajax-select');
var club_account = $('club-account-ajax-select');
var company = $('company-ajax-select');
2024-07-23 22:16:31 +00:00
var other = $('#id_target_label');
var need_link = $('#id_need_link_full');
function update_targets () {
if (target_type.val() == "USER") {
console.log(user);
user.show();
club.hide();
club_account.hide();
company.hide();
other.hide();
need_link.hide();
} else if (target_type.val() == "ACCOUNT") {
club_account.show();
need_link.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();
need_link.hide();
} else if (target_type.val() == "COMPANY") {
company.show();
user.hide();
club_account.hide();
club.hide();
other.hide();
need_link.hide();
} else if (target_type.val() == "OTHER") {
other.show();
user.hide();
club.hide();
club_account.hide();
company.hide();
need_link.hide();
} else {
company.hide();
user.hide();
club_account.hide();
club.hide();
other.hide();
need_link.hide();
}
}
update_targets();
target_type.change(update_targets);
} );
</script>
</div>
2016-08-24 17:50:22 +00:00
{% endblock %}