|
@@ -3,8 +3,11 @@ angular.module('app')
|
3
|
3
|
function($scope, $state, DataShareBusiness, WeeksBusiness) {
|
4
|
4
|
|
5
|
5
|
$scope.DataShareBusiness = DataShareBusiness;
|
|
6
|
+ $scope.dateFormat = "dd MMM yyyy";
|
6
|
7
|
$scope.courses = null;
|
7
|
|
- $scope.days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
8
|
+ $scope.days = [{day:"Monday", date: null}, {day:"Tuesday", date: null}, {day:"Wednesday", date: null},
|
|
9
|
+ {day:"Thursday", date: null}, {day:"Friday", date: null}, {day:"Saturday", date: null},
|
|
10
|
+ {day:"Sunday", date: null}];
|
8
|
11
|
|
9
|
12
|
$scope.getSheetCount = function()
|
10
|
13
|
{
|
|
@@ -21,6 +24,44 @@ angular.module('app')
|
21
|
24
|
return sheetCount(DataShareBusiness.getCurrentGroupOrRoot())
|
22
|
25
|
};
|
23
|
26
|
|
|
27
|
+ $scope.getMonday = function(d)
|
|
28
|
+ {
|
|
29
|
+ d = new Date(d);
|
|
30
|
+ var day = d.getDay(), diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday
|
|
31
|
+ d = new Date(d.setDate(diff));
|
|
32
|
+ d.setHours(0, 0, 0, 0);
|
|
33
|
+ return d;
|
|
34
|
+ };
|
|
35
|
+
|
|
36
|
+ $scope.setDates = function(monday)
|
|
37
|
+ {
|
|
38
|
+ $scope.days[0].date = new Date(monday);
|
|
39
|
+ for (var i = 1; i < $scope.days.length; ++i) {
|
|
40
|
+ $scope.days[i].date = new Date(monday.setDate(monday.getDate() + 1));
|
|
41
|
+ }
|
|
42
|
+ };
|
|
43
|
+
|
|
44
|
+ $scope.getCourseListByDay = function(date)
|
|
45
|
+ {
|
|
46
|
+ if ($scope.courses == null || date == null) {
|
|
47
|
+ return null;
|
|
48
|
+ }
|
|
49
|
+ return $scope.courses.DayList.find(function(day)
|
|
50
|
+ {
|
|
51
|
+ var d = new Date(day.DateTime);
|
|
52
|
+ return d.getTime() == date.getTime();
|
|
53
|
+ });
|
|
54
|
+ };
|
|
55
|
+
|
|
56
|
+ $scope.getCoursesByDate = function(date)
|
|
57
|
+ {
|
|
58
|
+ var courses = $scope.getCourseListByDay(date);
|
|
59
|
+ if (courses == null) {
|
|
60
|
+ return [];
|
|
61
|
+ }
|
|
62
|
+ return ["42", "24"];
|
|
63
|
+ };
|
|
64
|
+
|
24
|
65
|
$scope.$watch(function(){return DataShareBusiness.CurrentGroups}, function()
|
25
|
66
|
{
|
26
|
67
|
var group = DataShareBusiness.getCurrentGroup();
|
|
@@ -33,6 +74,7 @@ angular.module('app')
|
33
|
74
|
.then(function(data)
|
34
|
75
|
{
|
35
|
76
|
$scope.courses = data;
|
|
77
|
+ $scope.setDates($scope.getMonday(new Date()));
|
36
|
78
|
});
|
37
|
79
|
}
|
38
|
80
|
else {
|