Commit 17ba756b authored by dm141569's avatar dm141569 Committed by BZ

Add functions to attend meetup

parent ab3b3c2b
......@@ -64,6 +64,7 @@ class HomeController extends Controller {
public function participants($id) {
$ps = DB::table('participants')
->where('event_id', $id)
->orderBy('name', 'asc')
->get();
// funkt nicht, WHY?: $ps = Participant::find($id);
......
html, body {
}
#details {
display: none;
}
......@@ -73,8 +73,8 @@ SPORTMEETUPFH.Main = (function() {
.find('input[type=text], textarea')
.val('');
$('#meetups').empty(); // Quick and Dirty Solution
/** Quick and Dirty Solution */
$('#meetups').empty();
loadData();
return false;
......@@ -88,7 +88,18 @@ SPORTMEETUPFH.Main = (function() {
currentEvent = data[ $(this).data('meetup-date') ][ $(this).data('meetup-array-id') ];
$.get('/' + currentEvent.id + '/ps', function(d) {
console.debug(d);
if (d.length == 0) {
$('#no-ps').show();
return false;
};
$.each(d, function(key, value) {
var div = $(document.createElement('div'));
$(div).text(value.name + ' ' + value.contact);
$('#participants').append(div);
});
});
var header = $(document.createElement('header'));
......@@ -112,24 +123,21 @@ SPORTMEETUPFH.Main = (function() {
* Attend to a meetup
*/
function attendMeetup() {
console.debug('attending...');
console.debug(currentEvent.id);
$.post('/' + currentEvent.id, {
_token: $('#_a-token').val(),
id: currentEvent.id,
name: $('#a-name').val(),
contact: $('#a-contact').val()
});
})
$('#attend').fadeOut();
$('#attend').fadeOut(function() {
$('#attend')
.find('input[type=text], textarea')
.val('');
});
// @todo SUCCESS MESSAGE
$('#attend')
.find('input[type=text], textarea')
.val('');
return false;
}
......@@ -141,6 +149,8 @@ SPORTMEETUPFH.Main = (function() {
$('#create-meetup').fadeIn('slow');
$('#meetups').fadeIn('slow');
$('#attend').show();
$('#participants').empty();
$('#no-ps').hide();
});
return false;
......@@ -154,6 +164,9 @@ SPORTMEETUPFH.Main = (function() {
* Load data and call event listener setup
*/
init: function() {
$('#details').hide();
$('#no-ps').hide();
loadData();
this.initListeners();
......
......@@ -79,6 +79,12 @@
<input type="submit" name="submit-attend" id="submit-attend" value="Mitmachen!"/>
</fieldset>
</form>
<h2>Teilnehmer</h2>
<p id="no-ps">Bis jetzt keine Teilnehmer</p>
<div id="participants">
</div>
</div>
<footer>
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment