Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.137.177.116
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/user_logs.js |
function load_page() {
load_page_data(
window.location.href.substr(window.location.href.lastIndexOf("/") + 1)
);
clrs_data();
load_dept_data();
}
function clrs_data() {
$(function () {
$("#txtlogsdat1").datepicker({ dateFormat: "dd/mm/yy" });
});
$(function () {
$("#txtlogsdat2").datepicker({ dateFormat: "dd/mm/yy" });
});
document.getElementById("txtdeptcode").selectedIndex = 0;
document.getElementById("txtlogstype").selectedIndex = 0;
document.getElementById("txtlogsdat1").value = get_today_date();
document.getElementById("txtlogsdat2").value = get_today_date();
document.getElementById("txtdeptcode").focus();
$("#page-container-grid").empty();
}
function load_dept_data() {
$.ajax({
type: "POST",
url: "src/user_logs.php",
data: {
load_data: "dept_data",
},
cache: false,
success: function (data) {
$("#txtdeptcode").html(data);
load_user_data();
},
});
}
function load_user_data() {
$.ajax({
type: "POST",
url: "src/user_logs.php",
data: {
load_data: "user_data",
dept_code: document.getElementById("txtdeptcode").value,
},
cache: false,
success: function (data) {
$("#txtusercode").html(data);
},
});
}
function view_data() {
if (document.getElementById("txtdeptcode").value == 0) {
alert("Please select client!");
txtdeptcode.focus();
return false;
}
if (document.getElementById("txtusercode").value == 0) {
alert("Please select user!");
txtusercode.focus();
return false;
}
if (document.getElementById("txtlogstype").value == 0) {
alert("Please select log type!");
txtlogstype.focus();
return false;
}
if (document.getElementById("txtlogsdat1").value == "") {
alert("Please enter starting date!");
txtlogsdat1.focus();
return false;
}
if (document.getElementById("txtlogsdat2").value == "") {
alert("Please enter ending date!");
txtlogsdat2.focus();
return false;
}
$host = "oums";
$.ajax({
type: "POST",
url: "src/user_logs.php",
data: {
load_data: "view_data",
dept_code: document.getElementById("txtdeptcode").value,
user_code: document.getElementById("txtusercode").value,
logs_type: document.getElementById("txtlogstype").value,
logs_dat1: document.getElementById("txtlogsdat1").value,
logs_dat2: document.getElementById("txtlogsdat2").value,
},
cache: false,
beforeSend: function () {
show_process();
},
success: function (data) {
hide_process();
$("#page-container-grid").html(data);
},
error: function (data) {
hide_process();
$("#page-container-grid").html("Error: " + data);
},
});
}
|