-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.scheduler.html
52 lines (44 loc) · 1.57 KB
/
jquery.scheduler.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="jquery.scheduler.css"></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="date.format.min.js"></script>
<script src="jquery.scheduler.js"></script>
</head>
<body>
<div id="scheduler" style="padding-top: 50px;"></div>
<div id="log"></div>
<script>
// Sets dates for example reservations to always be on current day or after
var date = new Date(),
day = date.getDate(),
date1 = new Date(),
date2 = new Date(),
date3 = new Date();
date1.setDate(day);
date2.setDate(day + 1);
date3.setDate(day + 2);
date1 = date1.format('Y-m-d');
date2 = date2.format('Y-m-d');
date3 = date3.format('Y-m-d');
// Array of example date
var reservations = [
{date: date3, start: '8:00', end: '13:00', row: 0},
{date: date1, start: '8:00', end: '16:00', row: 1},
{date: date1, start: '7:00', end: '9:00', row: 3},
{date: date1, start: '12:00', end: '20:00', row: 5},
{date: date2, start: '12:00', end: '18:00', row: 5},
{date: date3, start: '8:00', end: '18:00', row: 4}
];
// Array of sample items
var printers = ['Printer 1', 'Printer 2', 'Printer 3', 'Printer 4', 'Printer 5', 'Printer 6'];
// Initialize
$("#scheduler").scheduler({items: printers, reservations: reservations, timeslotHeight: 70, timeslotWidth: 100});
// Allows for reservation deletion
$(document).on('click', ".reservation", function () {
$(this).remove();
});
</script>
</body>
</html>