mirror of https://gitlab.crans.org/bde/nk20
Fix deletion of consumptions in double consumption mode
This commit is contained in:
parent
e9cbc8e623
commit
c14d37eaeb
|
@ -95,6 +95,8 @@ function li(id, text, extra_css) {
|
||||||
* @param note The concerned note.
|
* @param note The concerned note.
|
||||||
*/
|
*/
|
||||||
function displayStyle(note) {
|
function displayStyle(note) {
|
||||||
|
if (!note)
|
||||||
|
return "";
|
||||||
let balance = note.balance;
|
let balance = note.balance;
|
||||||
var css = "";
|
var css = "";
|
||||||
if (balance < -5000)
|
if (balance < -5000)
|
||||||
|
@ -274,7 +276,6 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
|
||||||
field.attr('data-original-title', aliases_matched_html).tooltip('show');
|
field.attr('data-original-title', aliases_matched_html).tooltip('show');
|
||||||
|
|
||||||
consumers.results.forEach(function (consumer) {
|
consumers.results.forEach(function (consumer) {
|
||||||
let note = consumer.note;
|
|
||||||
let consumer_obj = $("#" + alias_prefix + "_" + consumer.id);
|
let consumer_obj = $("#" + alias_prefix + "_" + consumer.id);
|
||||||
consumer_obj.hover(function () {
|
consumer_obj.hover(function () {
|
||||||
displayNote(consumer.note, consumer.name, user_note_field, profile_pic_field)
|
displayNote(consumer.note, consumer.name, user_note_field, profile_pic_field)
|
||||||
|
@ -282,8 +283,8 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
|
||||||
consumer_obj.click(function () {
|
consumer_obj.click(function () {
|
||||||
var disp = null;
|
var disp = null;
|
||||||
notes_display.forEach(function (d) {
|
notes_display.forEach(function (d) {
|
||||||
// We compare the note ids
|
// We compare the alias ids
|
||||||
if (d.id === note.id) {
|
if (d.id === consumer.id) {
|
||||||
d.quantity += 1;
|
d.quantity += 1;
|
||||||
disp = d;
|
disp = d;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +294,7 @@ function autoCompleteNote(field_id, note_list_id, notes, notes_display, alias_pr
|
||||||
disp = {
|
disp = {
|
||||||
name: consumer.name,
|
name: consumer.name,
|
||||||
id: consumer.id,
|
id: consumer.id,
|
||||||
note: note,
|
note: consumer.note,
|
||||||
quantity: 1
|
quantity: 1
|
||||||
};
|
};
|
||||||
notes_display.push(disp);
|
notes_display.push(disp);
|
||||||
|
|
Loading…
Reference in New Issue