Use toggle for Enabled/Disabled switch

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-12-13 16:28:24 +00:00
parent 50f05b9119
commit b62c550ad7
7 changed files with 48 additions and 14 deletions
+3 -4
View File
@@ -63,11 +63,10 @@ $(document).ready(function() {
"rowCallback": function( row, data ) {
$('td:eq(0)', row).html( '<code>'+data["address"]+'</code>' );
const disabled = data["enabled"] === 0;
$('td:eq(1)', row).html( '<select id="status" class="form-control">'+
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
'</select>' );
$('td:eq(1)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
$('td:eq(2)', row).html( '<input id="comment" class="form-control"><input id="id" type="hidden" value="'+data["id"]+'">' );
$('#comment', row).val(data["comment"]);
+1 -1
View File
@@ -157,7 +157,7 @@ function addClient()
function editClient()
{
var tr = $(this).closest("tr");
var id = tr.find("td:eq(0)").html();
var id = tr.find("#id").val();
var groups = tr.find("#multiselect").val();
showAlert('info');
+2 -4
View File
@@ -72,10 +72,8 @@ $(document).ready(function() {
'</select>' );
const disabled = data["enabled"] === 0;
$('td:eq(2)', row).html( '<select id="status" class="form-control">'+
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
'</select>' );
$('td:eq(2)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
$('td:eq(3)', row).html( '<input id="comment" class="form-control"><input id="id" type="hidden" value="'+data["id"]+'">' );
$('#comment', row).val(data["comment"]);
+2 -4
View File
@@ -41,10 +41,8 @@ $(document).ready(function() {
},
"rowCallback": function( row, data ) {
const disabled = data["enabled"] === 0;
$('td:eq(1)', row).html( '<select id="status" class="form-control">'+
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
'</select>' );
$('td:eq(1)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
$('td:eq(2)', row).html( '<input id="name" class="form-control">' );
$('#name', row).val( data["name"] );
+3 -1
View File
@@ -219,9 +219,11 @@
<script src="style/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="scripts/vendor/app.min.js"></script>
<?php if(in_array($scriptname, array("groups-clients.php", "groups-domains.php", "groups-adlists.php"))){ ?>
<?php if(in_array($scriptname, array("groups.php", "groups-clients.php", "groups-domains.php", "groups-adlists.php"))){ ?>
<script src="style/vendor/bootstrap/js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="style/vendor/bootstrap/css/bootstrap-multiselect.css">
<script src="style/vendor/bootstrap/js/bootstrap-toggle.min.js"></script>
<link rel="stylesheet" href="style/vendor/bootstrap/css/bootstrap-toggle.min.css">
<?php } ?>
<script src="scripts/vendor/jquery.dataTables.min.js"></script>