From 9d721135033d1bbdaea982b0e7840ac2b5931a59 Mon Sep 17 00:00:00 2001 From: p1905074 Date: Mon, 14 Dec 2020 22:02:36 +0100 Subject: [PATCH] Notes interactives --- public/javascripts/marks.js | 18 +++++++++++++++ views/pages/marks.pug | 46 +++++++++++++++++++------------------ views/template/layout.pug | 4 ++-- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/public/javascripts/marks.js b/public/javascripts/marks.js index 0cd6cae..29351cf 100644 --- a/public/javascripts/marks.js +++ b/public/javascripts/marks.js @@ -1,4 +1,22 @@ +let socket = io.connect(); + +socket.on("marksDetails", data=>{ + if(data.error){ + alert(data.error.message); + }else{ + document.getElementById("dsName").value = data.dsName; + document.getElementById("dsMarks").value = data.dsMarks; + document.getElementById("dsRang").value = data.dsRang; + document.getElementById("dsCoeff").value = data.dsCoeff; + document.getElementById("dsMoy").value = data.dsMoy; + } +}) + + function setVisible(targetId) { + socket.emit("marksDetails", { + "dsId": targetId + }); document.getElementById("notvisible").id = "visible"; } diff --git a/views/pages/marks.pug b/views/pages/marks.pug index 6baa24c..87ec5ba 100644 --- a/views/pages/marks.pug +++ b/views/pages/marks.pug @@ -7,13 +7,15 @@ block content tr th(colspan="2") Details tr - td DS 1 + td(id="dsName") DS 1 tr - td Rang : 10/29 + td(id="dsMarks") Note : 16 tr - td Coeff : 1.5 + td(id="dsRang") Rang : 10/29 tr - td Moyenne de classe : 12 + td(id="dsCoeff") Coeff : 1.5 + tr + td(id="dsMoy") Moyenne de classe : 12 div(class="row" id="marks") div(class="col s12 m6 l4") table @@ -22,24 +24,24 @@ block content th(colspan="2") Maths tbody tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 @@ -50,17 +52,17 @@ block content th(colspan="2") TP SE tbody tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 @@ -71,17 +73,17 @@ block content th(colspan="2") PHP tbody tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 @@ -92,17 +94,17 @@ block content th(colspan="2") Anglais tbody tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 tr - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 1 p 18/20 - td(onclick="setVisible(this.getAttribute('id'))") + td(class="marksCursorPointer" onclick="setVisible(this.getAttribute('id'))") p DS 2 p 16/20 diff --git a/views/template/layout.pug b/views/template/layout.pug index 5fa9957..165f7ee 100644 --- a/views/template/layout.pug +++ b/views/template/layout.pug @@ -7,8 +7,8 @@ html link(rel="stylesheet", href="/stylesheets/style.css") script(src="/socket.io/socket.io.js") body - - var student = false - - var teacher = true + - var student = true + - var teacher = false - var admin = false div(class="row" id="page") div(class="col s2" id="panel")