diff options
Diffstat (limited to '')
-rw-r--r-- | frontend/student.js | 20 | ||||
-rw-r--r-- | templates/student.html | 18 |
2 files changed, 36 insertions, 2 deletions
diff --git a/frontend/student.js b/frontend/student.js index 178611c..f8ea843 100644 --- a/frontend/student.js +++ b/frontend/student.js @@ -205,6 +205,26 @@ document.addEventListener("DOMContentLoaded", () => { document.getElementById("stateindicator").textContent = "enabled" break case "YC": + document.querySelectorAll(".confirmed-handle").forEach(c => { + let handle = c.textContent + document.getElementById(`confirmed-name-${ handle }`).textContent = "" + document.getElementById(`confirmed-type-${ handle }`).textContent = "" + document.getElementById(`confirmed-teacher-${ handle }`).textContent = "" + document.getElementById(`confirmed-location-${ handle }`).textContent = "" + document.querySelectorAll(".coursecheckbox").forEach(d => { + if (d.dataset.group === handle && d.checked) { + document.getElementById(`confirmed-name-${ handle }`).textContent = + d.dataset.title + document.getElementById(`confirmed-type-${ handle }`).textContent = + d.dataset.type + document.getElementById(`confirmed-teacher-${ handle }`).textContent = + d.dataset.teacher + document.getElementById(`confirmed-location-${ handle }`).textContent = + d.dataset.location + /* TODO: break */ + } + }) + }) document.querySelectorAll(".unconfirmed").forEach(c => { c.style.display = "none" }) diff --git a/templates/student.html b/templates/student.html index d3c88e6..3eea9aa 100644 --- a/templates/student.html +++ b/templates/student.html @@ -120,11 +120,16 @@ <p> Course selections are <span style="font-weight: bold;" id="stateindicator">disabled</span>. </p> + <div class="neither-confirmed"> + <p> + (Still loading...) + </p> + </div> <div class="confirmed"> <table class="table-of-choices"> <thead> <tr> - <th scope="col">Period</th> + <th scope="col">Group</th> <th scope="col">Name</th> <th scope="col">Type</th> <th scope="col">Teacher</th> @@ -132,6 +137,15 @@ </tr> </thead> <tbody> + {{- range .Groups }} + <tr> + <th class="confirmed-handle" id="confirmed-handle-{{ .Handle }}" scope="row">{{ .Handle }}</th> + <td id="confirmed-name-{{ .Handle }}"></td> + <td id="confirmed-type-{{ .Handle }}"></td> + <td id="confirmed-teacher-{{ .Handle }}"></td> + <td id="confirmed-location-{{ .Handle }}"></td> + </tr> + {{- end }} </tbody> <tfoot> <tr> @@ -172,7 +186,7 @@ {{- range .Courses }} <tr class="courseitem" id="course{{.ID}}" data-group="{{.Group}}"> <th style="font-weight: normal;" scope="row"> - <input aria-label="Enroll in course" class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}" data-group="{{.Group}}" disabled ></input> + <input aria-label="Enroll in course" class="coursecheckbox" type="checkbox" id="tick{{.ID}}" name="tick{{.ID}}" value="tick{{.ID}}" data-group="{{.Group}}" data-type="{{.Type}}" data-title="{{.Title}}" data-teacher="{{.Teacher}}" data-location="{{.Location}}" disabled ></input> <span id="coursestatus{{.ID}}"></span> </th> <td> |