[MPP-466]change meal calendar for parent invoicebale

This commit is contained in:
Nicolas Selva 2024-04-04 11:52:07 +02:00
parent 2eee309102
commit 8e39243587
2 changed files with 33 additions and 15 deletions

View File

@ -35,6 +35,14 @@
background-color: grey;
}
.pp_mealcalendar .day.is_disabled h4 {
background-color: grey;
}
.pp_mealcalendar .day.is_disabled {
background-color: lightgrey;
}
.pp_mealcalendar .day .choice {
color: $primary-color;
border: 1px solid $primary-color;
@ -45,3 +53,9 @@
color: #fff;
background: $primary-color;
}
.pp_mealcalendar .day.is_disabled .choice {
background-color: grey;
color: white;
border: 1px solid grey;
}

View File

@ -88,6 +88,9 @@
if (day_menu.length > 0) {
for (let index_day_menu = 0; index_day_menu < day_menu.length; index_day_menu++) {
let choice = create_choice(day_menu[index_day_menu].text)
if (day_menu[index_day_menu]["is_disabled"]) {
day.classList.add("is_disabled")
}
choice.id = day_menu[index_day_menu].id
day.appendChild(choice);
}
@ -123,22 +126,23 @@
if (document.getElementsByName(checkboxes_id() + "$element" + dom_choices()[choice_index].id)[0].checked) {
dom_choices()[choice_index].classList.add('selected');
}
dom_choices()[choice_index].addEventListener('click', function(e) {
let selected = this.parentNode.querySelector('.selected')
if (this.isSameNode(selected)) {
this.classList.remove('selected');
} else if (selected != null) {
selected.classList.remove('selected');
this.classList.add('selected');
check_uncheck(selected.id)
} else {
this.classList.add('selected');
}
check_uncheck(this.id);
})
const menu_item_calendar = dom_choices()[choice_index]
if (!menu_item_calendar.closest("div").classList.contains("is_disabled")) {
menu_item_calendar.addEventListener('click', function(e) {
let selected = this.parentNode.querySelector('.selected')
if (this.isSameNode(selected)) {
this.classList.remove('selected');
} else if (selected != null) {
selected.classList.remove('selected');
this.classList.add('selected');
check_uncheck(selected.id)
} else {
this.classList.add('selected');
}
check_uncheck(this.id);
})
}
}
})();
</script>
<style>