Auto-complete first and last name for credits and debits

This commit is contained in:
Yohann D'ANELLO 2020-03-14 15:36:03 +01:00 committed by Bombar Maxime
parent 040bb27528
commit 717891869d
4 changed files with 26 additions and 10 deletions

View File

@ -28,8 +28,7 @@ class TransactionCreate(LoginRequiredMixin, TemplateView):
Add some context variables in template such as page title
"""
context = super().get_context_data(**kwargs)
context['title'] = _('Transfer money from your account '
'to one or others')
context['title'] = _('Transfer money')
context['polymorphic_ctype'] = ContentType.objects.get_for_model(Transaction).pk
context['special_polymorphic_ctype'] = ContentType.objects.get_for_model(SpecialTransaction).pk
context['special_types'] = NoteSpecial.objects.order_by("special_type").all()

View File

@ -443,7 +443,7 @@ msgid "membership transactions"
msgstr ""
#: apps/note/views.py:29
msgid "Transfer money from your account to one or others"
msgid "Transfer money"
msgstr ""
#: apps/note/views.py:139

View File

@ -456,8 +456,8 @@ msgid "membership transactions"
msgstr "transactions d'adhésion"
#: apps/note/views.py:29
msgid "Transfer money from your account to one or others"
msgstr "Transfert d'argent de ton compte vers un ou plusieurs autres"
msgid "Transfer money"
msgstr "Transferts d'argent"
#: note_kfet/settings/__init__.py:63
msgid ""

View File

@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="row">
<div class="col-xl-12">
<div class="btn-group btn-group-toggle" style="width: 100%" data-toggle="buttons">
<div class="btn-group btn-group-toggle" style="width: 100%; padding: 0 0 2em 0" data-toggle="buttons">
<label class="btn btn-sm btn-outline-primary active">
<input type="radio" name="transaction_type" id="type_gift" checked>
Virement
@ -93,7 +93,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<div class="col-md-12" id="dests_div">
<div class="card border-info shadow mb-4">
<div class="card-header">
<p class="card-text font-weight-bold">
<p class="card-text font-weight-bold" id="dest_title">
Sélection des destinataires
</p>
</div>
@ -156,31 +156,48 @@ SPDX-License-Identifier: GPL-2.0-or-later
autoCompleteNote("source_note", "source_alias_matched", "source_note_list", sources, sources_notes_display,
"source_alias", "source_note");
autoCompleteNote("dest_note", "dest_alias_matched", "dest_note_list", dests, dests_notes_display,
"dest_alias", "dest_note");
"dest_alias", "dest_note", null, null, function() {
let last = dests_notes_display[dests_notes_display.length - 1];
dests_notes_display.length = 0;
dests_notes_display.push(last);
last[3] = 1;
$.getJSON("/api/user/" + last[2].user + "/", function(user) {
$("#last_name").val(user.last_name);
$("#first_name").val(user.first_name);
});
return true;
});
});
$("#type_gift").click(function() {
$("#emitters_div").hide();
$("#external_div").hide();
$("#dests_div").attr('class', 'col-md-12');
$("#dest_title").text("Sélection des destinataires");
});
$("#type_transfer").click(function() {
$("#emitters_div").show();
$("#external_div").hide();
$("#dests_div").attr('class', 'col-md-6');
$("#dest_title").text("Sélection des destinataires");
});
$("#type_credit").click(function() {
$("#emitters_div").hide();
$("#external_div").show();
$("#dests_div").attr('class', 'col-md-6');
$("#dest_title").text("Note à créditer");
});
$("#type_debit").click(function() {
$("#emitters_div").hide();
$("#external_div").show();
$("#dests_div").attr('class', 'col-md-6');
$("#dest_title").text("Note à prélever");
});
$("#transfer").click(function() {