Delete button for tournaments

This commit is contained in:
Claude Brisson
2024-03-06 20:28:51 +01:00
parent 99d53510ad
commit 37160961d5
3 changed files with 17 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ Create Créer
Crit Crit Crit Crit
Ctr Pays Ctr Pays
Dates Dates Dates Dates
Delete Supprimer
Download Télécharger Download Télécharger
Download the standalone web interface module which suits your need, then follow Télécharger le module dinterface web qui correspond à vos besoins, puis suivez Download the standalone web interface module which suits your need, then follow Télécharger le module dinterface web qui correspond à vos besoins, puis suivez
Edit Éditer Edit Éditer

View File

@@ -10,7 +10,7 @@ onLoad(() => {
if ($('#tournament-infos').hasClass('edit') && typeof(tour_id) !== 'undefined') { if ($('#tournament-infos').hasClass('edit') && typeof(tour_id) !== 'undefined') {
$('#tournament-infos').removeClass('edit') $('#tournament-infos').removeClass('edit')
} else { } else {
document.location.href = '/index'; window.location.href = '/index';
} }
return false; return false;
}); });
@@ -107,6 +107,17 @@ onLoad(() => {
modal('export-modal'); modal('export-modal');
}); });
$('#delete').on('click', e => {
if (confirm('Supprimer ce tournoi ?')) {
api.deleteJson(`tour/${tour_id}`, {})
.then(resp => {
if (resp !== 'error') {
window.location.href = '/index';
}
})
}
});
$('#export-pairgoth').on('click', e => { $('#export-pairgoth').on('click', e => {
close_modal(); close_modal();
let form = $('#tournament-infos')[0]; let form = $('#tournament-infos')[0];

View File

@@ -225,6 +225,10 @@
<i class="pencil icon"></i> <i class="pencil icon"></i>
Edit Edit
</button> </button>
<button id="delete" type="button" class="ui red right labeled icon floating info button">
<i class="trash icon"></i>
Delete
</button>
#end #end
<button id="validate" class="ui next green right labeled icon floating edit button"> <button id="validate" class="ui next green right labeled icon floating edit button">
<i class="checkmark icon"></i> <i class="checkmark icon"></i>