-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.html
97 lines (89 loc) · 3.32 KB
/
event.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
<!DOCTYPE html>
<!--
This file is part of Booking App.
Booking App is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Booking App is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Booking App. If not, see <http://www.gnu.org/licenses/>.
-->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script src="js-cookie.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
</head>
<body>
<div data-role="page" id="event">
<div data-role="header">
<a id="cancel" data-ajax="false" data-icon="delete" href="index.html">Cancel</a>
<h1>Add Event</h1>
</div>
<div id="error"></div>
<form id="eventform" action="rest.php" method="post">
<div>
<label for="name">Event Name</label>
<input type="text" id="name" name="name" >
</div>
<div>
<label for="date">Date</label>
<input type="date" id="date" name="date" >
</div>
<div>
<label for="start">Start</label>
<input type="time" id="start" name="start" >
</div>
<div>
<label for="end">End</label>
<input type="time" id="end" name="end" >
</div>
<div>
<label for="description">Description</label>
<textarea name="description" id="description"/></textarea>
</div>
<div>
<label for="places">Places</label>
<input type="number" name="places" value="1" id="places" min="1" step="1"/>
</div>
<div>
<input type="submit" id="submit" name="submit" value="Save">
</div>
</form>
<script type='text/javascript'>
/* attach a submit handler to the form */
$("#eventform").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
/* get the action attribute from the <form action=""> element */
var $form = $( this ),
url = $form.attr( 'action' );
/* Send the data using post with element id name and name2*/
var posting = $.post( url+'/events?TOKEN='+Cookies.get("token")+'&USER='+Cookies.get("user"),
JSON.stringify({
'name': $('#name').val(),
'date' : $('#date').val(),
'start': $('#start').val(),
'end': $('#end').val(),
'description': $('#description').val(),
'places': $('#places').val(),
'bookings': '0'
}) );
/* Alerts the results */
posting.done(function( json ) {
if (json) {
data = $.parseJSON(json);
window.location.href = "events.html";
}
});
});
</script>
</div>
</body>