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 + '    '); } else { $("#list").append(' ' + item.Name + ' ' + item.KCoins + '    '); } }); }); } getList(); function updateCoins(id) { console.log('Update', id); var addcoins = $('#kcoins_' + id).val(); if(addcoins != 0) { $('#coins_container_' + id).addClass('disabled'); $.ajax({ url: '/update', method: 'POST', data: 'id=' + id + '&addcoins=' + addcoins, success: function (msg) { console.log(msg); $('#coins_container_' + id).removeClass('disabled'); if (msg.Message == 'success') { $('#kcoins_' + id).val("0"); $('#kcoins_display_' + id).html(msg.Data.KCoins); } else { $('#msg').html('
Ein Fehler trat auf.
'); } } }); } } function deleteKonfi(id) { console.log('Delete', id); $('#kcoins_container_' + id).addClass('disabled'); $('.ui.basic.kofidel.modal') .modal({ closable : false, duration: 200, onDeny : function(){ $('#kcoins_container_' + id).removeClass('disabled'); return true; }, onApprove : function() { $.ajax({ url: '/delete', method: 'POST', data: 'id=' + id, success: function (msg) { console.log(msg); if (msg.Message == 'success') { //$('#kcoins_row_' + id).remove(); getList(); $('#msg').html('
Der Konfi wurde erfolgreich gelöscht.
'); } else { $('#msg').html('
Ein Fehler trat auf.
'); } } }); } }) .modal('show') ; } function deleteGemeinde(id) { console.log('Delete', id); $('#kcoins_container_' + id).addClass('disabled'); $('.ui.basic.gemeindedel.modal') .modal({ closable : false, duration: 200, onDeny : function(){ $('#kcoins_container_' + id).removeClass('disabled'); return true; }, onApprove : function() { $.ajax({ url: '/delete', method: 'POST', data: 'id=' + id, success: function (msg) { console.log(msg); if (msg.Message == 'success') { //$('#kcoins_row_' + id).remove(); getList(); $('#msg').html('
Die Gemeinde wurde erfolgreich gelöscht.
'); } else { $('#msg').html('
Ein Fehler trat auf.
'); } } }); } }) .modal('show') ; } // Konfi hinzufügen $('.ui.kofiadd.modal') .modal({ duration: 200, onApprove : function() { $('.loader').addClass('active'); $.ajax({ url: '/add', method: 'POST', data: 'name=' + $('#name').val() + '&gemeinde=' + $('#gemeinde').val(), success: function (msg) { $('.loader').removeClass('active'); console.log(msg); if (msg.Message == 'success') { $('#name').val(''); $('#gemeinde').val(''); getList(); $('#msg').html('
Der Konfi wurde erfolgreich hinzugefügt.
'); } else { $('#msg').html('
Ein Fehler trat auf.
'); } } }); } }) .modal('attach events', '.addKofi.button', 'show') ; $('.ui.gemeindeadd.modal') .modal({ duration: 200, onApprove : function() { $('.loader').addClass('active'); console.log('bul'); $.ajax({ url: '/add', method: 'POST', data: 'name=' + $('#name').val(), success: function (msg) { $('.loader').removeClass('active'); console.log(msg); if (msg.Message == 'success') { $('#name').val(''); getList(); $('#msg').html('
Die Gemeinde wurde erfolgreich hinzugefügt.
'); } else { $('#msg').html('
Ein Fehler trat auf.
'); } } }); } }) .modal('attach events', '.addGemeinde.button', 'show') ; $('.ui.kofiupload.modal') .modal('attach events', '.ui.right.labeled.icon.uploadKofis.button.blue', 'show') ;