fix imports js
This commit is contained in:
parent
ada9fa4029
commit
f785e67f49
6 changed files with 163 additions and 42 deletions
|
@ -97,7 +97,7 @@ async function searchInseeCode(query) {
|
|||
}
|
||||
}
|
||||
|
||||
function updateMapHeightForLargeScreens() {
|
||||
export function updateMapHeightForLargeScreens() {
|
||||
const mapFound = document.querySelector('#map');
|
||||
if (mapFound && window.innerHeight > 800 && window.innerWidth > 800) {
|
||||
mapFound.style.height = window.innerWidth * 0.8 + 'px';
|
||||
|
@ -171,13 +171,24 @@ export function enableLabourageForm() {
|
|||
const form = citySearchInput.closest('form');
|
||||
setupCitySearch('citySearch', 'citySuggestions', function (result_search) {
|
||||
if (form) {
|
||||
const labourageBtn = form.querySelector('.btn-labourer');
|
||||
const labourageBtn = form.querySelector('button[type="submit"]');
|
||||
if (labourageBtn) {
|
||||
labourageBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Chargement...';
|
||||
labourageBtn.disabled = true;
|
||||
// Remplir le champ caché avec le code INSEE
|
||||
const inseeInput = form.querySelector('#selectedZipCode');
|
||||
if (inseeInput) {
|
||||
inseeInput.value = result_search.insee;
|
||||
}
|
||||
// Changer l'action du formulaire pour pointer vers la bonne URL
|
||||
form.action = getLabourerUrl(result_search);
|
||||
|
||||
// Changer le texte du bouton et le désactiver
|
||||
labourageBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Labourage de ' + result_search.name + '...';
|
||||
labourageBtn.disabled = true;
|
||||
|
||||
// Soumettre le formulaire
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
window.location.href = getLabourerUrl(result_search);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +202,7 @@ export function setupCitySearch(inputId, suggestionListId, onSelect) {
|
|||
let timeoutId = null;
|
||||
let searchOngoing = false;
|
||||
|
||||
searchInput.addEventListener('input', function () {
|
||||
searchInput.addEventListener('keyup', function () {
|
||||
clearTimeout(timeoutId);
|
||||
const query = this.value.trim();
|
||||
if (query.length < 3) {
|
||||
|
@ -329,7 +340,6 @@ export function calculateCompletion(properties) {
|
|||
if (properties.website || properties['contact:website']) completed++;
|
||||
if (properties.phone || properties['contact:phone']) completed++;
|
||||
if (properties.wheelchair) completed++;
|
||||
if (properties.note) completed++;
|
||||
|
||||
return {
|
||||
percentage: total > 0 ? (completed / total) * 100 : 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue