Skip to content
Snippets Groups Projects
Commit e97d77f6 authored by Lukas Gygi's avatar Lukas Gygi
Browse files

developed events tool

parent 9f140b8d
No related branches found
No related tags found
No related merge requests found
<div class="users-table-wrapper">
<div class="tools-full-height">
<table class="table table-hover events-table">
<thead>
<tr>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="tools-full-height">
<table class="table table-hover events-table" id="events-table">
<thead>
<tr>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<!-- modal for details of events-->
<div class="modal fade" id="detail-modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 id="event-modal-title" class="modal-title"></h4>
</div>
<div class="modal-body">
<table class="table table-hover" id="event-details-table">
<thead>
<tr>
<th>field</th>
<th>value</th>
</tr>
</thead>
<tbody name="table-body">
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- modal for creating new events-->
<div class="modal fade" id="new-modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Create new Event</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="title_de">Title</label>
<input type="text" class="form-control" id="title_de"></input>
</div>
<div class="form-group">
<label for="description_de">Description</label>
<textarea type="text" class="form-control" rows="3" id="description_de"></textarea>
</div>
<div class="form-group">
<label for="catchphrase_de">Catchphrase</label>
<input type="text" class="form-control" id="catchphrase_de"></input>
</div>
<div class="form-group">
<label for="time_start">Start Time</label>
<input type="datetime" class="form-control" id="time_start"></input>
</div>
<div class="form-group">
<label for="time_end">End Time</label>
<input type="datetime" class="form-control" id="time_end"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="signup-required" value="">No Signup
</label>
<label class="checkbox-inline">
<input type="checkbox" id="no-signup-limit" value="">No Signup Limit
</label>
<div class="form-group">
<label for="spots">Spots</label>
<input type="number" class="form-control" id="spots"></input>
</div>
<label class="checkbox-inline">
<input type="checkbox" id="allow_email_signup" value="">Only amiv Members
</label>
<div class="form-group">
<label for="time_register_start">Start of Registration</label>
<input type="datetime" class="form-control" id="time_register_start"></input>
</div>
<div class="form-group">
<label for="time_register_end">End of Registration</label>
<input type="datetime" class="form-control" id="time_register_end"></input>
</div>
<div class="form-group">
<label for="location">Location</label>
<input type="text" class="form-control" id="location"></input>
</div>
<div class="form-group">
<label for="price">Price</label>
<input type="text" class="form-control" id="price"></input>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_website" value="">Show on Webstite (requires banner image and title)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show_infoscreen" value="">Show ond Infoscreen (requires infoscreen image)
</label>
</div>
<div>
<label class="checkbox-inline">
<input type="checkbox" id="show announce" value="">Show in Announce (requires stuff)
</label>
</div>
<button data-toggle="collapse" data-target="#english-collapse">show english fields</button>
<div id="english-collapse" class="collapse">
<div class=form-group>
<label for="title_en">Title english</label>
<input type="text" class="form-control" id="title_en"></input>
</div>
<div class="form-group">
<label for="description_en">Description english</label>
<textarea type="text" class="form-control" rows="3" id="description_en"></textarea>
</div>
<div class="form-group">
<label for="catchphrase_en">Catchphrase english</label>
<input type="text" class="form-control" id="catchphrase_en"></input>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<style>
.users-table-wrapper {
position: relative;
position: relative;
}
.users-table-wrapper>div {
overflow: auto;
overflow: auto;
}
.users-sidebar {
background: #fff;
background: #fff;
}
</style>
<script type="text/javascript">
var showInTable = ['title_de', 'catchphrase_de', 'show_website', 'spots'];
var showInTable = ['title_de', 'time_start', 'show_website', 'spots'];
var tableTitles = ['Title', 'Date', 'on website', 'spots'];
amivcore.events.GET({data:{'max_results':'50'}}, function(ret){
console.log(ret);
if(!ret || ret['_items'].length == 0){
tools.log('No Data', 'w');
return;
}
showInTable.forEach(function(i){
$('.events-table thead tr').append('<th>'+ i +'</th>');
});
for(var n in ret['_items']){
var tmp = '';
showInTable.forEach(function(i){
tmp += '<td>'+ ret['_items'][n][i] +'</td>';
});
$('.events-table tbody').append('<tr>'+tmp+'</tr>');
//$('.users-table tbody').append('<tr><td>'+ret['_items'][n].firstname+'</td></tr>');
}
console.log(ret);
if(!ret || ret['_items'].length == 0){
tools.log('No Data', 'w');
return;
}
tableTitles.forEach(function(i){
$('.events-table thead tr').append('<th>'+ i +'</th>');
});
for(var n in ret['_items']){
var tmp = '';
showInTable.forEach(function(i){
tmp += '<td>'+ ret['_items'][n][i] +'</td>';
});
$('#events-table tbody').append('<tr name="'+ret['_items'][n]['id']+'"">'+tmp+'</tr>');
}
//show modal on click of the table
$('#events-table tbody tr').click(function(event) {
var id = $(this).attr('name')
var clickedEvent = $.grep(ret['_items'], function(e){return e.id == id;})[0];
console.log(clickedEvent);
$('#detail-modal .modal-title').text(clickedEvent['title_de']);
$('#detail-modal').modal('show');
for(var field in clickedEvent){
var temp = '<td>'+field+'</td><td>'+clickedEvent[field]+'</td>';
$('#event-details-table tbody').append('<tr>'+temp+'</tr>');
}
//var clicked = $.grep(_items, function(e){ return e.id == ; })[];
});
});
$('#detail-modal').on("hidden.bs.modal", function (e) {
$(e.target).removeData("bs.modal").find(".modal-content tbody").empty();
});
$(document).ready(function(){
// $('#time_start').datetimepicker({
// locale: 'de'
//});
});
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment