-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex_java.js
209 lines (185 loc) · 6.38 KB
/
index_java.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
let footer=document.getElementById("footer")
let infoindex=document.getElementById("infoIndex")
let LeFormulaire=document.getElementById("le_formulaire_index")
window.onload = function () {
if (leschecked()) {
footer.style.display="block"
infoindex.style.display="block"
}
}
function leschecked() {
au_moins_un=false
tabinput=document.getElementById('creneauxdispos').getElementsByTagName("input")
tablabel=document.getElementById('creneauxdispos').getElementsByTagName("label")
for (i=0;i<tabinput.length;i++) {
if (tabinput[i].checked) {
tablabel[i].style.backgroundColor="#FAB315"
tablabel[i].style.color="black"
au_moins_un=true
} else {
tablabel[i].style.backgroundColor="#2687c9"
tablabel[i].style.color="white"
}
}
return au_moins_un
}
function click_creneau(id) {
if (leschecked()) {
footer.style.display="block"
infoindex.style.display="block"
} else {
footer.style.display="none"
infoindex.style.display="none"
}
}
function validation_formulaire() {
if (nom.value=="" || prenom.value=="" || mail.value=="") { // telephone.value=="" ||
alert('Le formulaire est incomplet')
return
}
if (!consignergpd.checked) {
alert('Il faut autoriser Sand System à sauvegarder les données !')
return
}
LeFormulaire.submit()
}
/*let LeFormulaire=document.getElementById("le_formulaire_index")
let consignesecurite=document.getElementById("consignesecurite")
let consignergpd=document.getElementById("consignergpd")
let adherent=document.getElementsByName("adherent")
let niveau=document.getElementsByName("niveau")
let jeu1=document.getElementById("jeu1")
let jeu2=document.getElementById("jeu2")
let jeu3=document.getElementById("jeu3")
let jeu4=document.getElementById("jeu4")
let jeul1=document.getElementById("jeul1")
let jeul2=document.getElementById("jeul2")
let jeul3=document.getElementById("jeul3")
let jeul4=document.getElementById("jeul4")
let ad1=document.getElementById("ad1")
let ad2=document.getElementById("ad2")
let adl1=document.getElementById("adl1")
let adl2=document.getElementById("adl2")
let adhesion=document.getElementById("adherer")
let nom=document.getElementById("nom")
let prenom=document.getElementById("prenom")
let mail=document.getElementById("mail")
let telephone=document.getElementById("telephone")
function test_feminin() {
tab=document.getElementsByClassName("checkboxfeminin")
res=false
for (var unebox of tab) {
res=res || unebox.checked
}
return res
}
function test_masculin() {
tab=document.getElementsByClassName("checkboxmasculin")
res=false
for (var unebox of tab) {
res=res || unebox.checked
}
return res
}
function lesradio() {
jeul1.style.backgroundColor="#2687c9"
jeul2.style.backgroundColor="#2687c9"
jeul3.style.backgroundColor="#2687c9"
jeul4.style.backgroundColor="#2687c9"
adl1.style.backgroundColor="#2687c9"
adl2.style.backgroundColor="#2687c9"
jeul1.style.color="white"
jeul2.style.color="white"
jeul3.style.color="white"
jeul4.style.color="white"
adl1.style.color="white"
adl2.style.color="white"
if (jeu1.checked) { jeul1.style.backgroundColor="#FAB315"; jeul1.style.color="black" }
if (jeu2.checked) { jeul2.style.backgroundColor="#FAB315"; jeul2.style.color="black" }
if (jeu3.checked) { jeul3.style.backgroundColor="#FAB315"; jeul3.style.color="black" }
if (jeu4.checked) { jeul4.style.backgroundColor="#FAB315"; jeul4.style.color="black" }
if (ad1.checked) { adl1.style.backgroundColor="#FAB315"; adl1.style.color="black" }
if (ad2.checked) { adl2.style.backgroundColor="#FAB315"; adl2.style.color="black" }
}
function leschecked() {
tabinput=document.getElementById('creneauxdispos').getElementsByTagName("input")
tablabel=document.getElementById('creneauxdispos').getElementsByTagName("label")
for (i=0;i<tabinput.length;i++) {
if (tabinput[i].checked) {
tablabel[i].style.backgroundColor="#FAB315"
tablabel[i].style.color="black"
} else {
tablabel[i].style.backgroundColor="#2687c9"
tablabel[i].style.color="white"
}
}
}
//jeu1.onclick= function () {lesradio()}
//jeu2.onclick= function () {lesradio()}
//jeu3.onclick= function () {lesradio()}
//jeu4.onclick= function () {lesradio()}
ad1.onclick= function () {lesradio() ; pour_adherent();}
ad2.onclick= function () {lesradio(); pas_adherent()}
function pour_adherent() {
adhesion.style.display="none";
}
function pas_adherent() {
adhesion.style.display="block";
}
function click_creneau(id,type) { // type 0,1,2 : féminin, masculin,mixte value de l'input : 0,1,2 : défaut, prio, pasprio
let lesid=[document.getElementById("c"+id.toString()+"feminin")
,document.getElementById("c"+id.toString()+"masculin")
,document.getElementById("c"+id.toString()+"mixte")]
let lesidlabel=[document.getElementById("lc"+id.toString()+"feminin")
,document.getElementById("lc"+id.toString()+"masculin")
,document.getElementById("lc"+id.toString()+"mixte")]
if (test_masculin() && test_feminin()) {
alert('impossible de choisir masculin et féminin en même temps')
lesid[type].checked=false
}
leschecked()
}
function nbCreneauChecked() {
tabinput=document.getElementById('creneauxdispos').getElementsByTagName("input")
val=0
for (i=0;i<tabinput.length;i++) {
if (tabinput[i].checked) { val+=1}
}
return val
}
function validation_formulaire() {
if (nom.value=="" || prenom.value=="" || mail.value=="") { // telephone.value=="" ||
alert('Le formulaire est incomplet')
return
}
//if (!consignesecurite.checked) {
//alert('Il faut penser à valider les consignes de sécurité !')
//return
//}
if (!consignergpd.checked) {
alert('Il faut autoriser Sand System à sauvegarder les données !')
return
}
val=nbCreneauChecked()
if (val == 0) {
alert('Il faut choisir au moins un créneau')
return
}
bouton_adherent=false
for (i=0;i<adherent.length;i++) {
bouton_adherent=bouton_adherent || adherent[i].checked
}
//if (!bouton_adherent) {
//alert('Il faut indiquer si tu es adhérent SandSystem')
//return
//}
bouton_niveau=false
for (i=0;i<niveau.length;i++) {
bouton_niveau=bouton_niveau || niveau[i].checked
}
//if (!bouton_niveau) {
//alert('Il faut indiquer quel est ton niveau')
//return
//}
LeFormulaire.submit()
}*/