daily calendar works
This commit is contained in:
@ -41,7 +41,6 @@ class Schedule {
|
||||
var hours = parseInt(timeArray[0]);
|
||||
var minutes = parseInt(timeArray[1]);
|
||||
var pixels = parseInt((hours + (minutes / 60)) * hourHeight);
|
||||
console.log("convert " + time + " to " + pixels);
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@ -57,7 +56,6 @@ class Schedule {
|
||||
var w = dayWidth;
|
||||
var h = parseInt(this.time2pixel(until, hourHeight) - y);
|
||||
ctx.beginPath();
|
||||
console.log("draw " + x + "," + y + " -> +" + w + "," + h);
|
||||
ctx.fillRect(x, y, w, h);
|
||||
ctx.strokeRect(x, y, w, h);
|
||||
}
|
||||
|
@ -189,12 +189,25 @@
|
||||
let height = parseInt($("#schedule").css("min-height"));
|
||||
var schedule = new Schedule("#schedule", width, height);
|
||||
var ctx = $("#scheduleCanvas")[0].getContext("2d");
|
||||
/* TODO: replace by weekly times */
|
||||
schedule.drawSlot(ctx, 2, "07:15", "10:30", "black", "green");
|
||||
schedule.drawSlot(ctx, 2, "10:30", "10:45", "black", "gray");
|
||||
schedule.drawSlot(ctx, 2, "10:45", "12:00", "black", "red");
|
||||
schedule.drawSlot(ctx, 2, "13:00", "17:15", "black", "blue");
|
||||
|
||||
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;
|
||||
var color = "#aaaaaa";
|
||||
if (cssClass == "WP5") {
|
||||
color = "#aa0000";
|
||||
} else if (cssClass == "WP4") {
|
||||
color = "#0000aa";
|
||||
} else if (cssClass == "WP2") {
|
||||
color = "#aaaa00";
|
||||
} else if (cssClass == "TA3") {
|
||||
color = "#00aa00";
|
||||
}
|
||||
/* daySlot 7 = sunday, but this should be slot 0 */
|
||||
schedule.drawSlot(ctx, daySlot > 6 ? 0 : daySlot, r.from, r.until, "black", color);
|
||||
}
|
||||
var localeUrl = '[[@{/js/dataTables/de.json}]]';
|
||||
$("#project_table").DataTable({
|
||||
"language" : {
|
||||
|
Reference in New Issue
Block a user