|
|
@ -511,22 +511,36 @@ $(function() {
|
|
|
|
var data = $(this).data("val");
|
|
|
|
var data = $(this).data("val");
|
|
|
|
checkboxHeader(val, name, data);
|
|
|
|
checkboxHeader(val, name, data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".button_head").on("click",function() {
|
|
|
|
|
|
|
|
var result = $('#user-table').bootstrapTable('getSelections').map(a => a.id);
|
|
|
|
|
|
|
|
confirmDialog(
|
|
|
|
|
|
|
|
"btndeluser",
|
|
|
|
|
|
|
|
"GeneralDeleteModal",
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
function() {
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
method:"post",
|
|
|
|
|
|
|
|
url: window.location.pathname + "/../../ajax/deleteuser",
|
|
|
|
|
|
|
|
data: {"userid": result},
|
|
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
selections = selections.filter( ( el ) => !result.includes( el ) );
|
|
|
|
|
|
|
|
// selections = selections.filter(item => item !== userId);
|
|
|
|
|
|
|
|
handleListServerResponse(data);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
error: function (data) {
|
|
|
|
|
|
|
|
handleListServerResponse({type:"danger", message:data.responseText})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
function user_handle (userId) {
|
|
|
|
function user_handle (userId) {
|
|
|
|
$.ajax({
|
|
|
|
$.ajax({
|
|
|
|
method:"post",
|
|
|
|
method:"post",
|
|
|
|
url: window.location.pathname + "/../../ajax/deleteuser",
|
|
|
|
url: window.location.pathname + "/../../ajax/deleteuser",
|
|
|
|
data: {"userid":userId}
|
|
|
|
data: {"userid":userId}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$.ajax({
|
|
|
|
$("#user-table").bootstrapTable("refresh");
|
|
|
|
method:"get",
|
|
|
|
|
|
|
|
url: window.location.pathname + "/../../ajax/listusers",
|
|
|
|
|
|
|
|
async: true,
|
|
|
|
|
|
|
|
timeout: 900,
|
|
|
|
|
|
|
|
success:function(data) {
|
|
|
|
|
|
|
|
$("#user-table").bootstrapTable("load", data);
|
|
|
|
|
|
|
|
loadSuccess();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$("#user-table").on("click-cell.bs.table", function (field, value, row, $element) {
|
|
|
|
$("#user-table").on("click-cell.bs.table", function (field, value, row, $element) {
|
|
|
@ -642,23 +656,13 @@ function handleListServerResponse (data, disableButtons) {
|
|
|
|
$("#flash_success").remove();
|
|
|
|
$("#flash_success").remove();
|
|
|
|
$("#flash_danger").remove();
|
|
|
|
$("#flash_danger").remove();
|
|
|
|
if (!jQuery.isEmptyObject(data)) {
|
|
|
|
if (!jQuery.isEmptyObject(data)) {
|
|
|
|
$( ".navbar" ).after( '<div class="row-fluid text-center" style="margin-top: -20px;">' +
|
|
|
|
data.forEach(function(item) {
|
|
|
|
'<div id="flash_'+data.type+'" class="alert alert-'+data.type+'">'+data.message+'</div>' +
|
|
|
|
$(".navbar").after('<div class="row-fluid text-center" style="margin-top: -20px;">' +
|
|
|
|
'</div>');
|
|
|
|
'<div id="flash_' + item.type + '" class="alert alert-' + item.type + '">' + item.message + '</div>' +
|
|
|
|
|
|
|
|
'</div>');
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$.ajax({
|
|
|
|
$("#user-table").bootstrapTable("refresh");
|
|
|
|
method: "get",
|
|
|
|
|
|
|
|
url: window.location.pathname + "/../../ajax/listusers",
|
|
|
|
|
|
|
|
async: true,
|
|
|
|
|
|
|
|
timeout: 900,
|
|
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
$("#user-table").bootstrapTable("load", data);
|
|
|
|
|
|
|
|
if (disableButtons) {
|
|
|
|
|
|
|
|
deactivateHeaderButtons();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
loadSuccess();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -675,14 +679,16 @@ function checkboxChange(checkbox, userId, field, field_index) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function deactivateHeaderButtons() {
|
|
|
|
function deactivateHeaderButtons() {
|
|
|
|
$("#user_delete_selection").addClass("disabled");
|
|
|
|
if (selections.length < 1) {
|
|
|
|
$("#user_delete_selection").attr("aria-disabled", true);
|
|
|
|
$("#user_delete_selection").addClass("disabled");
|
|
|
|
$(".check_head").attr("aria-disabled", true);
|
|
|
|
$("#user_delete_selection").attr("aria-disabled", true);
|
|
|
|
$(".check_head").attr("disabled", true);
|
|
|
|
$(".check_head").attr("aria-disabled", true);
|
|
|
|
$(".check_head").prop('checked', false);
|
|
|
|
$(".check_head").attr("disabled", true);
|
|
|
|
$(".button_head").attr("aria-disabled", true);
|
|
|
|
$(".check_head").prop('checked', false);
|
|
|
|
$(".button_head").addClass("disabled");
|
|
|
|
$(".button_head").attr("aria-disabled", true);
|
|
|
|
$(".header_select").attr("disabled", true);
|
|
|
|
$(".button_head").addClass("disabled");
|
|
|
|
|
|
|
|
$(".header_select").attr("disabled", true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function selectHeader(element, field) {
|
|
|
|
function selectHeader(element, field) {
|
|
|
@ -719,7 +725,7 @@ function checkboxHeader(CheckboxState, field, field_index) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function deleteUser(a,b){
|
|
|
|
function deleteUser(a,id){
|
|
|
|
confirmDialog(
|
|
|
|
confirmDialog(
|
|
|
|
"btndeluser",
|
|
|
|
"btndeluser",
|
|
|
|
"GeneralDeleteModal",
|
|
|
|
"GeneralDeleteModal",
|
|
|
@ -728,8 +734,12 @@ function deleteUser(a,b){
|
|
|
|
$.ajax({
|
|
|
|
$.ajax({
|
|
|
|
method:"post",
|
|
|
|
method:"post",
|
|
|
|
url: window.location.pathname + "/../../ajax/deleteuser",
|
|
|
|
url: window.location.pathname + "/../../ajax/deleteuser",
|
|
|
|
data: {"userid":b},
|
|
|
|
data: {"userid":id},
|
|
|
|
success: handleListServerResponse,
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
userId = parseInt(id, 10);
|
|
|
|
|
|
|
|
selections = selections.filter(item => item !== userId);
|
|
|
|
|
|
|
|
handleListServerResponse(data);
|
|
|
|
|
|
|
|
},
|
|
|
|
error: function (data) {
|
|
|
|
error: function (data) {
|
|
|
|
handleListServerResponse({type:"danger", message:data.responseText})
|
|
|
|
handleListServerResponse({type:"danger", message:data.responseText})
|
|
|
|
},
|
|
|
|
},
|
|
|
|