Add exams
This commit is contained in:
parent
e3ca42275c
commit
ed4b6a0cce
7 changed files with 147 additions and 7 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 wulkanowy
|
||||
Copyright (c) 2018 wulkanowy
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
52
data/opiekun/sprawdziany.json
Normal file
52
data/opiekun/sprawdziany.json
Normal file
|
@ -0,0 +1,52 @@
|
|||
[
|
||||
{"exams": []},
|
||||
{"exams": []},
|
||||
{
|
||||
"date": "09.05.2018",
|
||||
"dayName": "środa",
|
||||
"exams": [
|
||||
{
|
||||
"subject": "Język angielski 1Ti|J1",
|
||||
"type": "Sprawdzian",
|
||||
"description": "słownictwo(kultura)",
|
||||
"teacher": "Anyż Zofia [AZ]",
|
||||
"date": "01.04.2018"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"date": "10.05.2018",
|
||||
"dayName": "czwartek",
|
||||
"exams": [
|
||||
{
|
||||
"subject": "Język polski",
|
||||
"type": "Sprawdzian",
|
||||
"description": "poprawa romantyzmu",
|
||||
"teacher": "Nowak Joanna [NJ]",
|
||||
"date": "01.04.2018"
|
||||
},
|
||||
{
|
||||
"subject": "Fizyka",
|
||||
"type": "Kartkówka",
|
||||
"description": "przemiany gazowe",
|
||||
"teacher": "Czyż Ireneusz",
|
||||
"date": "01.03.2018"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"date": "11.05.2018",
|
||||
"dayName": "piątek",
|
||||
"exams": [
|
||||
{
|
||||
"subject": "Systemy operacyjne",
|
||||
"type": "Kartkówka",
|
||||
"description": "Active Directory",
|
||||
"teacher": "Czerwieński Andrzej",
|
||||
"date": "19.04.2018"
|
||||
}
|
||||
]
|
||||
},
|
||||
{"exams": []},
|
||||
{"exams": []}
|
||||
]
|
23
public/stylesheets/_row-value.scss
Normal file
23
public/stylesheets/_row-value.scss
Normal file
|
@ -0,0 +1,23 @@
|
|||
article {
|
||||
padding: 30px 0;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1px solid red;
|
||||
}
|
||||
|
||||
.daneWiersz {
|
||||
display: flex;
|
||||
|
||||
.tytul {
|
||||
width: 100%;
|
||||
max-width: 250px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.wartosc {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
@import "grades-table";
|
||||
@import "attendance";
|
||||
@import "timetable-table";
|
||||
@import "row-value";
|
||||
@import "filters";
|
||||
@import "header";
|
||||
@import "nav";
|
||||
|
|
|
@ -86,4 +86,16 @@ router.get("/Default/123456/Lekcja(\.mvc|)/PlanLekcji", (req, res) => {
|
|||
})
|
||||
});
|
||||
|
||||
router.get("/Default/123456/Sprawdziany.mvc/Terminarz", (req, res) => {
|
||||
res.render("opiekun/sprawdziany", {
|
||||
title: "Witryna ucznia i rodzica – Terminarz sprawdzianów",
|
||||
data: require("../../data/opiekun/sprawdziany.json"),
|
||||
weekDays: converter.getWeekDaysFrom(req.query.data),
|
||||
tics: {
|
||||
prev: converter.getPrevTick(req.query.data),
|
||||
next: converter.getNextTick(req.query.data)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -12,8 +12,20 @@ function getTickFromDate(date) {
|
|||
return (date.getTime() * 10000) + 621355968000000000;
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
return date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear();
|
||||
function formatDate(today) {
|
||||
let dd = today.getDate();
|
||||
let mm = today.getMonth() + 1; //January is 0!
|
||||
|
||||
let yyyy = today.getFullYear();
|
||||
|
||||
if (dd < 10) {
|
||||
dd = '0' + dd;
|
||||
}
|
||||
if (mm < 10) {
|
||||
mm = '0' + mm;
|
||||
}
|
||||
|
||||
return dd + '.' + mm + '.' + yyyy;
|
||||
}
|
||||
|
||||
function getMonday(date) {
|
||||
|
@ -21,16 +33,15 @@ function getMonday(date) {
|
|||
return new Date(date.getFullYear(), date.getMonth(), day);
|
||||
}
|
||||
|
||||
function getDayName(dateStr)
|
||||
{
|
||||
return new Date(dateStr).toLocaleDateString("pl", { weekday: "long" });
|
||||
function getDayName(dateStr) {
|
||||
return new Date(dateStr).toLocaleDateString("pl", {weekday: "long"});
|
||||
}
|
||||
|
||||
function getWeekDaysFrom(tick) {
|
||||
let startDate = getDateFromTick(tick);
|
||||
|
||||
const days = [];
|
||||
for(let i = 0; i < 5; i++) {
|
||||
for (let i = 0; i < 5; i++) {
|
||||
let date = new Date(startDate).setDate(startDate.getDate() + i);
|
||||
days.push([
|
||||
getDayName(date),
|
||||
|
|
41
src/views/opiekun/sprawdziany.pug
Normal file
41
src/views/opiekun/sprawdziany.pug
Normal file
|
@ -0,0 +1,41 @@
|
|||
extends layout
|
||||
|
||||
mixin nav
|
||||
.navigation
|
||||
a.button-prev(href="/Default/123456/Sprawdziany.mvc/Terminarz?rodzajWidoku=2&data=" + tics.prev) Poprzedni tydzień
|
||||
a.button-next(href="/Default/123456/Sprawdziany.mvc/Terminarz?rodzajWidoku=2&data=" + tics.next) Następny tydzień
|
||||
|
||||
append content
|
||||
main.mainContainer
|
||||
h1 Sprawdziany
|
||||
h2 Tydzień #{weekDays[0][1]} - #{weekDays[4][1]}
|
||||
fieldset.pseudoForm
|
||||
legend.floatLeft Widok kalendarza:
|
||||
div.floatLeft
|
||||
input#radioWidokTygodnia(type="radio" value="1" name="wyborWidokuZadan")
|
||||
label(for="radioWidokTygodnia") najbliższe cztery tygodnie
|
||||
div.floatLeft
|
||||
input#radioWidokDnia(type="radio" value="1" name="wyborWidokuZadan" checked="checked")
|
||||
label(for="radioWidokDnia") bieżący tydzień
|
||||
+nav
|
||||
//h2 Nie zaplanowano żadnych sprawdzianów na wybrany tydzień
|
||||
|
||||
each day in data
|
||||
div
|
||||
if (day.exams.length)
|
||||
h2 #{day.dayName}, #{day.date}
|
||||
each exam in day.exams
|
||||
article
|
||||
div.daneWiersz
|
||||
div.tytul Przedmiot i grupa:
|
||||
div.wartosc= exam.subject
|
||||
div.daneWiersz
|
||||
div.tytul Rodzaj sprawdzianu:
|
||||
div.wartosc= exam.type
|
||||
div.daneWiersz
|
||||
div.tytul Opis:
|
||||
div.wartosc= exam.description
|
||||
div.daneWiersz
|
||||
div.tytul Nauczyciel i data wpisu:
|
||||
div.wartosc #{exam.teacher}, #{exam.date}
|
||||
+nav
|
Loading…
Reference in a new issue