| Current Path : /home/smartconb/www/armencom33/acv2026/member/ |
| Current File : /home/smartconb/www/armencom33/acv2026/member/index.js |
var editIcon = function (cell, formatterParams) {
return "<i class='fa fa-edit' data-id='" + cell.getRow().getData().member_id + "'></i>";
};
var editIconClick = function (e, cell) {
window.location.href = './edit.php?id=' + cell.getRow().getData().member_id;
};
var voteIcon = function (cell, formatterParams) {
var tmpVotedOn = cell.getRow().getData().member_votedon;
if (tmpVotedOn == '') {
return "<i class='fa fa-user ' style='color: #00bf00;' data-id='" + cell.getRow().getData().member_id + "'></i>";
} else {
return "<i class='fa fa-person-booth' disabled='disabled' style='color: #ff0000;' data-id='" + cell.getRow().getData().member_id + "'></i>";
}
};
var voteIconClick = function (e, cell) {
var tmpVotedOn = cell.getRow().getData().member_votedon;
if (tmpVotedOn == '') {
swal({
title: TX_VOTE_DIALOG_TITLE,
text: TX_VOTE_DIALOG_TEXT,
confirmButtonText: TX_VOTE_DIALOG_OK_BTN_TEXT,
cancelButtonText: TX_VOTE_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: 3,
id: cell.getRow().getData().member_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
});
}
}
});
}
});
} else {
swal({
type: 'error',
title: 'Oops...',
allowOutsideClick: false,
allowEnterKey: false,
customClass: 'animated wobble',
text: TX_VOTE_DIALOG_MEMBER_VOTED_TEXT
});
}
};
$(document).ready(function () {
var table = $("#data-table").tabulator({
layout: "fitColumns",
ajaxURL: "index.data.php",
movableColumns: true,
ajaxFiltering: true,
ajaxSorting: true,
ajaxConfig: "POST",
ajaxParams: {
firstname: $('#memberFilterFirstname').val(),
lastname: $('#memberFilterLastname').val(),
postalcode: $('#memberFilterPostalCode').val(),
city: $('#memberFilterCity').val(),
},
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: "vote",
headerSort: false,
width: 20,
frozen: true,
formatter: voteIcon,
align: "center",
cellClick: voteIconClick
},
{
title: "",
field: "edit",
headerSort: false,
width: 20,
frozen: true,
formatter: editIcon,
align: "center",
cellClick: editIconClick
},
{
title: TX_COLUMN_ID,
field: "member_id",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_FIRSTNAME,
field: "member_firstname",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_LASTNAME,
field: "member_lastname",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_ADDRESS,
field: "member_address",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_POSTAL_CODE,
field: "member_postalcode",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_CITY,
field: "member_city",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_MAIL,
field: "member_mail",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_PHONE,
field: "member_phone",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_IN_BELGIUM_SINCE,
field: "member_inbelgumesince",
widthGrow: 1,
},
{
title: TX_COLUMN_MEMBER_VOTED_ON,
field: "member_votedon",
widthGrow: 1,
//cellEdited: customEditorFunc
},
{
title: TX_COLUMN_MEMBER_VOTED_BY,
field: "user_name",
widthGrow: 1,
//cellEdited: customEditorFunc
}
],
//rowFormatter: userRowFormatter,
});
$(document).on('submit', '#memberFilterFrm', function (e) {
e.preventDefault();
});
$(document).on('click', '#memberFilterResetBtn', function (e) {
e.preventDefault();
$('#memberFilterFrm input').each(function () {
$(this).val('');
});
$("#data-table").tabulator("setData", 'index.data.php', {
firstname: $('#memberFilterFirstname').val(),
lastname: $('#memberFilterLastname').val(),
postalcode: $('#memberFilterPostalCode').val(),
city: $('#memberFilterCity').val(),
});
});
$(document).on('keyup', '#memberFilterFirstname', function (e) {
e.preventDefault();
var tmpVal = $(this).val();
if (tmpVal.length < 3) {
tmpVal = '';
}
$("#data-table").tabulator("setData", 'index.data.php', {
firstname: tmpVal,
lastname: $('#memberFilterLastname').val(),
postalcode: $('#memberFilterPostalCode').val(),
city: $('#memberFilterCity').val(),
});
});
$(document).on('keyup', '#memberFilterLastname', function (e) {
e.preventDefault();
var tmpVal = $(this).val();
if (tmpVal.length < 3) {
tmpVal = '';
}
$("#data-table").tabulator("setData", 'index.data.php', {
firstname: $('#memberFilterFirstname').val(),
lastname: tmpVal,
postalcode: $('#memberFilterPostalCode').val(),
city: $('#memberFilterCity').val(),
});
});
$(document).on('keyup', '#memberFilterCity', function (e) {
e.preventDefault();
var tmpVal = $(this).val();
if (tmpVal.length < 3) {
tmpVal = '';
}
$("#data-table").tabulator("setData", 'index.data.php', {
firstname: $('#memberFilterFirstname').val(),
lastname: $('#memberFilterLastname').val(),
postalcode: $('#memberFilterPostalCode').val(),
city: tmpVal,
});
});
$(document).on('click', '#memberAddBtn', function (e) {
window.location.href = './edit.php?id=-1';
});
$(document).on('keyup', '#memberFilterPostalCode', function (e) {
e.preventDefault();
var tmpVal = $(this).val();
if (tmpVal.length != 4) {
tmpVal = '';
}
$("#data-table").tabulator("setData", 'index.data.php', {
firstname: $('#memberFilterFirstname').val(),
lastname: $('#memberFilterLastname').val(),
postalcode: tmpVal,
city: $('#memberFilterCity').val(),
});
});
});