Skip to content
Snippets Groups Projects
Commit 99c34282 authored by degygii's avatar degygii
Browse files

added stuff to event tool and groups tool

parent 920ee80a
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
var groups = { var groups = {
showInTable: ['firstname', 'lastname', 'nethz', 'legi', 'membership'], tableTitles: ['Name', 'Zoidberg', 'self enrollment', '# Of Subscribers'],
showInTable: ['name', 'has_zoidberg_share', 'allow_self_enrollment'],
curgroupData: null, curgroupData: null,
// Page // Page
...@@ -77,20 +78,22 @@ ...@@ -77,20 +78,22 @@
// Get groups // Get groups
get: function() { get: function() {
$('#wheel-logo').css('transform', 'rotate(360deg)');
amivcore.groups.GET({ amivcore.groups.GET({
data: { data: {
'max_results': '50', 'max_results': '50',
//page: groups.page.cur(), page: groups.page.cur(),
//sort: groups.sort.cur(), sort: groups.sort.cur(),
//where: groups.search.cur(), where: groups.search.cur(),
} }
}, function(ret) { }, function(ret) {
console.log(ret);
if (ret === undefined || ret['_items'].length == 0) { if (ret === undefined || ret['_items'].length == 0) {
tools.log('No Data', 'w'); tools.log('No Data', 'w');
$('#wheel-logo').css('transform', 'rotate(0deg)');
return; return;
} }
groups.meta = ret['_meta']; groups.meta = ret['_meta'];
groups.page.max = Math.ceil(groups.meta.total / groups.meta.max_results); groups.page.max = Math.ceil(groups.meta.total / groups.meta.max_results);
$('.groups-page-max-cont').html(groups.page.max); $('.groups-page-max-cont').html(groups.page.max);
...@@ -98,7 +101,7 @@ ...@@ -98,7 +101,7 @@
// Clear table from previous contentent // Clear table from previous contentent
$('.groups-table thead tr, .groups-table tbody').html(''); $('.groups-table thead tr, .groups-table tbody').html('');
groups.showInTable.forEach(function(i) { groups.tableTitles.forEach(function(i) {
$('.groups-table thead tr').append('<th>' + i + '</th>'); $('.groups-table thead tr').append('<th>' + i + '</th>');
}); });
...@@ -107,8 +110,10 @@ ...@@ -107,8 +110,10 @@
groups.showInTable.forEach(function(i) { groups.showInTable.forEach(function(i) {
tmp += '<td>' + ret['_items'][n][i] + '</td>'; tmp += '<td>' + ret['_items'][n][i] + '</td>';
}); });
tmp += '<td>' + ret['_items'][n]['user_subscribers'].length + '</td>';
$('.groups-table tbody').append('<tr data-id="' + ret['_items'][n]['id'] + '">' + tmp + '</tr>'); $('.groups-table tbody').append('<tr data-id="' + ret['_items'][n]['id'] + '">' + tmp + '</tr>');
} }
$('#wheel-logo').css('transform', 'rotate(0deg)');
$('.groups-table tbody tr').click(groups.showDetails); $('.groups-table tbody tr').click(groups.showDetails);
}); });
}, },
...@@ -236,7 +241,7 @@ ...@@ -236,7 +241,7 @@
callback: function() { callback: function() {
var tmp = '<div class="form-group"><select class="form-control groups-sort-select">'; var tmp = '<div class="form-group"><select class="form-control groups-sort-select">';
var cur = groups.sort.cur(); var cur = groups.sort.cur();
['id', 'firstname', 'lastname', 'membership', 'nethz'].forEach(function(i) { ['id', 'name', 'has_zoidberg_share', 'allow_self_enrollment'].forEach(function(i) {
tmp += '<option value="' + i + '"' + ((i == cur) ? ' selected' : '') + '>&#8673; ' + i + '</option>'; tmp += '<option value="' + i + '"' + ((i == cur) ? ' selected' : '') + '>&#8673; ' + i + '</option>';
tmp += '<option value="-' + i + '"' + (('-' + i == cur) ? ' selected' : '') + '>&#8675; ' + i + '</option>'; tmp += '<option value="-' + i + '"' + (('-' + i == cur) ? ' selected' : '') + '>&#8675; ' + i + '</option>';
}); });
...@@ -265,7 +270,7 @@ ...@@ -265,7 +270,7 @@
cur = ''; cur = '';
else else
cur = cur.split('==')[1]; cur = cur.split('==')[1];
['id', 'firstname', 'lastname'].forEach(function(i) { ['id', 'name', 'has_zoidberg_share', 'allow_self_enrollment'].forEach(function(i) {
tmp += '<option value="' + i + '"' + ((i == cur) ? ' selected' : '') + '>' + i + '</option>'; tmp += '<option value="' + i + '"' + ((i == cur) ? ' selected' : '') + '>' + i + '</option>';
}); });
tmp += '</select><br><input type="text" value="' + cur + '" class="form-control groups-search-val"></div>'; tmp += '</select><br><input type="text" value="' + cur + '" class="form-control groups-search-val"></div>';
......
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