console.log("la"); console.log("la"); async function validatePath() { const pathInput = document.getElementById('path-input'); const statusIcon = document.getElementById('path-status-icon'); const validateBtn = document.getElementById('validate-btn'); const inputPath=document.getElementById('path'); const inputPathV=document.getElementById('namePath'); const path = pathInput.value; if (!path) { statusIcon.innerHTML = ''; validateBtn.disabled = true; return; } statusIcon.innerHTML = ''; // Loading icon try { const response = await fetch('/validate-path', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path }), }); if (response.ok) { statusIcon.innerHTML = ''; validateBtn.disabled = false; inputPath.value=path; inputPathV.style.display="block"; } else { const result = await response.json(); statusIcon.innerHTML = ''; validateBtn.disabled = true; console.error('Error:', result.error); } } catch (error) { statusIcon.innerHTML = ''; validateBtn.disabled = true; console.error('Request failed:', error); } } function disableAllInputPath(id){ console.log(this) var inputs = document.querySelectorAll('#path-'+id+' .fff'); var btn =document.getElementById('btn-path-annuler-'+id) btn.style.display = "none"; var btn2 =document.getElementById('btn-path-edit-'+id) btn2.style.display = "block"; var btn3 =document.getElementById('btn-path-valider-'+id) btn3.style.display = "none"; inputs.forEach(function(input) { input.disabled = true; }); } function enableAllInputPath(id){ console.log(this) var inputs = document.querySelectorAll('#path-'+id+' .fff'); var btn =document.getElementById('btn-path-annuler-'+id) btn.style.display = "block"; var btn2 =document.getElementById('btn-path-edit-'+id) btn2.style.display = "none"; var btn3 =document.getElementById('btn-path-valider-'+id) btn3.style.display = "block"; inputs.forEach(function(input) { input.disabled = false; }); } function setInputHidden(target,value){ document.getElementById(target).value = value; } function hide(target){ var btn =document.getElementById(target) btn.style.display = "none"; } document.addEventListener("htmx:afterOnLoad", function (event) { // console.log("Réponse du serveur :", event.detail.xhr.responseText); });