| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- var tableOptions = [["Ajouter une nouvelle loi", false],["Améliorer une loi", false],["Supprimer une loi", false]];
- function chooseOption(id, newEventId) {
- let listLaws = document.querySelector("#listLaws");
- listLaws.innerHTML = genListeTableLaws();
- console.log(newEventId);
- switch (id) {
- case 0:
- listLaws.innerHTML = displayAddLaws(newEventId);
- break;
- case 1:
- listLaws.innerHTML = genListeUpgradeLaws();
- break;
- case 2:
- listLaws.innerHTML = genListeRemoveLaws();
- break;
- default:
- listLaws.innerHTML = genListeTableLaws();
- }
- enableOption(id, newEventId);
- }
- function genListeOptions(newEventId) {
- console.log(newEventId);
- let element = document.querySelector("#options");
- let res = "";
- for (var i = 0; i < tableOptions.length; i++) {
- res = res + genOption(i, newEventId);
- }
- element.innerHTML = res;
- }
- function enableOption(id, newEventId) {
- for (var i = 0; i < tableOptions.length; i++) {
- if (i == id) {
- tableOptions[i][1] = true;
- }
- else {
- tableOptions[i][1] = false;
- }
- }
- genListeOptions(newEventId);
- }
- function resetOptions() {
- for (var i = 0; i < tableOptions.length; i++) {
- tableOptions[i][1] = false;
- }
- }
- function genOption(id, newEventId) {
- return "<p onClick=\"chooseOption(" + id + ","+ newEventId +")\">" + tableOptions[id][0] + "</p>";
- }
|