Move transfer type selector in credit/debit mode

This commit is contained in:
Yohann D'ANELLO 2020-08-31 23:06:21 +02:00
parent e74f92cf8d
commit 5642c268e9
6 changed files with 166 additions and 114 deletions

View File

@ -16,6 +16,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
<a href="{% url "note:transfer" %}#credit" class="btn btn-sm btn-outline-primary"> <a href="{% url "note:transfer" %}#credit" class="btn btn-sm btn-outline-primary">
{% trans "Credit" %} {% trans "Credit" %}
</a> </a>
<a href="{% url "note:transfer" %}#debit" class="btn btn-sm btn-outline-primary">
{% trans "Debit" %}
</a>
{% endif %} {% endif %}
{% for a in activities_open %} {% for a in activities_open %}
<a href="{% url "activity:activity_entry" pk=a.pk %}" <a href="{% url "activity:activity_entry" pk=a.pk %}"

View File

@ -173,14 +173,16 @@ class TransactionSerializer(serializers.ModelSerializer):
The djangorestframework plugin will analyse the model `Transaction` and parse all fields in the API. The djangorestframework plugin will analyse the model `Transaction` and parse all fields in the API.
""" """
def validate_source(self, value): def validate_source(self, value):
if value.is_active: if not value.is_active:
raise ValidationError(_("The transaction can't be saved since the source note " raise ValidationError(_("The transaction can't be saved since the source note "
"or the destination note is not active.")) "or the destination note is not active."))
return value
def validate_destination(self, value): def validate_destination(self, value):
if value.is_active: if not value.is_active:
raise ValidationError(_("The transaction can't be saved since the source note " raise ValidationError(_("The transaction can't be saved since the source note "
"or the destination note is not active.")) "or the destination note is not active."))
return value
class Meta: class Meta:
model = Transaction model = Transaction

View File

@ -19,12 +19,10 @@ SPDX-License-Identifier: GPL-2.0-or-later
<input type="radio" name="transaction_type" id="type_credit"> <input type="radio" name="transaction_type" id="type_credit">
{% trans "Credit" %} {% trans "Credit" %}
</label> </label>
{% if not activities_open %} <label for="type_debit" class="btn btn-sm btn-outline-primary">
<label type="type_debit" class="btn btn-sm btn-outline-primary"> <input type="radio" name="transaction_type" id="type_debit">
<input type="radio" name="transaction_type" id="type_debit"> {% trans "Debit" %}
{% trans "Debit" %} </label>
</label>
{% endif %}
{% endif %} {% endif %}
{% for activity in activities_open %} {% for activity in activities_open %}
<a href="{% url "activity:activity_entry" pk=activity.pk %}" class="btn btn-sm btn-outline-primary"> <a href="{% url "activity:activity_entry" pk=activity.pk %}" class="btn btn-sm btn-outline-primary">
@ -40,7 +38,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="col-md-3" id="note_infos_div"> <div class="col-md-3" id="note_infos_div">
<div class="card bg-light border-success shadow mb-4"> <div class="card bg-light border-success shadow mb-4">
<a id="profile_pic_link" href="#"><img src="/media/pic/default.png" <a id="profile_pic_link" href="#"><img src="/media/pic/default.png"
id="profile_pic" alt="" class="img-fluid rounded mx-auto d-block"></a> id="profile_pic" alt="" class="img-fluid rounded mx-auto"></a>
<div class="card-body text-center"> <div class="card-body text-center">
<span id="user_note"></span> <span id="user_note"></span>
</div> </div>
@ -52,16 +50,21 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="card bg-light border-success shadow mb-4"> <div class="card bg-light border-success shadow mb-4">
<div class="card-header"> <div class="card-header">
<p class="card-text font-weight-bold"> <p class="card-text font-weight-bold">
{% trans "Select emitters" %} <label for="source_note" id="source_note_label">{% trans "Select emitters" %}</label>
</p> </p>
</div> </div>
<ul class="list-group list-group-flush" id="source_note_list"> <ul class="list-group list-group-flush" id="source_note_list">
</ul> </ul>
<div class="card-body"> <div class="card-body">
<input class="form-control mx-auto d-block" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" /> <select id="credit_type" class="custom-select d-none">
{% for special_type in special_types %}
<option value="{{ special_type.id }}">{{ special_type.special_type }}</option>
{% endfor %}
</select>
<input class="form-control mx-auto" type="text" id="source_note" placeholder="{% trans "Name or alias..." %}" />
<div id="source_me_div"> <div id="source_me_div">
<hr> <hr>
<span class="form-control mx-auto d-block btn btn-secondary" id="source_me"> <span class="form-control mx-auto btn btn-secondary" id="source_me">
{% trans "I am the emitter" %} {% trans "I am the emitter" %}
</span> </span>
</div> </div>
@ -74,13 +77,18 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="card bg-light border-info shadow mb-4"> <div class="card bg-light border-info shadow mb-4">
<div class="card-header"> <div class="card-header">
<p class="card-text font-weight-bold" id="dest_title"> <p class="card-text font-weight-bold" id="dest_title">
{% trans "Select receivers" %} <label for="dest_note" id="dest_note_label">{% trans "Select receivers" %}</label>
</p> </p>
</div> </div>
<ul class="list-group list-group-flush" id="dest_note_list"> <ul class="list-group list-group-flush" id="dest_note_list">
</ul> </ul>
<div class="card-body"> <div class="card-body">
<input class="form-control mx-auto d-block" type="text" id="dest_note" placeholder="{% trans "Name or alias..." %}" /> <select id="debit_type" class="custom-select d-none">
{% for special_type in special_types %}
<option value="{{ special_type.id }}">{{ special_type.special_type }}</option>
{% endfor %}
</select>
<input class="form-control mx-auto" type="text" id="dest_note" placeholder="{% trans "Name or alias..." %}" />
<ul class="list-group list-group-flush" id="dest_alias_matched"> <ul class="list-group list-group-flush" id="dest_alias_matched">
</ul> </ul>
</div> </div>
@ -108,22 +116,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="form-row"> <div class="form-row">
<div class="col-md-12"> <div class="col-md-12">
<label for="reason">{% trans "Reason" %} :</label> <label for="reason">{% trans "Reason" %} :</label>
<input class="form-control mx-auto d-block" type="text" id="reason" /> <input class="form-control mx-auto" type="text" id="reason" />
<p id="reason-required" class="invalid-feedback"></p> <p id="reason-required" class="invalid-feedback"></p>
</div> </div>
</div> </div>
{# in case of special transaction add identity information #} {# in case of special transaction add identity information #}
<div class="d-none" id="special_transaction_div"> <div class="d-none" id="special_transaction_div">
<div class="form-row">
<div class="col-md-12">
<label for="credit_type">{% trans "Transfer type" %} :</label>
<select id="credit_type" class="custom-select">
{% for special_type in special_types %}
<option value="{{ special_type.id }}">{{ special_type.special_type }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-row"> <div class="form-row">
<div class="col-md-12"> <div class="col-md-12">
<label for="last_name">{% trans "Name" %} :</label> <label for="last_name">{% trans "Name" %} :</label>
@ -170,6 +168,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
SPECIAL_TRANSFER_POLYMORPHIC_CTYPE = {{ special_polymorphic_ctype }}; SPECIAL_TRANSFER_POLYMORPHIC_CTYPE = {{ special_polymorphic_ctype }};
user_id = {{ user.note.pk }}; user_id = {{ user.note.pk }};
username = "{{ user.username|escapejs }}"; username = "{{ user.username|escapejs }}";
select_emitter_label = "{% trans "Select emitter" %}";
select_emitters_label = "{% trans "Select emitters" %}";
select_receveir_label = "{% trans "Select receiver" %}";
select_receveirs_label = "{% trans "Select receivers" %}";
transfer_type_label = "{% trans "Transfer type" %}";
</script> </script>
<script src="/static/js/transfer.js"></script> <script src="/static/js/transfer.js"></script>
{% endblock %} {% endblock %}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-31 21:45+0200\n" "POT-Creation-Date: 2020-08-31 23:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -169,12 +169,12 @@ msgid "note"
msgstr "" msgstr ""
#: apps/activity/models.py:183 #: apps/activity/models.py:183
#: apps/activity/templates/activity/activity_entry.html:42 #: apps/activity/templates/activity/activity_entry.html:45
msgid "entry" msgid "entry"
msgstr "" msgstr ""
#: apps/activity/models.py:184 #: apps/activity/models.py:184
#: apps/activity/templates/activity/activity_entry.html:42 #: apps/activity/templates/activity/activity_entry.html:45
msgid "entries" msgid "entries"
msgstr "" msgstr ""
@ -248,7 +248,7 @@ msgid "Last name"
msgstr "" msgstr ""
#: apps/activity/tables.py:84 apps/member/forms.py:136 #: apps/activity/tables.py:84 apps/member/forms.py:136
#: apps/note/templates/note/transaction_form.html:135 #: apps/note/templates/note/transaction_form.html:133
#: apps/registration/forms.py:86 apps/treasury/forms.py:137 #: apps/registration/forms.py:86 apps/treasury/forms.py:137
#: apps/wei/forms/registration.py:101 #: apps/wei/forms/registration.py:101
msgid "First name" msgid "First name"
@ -269,8 +269,8 @@ msgstr ""
#: apps/activity/templates/activity/activity_entry.html:13 #: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:259 #: apps/note/models/transactions.py:259
#: apps/note/templates/note/transaction_form.html:15 #: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:149 #: apps/note/templates/note/transaction_form.html:147
#: note_kfet/templates/base.html:76 #: note_kfet/templates/base.html:78
msgid "Transfer" msgid "Transfer"
msgstr "" msgstr ""
@ -280,12 +280,18 @@ msgstr ""
msgid "Credit" msgid "Credit"
msgstr "" msgstr ""
#: apps/activity/templates/activity/activity_entry.html:23 #: apps/activity/templates/activity/activity_entry.html:20
#: apps/note/templates/note/transaction_form.html:31 #: apps/note/models/transactions.py:313
#: apps/note/templates/note/transaction_form.html:24
msgid "Debit"
msgstr ""
#: apps/activity/templates/activity/activity_entry.html:26
#: apps/note/templates/note/transaction_form.html:29
msgid "Entries" msgid "Entries"
msgstr "" msgstr ""
#: apps/activity/templates/activity/activity_entry.html:33 #: apps/activity/templates/activity/activity_entry.html:36
msgid "Return to activity page" msgid "Return to activity page"
msgstr "" msgstr ""
@ -359,7 +365,7 @@ msgstr ""
msgid "Create new activity" msgid "Create new activity"
msgstr "" msgstr ""
#: apps/activity/views.py:59 note_kfet/templates/base.html:91 #: apps/activity/views.py:59 note_kfet/templates/base.html:96
msgid "Activities" msgid "Activities"
msgstr "" msgstr ""
@ -523,7 +529,7 @@ msgstr ""
msgid "Credit amount" msgid "Credit amount"
msgstr "" msgstr ""
#: apps/member/forms.py:141 apps/note/templates/note/transaction_form.html:141 #: apps/member/forms.py:141 apps/note/templates/note/transaction_form.html:139
#: apps/registration/forms.py:91 apps/treasury/forms.py:139 #: apps/registration/forms.py:91 apps/treasury/forms.py:139
#: apps/wei/forms/registration.py:106 #: apps/wei/forms/registration.py:106
msgid "Bank" msgid "Bank"
@ -1080,7 +1086,7 @@ msgstr ""
msgid "amount" msgid "amount"
msgstr "" msgstr ""
#: apps/note/api/serializers.py:177 apps/note/api/serializers.py:182 #: apps/note/api/serializers.py:177 apps/note/api/serializers.py:183
#: apps/note/models/transactions.py:224 #: apps/note/models/transactions.py:224
msgid "" msgid ""
"The transaction can't be saved since the source note or the destination note " "The transaction can't be saved since the source note or the destination note "
@ -1095,7 +1101,7 @@ msgstr ""
msgid "Destination" msgid "Destination"
msgstr "" msgstr ""
#: apps/note/forms.py:72 apps/note/templates/note/transaction_form.html:110 #: apps/note/forms.py:72 apps/note/templates/note/transaction_form.html:118
msgid "Reason" msgid "Reason"
msgstr "" msgstr ""
@ -1317,11 +1323,6 @@ msgstr ""
msgid "bank" msgid "bank"
msgstr "" msgstr ""
#: apps/note/models/transactions.py:313
#: apps/note/templates/note/transaction_form.html:25
msgid "Debit"
msgstr ""
#: apps/note/models/transactions.py:324 #: apps/note/models/transactions.py:324
msgid "" msgid ""
"A special transaction is only possible between a Note associated to a " "A special transaction is only possible between a Note associated to a "
@ -1378,8 +1379,8 @@ msgid "Consum"
msgstr "" msgstr ""
#: apps/note/templates/note/conso_form.html:44 #: apps/note/templates/note/conso_form.html:44
#: apps/note/templates/note/transaction_form.html:61 #: apps/note/templates/note/transaction_form.html:64
#: apps/note/templates/note/transaction_form.html:83 #: apps/note/templates/note/transaction_form.html:91
msgid "Name or alias..." msgid "Name or alias..."
msgstr "" msgstr ""
@ -1404,7 +1405,7 @@ msgid "Double consumptions"
msgstr "" msgstr ""
#: apps/note/templates/note/conso_form.html:154 #: apps/note/templates/note/conso_form.html:154
#: apps/note/templates/note/transaction_form.html:160 #: apps/note/templates/note/transaction_form.html:158
msgid "Recent transactions history" msgid "Recent transactions history"
msgstr "" msgstr ""
@ -1418,38 +1419,48 @@ msgstr ""
msgid "Mail generated by the Note Kfet on the" msgid "Mail generated by the Note Kfet on the"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:55 #: apps/note/templates/note/transaction_form.html:53
#: apps/note/templates/note/transaction_form.html:173
msgid "Select emitters" msgid "Select emitters"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:65 #: apps/note/templates/note/transaction_form.html:68
msgid "I am the emitter" msgid "I am the emitter"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:77 #: apps/note/templates/note/transaction_form.html:80
#: apps/note/templates/note/transaction_form.html:175
msgid "Select receivers" msgid "Select receivers"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:95 #: apps/note/templates/note/transaction_form.html:103
msgid "Action" msgid "Action"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:103 #: apps/note/templates/note/transaction_form.html:111
#: apps/treasury/forms.py:141 apps/treasury/tables.py:67 #: apps/treasury/forms.py:141 apps/treasury/tables.py:67
#: apps/treasury/tables.py:135 #: apps/treasury/tables.py:135
#: apps/treasury/templates/treasury/remittance_form.html:23 #: apps/treasury/templates/treasury/remittance_form.html:23
msgid "Amount" msgid "Amount"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:119 #: apps/note/templates/note/transaction_form.html:127
msgid "Transfer type"
msgstr ""
#: apps/note/templates/note/transaction_form.html:129
#: apps/treasury/models.py:51 #: apps/treasury/models.py:51
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: apps/note/templates/note/transaction_form.html:172
msgid "Select emitter"
msgstr ""
#: apps/note/templates/note/transaction_form.html:174
msgid "Select receiver"
msgstr ""
#: apps/note/templates/note/transaction_form.html:176
msgid "Transfer type"
msgstr ""
#: apps/note/templates/note/transactiontemplate_form.html:10 #: apps/note/templates/note/transactiontemplate_form.html:10
msgid "Buttons list" msgid "Buttons list"
msgstr "" msgstr ""
@ -1502,7 +1513,7 @@ msgstr ""
msgid "Update button" msgid "Update button"
msgstr "" msgstr ""
#: apps/note/views.py:151 note_kfet/templates/base.html:71 #: apps/note/views.py:151 note_kfet/templates/base.html:72
msgid "Consumptions" msgid "Consumptions"
msgstr "" msgstr ""
@ -1666,7 +1677,7 @@ msgid ""
"with these parameters. Please correct your data and retry." "with these parameters. Please correct your data and retry."
msgstr "" msgstr ""
#: apps/permission/views.py:96 note_kfet/templates/base.html:106 #: apps/permission/views.py:96 note_kfet/templates/base.html:114
msgid "Rights" msgid "Rights"
msgstr "" msgstr ""
@ -1844,7 +1855,7 @@ msgstr ""
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "" msgstr ""
#: apps/treasury/apps.py:12 note_kfet/templates/base.html:96 #: apps/treasury/apps.py:12 note_kfet/templates/base.html:102
msgid "Treasury" msgid "Treasury"
msgstr "" msgstr ""
@ -2213,7 +2224,7 @@ msgstr ""
#: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50
#: apps/wei/models.py:61 apps/wei/models.py:167 #: apps/wei/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:101 #: note_kfet/templates/base.html:108
msgid "WEI" msgid "WEI"
msgstr "" msgstr ""
@ -2787,19 +2798,19 @@ msgstr ""
msgid "The ENS Paris-Saclay BDE note." msgid "The ENS Paris-Saclay BDE note."
msgstr "" msgstr ""
#: note_kfet/templates/base.html:81 #: note_kfet/templates/base.html:84
msgid "Users" msgid "Users"
msgstr "" msgstr ""
#: note_kfet/templates/base.html:86 #: note_kfet/templates/base.html:90
msgid "Clubs" msgid "Clubs"
msgstr "" msgstr ""
#: note_kfet/templates/base.html:111 #: note_kfet/templates/base.html:119
msgid "Admin" msgid "Admin"
msgstr "" msgstr ""
#: note_kfet/templates/base.html:155 #: note_kfet/templates/base.html:163
msgid "" msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click " "Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link." "on the validation link."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-31 21:45+0200\n" "POT-Creation-Date: 2020-08-31 23:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -172,12 +172,12 @@ msgid "note"
msgstr "note" msgstr "note"
#: apps/activity/models.py:183 #: apps/activity/models.py:183
#: apps/activity/templates/activity/activity_entry.html:42 #: apps/activity/templates/activity/activity_entry.html:45
msgid "entry" msgid "entry"
msgstr "entrée" msgstr "entrée"
#: apps/activity/models.py:184 #: apps/activity/models.py:184
#: apps/activity/templates/activity/activity_entry.html:42 #: apps/activity/templates/activity/activity_entry.html:45
msgid "entries" msgid "entries"
msgstr "entrées" msgstr "entrées"
@ -251,7 +251,7 @@ msgid "Last name"
msgstr "Nom de famille" msgstr "Nom de famille"
#: apps/activity/tables.py:84 apps/member/forms.py:136 #: apps/activity/tables.py:84 apps/member/forms.py:136
#: apps/note/templates/note/transaction_form.html:135 #: apps/note/templates/note/transaction_form.html:133
#: apps/registration/forms.py:86 apps/treasury/forms.py:137 #: apps/registration/forms.py:86 apps/treasury/forms.py:137
#: apps/wei/forms/registration.py:101 #: apps/wei/forms/registration.py:101
msgid "First name" msgid "First name"
@ -272,8 +272,8 @@ msgstr "Liste des invités"
#: apps/activity/templates/activity/activity_entry.html:13 #: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:259 #: apps/note/models/transactions.py:259
#: apps/note/templates/note/transaction_form.html:15 #: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:149 #: apps/note/templates/note/transaction_form.html:147
#: note_kfet/templates/base.html:76 #: note_kfet/templates/base.html:78
msgid "Transfer" msgid "Transfer"
msgstr "Virement" msgstr "Virement"
@ -283,12 +283,18 @@ msgstr "Virement"
msgid "Credit" msgid "Credit"
msgstr "Crédit" msgstr "Crédit"
#: apps/activity/templates/activity/activity_entry.html:23 #: apps/activity/templates/activity/activity_entry.html:20
#: apps/note/templates/note/transaction_form.html:31 #: apps/note/models/transactions.py:313
#: apps/note/templates/note/transaction_form.html:24
msgid "Debit"
msgstr "Débit"
#: apps/activity/templates/activity/activity_entry.html:26
#: apps/note/templates/note/transaction_form.html:29
msgid "Entries" msgid "Entries"
msgstr "Entrées" msgstr "Entrées"
#: apps/activity/templates/activity/activity_entry.html:33 #: apps/activity/templates/activity/activity_entry.html:36
msgid "Return to activity page" msgid "Return to activity page"
msgstr "Retour à la page de l'activité" msgstr "Retour à la page de l'activité"
@ -362,7 +368,7 @@ msgstr "Inviter"
msgid "Create new activity" msgid "Create new activity"
msgstr "Créer une nouvelle activité" msgstr "Créer une nouvelle activité"
#: apps/activity/views.py:59 note_kfet/templates/base.html:91 #: apps/activity/views.py:59 note_kfet/templates/base.html:96
msgid "Activities" msgid "Activities"
msgstr "Activités" msgstr "Activités"
@ -528,7 +534,7 @@ msgstr "Vous pouvez créditer la note de l'utisateur avant l'adhésion."
msgid "Credit amount" msgid "Credit amount"
msgstr "Montant à créditer" msgstr "Montant à créditer"
#: apps/member/forms.py:141 apps/note/templates/note/transaction_form.html:141 #: apps/member/forms.py:141 apps/note/templates/note/transaction_form.html:139
#: apps/registration/forms.py:91 apps/treasury/forms.py:139 #: apps/registration/forms.py:91 apps/treasury/forms.py:139
#: apps/wei/forms/registration.py:106 #: apps/wei/forms/registration.py:106
msgid "Bank" msgid "Bank"
@ -1107,7 +1113,7 @@ msgstr "destination"
msgid "amount" msgid "amount"
msgstr "montant" msgstr "montant"
#: apps/note/api/serializers.py:177 apps/note/api/serializers.py:182 #: apps/note/api/serializers.py:177 apps/note/api/serializers.py:183
#: apps/note/models/transactions.py:224 #: apps/note/models/transactions.py:224
msgid "" msgid ""
"The transaction can't be saved since the source note or the destination note " "The transaction can't be saved since the source note or the destination note "
@ -1124,7 +1130,7 @@ msgstr "Source"
msgid "Destination" msgid "Destination"
msgstr "Destination" msgstr "Destination"
#: apps/note/forms.py:72 apps/note/templates/note/transaction_form.html:110 #: apps/note/forms.py:72 apps/note/templates/note/transaction_form.html:118
msgid "Reason" msgid "Reason"
msgstr "Raison" msgstr "Raison"
@ -1358,11 +1364,6 @@ msgstr "prénom"
msgid "bank" msgid "bank"
msgstr "banque" msgstr "banque"
#: apps/note/models/transactions.py:313
#: apps/note/templates/note/transaction_form.html:25
msgid "Debit"
msgstr "Débit"
#: apps/note/models/transactions.py:324 #: apps/note/models/transactions.py:324
msgid "" msgid ""
"A special transaction is only possible between a Note associated to a " "A special transaction is only possible between a Note associated to a "
@ -1421,8 +1422,8 @@ msgid "Consum"
msgstr "Consommer" msgstr "Consommer"
#: apps/note/templates/note/conso_form.html:44 #: apps/note/templates/note/conso_form.html:44
#: apps/note/templates/note/transaction_form.html:61 #: apps/note/templates/note/transaction_form.html:64
#: apps/note/templates/note/transaction_form.html:83 #: apps/note/templates/note/transaction_form.html:91
msgid "Name or alias..." msgid "Name or alias..."
msgstr "Pseudo ou alias ..." msgstr "Pseudo ou alias ..."
@ -1447,7 +1448,7 @@ msgid "Double consumptions"
msgstr "Consommations doubles" msgstr "Consommations doubles"
#: apps/note/templates/note/conso_form.html:154 #: apps/note/templates/note/conso_form.html:154
#: apps/note/templates/note/transaction_form.html:160 #: apps/note/templates/note/transaction_form.html:158
msgid "Recent transactions history" msgid "Recent transactions history"
msgstr "Historique des transactions récentes" msgstr "Historique des transactions récentes"
@ -1461,38 +1462,48 @@ msgstr "Historique des transactions récentes"
msgid "Mail generated by the Note Kfet on the" msgid "Mail generated by the Note Kfet on the"
msgstr "Mail généré par la Note Kfet le" msgstr "Mail généré par la Note Kfet le"
#: apps/note/templates/note/transaction_form.html:55 #: apps/note/templates/note/transaction_form.html:53
#: apps/note/templates/note/transaction_form.html:173
msgid "Select emitters" msgid "Select emitters"
msgstr "Sélection des émetteurs" msgstr "Sélection des émetteurs"
#: apps/note/templates/note/transaction_form.html:65 #: apps/note/templates/note/transaction_form.html:68
msgid "I am the emitter" msgid "I am the emitter"
msgstr "Je suis l'émetteur" msgstr "Je suis l'émetteur"
#: apps/note/templates/note/transaction_form.html:77 #: apps/note/templates/note/transaction_form.html:80
#: apps/note/templates/note/transaction_form.html:175
msgid "Select receivers" msgid "Select receivers"
msgstr "Sélection des destinataires" msgstr "Sélection des destinataires"
#: apps/note/templates/note/transaction_form.html:95 #: apps/note/templates/note/transaction_form.html:103
msgid "Action" msgid "Action"
msgstr "Action" msgstr "Action"
#: apps/note/templates/note/transaction_form.html:103 #: apps/note/templates/note/transaction_form.html:111
#: apps/treasury/forms.py:141 apps/treasury/tables.py:67 #: apps/treasury/forms.py:141 apps/treasury/tables.py:67
#: apps/treasury/tables.py:135 #: apps/treasury/tables.py:135
#: apps/treasury/templates/treasury/remittance_form.html:23 #: apps/treasury/templates/treasury/remittance_form.html:23
msgid "Amount" msgid "Amount"
msgstr "Montant" msgstr "Montant"
#: apps/note/templates/note/transaction_form.html:119 #: apps/note/templates/note/transaction_form.html:127
msgid "Transfer type"
msgstr "Type de transfert"
#: apps/note/templates/note/transaction_form.html:129
#: apps/treasury/models.py:51 #: apps/treasury/models.py:51
msgid "Name" msgid "Name"
msgstr "Nom" msgstr "Nom"
#: apps/note/templates/note/transaction_form.html:172
msgid "Select emitter"
msgstr "Sélection de l'émetteur"
#: apps/note/templates/note/transaction_form.html:174
msgid "Select receiver"
msgstr "Sélection du destinataire"
#: apps/note/templates/note/transaction_form.html:176
msgid "Transfer type"
msgstr "Type de transfert"
#: apps/note/templates/note/transactiontemplate_form.html:10 #: apps/note/templates/note/transactiontemplate_form.html:10
msgid "Buttons list" msgid "Buttons list"
msgstr "Liste des boutons" msgstr "Liste des boutons"
@ -1545,7 +1556,7 @@ msgstr "Chercher un bouton"
msgid "Update button" msgid "Update button"
msgstr "Modifier le bouton" msgstr "Modifier le bouton"
#: apps/note/views.py:151 note_kfet/templates/base.html:71 #: apps/note/views.py:151 note_kfet/templates/base.html:72
msgid "Consumptions" msgid "Consumptions"
msgstr "Consommations" msgstr "Consommations"
@ -1671,7 +1682,8 @@ msgstr "Liste des utilisateurs ayant des droits surnormaux"
#: apps/permission/templates/permission/all_rights.html:17 #: apps/permission/templates/permission/all_rights.html:17
msgid "Superusers have all rights on everything, to manage the website." msgid "Superusers have all rights on everything, to manage the website."
msgstr "Les super-utilisateurs ont tous les droits sur tout, afin de gérer le site." msgstr ""
"Les super-utilisateurs ont tous les droits sur tout, afin de gérer le site."
#: apps/permission/templates/permission/all_rights.html:22 #: apps/permission/templates/permission/all_rights.html:22
msgid "Superusers" msgid "Superusers"
@ -1723,7 +1735,7 @@ msgstr ""
"Vous n'avez pas la permission d'ajouter une instance du modèle « {model} » " "Vous n'avez pas la permission d'ajouter une instance du modèle « {model} » "
"avec ces paramètres. Merci de les corriger et de réessayer." "avec ces paramètres. Merci de les corriger et de réessayer."
#: apps/permission/views.py:96 note_kfet/templates/base.html:106 #: apps/permission/views.py:96 note_kfet/templates/base.html:114
msgid "Rights" msgid "Rights"
msgstr "Droits" msgstr "Droits"
@ -1919,7 +1931,7 @@ msgstr ""
msgid "Invalidate pre-registration" msgid "Invalidate pre-registration"
msgstr "Invalider l'inscription" msgstr "Invalider l'inscription"
#: apps/treasury/apps.py:12 note_kfet/templates/base.html:96 #: apps/treasury/apps.py:12 note_kfet/templates/base.html:102
msgid "Treasury" msgid "Treasury"
msgstr "Trésorerie" msgstr "Trésorerie"
@ -2308,7 +2320,7 @@ msgstr "Gérer les crédits de la Société générale"
#: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50 #: apps/wei/apps.py:10 apps/wei/models.py:49 apps/wei/models.py:50
#: apps/wei/models.py:61 apps/wei/models.py:167 #: apps/wei/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:101 #: note_kfet/templates/base.html:108
msgid "WEI" msgid "WEI"
msgstr "WEI" msgstr "WEI"
@ -2916,19 +2928,19 @@ msgstr "Réinitialiser"
msgid "The ENS Paris-Saclay BDE note." msgid "The ENS Paris-Saclay BDE note."
msgstr "La note du BDE de l'ENS Paris-Saclay." msgstr "La note du BDE de l'ENS Paris-Saclay."
#: note_kfet/templates/base.html:81 #: note_kfet/templates/base.html:84
msgid "Users" msgid "Users"
msgstr "Utilisateurs" msgstr "Utilisateurs"
#: note_kfet/templates/base.html:86 #: note_kfet/templates/base.html:90
msgid "Clubs" msgid "Clubs"
msgstr "Clubs" msgstr "Clubs"
#: note_kfet/templates/base.html:111 #: note_kfet/templates/base.html:119
msgid "Admin" msgid "Admin"
msgstr "Admin" msgstr "Admin"
#: note_kfet/templates/base.html:155 #: note_kfet/templates/base.html:163
msgid "" msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click " "Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link." "on the validation link."

View File

@ -104,10 +104,17 @@ $(document).ready(function() {
$("#source_note").removeClass('is-invalid'); $("#source_note").removeClass('is-invalid');
$("#dest_note").removeClass('is-invalid'); $("#dest_note").removeClass('is-invalid');
$("#special_transaction_div").addClass('d-none'); $("#special_transaction_div").addClass('d-none');
source.attr('disabled', false); source.removeClass('d-none');
$("#source_note_list").removeClass('d-none'); $("#source_note_list").removeClass('d-none');
dest.attr('disabled', false); $("#credit_type").addClass('d-none');
dest.removeClass('d-none');
$("#dest_note_list").removeClass('d-none'); $("#dest_note_list").removeClass('d-none');
$("#debit_type").addClass('d-none');
$("#source_note_label").text(select_emitters_label);
$("#dest_note_label").text(select_receveirs_label);
location.hash = "transfer";
}); });
$("#type_credit").click(function() { $("#type_credit").click(function() {
@ -120,17 +127,23 @@ $(document).ready(function() {
$("#special_transaction_div").removeClass('d-none'); $("#special_transaction_div").removeClass('d-none');
$("#source_note_list").addClass('d-none'); $("#source_note_list").addClass('d-none');
$("#dest_note_list").removeClass('d-none'); $("#dest_note_list").removeClass('d-none');
source.attr('disabled', true); source.addClass('d-none');
source.val($("#credit_type option:selected").text());
source.tooltip('hide'); source.tooltip('hide');
dest.attr('disabled', false); $("#credit_type").removeClass('d-none');
dest.removeClass('d-none');
dest.val(''); dest.val('');
dest.tooltip('hide'); dest.tooltip('hide');
$("#debit_type").addClass('d-none');
$("#source_note_label").text(transfer_type_label);
$("#dest_note_label").text(select_receveir_label);
if (dests_notes_display.length > 1) { if (dests_notes_display.length > 1) {
$("#dest_note_list").html(''); $("#dest_note_list").html('');
dests_notes_display.length = 0; dests_notes_display.length = 0;
} }
location.hash = "credit";
}); });
$("#type_debit").click(function() { $("#type_debit").click(function() {
@ -143,17 +156,23 @@ $(document).ready(function() {
$("#special_transaction_div").removeClass('d-none'); $("#special_transaction_div").removeClass('d-none');
$("#source_note_list").removeClass('d-none'); $("#source_note_list").removeClass('d-none');
$("#dest_note_list").addClass('d-none'); $("#dest_note_list").addClass('d-none');
source.attr('disabled', false); source.removeClass('d-none');
source.val(''); source.val('');
source.tooltip('hide'); source.tooltip('hide');
dest.attr('disabled', true); $("#credit_type").addClass('d-none');
dest.val($("#credit_type option:selected").text()); dest.addClass('d-none');
dest.tooltip('hide'); dest.tooltip('hide');
$("#debit_type").removeClass('d-none');
$("#source_note_label").text(select_emitter_label);
$("#dest_note_label").text(transfer_type_label);
if (sources_notes_display.length > 1) { if (sources_notes_display.length > 1) {
$("#source_note_list").html(''); $("#source_note_list").html('');
sources_notes_display.length = 0; sources_notes_display.length = 0;
} }
location.hash = "debit";
}); });
$("#credit_type").change(function() { $("#credit_type").change(function() {
@ -174,7 +193,6 @@ $(document).ready(function() {
$("#type_" + location.hash.substr(1)).click(); $("#type_" + location.hash.substr(1)).click();
else else
type_transfer.click(); type_transfer.click();
location.hash = "";
$("#source_me").click(function() { $("#source_me").click(function() {
if (LOCK) if (LOCK)
@ -364,12 +382,13 @@ $("#btn_transfer").click(function() {
}); });
}); });
} else if ($("#type_credit").is(':checked') || $("#type_debit").is(':checked')) { } else if ($("#type_credit").is(':checked') || $("#type_debit").is(':checked')) {
let special_note = $("#credit_type").val(); let special_note;
let user_note; let user_note;
let alias; let alias;
let given_reason = reason; let given_reason = reason;
let source_id, dest_id; let source_id, dest_id;
if ($("#type_credit").is(':checked')) { if ($("#type_credit").is(':checked')) {
special_note = $("#credit_type").val();
user_note = dests_notes_display[0].note; user_note = dests_notes_display[0].note;
alias = dests_notes_display[0].name; alias = dests_notes_display[0].name;
source_id = special_note; source_id = special_note;
@ -379,6 +398,7 @@ $("#btn_transfer").click(function() {
reason += " (" + given_reason + ")"; reason += " (" + given_reason + ")";
} }
else { else {
special_note = $("#debit_type").val();
user_note = sources_notes_display[0].note; user_note = sources_notes_display[0].note;
alias = sources_notes_display[0].name; alias = sources_notes_display[0].name;
source_id = user_note.id; source_id = user_note.id;