classattendance.cohort.content.footer.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$j("#attendance-table tr:first").append("<th>Cohort</th>"); | |
$j(".studentrow").each(function() { | |
$j(this).append("<td id=\"cohort_"+ $j(this).attr('id').replace("ccid_","")+"\"></td>"); | |
}); | |
default_attend = [~[tlist_sql;select cc.id, U_STU64.COHORT | |
from cc | |
join students on cc.studentid = students.id | |
left outer join U_STU64 on students.dcid = U_STU64.studentsdcid | |
where sectionid = ~(gpv.sectionid)]{"ccid" : "~(ccid)", "code" : "~(U_STU64.COHORT)"},[/tlist_sql]]; | |
default_attend.forEach(displayCohort); | |
function displayCohort(value, index, array) { | |
var day = $j("[name*='att_periodpopup'] :selected").html().split(" ")[0]; | |
if (day == "Mon" || day == "Tue"){ | |
if (value["code"] == "A"){ | |
$j("#cohort_"+value["ccid"]).html("🏫 In School ("+value["code"]+")"); | |
} | |
else if (value["code"] == "B" || value["code"] == "R"){ | |
$j("#cohort_"+value["ccid"]).html("💻 Remote ("+value["code"]+")"); | |
} | |
} | |
else if (day == "Thu" || day == "Fri"){ | |
if (value["code"] == "A" || value["code"] == "R"){ | |
$j("#cohort_"+value["ccid"]).html("💻 Remote ("+value["code"]+")"); | |
} | |
else if (value["code"] == "B"){ | |
$j("#cohort_"+value["ccid"]).html("🏫 In School ("+value["code"]+")"); | |
} | |
} | |
else if (day == "Wed" && (value["code"] == "A" || value["code"] == "B" || value["code"] == "R")){ | |
$j("#cohort_"+value["ccid"]).html("💻 Remote ("+value["code"]+")"); | |
} | |
} | |
$j("#id_btn_show_multiple_sections").after(" <a id=\"fillCohort\" class=\"button\" href=\"\" style=\"margin: 0px;\">Fill Cohort Default</a>"); | |
$j("#fillCohort").after(" <a id=\"allremote\" class=\"button\" href=\"\" style=\"margin: 0px;\">Fill All Remote</a>"); | |
$j('#fillCohort').click( function(e) {e.preventDefault(); default_attend.forEach(fillAttendance); return false; } ); | |
$j('#allremote').click( function(e) {e.preventDefault(); $j(".studentrow").children().find(":text").val('PR'); return false; } ); | |
var dayItems = $j("[name*='att_periodpopup'] :selected").split(" "); | |
function fillAttendance(value, index, array) { | |
var day = $j("[name*='att_periodpopup'] :selected").html().split(" ")[0]; | |
if (day == "Mon" || day == "Tue"){ | |
if (value["code"] == "A"){ | |
$j("#ccid_"+value["ccid"]).children().find(":text").val('P'); | |
} | |
else if (value["code"] == "B" || value["code"] == "R"){ | |
$j("#ccid_"+value["ccid"]).children().find(":text").val('PR'); | |
} | |
} | |
else if (day == "Thu" || day == "Fri"){ | |
if (value["code"] == "A" || value["code"] == "R"){ | |
$j("#ccid_"+value["ccid"]).children().find(":text").val('PR'); | |
} | |
else if (value["code"] == "B"){ | |
$j("#ccid_"+value["ccid"]).children().find(":text").val('P'); | |
} | |
} | |
else if (day == "Wed" && (value["code"] == "A" || value["code"] == "B" || value["code"] == "R")){ | |
$j("#ccid_"+value["ccid"]).children().find(":text").val('PR'); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment