-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
78 lines (58 loc) · 2.12 KB
/
app.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var app = angular.module('Myapp', ['ui.calendar', 'ui.bootstrap']);
app.controller('MainController',['$scope', '$compile', 'uiCalendarConfig', function($scope, $compile, uiCalendarConfig) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var currentView = "month";
//event source that pulls from google.com
$scope.eventSource = {
url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
className: 'gcal-event', // an option!
currentTimezone: 'America/Chicago' // an option!
};
$scope.events = [
{ title: "All Day Event test", start: "03/08/2017 12:00 am",end:"03/08/2017 05:30 pm"},
{ title: 'Long Event test', start: "03/16/2017 12:30 am",end: "03/18/2017 06:00 pm"},
];
//$scope.events.start=moment(start).format('MM/DD/YYYY hh:mm a');
//$scope.events.end=moment(end).format('MM/DD/YYYY hh:mm a');
$scope.eventSources = [$scope.events];
/* config object */
$scope.uiConfig = {
calendar:{
height: 450,
editable: true,
selectable: true,
selectHelper: true,
eventLimit: true,
header:{
left: 'month basicWeek basicDay agendaWeek agendaDay',
center: 'title',
right: 'today prev,next'
},
eventClick: $scope.alertEventOnClick,
eventDrop: $scope.alertOnDrop,
eventResize: $scope.alertOnResize
}
};
$scope.curent = {};
// For removing the current event
$scope.removeEvent = function(event) {
var index = $scope.events.indexOf(event);
if(confirm("Remove this Event ?") === true) {
$scope.events.splice(index, 1);
}
};
$scope.editPencil = true;
//set the the selected event to current editable
$scope.editEvent = function(event) {
$scope.current = event;
};
// Save the current event to the calendar and clear the form
$scope.saveEvent = function(event) {
$scope.events.push(event);
$scope.current = {};
};
$scope.curent = {};
}]);