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

weekview finished

parent d2eafd42
......@@ -40,7 +40,8 @@ function getFull(info, now, cb) {
threeMonth: dateView.threeMonth(dataObj, now),
isOpen: short.isOpen,
text: short.text,
status: short.status
status: short.status,
weekView: dateView.weekViewData(dataObj, now)
};
cb(null, res);
})
......
......@@ -414,6 +414,7 @@ function formatTime(date) {
function weekViewData(dataObj, now) {
const DAY_FORMAT = "dd";
var noOfDays = 7;
var offset = now.getDay() - 1;
......@@ -452,10 +453,16 @@ function weekViewData(dataObj, now) {
var dayLabels = [];
var today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
console.log(today);
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({
class: "label-day-" + day.date.getDay(),
text: moment(day.date).format("dd Do MMMM")
class: "label-day-" + day.date.getDay() + isTodayCls,
text: labelText
});
var date0 = new Date(day.date);
date0.setHours(hourSpan[0]);
......@@ -466,7 +473,7 @@ function weekViewData(dataObj, now) {
var height = (elem[1] - elem[0]) / dateDiff;
var top = (elem[0] - date0) / dateDiff;
return {
class: "day-" + day.date.getDay(),
class: "day-" + day.date.getDay() + isTodayCls,
top: 100 * top.toFixed(3) + "%",
height: 100 * height.toFixed(3) + "%",
text: formatTime(elem[0]) + timeSeparator + formatTime(elem[1])
......
......@@ -4,11 +4,18 @@
<meta charset="UTF-8">
<title></title>
<style>
div.outer-container {
position: relative;
background-color: #f1f1f1;
width: 500px;
height: 300px;
}
div.week.container {
position: relative;
background-color: #f1f1f1;
width: 500px;
height: 300px;
left: 10%;
}
div.week.container table {
border-collapse: collapse;
......@@ -32,9 +39,15 @@
left: 0%;
height: 40%;
}
div.labels {
width: 20%;
}
</style>
</head>
<body>
<div class="outer-container">
<div class="labels">
</div>
<div class="week container">
<table class="inner hori-lines">
<tr> <td></td> </tr>
......@@ -63,5 +76,7 @@
</table>
<div id="item">asd</div>
</div>
</div>
</body>
</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