PageSourceSearch

https://www.chazelles-sur-lavieu.fr/assets/js/utils/evenement-utils-9b3a31fd2328512e8bdc88b3de8ad55f.js

js chazelles-sur-lavieu.fr collected 2026-10-02 21:00:26 UTC 5,897 bytes, 140 lines download raw bytes

1// Function to display or hide the recurrence fields
2export function afficheRecurrence() {
3    const checkbox = document.getElementById('checkboxRecurrence');
4    const formRecurrence = document.querySelector('.form-recurrence');
5
6    if (checkbox && formRecurrence) {
7        if (checkbox.checked) {
8            formRecurrence.classList.remove('d-none');
9            if (document.querySelector('[name="evenement_step_content[recurrence][repetition]"]').value === '') {
10                document.querySelector('[name="evenement_step_content[recurrence][repetition]"]').value = '1';
11                document.querySelector('[name="evenement_step_content[recurrence][type]"]').value = 'semaine';
12            }
13            afficheRecurrenceSemaineMois();
14            afficheOccurrences();
15        } else {
16            formRecurrence.classList.add('d-none');
17            document.querySelector('[name="evenement_step_content[recurrence][repetition]"]').value = '';
18            document.querySelector('[name="evenement_step_content[recurrence][type]"]').value = '';
19            document.getElementById('evenement_step_content_recurrence_jours').value = '';
20            document.querySelector('[name="evenement_step_content[recurrence][mois]"]').value = '';
21            document.querySelector('[name="evenement_step_content[recurrence][occurrences]"]').value = '';
22            document.querySelector('[name="evenement_step_content[recurrence][dateFin]"]').value = '';
23        }
24    }
25}
26
27// Function to display or hide the number of occurrences input
28export function afficheOccurrences() {
29    const occurrenceInput = document.getElementById('evenement_step_content_recurrence_occurrences');
30    const dateFinInput = document.getElementById('evenement_step_content_recurrence_dateFin');
31
32    if (occurrenceInput && dateFinInput) {
33        if (occurrenceInput.value > 0) {
34            afficheNombreOccurrences();
35            masqueDateOccurrences();
36            document.getElementById('termine_fin_occurence').checked = true;
37        } else {
38            masqueNombreOccurrences();
39        }
40
41        if (dateFinInput.value !== '') {
42            afficheDateOccurrences();
43            masqueNombreOccurrences();
44            document.getElementById('termine_fin_date').checked = true;
45        } else {
46            masqueDateOccurrences();
47        }
48
49        document.querySelectorAll('[name="termine"]').forEach(input => {
50            input.addEventListener('change', function() {
51                switch (this.value) {
52                    case 'jamais':
53                        masqueNombreOccurrences();
54                        masqueDateOccurrences();
55                        break;
56                    case 'fin_date':
57                        masqueNombreOccurrences();
58                        afficheDateOccurrences();
59                        break;
60                    case 'fin_occurence':
61                        afficheNombreOccurrences();
62                        masqueDateOccurrences();
63                        break;
64                }
65            });
66        });
67    }
68}
69
70// Function to disable the number of occurrences input
71export function masqueNombreOccurrences() {
72    const occurrenceInput = document.getElementById('evenement_step_content_recurrence_occurrences');
73    if (occurrenceInput) {
74        occurrenceInput.disabled = true;
75        occurrenceInput.value = '';
76    }
77}
78
79// Function to enable the recurrence end date input
80export function afficheDateOccurrences() {
81    const dateInput = document.getElementById('evenement_step_content_recurrence_dateFin');
82    if (dateInput) {
83        dateInput.disabled = false;
84        if (dateInput.value === '') {
85            dateInput.value = dateInput.getAttribute('placeholder');
86        }
87    }
88}
89
90// Function to disable the recurrence end date input
91export function masqueDateOccurrences() {
92    const dateInput = document.getElementById('evenement_step_content_recurrence_dateFin');
93    if (dateInput) {
94        dateInput.disabled = true;
95        dateInput.value = '';
96    }
97}
98
99// Function to enable the number of occurrences input
100export function afficheNombreOccurrences() {
101    const occurrenceInput = document.getElementById('evenement_step_content_recurrence_occurrences');
102    if (occurrenceInput) {
103        occurrenceInput.disabled = false;
104        if (occurrenceInput.value === '') {
105            occurrenceInput.value = 10;
106        }
107    }
108}
109
110// Function to display or hide the weekly and monthly recurrence fields
111export function afficheRecurrenceSemaineMois() {
112    const recurrenceType = document.querySelector('[name="evenement_step_content[recurrence][type]"]');
113    const recurrenceJours = document.getElementById('evenement_step_content_recurrence_jours');
114    const recurrenceMois = document.querySelector('[name="evenement_step_content[recurrence][mois]"]');
115
116    if (recurrenceType && recurrenceJours && recurrenceMois) {
117        if (recurrenceType.value === "semaine") {
118            recurrenceJours.parentElement.classList.remove('d-none');
119            const joursSelectionnes = Array.from(document.querySelectorAll('[name="evenement_step_content[recurrence][jours][]"]:checked'))
120                .map(c => c.value);
121
122            if (joursSelectionnes.length === 0) {
123                let jourSemaine = new Date().getDay() - 1;
124                if (jourSemaine < 0) jourSemaine = 6;
125                document.getElementById(`evenement_step_content_recurrence_jours_${jourSemaine}`).checked = true;
126            }
127        } else {
128            recurrenceJours.parentElement.classList.add('d-none');
129        }
130
131        if (recurrenceType.value === "mois") {
132            recurrenceMois.parentElement.classList.remove('d-none');
133            if (!recurrenceMois.value) {
134                recurrenceMois.value = 0;
135            }
136        } else {
137            recurrenceMois.parentElement.classList.add('d-none');
138        }
139    }
140}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.