forked from myasonik/PDP-Front-end
/
calendarEditEvent.html
199 lines (189 loc) · 10.7 KB
/
calendarEditEvent.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
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
104
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<html lang="en">
<head>
<title>Professional Development Program</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="dns-prefetch" href="http://fonts.googleapis.com"/>
<link rel="dns-prefetch" href="http://google-analytics.com"/>
<link rel="icon" href="imgs/favicon.png"/>
<link rel="stylesheet" href="fullcalendar.css"/>
<link rel="stylesheet" href="../time/bootstrap.css"/>
<link rel="stylesheet" href="../time/bootstrap-datetimepicker.css"/>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600"/>
<link rel="stylesheet" href="style.min.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="fullcalendar.min.js"></script>
<script src="scripts.min.js"></script>
<script type="text/javascript" src="../time/moment.min.js"></script>
<script type="text/javascript" src="../time/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../time/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var eventId = getQueryVariable("event");
$('.time').datetimepicker();
var userId = 'tst1111';
$.ajax({
type: "GET",
url: rootLoc + "/api/v1/calendar/events/" + eventId,
cache: false,
success: function(result) {
console.log(result);
console.log(typeof result);
console.log(result["title"]);
console.log(result['location']);
console.log(result['start']);
console.log(result['end']);
console.log(result['registration_start']);
console.log(result['registration_end']);
console.log(result['approval_start']);
console.log(result['approval_end']);
console.log(result['description']);
//Prefill the boxes
var form = $( "#editEventForm" );
form.find( "input[id='title']" ).val(result['title']);
form.find( "input[id='loc']" ).val(result['location']);
form.find( "input[id='startTime']" ).val(formatDate(result['start']));
form.find( "input[id='endTime']" ).val(formatDate(result['end']));
form.find( "input[id='startTimeReg']" ).val(formatDate(result['registration_start']));
form.find( "input[id='endTimeReg']" ).val(formatDate(result['registration_end']));
form.find( "input[id='startTimeApprove']" ).val(formatDate(result['approval_start']));
form.find( "input[id='endTimeApprove']" ).val(formatDate(result['registration_end']));
$("#description" ).val(result['description']);
if(result['ceus']['type'] === "general"){
$("#genCEUs").html(result['ceus']['scalar']);
$("#profCEUs").html("0");
}else if(result['ceus']['type'] === "professional"){
$("#genCEUs").html("0");
$("#profCEUs").html(result['ceus']['scalar']);
}else{
$("#genCEUs").html("0");
$("#profCEUs").html("0");
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Status: " + textStatus);
console.log("Error: " + errorThrown);
}
});
$( "#deleteEventForm" ).submit(function( event ) {
event.preventDefault();
if(confirm('Would You like to delete this event?')){
$.ajax({
type: "POST",
url: rootLoc + "/calendar/delete_event",
data: "event_uid=" + eventId,
cache: false,
success: function(result) {
console.log(result);
window.location.href="calendarIndex.html";
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Status: " + textStatus);
console.log("Error: " + errorThrown);
}
});
}
});
$( "#editEventForm" ).submit(function( event ) {
// Stop form from submitting normally
event.preventDefault();
// Get some values from elements on the page:
var $form = $( this );
var title = $form.find( "input[id='title']" ).val();
var loc = $form.find( "input[id='loc']" ).val();
var start = $form.find( "input[id='startTime']" ).val();
var end = $form.find( "input[id='endTime']" ).val();
var startReg = $form.find( "input[id='startTimeReg']" ).val();
var endReg = $form.find( "input[id='endTimeReg']" ).val();
var startApprove = $form.find( "input[id='startTimeApprove']" ).val();
var endApprove = $form.find( "input[id='endTimeApprove']" ).val();
var des = $("#description").val();
console.log($("#description" ).val());
var dataString = 'title='+ title;
dataString += '&location='+ loc;
dataString += '&start='+ start;
dataString += '&end='+ end;
dataString += '®istration_start='+ startReg;
dataString += '®istration_end='+ endReg;
dataString += '&approval_start='+ startApprove;
dataString += '&approval_end='+ endApprove;
dataString += '&description=' + des;
dataString += '&event_uid=' + eventId
dataString += '&username=' + userId;
console.log("Sending out: " + dataString);
$.ajax({
type: "POST",
url: rootLoc + "/calendar/modify_event",
data: dataString,
cache: false,
success: function(result) {
console.log("Event Fixed!");
window.location.href="calendarIndex.html";
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Status: " + textStatus);
console.log("Error: " + errorThrown);
}
});
});
});
</script>
</head>
<body class="preload">
<header>
<div class="container"><a href="index.html" class="logo"><img src="imgs/PDPLogo.png" alt="PDP Logo"/></a>
<p class="motto"><span>Pause for PD...</span>It's good for you!</p>
<nav class="breadcrumbs"><a href="http://rit.edu" target="_blank">RIT</a><a href="http://ntid.rit.edu" target="_blank">NTID</a><a href="http://ntid.rit.edu/das" target="_blank">DAS</a><a href="http://index.html">Professional Development Program</a></nav>
<nav class="mainNav"><a href="index.html" class="Home">Home</a><a href="userMyAccount.html" class="MyAccount">My Account</a><a href="calendarIndex.html" class="Calendar selected">Calendar</a><a href="committee.html" class="Committee">Committee</a><a href="forms.html" class="Forms">Forms</a><a href="resources.html" class="Resources">Resources</a><a href="blog.html" class="Blog">Blog</a><a href="contact.html" class="Contact">Contact</a><a href="faq.html" class="FAQ">FAQ</a><img src="imgs/swoosh.png" class="swoosh"/>
</nav>
</div>
</header>
<main>
<div class="container">
<div class="block onehalf center">
<h2>Modify Event</h2>
<form id="editEventForm" class="content center">
<label for="title">Event Title:<span id="titleError" class="error">Please enter an event title</span></label>
<input type="text" id="title" placeholder="Team Status Meeting"/>
<label for="loc">Event Location:<span id="locError" class="error">Please enter an event location</span></label>
<input type="text" id="loc" placeholder="Sundial"/>
<label for="startTime">Event Start Time:<span id="startTimeError" class="error">Please enter an event start time</span></label>
<input type="text" id="startTime" placeholder="Enter text in the format 03:35PM" class="time"/>
<label for="endTime">Event End Time:<span id="endTimeError" class="error">Please enter an event end time</span></label>
<input type="text" id="endTime" placeholder="Enter text in the format 04:35PM" class="time"/>
<label for="startTimeReg">Registration Start Time:<span id="startTimeError" class="error">Please enter an event start time</span></label>
<input type="text" id="startTimeReg" placeholder="Enter text in the format 03:35PM" class="time"/>
<label for="endTimeReg">Registration End Time:<span id="endTimeError" class="error">Please enter an event end time</span></label>
<input type="text" id="endTimeReg" placeholder="Enter text in the format 04:35PM" class="time"/>
<label for="startTimeApprove">Approval Start Time:<span id="startTimeError" class="error">Please enter an event start time</span></label>
<input type="text" id="startTimeApprove" placeholder="Enter text in the format 03:35PM" class="time"/>
<label for="endTimeApprove">Approval End Time:<span id="endTimeError" class="error">Please enter an event end time</span></label>
<input type="text" id="endTimeApprove" placeholder="Enter text in the format 04:35PM" class="time"/>
<label for="profCEUs">Professional Studies CEUs:<span id="profCEUsError" class="error">Please enter a valid CEU quantity</span></label>
<input type="text" id="profCEUs" placeholder=".2"/>
<label for="genCEUs">General Studies CEUs:<span id="genCEUsError" class="error">Please enter a valid CEU quantity</span></label>
<input type="text" id="genCEUs" placeholder=".2"/>
<label for="description">Event Description:<span id="descriptionError" class="error">Required Field</span></label>
<textarea id="description" rows="6" placeholder="Quick stand up meeting to report the status of our current projects"></textarea>
<input type="submit" id="submitButton" value="Save"/>
</form>
<form id="deleteEventForm" class="content center">
<input type="submit" id="submitButton" value="Delete Event"/>
</form>
</div>
</div>
</main>
<footer>
<div class="container">
<div class="left"><a href="http://rit.edu" target="_blank">Rochester Institute of Technology</a><a href="http://ntid.rit.edu" target="_blank">National Technical Institute for the Deaf</a><a href="http://ntid.rit.edu/das" target="_blank">Deartment of Access Services</a>
<p>© 2013</p>
</div>
<div class="logos"><a href="http://www.rid.org/" target="_blank"><img src="imgs/RID.png" alt="RID logo"/></a><a href="http://www.rid.org/education/index.cfm/AID/99" target="_blank"><img src="imgs/ACET.png" alt="ACET logo"/></a>
<div class="interpretek">
<p>Our Sponsor:</p><a href="http://www.interpretek.com" target="_blank"><img src="imgs/interpretek.png" alt="Interpretek logo"/></a>
</div>
</div>
</div>
</footer>
</body>
</html>