-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscriptenseignant.js
355 lines (257 loc) · 9.09 KB
/
scriptenseignant.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
const groupe = [
{id:1, name:"ABABSA", prenom:"AYMEN" , groupe:4, section:2 },
{id:2, name:"ARFA", prenom: "SARA ", group: 4,section:2},
{id:3, name:"AYMEN",prenom:"BEKKAI" , groupe: 3,section:2} ,
{id:4, name: "BENAICHA" ,prenom:"NOURELYAKINE", groupe:4,section:2},
{id:5, name: "BENDJELLOUL" ,prenom:"SIDAHMED", groupe:4 ,section:2},
{id:6, name: "BENHAYA", prenom: "MESSAOUD ", groupe:4 ,section:2},
{id:7, name:"BENNAMOUN" ,prenom: "RAZANE", groupe:4,section:2},
{id:8, name:"BENOULHA", prenom: "WAIL" , groupe:4 ,section:2},
{id:9, name:"BESTA",prenom: "MALEK" , groupe:4,section:2},
{id:10, name:"BOUKAHIL",prenom: "WASSIM", groupe:4 ,section:2},
{id:11, name:"BOUKERZAZA",prenom: "Ibtihel", groupe:1,section:2},
{id:12, name:"BOURADA",prenom:" MAHA ", groupe:2,section:2},
{id:13, name:"BOURAOUI",prenom: "ZAKARIA", groupe:3,section:2 },
{id:14, name:"BRAHIMI",prenom: "BIDAS", groupe:2 ,section:2},
{id:15, name:"CHELGHAM",prenom:"MOUNSIF", groupe:1 ,section:2},
{id:16, name:"DAHMANI",prenom:"AMAR ", groupe:1,section:2 },
{id:17, name:"GHEDJATI ",prenom:"Houcine", groupe:1 ,section:2},
{id:18, name:"GHRIB",prenom: "AYA" , groupe:1,section:2},
{id:19, name:"GUEBLI", prenom:"AYOUB ", groupe:1 ,section:1},
{id:20, name:"HAZOURLI",prenom: "MEHDI", groupe:1 ,section:1},
{id:21, name:"KAHOUL" ,prenom:"ABDELMADJID", groupe:1,section:1},
{id:22, name:"KHERRAB",prenom: "BOUCHRA", groupe:1,section:1},
{id:23, name:"LABACI",prenom:"ASMAA" , groupe:3,section:1},
{id:24, name:"LARKEM",prenom: "ZINEEDDINE", groupe:2 , section:1},
{id:25, name:"MAALLEM" ,prenom:"ABDERRAZAK", groupe:2 ,section:1},
{id:26, name:"MACHICHE",prenom: "SOUMIA", groupe:2,section:1},
{id:27, name:"MEDJANI",prenom: "ABDELMOUHEIMENE", groupe:2 ,section:1},
{id:28, name:"MEZRAG",prenom: "ABDELOUADOUD" , groupe:2 ,section:1},
{id:29, name:"NAANAA",prenom: "AYA" , groupe:2,section:1},
{id:30, name:"OUBAZIZ",prenom: "WASSIM", groupe:3 ,section:1},
{id:31, name:"SEDDIKI",prenom: "ABDERRAHIM", groupe:3,section:1 },
{id:32, name:"SMAALI" ,prenom:"MARIA" , groupe:3,section:1},
{id:33, name:"TABBI",prenom: "ABDELAZIZ", groupe:3 ,section:1},
{id:34, name:"TOUATI" ,prenom:"MOHAMED", groupe:3 ,section:1},
{id:35, name:"ZEGHIDA" , prenom:"IHSSENE" , groupe:3,section:1},
];
var ul= document.getElementById("filtered");
home.onclick= (e)=>{
window.open("index.html","_self");
console.log(home);
};
//default list
for (var i=0; i<groupe.length; i++){
var li=document.createElement("li");
ul.appendChild(li);
li.setAttribute("onclick","selected(this)");
li.innerHTML=li.innerHTML + groupe[i].name + " " +groupe[i].prenom ;
}
var filteredlist;
//Filter list
function filter(critere){
if(critere==1){
var filteredlist = groupe.filter(function(user){
if(user.section==1){
return user;
}
}
) }
else if(critere==2){
filteredlist= groupe.filter(function(user){
if(user.section==2){
return user;
}
}
)}
else if(critere==3){
filteredlist= groupe.filter(function(user){
if(user.groupe==1){
return user;
}
}
)}
else if(critere==4){
filteredlist= groupe.filter(function(user){
if(user.groupe==2){
return user;
}
}
)
}
else if(critere==5){
filteredlist= groupe.filter(function(user){
if(user.groupe==3){
return user;
}
}
)
}
else {
filteredlist= groupe.filter(function(user){
if(user.groupe==4){
return user;
}
}
)
} display(filteredlist);
console.log(filteredlist);
filteredlist= this.filteredlist;
//display filtered list
function display(l){
let displaylist = l.map(function(item){
return `<li onclick="selected(this)"> ${item.name} ${item.prenom}</li>`;
});
displaylist= displaylist.join("");
ul.innerHTML=displaylist;
} }
const list = ul.childNodes;
//one selected element at a time
function selected(a){
console.log(a);
list.forEach(function(item){
item.classList.add("selected");
if(item !== a){
item.classList.remove("selected");
}
})
//already opened questions
}
// delete users
function deleteuser(){
var s = document.querySelector(".selected");
if (s== null){
window.alert("Please select student!");
}else{
console.log(s);
ul.removeChild(s);
console.log(list);
window.alert("student"+" "+s.textContent+" "+"is deleted.");
}
}
//close tab
function closetab(){
ol.forEach(e=> {
e.classList.remove("open-overlay");
hd.classList.remove("blur");
bg.classList.remove("blur");
})
inputs.forEach(e=>{
e.value="";
})
}
//phone navbar
let nav = document.querySelector(".sidebar");
let navbtn = document.getElementById("sidebar");
navbtn.onclick=(e)=>{
nav.classList.toggle("opennav");
navbtn.style.color="white";
}
// click on module enseignant
const a = document.querySelectorAll(".a");
const b = document.querySelector(".moduleconf");
const c =document.querySelector(".module");
var name;
a.forEach(function (item) {
item.onclick= (e)=>{
c.style.display ="none";
b.style.display ="block";
}
});
const insertol = document.querySelector(".insert");
const updateol = document.querySelector(".update");
const ol = document.querySelectorAll(".tab-overlay");
const inputs = document.querySelectorAll(".input");
let submit1 = document.getElementById("submitA");
let submit2 = document.getElementById("submitB");
const nb = document.getElementById("weeknumber");
const cnt1 = document.getElementById("content");
const cnt2 = document.getElementById("content2");
const t = document.getElementById("moduletable");
const bg = document.querySelector(".container");
const hd = document.querySelector(".header");
var tbody = document.querySelector("tbody");
//insert into weekly schedule
function addweek() {
insertol.classList.add("open-overlay");
hd.classList.add("blur");
bg.classList.add("blur");
submitA.onclick=(e) =>{
var td=document.createElement("td");
var td1=document.createElement("td");
var tr=document.createElement("tr");
td.innerHTML = "week"+" "+ nb.value ;
td1.setAttribute("onclick", "selectedweek(this)");
td1.classList.add("cnt");
td1.innerHTML= cnt1.value;
tr.appendChild(td);
tr.appendChild(td1);
tr.classList.add("week");
tbody.appendChild(tr);
t.appendChild
closetab();
}
inputs.forEach(e => {
e.addEventListener("keypress", function(event) {
// If the user presses the "Enter" key on the keyboard
if (event.key === "Enter") {
// Cancel the default action, if needed
event.preventDefault();
// Trigger the button element with a click
submitA.click();
closetab();
}
});
});
}
//update a week content
function updateweek(){
var s = document.querySelector(".selectedweek");
if (s== null){
window.alert("Please select week!");
}else{
updateol.classList.add("open-overlay");
hd.classList.add("blur");
bg.classList.add("blur");
submitB.onclick=(e) =>{
s.innerHTML= cnt2.value;
closetab();
}
inputs.forEach(e => {
e.addEventListener("keypress", function(event) {
// If the user presses the "Enter" key on the keyboard
if (event.key === "Enter") {
// Cancel the default action, if needed
event.preventDefault();
// Trigger the button element with a click
submitB.click();
closetab();
}
});
});
}
}
//delete a week
function deleteweek(){
var s = document.querySelector(".selectedweek");
var tr = document.querySelectorAll(".cnt");
if (s== null){
window.alert("Please select week!");
}else{
var tr = s.previousSibling.previousSibling;
tbody.removeChild(s.parentElement);
console.log(s.parentElement);
window.alert(tr.textContent+" "+"is deleted.");
}
}
// selected content line
function selectedweek(a){
var tds = document.querySelectorAll(".cnt")
console.log(content);
tds.forEach(function(e){
e.classList.add("selectedweek");
if(e !== a){
e.classList.remove("selectedweek");
}
})
}