diff --git a/assets/js/admin.js b/assets/js/admin.js index 6330df7..861e0e4 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -1,21 +1,21 @@ function getList() { $.getJSON('/list?asc=asc', function (data) { - console.log(data); $("#list").html(''); $.each(data, function (i, item) { - if(item.Gemeinde !== undefined) { - $("#list").append('' + - '' + item.Name + ' ' + - '' + item.Gemeinde + ' ' + - '' + item.KCoins + '' + - '    '); + // Modus nach Gemeindeb + if(item.gemeinde !== undefined) { + $("#list").append('' + + '' + item.name + ' ' + + '' + item.gemeinde + ' ' + + '' + item.kcoins + '' + + '    '); } else { - $("#list").append(' ' + - '' + item.Name + ' ' + - '' + item.KCoins + '' + - '' + item.KonfiCount + ' ' + - '' + (item.CoinsQuota).toFixed(2) + ' ' + - '    '); + $("#list").append(' ' + + '' + item.name + ' ' + + '' + item.kcoins + '' + + '' + item.konfi_count + ' ' + + '' + (item.coins_quota).toFixed(2) + ' ' + + '    '); } }); }); @@ -24,10 +24,9 @@ function getList() { getList(); function updateCoins(id) { - console.log('Update', id); - var addcoins = $('#kcoins_' + id).val(); + let addcoins = $('#kcoins_' + id).val(); - if(addcoins != 0) { + if(addcoins !== 0) { $('#coins_container_' + id).addClass('disabled'); $.ajax({ @@ -35,14 +34,13 @@ function updateCoins(id) { method: 'POST', data: 'id=' + id + '&addcoins=' + addcoins, success: function (msg) { - console.log(msg); $('#coins_container_' + id).removeClass('disabled'); - if (msg.Message == 'success') { + if (msg.message === 'success') { $('#kcoins_' + id).val("0"); - $('#kcoins_display_' + id).html(msg.Data.KCoins); - if(msg.Data.CoinsQuota !== undefined) { - $('#kcoins_quota_' + id).html(msg.Data.CoinsQuota.toFixed(2)); + $('#kcoins_display_' + id).html(msg.data.kcoins); + if(msg.data.coins_quota !== undefined) { + $('#kcoins_quota_' + id).html(msg.data.coins_quota.toFixed(2)); } } else { @@ -54,7 +52,6 @@ function updateCoins(id) { } function deleteKonfi(id) { - console.log('Delete', id); $('#kcoins_container_' + id).addClass('disabled'); $('.ui.basic.kofidel.modal') @@ -71,9 +68,8 @@ function deleteKonfi(id) { method: 'POST', data: 'id=' + id, success: function (msg) { - console.log(msg); - if (msg.Message == 'success') { + if (msg.message === 'success') { //$('#kcoins_row_' + id).remove(); getList(); $('#msg').html('
Der Konfi wurde erfolgreich gelöscht.
'); @@ -89,7 +85,6 @@ function deleteKonfi(id) { } function deleteGemeinde(id) { - console.log('Delete', id); $('#kcoins_container_' + id).addClass('disabled'); $('.ui.basic.gemeindedel.modal') @@ -106,9 +101,8 @@ function deleteGemeinde(id) { method: 'POST', data: 'id=' + id, success: function (msg) { - console.log(msg); - if (msg.Message == 'success') { + if (msg.message === 'success') { //$('#kcoins_row_' + id).remove(); getList(); $('#msg').html('
Die Gemeinde wurde erfolgreich gelöscht.
'); @@ -135,9 +129,8 @@ $('.ui.kofiadd.modal') data: 'name=' + $('#name').val() + '&gemeinde=' + $('#gemeinde').val(), success: function (msg) { $('.loader').removeClass('active'); - console.log(msg); - if (msg.Message == 'success') { + if (msg === 'success') { $('#name').val(''); $('#gemeinde').val(''); @@ -158,16 +151,13 @@ $('.ui.gemeindeadd.modal') duration: 200, onApprove : function() { $('.loader').addClass('active'); - console.log('bul'); $.ajax({ url: '/add', method: 'POST', data: 'name=' + $('#name').val() + '&konfis=' + $('#konfis').val(), success: function (msg) { $('.loader').removeClass('active'); - console.log(msg); - - if (msg.Message == 'success') { + if (msg === 'success') { $('#name').val(''); getList(); diff --git a/assets/js/load.js b/assets/js/load.js index 1253dac..ee054ff 100644 --- a/assets/js/load.js +++ b/assets/js/load.js @@ -1,19 +1,18 @@ setInterval(function() { $.getJSON('/list', function (data) { - //console.log(data); $( "#konfis" ).html(''); $.each( data, function( i, item ) { - if (item.Gemeinde != undefined) { + if (item.gemeinde != undefined) { $( "#konfis" ).append(' ' + - '' + item.Name + ' ' + - '' + item.Gemeinde + ' ' + - '' + item.KCoins + '' + + '' + item.name + ' ' + + '' + item.gemeinde + ' ' + + '' + item.kcoins + '' + ''); } else { $( "#konfis" ).append(' ' + - '' + item.Name + ' ' + - '' + item.KCoins + '' + - '' + (item.CoinsQuota).toFixed(2) + ' ' + + '' + item.name + ' ' + + '' + item.kcoins + '' + + '' + (item.coins_quota).toFixed(2) + ' ' + ''); } }); diff --git a/tpl/admin_mode_0.html b/tpl/admin_mode_0.html index 0f95deb..b1fc6db 100644 --- a/tpl/admin_mode_0.html +++ b/tpl/admin_mode_0.html @@ -50,7 +50,7 @@ -

© 2017 Konrad Langenberg (kola-entertainments.de) | Version: {{.Version}}

+

© 2017-2019 Konrad Langenberg | Version: {{.Version}}

diff --git a/tpl/admin_mode_1.html b/tpl/admin_mode_1.html index 1977aaf..ae4a232 100644 --- a/tpl/admin_mode_1.html +++ b/tpl/admin_mode_1.html @@ -45,7 +45,7 @@ -

© 2017 Konrad Langenberg (kola-entertainments.de) | Version: {{.Version}}

+

© 2017-2019 Konrad Langenberg | Version: {{.Version}}