130 lines
3.0 KiB
JavaScript
130 lines
3.0 KiB
JavaScript
$(document).ready(function() {
|
|
$("input[type='text']:not([disabled])").on("blur", function(e){
|
|
var origVal = $(this).attr('data-orig-value');
|
|
var val = $(this).val();
|
|
console.log('paste behaviour detected!', origVal, val);
|
|
if(val && val != origVal) {
|
|
$(this).attr('data-orig-value', val)
|
|
var obj = {};
|
|
obj[$(this).attr('name')] = $(this).val();
|
|
console.log("------------", obj);
|
|
update(obj);
|
|
}
|
|
});
|
|
|
|
$(".otp-new").otp({callback: function() {
|
|
console.log("THIS IS A CALLBACK FUNCTION!!!!")
|
|
location.href = contextPath + "/projections";
|
|
}});
|
|
/*setFormValidation('#RegisterValidation');
|
|
setFormValidation('#UserProfileValidation');
|
|
|
|
$('#datatables').DataTable({
|
|
"pagingType": "full_numbers",
|
|
"lengthMenu": [
|
|
[10, 25, 50, -1],
|
|
[10, 25, 50, "All"]
|
|
],
|
|
responsive: true,
|
|
language: {
|
|
search: "_INPUT_",
|
|
searchPlaceholder: "Search records",
|
|
}
|
|
});
|
|
|
|
var table = $('#datatable').DataTable();
|
|
|
|
// Edit record
|
|
table.on('click', '.edit', function() {
|
|
$tr = $(this).closest('tr');
|
|
var data = table.row($tr).data();
|
|
alert('You press on Row: ' + data[0] + ' ' + data[1] + ' ' + data[2] + '\'s row.');
|
|
});
|
|
|
|
// Delete a record
|
|
table.on('click', '.remove', function(e) {
|
|
$tr = $(this).closest('tr');
|
|
table.row($tr).remove().draw();
|
|
e.preventDefault();
|
|
});
|
|
|
|
//Like record
|
|
table.on('click', '.like', function() {
|
|
alert('You clicked on Like button');
|
|
});*/
|
|
|
|
});
|
|
|
|
function onChangelanguage(e) {
|
|
var langSel = $(e).val()
|
|
var origVal = $(this).attr('data-orig-value');
|
|
if(langSel && langSel != origVal) {
|
|
$(this).attr('data-orig-value', langSel)
|
|
var obj = {};
|
|
obj[$(this).attr('name')] = $(this).val();
|
|
console.log("------------", obj);
|
|
update(obj);
|
|
langSelect(langSel);
|
|
}
|
|
}
|
|
|
|
function update(field) {
|
|
console.log(field)
|
|
var inputUrl = contextPath + '/profile/update'
|
|
$.ajax({
|
|
async : false,
|
|
global : false,
|
|
headers : {
|
|
'X-CSRF-Token' : csrf_token
|
|
},
|
|
type : "POST",
|
|
action : 'xhttp',
|
|
url : inputUrl,
|
|
data: field,
|
|
success : function(data) {
|
|
console.log(data)
|
|
}
|
|
});
|
|
}
|
|
|
|
function editPword() {
|
|
setTimeout(
|
|
function() {
|
|
var inputUrl = contextPath + "/edit"
|
|
inputUrl = encodeURI(inputUrl);
|
|
console.log(inputUrl)
|
|
$.ajax({
|
|
async : false,
|
|
global : false,
|
|
headers : {
|
|
'X-CSRF-Token' : csrf_token
|
|
},
|
|
type : "GET",
|
|
action : 'xhttp',
|
|
url : inputUrl,
|
|
success : function(data) {
|
|
portalUtil.showPopup("Change Password", data, true)
|
|
}
|
|
}).done(function() {
|
|
portalUtil.showMainLoading(false);
|
|
});
|
|
}, 1000);
|
|
}
|
|
|
|
function loggedinReset() {
|
|
var inputUrl = contextPath + "/resetLink"
|
|
$.ajax({
|
|
headers : {
|
|
'X-CSRF-Token' : csrf_token,
|
|
'Content-Type' : 'application/json'
|
|
},
|
|
type : "GET",
|
|
action : 'xhttp',
|
|
url : inputUrl,
|
|
success : function(data) {
|
|
console.log(data)
|
|
}
|
|
}).done(function() {
|
|
portalUtil.showMainLoading(false);
|
|
});
|
|
} |