schedule for weeks

This commit is contained in:
Jörg Henke
2022-07-27 14:46:25 +02:00
parent 676fa63471
commit af956f4650
13 changed files with 178 additions and 38 deletions

View File

@ -17,16 +17,32 @@ class Schedule {
drawBackgroundDay = function(ctx, width, height, offsetx) {
var hourHeight = parseInt(height / 24);
var fs = ["#eeeeee", "#bbbbbb", "#eeeeee", "#bbbbbb", "#eeeeee", "#bbbbbb",
"#faf0fa", "#d9cbd9", "#faf0fa", "#9acbd9", "#cdf0fa", "#9acbd9",
"#cdf0fa", "#9acbd9", "#cdf0fa", "#d9cbd9", "#faf0fa", "#d9cbd9",
"#faf0fa", "#d9cbd9", "#eeeeee", "#bbbbbb", "#eeeeee", "#bbbbbb"];
for (var i = 0; i < 24; i++) {
var x = parseInt(offsetx);
var y = parseInt(i * hourHeight);
var w = parseInt(width);
var h = parseInt(hourHeight);
ctx.fillStyle = (i > 8 & i <= 17) ? (i % 2 ? "#cdf0fa" : "#9acbd9") : (i % 2 ? "#faf0fa" : "#d9cbd9");
ctx.fillStyle = fs[i];
ctx.fillRect(x, y, w, h);
}
ctx.lineWidth = 1;
ctx.strokeStyle = "white";
ctx.strokeRect(offsetx, 0, width, height);
ctx.strokeStyle = "black";
ctx.lineWidth = 2;
ctx.moveTo(parseInt(offsetx), parseInt(hourHeight * 6));
ctx.lineTo(parseInt(offsetx + width), parseInt(hourHeight * 6));
ctx.stroke();
ctx.moveTo(parseInt(offsetx), parseInt(hourHeight * 12));
ctx.lineTo(parseInt(offsetx + width), parseInt(hourHeight * 12));
ctx.stroke();
ctx.moveTo(parseInt(offsetx), parseInt(hourHeight * 18));
ctx.lineTo(parseInt(offsetx + width), parseInt(hourHeight * 18));
ctx.stroke();
}
drawBackgroundWeek = function(ctx, width, height) {

View File

@ -191,7 +191,6 @@
var ctx = $("#scheduleCanvas")[0].getContext("2d");
var currentDayRecords = JSON.parse('[(${schedule})]');
var scheduleRecords = currentDayRecords.schedule;
var daySlot = currentDayRecords.daySlot;
for (var i = 0; i < scheduleRecords.length; i++) {
var r = scheduleRecords[i];
var cssClass = r.billing;
@ -206,7 +205,7 @@
color = "#00aa00";
}
/* daySlot 7 = sunday, but this should be slot 0 */
schedule.drawSlot(ctx, daySlot > 6 ? 0 : daySlot, r.from, r.until, "black", color);
schedule.drawSlot(ctx, r.daySlot > 6 ? 0 : r.daySlot, r.from, r.until, "black", color);
}
var localeUrl = '[[@{/js/dataTables/de.json}]]';
$("#project_table").DataTable({