| Current Path : /home/smartconb/www/armencom33/acv2026/user/ |
| Current File : /home/smartconb/www/armencom33/acv2026/user/index.js |
var editIcon = function (cell, formatterParams) {
return "<i class='fa fa-edit' data-id='" + cell.getRow().getData().user_id + "'></i>";
};
var editIconClick = function (e, cell) {
window.location.href = './edit.php?id=' + cell.getRow().getData().user_id;
};
var pwdResetIcon = function (cell, formatterParams) {
return "<i class='fa fa-repeat' data-id='" + cell.getRow().getData().user_id + "'></i>";
};
var pwdResetIconClick = function (e, cell) {
swal({
title: TX_RESET_PWD_DIALOG_TITLE,
text: TX_RESET_PWD_DIALOG_TEXT,
confirmButtonText: TX_RESET_PWD_DIALOG_OK_BTN_TEXT,
cancelButtonText: TX_RESET_PWD_DIALOG_CANCEL_BTN_TEXT,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
//confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
$.ajax({
url: 'action.php',
type: "POST",
dataType: "json",
data: {
action: 2,
id: cell.getRow().getData().user_id
},
success: function (data, textStatus, jqXHR) {
if (data.error == 0) {
swal({
type: 'success',
//title: 'Oops...',
allowOutsideClick: false,
allowEnterKey: false,
customClass: 'animated wobble',
text: data.message
}).then((result) => {
$("#data-table").tabulator("setData");
})
} else {
swal({
type: 'error',
title: 'Oops...',
allowOutsideClick: false,
allowEnterKey: false,
customClass: 'animated wobble',
text: data.message
});
}
}
});
}
});
};
var deleteIcon = function (cell, formatterParams) {
return "<i class='fa fa-trash' data-id='" + cell.getRow().getData().user_id + "'></i>";
};
var deleteIconClick = function (e, cell) {
swal({
title: TX_DELETE_DIALOG_TITLE,
text: TX_DELETE_DIALOG_TEXT,
confirmButtonText: TX_DELETE_DIALOG_OK_BTN_TEXT,
cancelButtonText: TX_DELETE_DIALOG_CANCEL_BTN_TEXT,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
//confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
$.ajax({
url: 'action.php',
type: "POST",
dataType: "json",
data: {
action: 1,
id: cell.getRow().getData().user_id
},
success: function (data, textStatus, jqXHR) {
if (data.error == 0) {
swal({
type: 'success',
//title: 'Oops...',
allowOutsideClick: false,
allowEnterKey: false,
customClass: 'animated wobble',
text: data.message
}).then((result) => {
$("#data-table").tabulator("setData");
})
} else {
swal({
type: 'error',
title: 'Oops...',
allowOutsideClick: false,
allowEnterKey: false,
customClass: 'animated wobble',
text: data.message
});
}
}
});
}
});
};
$(document).ready(function () {
$("#data-table").tabulator({
layout: "fitColumns",
paginationSize: 25,
ajaxURL: "index.data.php",
movableColumns: true,
ajaxFiltering: true,
ajaxSorting: true,
pagination: "remote",
ajaxConfig: "POST",
locale: 'fr',
langs: {
"fr": { //French language definition
"groups": {
"item": "élémént",
"items": "éléments"
},
"ajax": {
"loading": "Chargement",
"error": "Erreur"
},
"pagination": {
"first": "Première",
"first_title": "Première Page",
"last": "Dernière",
"last_title": "Dernière Page ",
"prev": "Précédente",
"prev_title": "Page Précédente",
"next": "Suivante",
"next_title": " Page Suivante"
},
"headerFilters": {
"default": " Filtrer la colonne......"
}
}
},
columns: [
{
title: "",
field: "edit",
headerSort: false,
width: 20,
frozen: true,
formatter: editIcon,
align: "center",
cellClick: editIconClick
},
{
title: "",
field: "edit",
headerSort: false,
width: 20,
frozen: true,
formatter: pwdResetIcon,
align: "center",
cellClick: pwdResetIconClick
},
{
title: TX_COLUMN_ID,
field: "user_id",
sorter: "number",
headerFilter: "input",
headerFilterFunc: "=",
widthGrow: 1
},
{
title: TX_COLUMN_USER_NAME,
field: "user_firstname",
headerFilter: "input",
//editor: "select",
//editorParams: getServiceData,
widthGrow: 2,
//cellEdited: customEditorFunc
},
{
title: TX_COLUMN_USER_NAME,
field: "user_lastname",
headerFilter: "input",
//editor: "select",
//editorParams: getServiceData,
widthGrow: 2,
//cellEdited: customEditorFunc
},
{
title: TX_COLUMN_MAIL,
field: "user_mail",
headerFilter: "input",
widthGrow: 2,
//cellEdited: customEditorFunc
},
{title: "", field: "delete", headerSort: false, width: 20, frozen: true, formatter: deleteIcon, align: "center", cellClick: deleteIconClick}
],
//rowFormatter: userRowFormatter,
});
$(document).on('click', '#sc-user-refresh-btn', function (e) {
e.preventDefault();
$("#data-table").tabulator("setData");
});
});