1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-29 12:50:55 +02:00

Add shortcuts for transfers and credits in the activity entry page

This commit is contained in:
Yohann D'ANELLO
2020-04-06 07:06:52 +02:00
parent 6498a20b87
commit 9d584ae87a
8 changed files with 232 additions and 152 deletions

View File

@ -28,6 +28,7 @@ function reset() {
}
$(document).ready(function() {
console.log(42);
autoCompleteNote("source_note", "source_alias_matched", "source_note_list", sources, sources_notes_display,
"source_alias", "source_note", "user_note", "profile_pic");
autoCompleteNote("dest_note", "dest_alias_matched", "dest_note_list", dests, dests_notes_display,
@ -61,16 +62,25 @@ $(document).ready(function() {
// Ensure we begin in gift mode. Removing these lines may cause problems when reloading.
$("#type_gift").prop('checked', 'true');
let type_gift = $("#type_gift"); // Default mode
type_gift.removeAttr('checked');
$("#type_transfer").removeAttr('checked');
$("#type_credit").removeAttr('checked');
$("#type_debit").removeAttr('checked');
$("label[for='type_gift']").attr('class', 'btn btn-sm btn-outline-primary');
$("label[for='type_transfer']").attr('class', 'btn btn-sm btn-outline-primary');
$("label[for='type_credit']").attr('class', 'btn btn-sm btn-outline-primary');
$("label[for='type_debit']").attr('class', 'btn btn-sm btn-outline-primary');
console.log("#type_" + location.hash.substr(1));
if (location.hash)
$("#type_" + location.hash.substr(1)).click();
else
type_gift.click();
location.hash = "";
});
$("#transfer").click(function() {
$("#btn_transfer").click(function() {
if ($("#type_gift").is(':checked')) {
dests_notes_display.forEach(function (dest) {
$.post("/api/note/transaction/transaction/",