From 1ac31ccb9da44295fc9b53a7554ca077aea97664 Mon Sep 17 00:00:00 2001 From: tofulm Date: Thu, 12 Jan 2023 14:36:08 +0100 Subject: [PATCH] Feat: on recharge en prenant en compte le timestamp TODO : la suppression --- gamutable_fonctions.php | 28 ++++++++++++++++++++-------- gamutable_pipelines.php | 2 +- src/components/gamuTable.vue | 22 ++++++++++++++++------ 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/gamutable_fonctions.php b/gamutable_fonctions.php index 00bd989..0d6cd18 100644 --- a/gamutable_fonctions.php +++ b/gamutable_fonctions.php @@ -15,8 +15,8 @@ if (!defined("_ECRIRE_INC_VERSION")) { include_spip("inc/vite"); function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) { - if ($num) { - $num = '_deux'; + if ($id_objet === 'maj') { + $id_objet = 1; } $html = << @@ -24,13 +24,19 @@ function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) { id = parseInt(id); if (id > 0 && id < 9999999999) { if (typeof app !== 'undefined') { - app$num.rechargerJson(id); + app.rechargerJson('maj'); + } + if (typeof app_deux !== 'undefined') { + app_deux.rechargerJson('maj'); } $.modalboxclose(); } if (id === 9999999999) { if (typeof app !== 'undefined') { - app$num.rechargerJson(); + app.rechargerJson(); + } + if (typeof app_deux !== 'undefined') { + app_deux.rechargerJson(); } $.modalboxclose(); } @@ -41,8 +47,8 @@ EOJS; } function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) { - if ($num) { - $num = '_deux'; + if ($id_objet === 'maj') { + $id_objet = 1; } $html = << @@ -50,12 +56,18 @@ function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) { id = parseInt(id); if (id > 0 && id < 9999999999) { if (typeof app !== 'undefined') { - app$num.rechargerJson(id); + app.rechargerJson('maj'); + } + if (typeof app_deux !== 'undefined') { + app_deux.rechargerJson('maj'); } } if (id === 9999999999) { if (typeof app !== 'undefined') { - app$num.rechargerJson(); + app.rechargerJson(); + } + if (typeof app_deux !== 'undefined') { + app_deux.rechargerJson(); } } delete id; diff --git a/gamutable_pipelines.php b/gamutable_pipelines.php index a2afabb..37a8f9b 100644 --- a/gamutable_pipelines.php +++ b/gamutable_pipelines.php @@ -54,7 +54,7 @@ function gamutable_crayons_vue_affichage_final($flux){ $id = intval($id) and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? []) ) { - $flux['data'] .= ' '; + $flux['data'] .= ' '; } else { $flux['data'] .= $objet . ' '; } diff --git a/src/components/gamuTable.vue b/src/components/gamuTable.vue index 1fc8d4f..7e17c0f 100644 --- a/src/components/gamuTable.vue +++ b/src/components/gamuTable.vue @@ -667,6 +667,21 @@ function gererData(filtreColRecup, data, id = null) { nameLocalStorage.value, JSON.stringify(table.value) ); + } else if (id === "maj") { + console.log("table.value = ", table.value); + if (data[0] && data[0].search) { + champ_search.value = "search"; + } + if (data.length > 0) { + data.forEach((ligne, index) => { + let i = trouver_index(table.value, ligne.html.id); + table.value[i] = data[index]; + }); + } + localforage.setItem( + nameLocalStorage.value, + JSON.stringify(table.value) + ); } else { table.value = data; if (data[0] && data[0].search) { @@ -791,6 +806,7 @@ function saveHeader() { classes: classes.value, filtreCol: filtreColType.value, ordreCol: ordreCol.value, + maj: maj.value, }; localStorage.setItem( "header_" + nameLocalStorage.value, @@ -801,14 +817,8 @@ function deleteInputSearch(head) { loadingVueSelect.value = false; filtreColSelected.value[head] = []; } -function hanldeSearchInput(event, head) { - searchInputHead.value = head; - searchInputVal.value = event.target.value; -} function selectValCol() { filtreColModif.value++; - searchInputVal.value = ""; - searchInputHead.value = ""; } function endLoadingVueSelect() { loadingVueSelect.value = false;