mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-08-14 09:56:38 +02:00
Visual improvement on manage page
This commit is contained in:
@@ -57,7 +57,6 @@ function addChallenge (id, name, amount) {
|
||||
/** Ajout de 1 à chaque clic d'un bouton déjà choisi */
|
||||
buttons.forEach(function (b) {
|
||||
if (b.id === id) {
|
||||
b.quantity += 1
|
||||
challenge = b
|
||||
}
|
||||
})
|
||||
@@ -65,8 +64,6 @@ function addChallenge (id, name, amount) {
|
||||
challenge = {
|
||||
id: id,
|
||||
name: name,
|
||||
quantity: 1,
|
||||
amount: amount,
|
||||
}
|
||||
buttons.push(challenge)
|
||||
}
|
||||
@@ -76,8 +73,7 @@ function addChallenge (id, name, amount) {
|
||||
const list = 'consos_list'
|
||||
let html = ''
|
||||
buttons.forEach(function (challenge) {
|
||||
html += li('conso_button_' + challenge.id, challenge.name +
|
||||
'<span class="badge badge-dark badge-pill">' + challenge.quantity + '</span>')
|
||||
html += li('conso_button_' + challenge.id, challenge.name)
|
||||
})
|
||||
document.getElementById(list).innerHTML = html
|
||||
|
||||
@@ -94,7 +90,6 @@ function addChallenge (id, name, amount) {
|
||||
* Reset the page as its initial state.
|
||||
*/
|
||||
function reset () {
|
||||
console.log("reset lancée")
|
||||
notes_display.length = 0
|
||||
notes.length = 0
|
||||
buttons.length = 0
|
||||
@@ -113,7 +108,6 @@ function reset () {
|
||||
* Apply all transactions: all notes in `notes` buy each item in `buttons`
|
||||
*/
|
||||
function consumeAll () {
|
||||
console.log("test");
|
||||
if (LOCK) { return }
|
||||
LOCK = true
|
||||
|
||||
@@ -131,13 +125,10 @@ function consumeAll () {
|
||||
LOCK = false
|
||||
return
|
||||
}
|
||||
console.log("couocu")
|
||||
// Récupérer les IDs des familles et des challenges
|
||||
const family_ids = notes_display.map(fam => fam.id)
|
||||
const challenge_ids = buttons.map(chal => chal.id)
|
||||
|
||||
console.log(family_ids)
|
||||
console.log(challenge_ids)
|
||||
$.ajax({
|
||||
url: '/family/api/family/achievements/batch/',
|
||||
type: 'POST',
|
||||
@@ -318,7 +309,6 @@ function autoCompleteFamily(field_id, family_list_id, families, families_display
|
||||
var disp = null
|
||||
families_display.forEach(function (d) {
|
||||
if (d.id === family.id) {
|
||||
d.quantity += 1
|
||||
disp = d
|
||||
}
|
||||
})
|
||||
@@ -327,7 +317,6 @@ function autoCompleteFamily(field_id, family_list_id, families, families_display
|
||||
name: family.name,
|
||||
id: family.id,
|
||||
family: family,
|
||||
quantity: 1
|
||||
}
|
||||
families_display.push(disp)
|
||||
}
|
||||
@@ -338,9 +327,7 @@ function autoCompleteFamily(field_id, family_list_id, families, families_display
|
||||
let html = ''
|
||||
families_display.forEach(function (disp) {
|
||||
html += li(family_prefix + '_' + disp.id,
|
||||
disp.name +
|
||||
'<span class="badge badge-dark badge-pill">' +
|
||||
disp.quantity + '</span>',
|
||||
disp.name,
|
||||
'')
|
||||
})
|
||||
|
||||
@@ -398,12 +385,6 @@ function removeFamily(d, family_prefix, families_display, family_list_id, user_f
|
||||
const new_families_display = []
|
||||
let html = ''
|
||||
families_display.forEach(function (disp) {
|
||||
if (disp.quantity > 1 || disp.id !== d.id) {
|
||||
disp.quantity -= disp.id === d.id ? 1 : 0
|
||||
new_families_display.push(disp)
|
||||
html += li(family_prefix + '_' + disp.id, disp.name +
|
||||
'<span class="badge badge-dark badge-pill">' + disp.quantity + '</span>')
|
||||
}
|
||||
})
|
||||
|
||||
families_display.length = 0
|
||||
|
Reference in New Issue
Block a user