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.129.210.36
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/control.js |
function load_page() {
load_page_data(
window.location.href.substr(window.location.href.lastIndexOf("/") + 1)
);
cncl_data();
load_grid_data(15, 1);
}
function cncl_data() {
$("#btn_addn").show();
$("#btn_save").hide();
$("#btn_cncl").hide();
$("#page-container-grid").show();
$("#page-container-form").hide();
}
function clrs_data() {
$("#btn_addn").hide();
$("#btn_save").show();
$("#btn_cncl").show();
$("#page-container-grid").hide();
$("#page-container-form").show();
document.getElementById("txtadmncode").value = "";
document.getElementById("txtadmnname").value = "";
document.getElementById("txtadmnadd1").value = "";
document.getElementById("txtadmnadd2").value = "";
document.getElementById("txtadmnadd3").value = "";
document.getElementById("txtadmnadd4").value = "";
document.getElementById("txtadmnphon").value = "";
document.getElementById("txtadmnmobl").value = "";
document.getElementById("txtadmnmail").value = "";
document.getElementById("txtmessuser").value = "";
document.getElementById("txtmesspswd").value = "";
document.getElementById("txtmessfrom").value = "";
document.getElementById("txtmesscatg").value = "";
document.getElementById("txtmailhost").value = "";
document.getElementById("txtmailport").value = "";
document.getElementById("txtmailuser").value = "";
document.getElementById("txtmailpswd").value = "";
document.getElementById("txtmailname").value = "";
}
function load_grid_data(page_limt, page_numb) {
$.ajax({
type: "POST",
url: "src/control.php",
data: {
load_data: "grid_data",
page_limt: page_limt,
page_numb: page_numb,
},
cache: false,
success: function (data) {
$("#page-container-grid").html(data);
},
error: function (data) {
$("#page-container-grid").html("Error: " + data);
},
});
}
function load_page_limt(page_limt) {
load_data_grid(page_limt, 1);
}
function edit_data(prim_data) {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Edit";
document.getElementById("txtpagemode").value = "edit";
document.getElementById("txtadmncode").disabled = true;
document.getElementById("txtadmnname").focus();
$.ajax({
type: "POST",
url: "src/control.php",
data: {
load_data: "disp_data",
admn_code: prim_data,
},
cache: false,
success: function (data) {
var data = JSON.parse(data);
document.getElementById("txtadmncode").value = data.fadmncode;
document.getElementById("txtadmnname").value = data.fadmnname;
document.getElementById("txtadmnadd1").value = data.fadmnadd1;
document.getElementById("txtadmnadd2").value = data.fadmnadd2;
document.getElementById("txtadmnadd3").value = data.fadmnadd3;
document.getElementById("txtadmnadd4").value = data.fadmnadd4;
document.getElementById("txtadmnphon").value = data.fadmnphon;
document.getElementById("txtadmnmobl").value = data.fadmnmobl;
document.getElementById("txtadmnmail").value = data.fadmnmail;
document.getElementById("txtmessuser").value = data.fmessuser;
document.getElementById("txtmesspswd").value = data.fmesspswd;
document.getElementById("txtmessfrom").value = data.fmessfrom;
document.getElementById("txtmesscatg").value = data.fmesscatg;
document.getElementById("txtmailhost").value = data.fmailhost;
document.getElementById("txtmailport").value = data.fmailport;
document.getElementById("txtmailuser").value = data.fmailuser;
document.getElementById("txtmailpswd").value = data.fmailpswd;
document.getElementById("txtmailname").value = data.fmailname;
},
error: function (data) {
$("#page-container-form").html("Error: " + data);
},
});
}
function save_data() {
if (document.getElementById("txtadmncode").value == 0) {
alert("Please enter administrator code!");
txtadmncode.focus();
return false;
}
if (document.getElementById("txtadmnname").value == "") {
alert("Please enter administrator name!");
txtadmnname.focus();
return false;
}
$.ajax({
type: "POST",
url: "src/control.php",
dataType: "json",
data: {
load_data: "save_data",
page_mode: document.getElementById("txtpagemode").value,
admn_code: document.getElementById("txtadmncode").value,
admn_name: document.getElementById("txtadmnname").value,
admn_add1: document.getElementById("txtadmnadd1").value,
admn_add2: document.getElementById("txtadmnadd2").value,
admn_add3: document.getElementById("txtadmnadd3").value,
admn_add4: document.getElementById("txtadmnadd4").value,
admn_phon: document.getElementById("txtadmnphon").value,
admn_mobl: document.getElementById("txtadmnmobl").value,
admn_mail: document.getElementById("txtadmnmail").value,
mess_user: document.getElementById("txtmessuser").value,
mess_pswd: document.getElementById("txtmesspswd").value,
mess_from: document.getElementById("txtmessfrom").value,
mess_catg: document.getElementById("txtmesscatg").value,
mail_user: document.getElementById("txtmailuser").value,
mail_pswd: document.getElementById("txtmailpswd").value,
mail_name: document.getElementById("txtmailname").value,
mail_host: document.getElementById("txtmailhost").value,
mail_port: document.getElementById("txtmailport").value,
},
cache: false,
success: function (data) {
alert(data.mesg);
cncl_data();
load_grid_data(15, 1);
},
error: function (data) {
$("#page-container-form").html("Error: " + data);
},
});
}
|