21a1ff19
Apichat.Tum
fix follow smartr...
|
1
|
'use strict';
|
cf86e9a3
Apichat.Tum
- ui with oauth2 ...
|
2
3
|
angular.module("KendoDemos", ["kendo.directives"])
.controller("MyCtrl", function ($scope, $http) {
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
4
5
6
7
8
9
10
|
var config = false;
var devconsole = {
log: function (text) {
if (config) {
console.log(text);
}
;
|
77034810
Apichat.Tum
fix REST API
|
11
|
}
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
12
13
14
15
16
17
18
19
20
21
|
};
function getAuthURL() {
$http({
method: 'get',
url: '/events'
}).then(function successCallback(response) {
var res = response.data;
if (res.result) {
if (res.result.status == "redirect") {
window.open(res.result.data, '_self');
|
77034810
Apichat.Tum
fix REST API
|
22
|
}
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
}
else {
console.info(response);
schedulerStart();
}
}, function errorCallback(response) {
console.error(response);
});
}
getAuthURL();
$scope.filter = {};
$scope.data = {};
$scope.filterEventID = function () {
devconsole.log("filterEventID");
$scope.schedulerSmartRMS.dataSource.filter({
operator: function (task) {
return $scope.selectedIds.indexOf(parseInt(task.eventTypeID)) >= 0;
}
});
};
$scope.selectOptions = {
placeholder: "Select event...",
dataTextField: "eventName",
dataValueField: "eventID",
tagTemplate: '<span class="k-button" style="background-color: #:data.color# "></span> <span>#:data.eventName#</span>',
valuePrimitive: true,
autoBind: false,
dataSource: [{
eventName: "Type1",
eventID: 1,
color: "#f8a398"
},
{
eventName: "Type2",
eventID: 2,
color: "#51a0ed"
},
{
eventName: "Type3",
eventID: 3,
color: "#56ca85"
}]
};
$scope.selectedIds = [1];
function scheduler_dataBinding(e) {
devconsole.log("dataBinding");
}
function scheduler_dataBound(e) {
devconsole.log("dataBound");
}
function scheduler_save(e) {
devconsole.log("save");
$scope.schedulerSmartRMS.refresh();
}
function scheduler_remove(e) {
devconsole.log("remove");
$scope.schedulerSmartRMS.refresh();
}
function scheduler_cancel(e) {
devconsole.log("cancel");
}
function scheduler_edit(e) {
devconsole.log("edit");
}
function scheduler_add(e) {
devconsole.log("add");
}
function schedulerStart() {
$scope.schedulerOptions = {
date: new Date("2016/10/12"),
startTime: new Date("2016/10/12 07:00"),
majorTimeHeaderTemplate: kendo.template("<strong>#=kendo.toString(date, 'HH:mm')#</strong><sup> น.</sup>"),
minorTickCount: 1,
toolbar: ["pdf"],
messages: {
cancel: "Cancel",
save: "Save",
deleteWindowTitle: "Remove event",
pdf: "PDF Export",
editable: {
confirmation: "Are you sure you want to delete this event?"
|
7598c58f
Apichat.Tum
add eventTypeID /...
|
104
|
},
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
editor: {
description: "Description"
}
},
height: 600,
dataBinding: scheduler_dataBinding,
dataBound: scheduler_dataBound,
save: scheduler_save,
remove: scheduler_remove,
edit: scheduler_edit,
add: scheduler_add,
cancel: scheduler_cancel,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
"agenda",
"timeline"
],
timezone: "Asia/Bangkok",
dataSource: {
batch: true,
transport: {
read: {
url: "//localhost:3001/events",
dataType: "jsonp",
type: "GET"
|
cf86e9a3
Apichat.Tum
- ui with oauth2 ...
|
133
|
},
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
134
135
136
137
|
update: {
url: "//localhost:3001/events",
dataType: "jsonp",
type: "PUT"
|
cf86e9a3
Apichat.Tum
- ui with oauth2 ...
|
138
|
},
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
139
140
141
142
|
create: {
url: "//localhost:3001/events",
dataType: "jsonp",
type: "POST"
|
7598c58f
Apichat.Tum
add eventTypeID /...
|
143
|
},
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
144
145
146
147
|
destroy: {
url: "//localhost:3001/events",
dataType: "jsonp",
type: "DELETE"
|
7598c58f
Apichat.Tum
add eventTypeID /...
|
148
|
},
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
149
150
151
|
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
|
7598c58f
Apichat.Tum
add eventTypeID /...
|
152
|
}
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
}
},
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "TaskID" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "datetime", from: "Start" },
end: { type: "datetime", from: "End" },
startTimezone: { from: "StartTimezone", defaultValue: "Asia/Bangkok" },
endTimezone: { from: "EndTimezone", defaultValue: "Asia/Bangkok" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
eventTypeID: { from: "EventTypeID" },
isAllDay: { type: "boolean", from: "IsAllDay" }
|
7598c58f
Apichat.Tum
add eventTypeID /...
|
171
|
}
|
21a1ff19
Apichat.Tum
fix follow smartr...
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
}
},
filter: {
field: "eventTypeID", operator: "eq", value: 1
}
},
editable: true,
resources: [
{
field: "eventTypeID",
title: "EventType",
dataSource: [
{ text: "Type1", value: 1, color: "#f8a398" },
{ text: "Type2", value: 2, color: "#51a0ed" },
{ text: "Type3", value: 3, color: "#56ca85" }
]
}
]
};
}
});
|