<div class="panel panel-default">
<div class="panel-heading">
{{lang_organizationListHeader}}
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-stripped table-condensed table-hover stupidtable">
<thead>
<tr>
<th width="95%" data-sort="string">{{lang_organization}}</th>
<th width="5%"><span class="glyphicon glyphicon-ok" title="{{lang_canLoginOrganization}}"></span></th>
</tr>
</thead>
<tbody>
{{#organizations}}
<tr>
<td width="95%" class="text-left text-nowrap">{{displayname}}</td>
<td width="5%">
<div class="checkbox">
<input onclick="seto('setorglogin', this, '{{organizationid}}')" type="checkbox" {{{canlogin}}}>
<label></label>
</div>
</td>
</tr>
{{/organizations}}
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript"><!--
function seto(action, el, orgid) {
var box = $(el);
var $notification;
box = box.parent();
var v = el.checked ? '1' : '0';
var old = el.checked == true;
box.css('display', 'none');
$.post('?do=DozMod', { token: TOKEN, section: 'users', action: action, organizationid: orgid, value: v }).done(function (data) {
if (data !== '1' && data !== '0') {
el.checked = !old;
box.parent().css('background-color', '');
/* show success notification */
$notification = $('<span></span>')
.addClass('glyphicon glyphicon-remove')
.css('color', 'red')
.css('width', '0px')
.css('position', 'relative')
.css('right', '20px')
.hide();
box.before($notification);
$notification.fadeIn('fast', function () {
$notification.fadeOut('slow', function () { $notification.remove() });
});
} else {
el.checked = (data == 1);
box.parent().css('background-color', '');
/* show success notification */
$notification = $('<span></span>')
.addClass('glyphicon glyphicon-saved')
.css('color', '#2ecc71')
.css('width', '0px')
.css('position', 'relative')
.css('right', '20px')
.hide();
box.before($notification);
$notification.fadeIn('fast', function () {
$notification.fadeOut('slow', function () { $notification.remove() });
});
}
box.css('display', '');
}).fail(function() {
el.checked = !old;
box.parent().css('background-color', 'red !important');
box.css('display', '');
});
}
--> </script>