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">
{% trans "Credit" %}
</a>
<a href="{% url "note:transfer" %}#debit" class="btn btn-sm btn-outline-primary">
{% trans "Debit" %}
</a>
{% endif %}
{% for a in activities_open %}
<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.
"""
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 "
"or the destination note is not active."))
return 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 "
"or the destination note is not active."))
return value
class Meta:
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">
{% trans "Credit" %}
</label>
{% if not activities_open %}
<label type="type_debit" class="btn btn-sm btn-outline-primary">
<input type="radio" name="transaction_type" id="type_debit">
{% trans "Debit" %}
</label>
{% endif %}
<label for="type_debit" class="btn btn-sm btn-outline-primary">
<input type="radio" name="transaction_type" id="type_debit">
{% trans "Debit" %}
</label>
{% endif %}
{% for activity in activities_open %}
<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="card bg-light border-success shadow mb-4">
<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">
<span id="user_note"></span>
</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-header">
<p class="card-text font-weight-bold">
{% trans "Select emitters" %}
<label for="source_note" id="source_note_label">{% trans "Select emitters" %}</label>
</p>
</div>
<ul class="list-group list-group-flush" id="source_note_list">
</ul>
<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">
<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" %}
</span>
</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-header">
<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>
</div>
<ul class="list-group list-group-flush" id="dest_note_list">
</ul>
<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>
</div>
@ -108,22 +116,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="form-row">
<div class="col-md-12">
<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>
</div>
</div>
{# in case of special transaction add identity information #}
<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="col-md-12">
<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 }};
user_id = {{ user.note.pk }};
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 src="/static/js/transfer.js"></script>
{% endblock %}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -169,12 +169,12 @@ msgid "note"
msgstr ""
#: apps/activity/models.py:183
#: apps/activity/templates/activity/activity_entry.html:42
#: apps/activity/templates/activity/activity_entry.html:45
msgid "entry"
msgstr ""
#: apps/activity/models.py:184
#: apps/activity/templates/activity/activity_entry.html:42
#: apps/activity/templates/activity/activity_entry.html:45
msgid "entries"
msgstr ""
@ -248,7 +248,7 @@ msgid "Last name"
msgstr ""
#: 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/wei/forms/registration.py:101
msgid "First name"
@ -269,8 +269,8 @@ msgstr ""
#: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:259
#: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:149
#: note_kfet/templates/base.html:76
#: apps/note/templates/note/transaction_form.html:147
#: note_kfet/templates/base.html:78
msgid "Transfer"
msgstr ""
@ -280,12 +280,18 @@ msgstr ""
msgid "Credit"
msgstr ""
#: apps/activity/templates/activity/activity_entry.html:23
#: apps/note/templates/note/transaction_form.html:31
#: apps/activity/templates/activity/activity_entry.html:20
#: 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"
msgstr ""
#: apps/activity/templates/activity/activity_entry.html:33
#: apps/activity/templates/activity/activity_entry.html:36
msgid "Return to activity page"
msgstr ""
@ -359,7 +365,7 @@ msgstr ""
msgid "Create new activity"
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"
msgstr ""
@ -523,7 +529,7 @@ msgstr ""
msgid "Credit amount"
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/wei/forms/registration.py:106
msgid "Bank"
@ -1080,7 +1086,7 @@ msgstr ""
msgid "amount"
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
msgid ""
"The transaction can't be saved since the source note or the destination note "
@ -1095,7 +1101,7 @@ msgstr ""
msgid "Destination"
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"
msgstr ""
@ -1317,11 +1323,6 @@ msgstr ""
msgid "bank"
msgstr ""
#: apps/note/models/transactions.py:313
#: apps/note/templates/note/transaction_form.html:25
msgid "Debit"
msgstr ""
#: apps/note/models/transactions.py:324
msgid ""
"A special transaction is only possible between a Note associated to a "
@ -1378,8 +1379,8 @@ msgid "Consum"
msgstr ""
#: apps/note/templates/note/conso_form.html:44
#: apps/note/templates/note/transaction_form.html:61
#: apps/note/templates/note/transaction_form.html:83
#: apps/note/templates/note/transaction_form.html:64
#: apps/note/templates/note/transaction_form.html:91
msgid "Name or alias..."
msgstr ""
@ -1404,7 +1405,7 @@ msgid "Double consumptions"
msgstr ""
#: 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"
msgstr ""
@ -1418,38 +1419,48 @@ msgstr ""
msgid "Mail generated by the Note Kfet on the"
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"
msgstr ""
#: apps/note/templates/note/transaction_form.html:65
#: apps/note/templates/note/transaction_form.html:68
msgid "I am the emitter"
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"
msgstr ""
#: apps/note/templates/note/transaction_form.html:95
#: apps/note/templates/note/transaction_form.html:103
msgid "Action"
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/tables.py:135
#: apps/treasury/templates/treasury/remittance_form.html:23
msgid "Amount"
msgstr ""
#: apps/note/templates/note/transaction_form.html:119
msgid "Transfer type"
msgstr ""
#: apps/note/templates/note/transaction_form.html:129
#: apps/note/templates/note/transaction_form.html:127
#: apps/treasury/models.py:51
msgid "Name"
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
msgid "Buttons list"
msgstr ""
@ -1502,7 +1513,7 @@ msgstr ""
msgid "Update button"
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"
msgstr ""
@ -1666,7 +1677,7 @@ msgid ""
"with these parameters. Please correct your data and retry."
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"
msgstr ""
@ -1844,7 +1855,7 @@ msgstr ""
msgid "Invalidate pre-registration"
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"
msgstr ""
@ -2213,7 +2224,7 @@ msgstr ""
#: 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
#: note_kfet/templates/base.html:101
#: note_kfet/templates/base.html:108
msgid "WEI"
msgstr ""
@ -2787,19 +2798,19 @@ msgstr ""
msgid "The ENS Paris-Saclay BDE note."
msgstr ""
#: note_kfet/templates/base.html:81
#: note_kfet/templates/base.html:84
msgid "Users"
msgstr ""
#: note_kfet/templates/base.html:86
#: note_kfet/templates/base.html:90
msgid "Clubs"
msgstr ""
#: note_kfet/templates/base.html:111
#: note_kfet/templates/base.html:119
msgid "Admin"
msgstr ""
#: note_kfet/templates/base.html:155
#: note_kfet/templates/base.html:163
msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link."

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -172,12 +172,12 @@ msgid "note"
msgstr "note"
#: apps/activity/models.py:183
#: apps/activity/templates/activity/activity_entry.html:42
#: apps/activity/templates/activity/activity_entry.html:45
msgid "entry"
msgstr "entrée"
#: apps/activity/models.py:184
#: apps/activity/templates/activity/activity_entry.html:42
#: apps/activity/templates/activity/activity_entry.html:45
msgid "entries"
msgstr "entrées"
@ -251,7 +251,7 @@ msgid "Last name"
msgstr "Nom de famille"
#: 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/wei/forms/registration.py:101
msgid "First name"
@ -272,8 +272,8 @@ msgstr "Liste des invités"
#: apps/activity/templates/activity/activity_entry.html:13
#: apps/note/models/transactions.py:259
#: apps/note/templates/note/transaction_form.html:15
#: apps/note/templates/note/transaction_form.html:149
#: note_kfet/templates/base.html:76
#: apps/note/templates/note/transaction_form.html:147
#: note_kfet/templates/base.html:78
msgid "Transfer"
msgstr "Virement"
@ -283,12 +283,18 @@ msgstr "Virement"
msgid "Credit"
msgstr "Crédit"
#: apps/activity/templates/activity/activity_entry.html:23
#: apps/note/templates/note/transaction_form.html:31
#: apps/activity/templates/activity/activity_entry.html:20
#: 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"
msgstr "Entrées"
#: apps/activity/templates/activity/activity_entry.html:33
#: apps/activity/templates/activity/activity_entry.html:36
msgid "Return to activity page"
msgstr "Retour à la page de l'activité"
@ -362,7 +368,7 @@ msgstr "Inviter"
msgid "Create new activity"
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"
msgstr "Activités"
@ -528,7 +534,7 @@ msgstr "Vous pouvez créditer la note de l'utisateur avant l'adhésion."
msgid "Credit amount"
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/wei/forms/registration.py:106
msgid "Bank"
@ -1107,7 +1113,7 @@ msgstr "destination"
msgid "amount"
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
msgid ""
"The transaction can't be saved since the source note or the destination note "
@ -1124,7 +1130,7 @@ msgstr "Source"
msgid "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"
msgstr "Raison"
@ -1358,11 +1364,6 @@ msgstr "prénom"
msgid "bank"
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
msgid ""
"A special transaction is only possible between a Note associated to a "
@ -1421,8 +1422,8 @@ msgid "Consum"
msgstr "Consommer"
#: apps/note/templates/note/conso_form.html:44
#: apps/note/templates/note/transaction_form.html:61
#: apps/note/templates/note/transaction_form.html:83
#: apps/note/templates/note/transaction_form.html:64
#: apps/note/templates/note/transaction_form.html:91
msgid "Name or alias..."
msgstr "Pseudo ou alias ..."
@ -1447,7 +1448,7 @@ msgid "Double consumptions"
msgstr "Consommations doubles"
#: 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"
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"
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"
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"
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"
msgstr "Sélection des destinataires"
#: apps/note/templates/note/transaction_form.html:95
#: apps/note/templates/note/transaction_form.html:103
msgid "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/tables.py:135
#: apps/treasury/templates/treasury/remittance_form.html:23
msgid "Amount"
msgstr "Montant"
#: apps/note/templates/note/transaction_form.html:119
msgid "Transfer type"
msgstr "Type de transfert"
#: apps/note/templates/note/transaction_form.html:129
#: apps/note/templates/note/transaction_form.html:127
#: apps/treasury/models.py:51
msgid "Name"
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
msgid "Buttons list"
msgstr "Liste des boutons"
@ -1545,7 +1556,7 @@ msgstr "Chercher un bouton"
msgid "Update button"
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"
msgstr "Consommations"
@ -1671,7 +1682,8 @@ msgstr "Liste des utilisateurs ayant des droits surnormaux"
#: apps/permission/templates/permission/all_rights.html:17
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
msgid "Superusers"
@ -1723,7 +1735,7 @@ msgstr ""
"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."
#: apps/permission/views.py:96 note_kfet/templates/base.html:106
#: apps/permission/views.py:96 note_kfet/templates/base.html:114
msgid "Rights"
msgstr "Droits"
@ -1919,7 +1931,7 @@ msgstr ""
msgid "Invalidate pre-registration"
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"
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/models.py:61 apps/wei/models.py:167
#: note_kfet/templates/base.html:101
#: note_kfet/templates/base.html:108
msgid "WEI"
msgstr "WEI"
@ -2916,19 +2928,19 @@ msgstr "Réinitialiser"
msgid "The ENS Paris-Saclay BDE note."
msgstr "La note du BDE de l'ENS Paris-Saclay."
#: note_kfet/templates/base.html:81
#: note_kfet/templates/base.html:84
msgid "Users"
msgstr "Utilisateurs"
#: note_kfet/templates/base.html:86
#: note_kfet/templates/base.html:90
msgid "Clubs"
msgstr "Clubs"
#: note_kfet/templates/base.html:111
#: note_kfet/templates/base.html:119
msgid "Admin"
msgstr "Admin"
#: note_kfet/templates/base.html:155
#: note_kfet/templates/base.html:163
msgid ""
"Your e-mail address is not validated. Please check your mail inbox and click "
"on the validation link."

View File

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