Giorgi Tedoradze Posted yesterday at 05:03 PM Share Posted yesterday at 05:03 PM Hello. We need to changing client status from cliens.php in admin by checkboxes. for example check users which we want to change status and on clicking button(change) change selected users status (or more every client has additional link/button when click change status on closed. please tell us right way for your cms. p.s. and please sql request tell too maybe from mysql changing will need. please check what i did. and tell me is it good way? add_hook('AdminAreaFooterOutput', 1, function ($vars) { if ($vars['filename'] != 'clients') { return; } $token = generate_token('plain'); return <<<HTML <script> jQuery(function($){ window.closeClientFromList = function(userid) { if (!confirm('დარწმუნებული ხართ, რომ გსურთ არჩეული კლიენტების დახურვა? ეს პაკეტებსა და გადაუხდელ ინვოისებს გაუქმებულზე დააყენებს.')) { return false; } var url = 'clientssummary.php?userid=' + userid + '&action=closeclient' + '&token={$token}'; var iframe = $('<iframe>', { src: url, style: 'display:none;', load: function() { setTimeout(function(){ location.reload(); }, 1000); } }); $('body').append(iframe); return false; }; $('table tbody tr').each(function(){ var row = $(this); var checkbox = row.find('input[name="selectedclients[]"]'); if (!checkbox.length) { return; } var userid = checkbox.val(); var link = '<a class="btn btn-xs btn-danger ml-1" ' + 'href="#" ' + 'onclick="return closeClientFromList(' + userid + ');">' + 'კლიენტის დახურვა</a>'; row.find('td:last').append(' ' + link); }); }); </script> HTML; }); add_hook('AdminAreaFooterOutput', 1, function ($vars) { if ($vars['filename'] != 'clients') { return; } $token = generate_token('plain'); return <<<HTML <script> jQuery(function($){ var btn = $('<button type="button" class="btn btn-danger" id="closeSelectedClients" style="margin-left:-160px;margin-top:20px;padding:10px;">მონიშნული კლიენტების დახურვა</button>'); $('#btnSearchClients').after(btn); $('#closeSelectedClients').click(function(){ var clients = []; $('input[name="selectedclients[]"]:checked').each(function(){ clients.push($(this).val()); }); if (clients.length == 0) { alert('გთხოვთ მონიშნეტ მინიმუმ 1 კლიენტი'); return; } if (!confirm('დარწმუნებული ხართ, რომ გსურთ არჩეული კლიენტების დახურვა? ეს პაკეტებსა და გადაუხდელ ინვოისებს გაუქმებულზე დააყენებს.')) { return; } var completed = 0; clients.forEach(function(userid){ var url = 'clientssummary.php?userid=' + userid + '&action=closeclient' + '&token={$token}'; var iframe = $('<iframe>', { src: url, style: 'display:none;', load: function(){ completed++; if (completed == clients.length) { location.reload(); } } }); $('body').append(iframe); }); }); }); </script> HTML; }); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.