This commit is contained in:
Tykayn 2025-06-07 00:23:36 +02:00 committed by tykayn
parent 16bc549ece
commit 19cb2f6458
5 changed files with 48 additions and 16 deletions

View file

@ -17,10 +17,13 @@ import './edit.js';
document.addEventListener('DOMContentLoaded', () => {
console.log('DOMContentLoaded');
const randombg = genererCouleurPastel();
// Appliquer la couleur au body
document.body.style.backgroundColor = randombg;
document.querySelectorAll('body, .edit-land, .body-landing').forEach(element => {
element.style.backgroundColor = randombg;
});
// Gestion du bouton pour afficher tous les champs
const btnShowAllFields = document.querySelector('#showAllFields');
@ -30,7 +33,9 @@ document.addEventListener('DOMContentLoaded', () => {
// Sélectionner tous les inputs dans le formulaire
const form = document.querySelector('form');
if (form) {
const hiddenInputs = form.querySelectorAll('.d-none');
// Sélectionner tous les inputs sauf #validation_messages
const hiddenInputs = form.querySelectorAll('#advanced_tags');
hiddenInputs.forEach(input => {
input.classList.toggle('d-none');
});

View file

@ -108,4 +108,8 @@ table.js-sort-table th:active {
.end-hour {
margin-left: -1rem;
}
.good_filled {
border-color: green;
}

View file

@ -16,6 +16,29 @@ function colorHeadingTable() {
function check_validity(e) {
list_inputs_good_to_fill = [
'input[name="commerce_tag_value__contact:email"]',
'input[name="commerce_tag_value__contact:phone"]',
'input[name="commerce_tag_value__contact:website"]',
'commerce_tag_value__contact:mastodon',
'input[name="commerce_tag_value__address"]',
'input[name="custom_opening_hours"]',
'input[name="commerce_tag_value__contact:street"]',
'input[name="commerce_tag_value__contact:housenumber"]',
'input[name="custom__cuisine"]',
]
list_inputs_good_to_fill.forEach(selector => {
const input = document.querySelector(selector);
if (input) {
if (input.value.trim() !== '') {
input.classList.add('good_filled');
} else {
input.classList.remove('good_filled');
}
}
});
let errors = [];
document.querySelectorAll('.is-invalid').forEach(input => {
input.classList.remove('is-invalid');