Commit 2271e62f authored by Johannes Bill's avatar Johannes Bill

weekview finished

parent d2eafd42
...@@ -40,7 +40,8 @@ function getFull(info, now, cb) { ...@@ -40,7 +40,8 @@ function getFull(info, now, cb) {
threeMonth: dateView.threeMonth(dataObj, now), threeMonth: dateView.threeMonth(dataObj, now),
isOpen: short.isOpen, isOpen: short.isOpen,
text: short.text, text: short.text,
status: short.status status: short.status,
weekView: dateView.weekViewData(dataObj, now)
}; };
cb(null, res); cb(null, res);
}) })
......
...@@ -414,6 +414,7 @@ function formatTime(date) { ...@@ -414,6 +414,7 @@ function formatTime(date) {
function weekViewData(dataObj, now) { function weekViewData(dataObj, now) {
const DAY_FORMAT = "dd";
var noOfDays = 7; var noOfDays = 7;
var offset = now.getDay() - 1; var offset = now.getDay() - 1;
...@@ -452,10 +453,16 @@ function weekViewData(dataObj, now) { ...@@ -452,10 +453,16 @@ function weekViewData(dataObj, now) {
var dayLabels = []; var dayLabels = [];
var today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
console.log(today);
var oHours = rawHours.map(function (day) { var oHours = rawHours.map(function (day) {
var isToday = day.date.getTime() == today;
var isTodayCls = isToday?" date-today":"";
var labelText = moment(day.date).format(DAY_FORMAT);
if(isToday) labelText = "Heute, " + labelText;
dayLabels.push({ dayLabels.push({
class: "label-day-" + day.date.getDay(), class: "label-day-" + day.date.getDay() + isTodayCls,
text: moment(day.date).format("dd Do MMMM") text: labelText
}); });
var date0 = new Date(day.date); var date0 = new Date(day.date);
date0.setHours(hourSpan[0]); date0.setHours(hourSpan[0]);
...@@ -466,7 +473,7 @@ function weekViewData(dataObj, now) { ...@@ -466,7 +473,7 @@ function weekViewData(dataObj, now) {
var height = (elem[1] - elem[0]) / dateDiff; var height = (elem[1] - elem[0]) / dateDiff;
var top = (elem[0] - date0) / dateDiff; var top = (elem[0] - date0) / dateDiff;
return { return {
class: "day-" + day.date.getDay(), class: "day-" + day.date.getDay() + isTodayCls,
top: 100 * top.toFixed(3) + "%", top: 100 * top.toFixed(3) + "%",
height: 100 * height.toFixed(3) + "%", height: 100 * height.toFixed(3) + "%",
text: formatTime(elem[0]) + timeSeparator + formatTime(elem[1]) text: formatTime(elem[0]) + timeSeparator + formatTime(elem[1])
......
...@@ -4,11 +4,18 @@ ...@@ -4,11 +4,18 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title></title> <title></title>
<style> <style>
div.outer-container {
position: relative;
background-color: #f1f1f1;
width: 500px;
height: 300px;
}
div.week.container { div.week.container {
position: relative; position: relative;
background-color: #f1f1f1; background-color: #f1f1f1;
width: 500px; width: 500px;
height: 300px; height: 300px;
left: 10%;
} }
div.week.container table { div.week.container table {
border-collapse: collapse; border-collapse: collapse;
...@@ -32,9 +39,15 @@ ...@@ -32,9 +39,15 @@
left: 0%; left: 0%;
height: 40%; height: 40%;
} }
div.labels {
width: 20%;
}
</style> </style>
</head> </head>
<body> <body>
<div class="outer-container">
<div class="labels">
</div>
<div class="week container"> <div class="week container">
<table class="inner hori-lines"> <table class="inner hori-lines">
<tr> <td></td> </tr> <tr> <td></td> </tr>
...@@ -63,5 +76,7 @@ ...@@ -63,5 +76,7 @@
</table> </table>
<div id="item">asd</div> <div id="item">asd</div>
</div> </div>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment