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 : 18.191.171.72
Current Path : /var/www/oasis/js/ |
| Current File : /var/www/oasis/js/usersetupNew.js |
function CallenableUserSetUpNew() {
$("#page_main_div").load("../html_modules/useretupNew.html", function () {
document.getElementById("display_module_name").innerHTML = "User Setup";
document.getElementById("module_name_for_save").value = "User Setup New";
getDefaultHeadFooterLinks("User Setup New");
getUserType();
$("#viewuser").hide();
$("#adduser").show();
if (window.db === "sjbit" || window.db === "epcet") {
$("#usertype_row").show();
} else {
$("#usertype_row").hide();
}
});
}
function getUserType() {
$.ajax({
type: "GET",
url: $host_url + "getUserSetupDetails.demo",
success: function (res) {
let response = JSON.parse(res);
let usercode = "";
if (response.error_code === 0) {
let options = '<option value="">--Select--</option>';
for (let data of response.data.user_type) {
options += `<option value='${data["internal_code"]}'>${data["value"]}</option>`;
usercode = data["usertype"];
}
$("#usertype").html(options);
if (window.db === "epcet" && usercode != "14" && usercode != "40")
$("#usertype_row").hide();
}
},
});
}
function saveNewUser() {
let usrname = $("#usrname").val();
let pws = $("#pws").val();
let fpws1 = $("#fpws1").val();
let mob = $("#mob").val();
let email = $("#email").val();
let name = $("#name").val();
let screen = $("#screen").val();
let usertype = $("#usertype").val();
if (usrname == "") {
alert("Enter User Name");
$("#usrname").focus();
return;
}
if (mob == "") {
alert("Enter Mobile No.");
$("#mob").focus();
return;
} else if (email == "") {
alert("Enter Email Id.");
$("#email").focus();
return;
} else if (name == "") {
alert("Enter Name");
$("#name").focus();
return;
}
if (screen == "add") {
if (pws == "") {
alert("Enter Password");
$("#pws").focus();
return;
}
if (pws != fpws1) {
alert("Password and Confirm Password not Matching");
$("#pws").focus();
return;
}
}
$.ajax({
type: "GET",
url: $host_url + "saveNewUser",
data:
"usrname=" +
usrname +
"&pws=" +
pws +
"&mob=" +
mob +
"&email=" +
email +
"&name=" +
name +
"&screen=" +
screen +
"&usertype=" +
usertype,
success: function ($responce) {
$responce = eval("(" + $responce + ")");
if ($responce.error_code == 0) {
alert($responce.data);
viewUserDet();
return;
} else {
alert($responce.data);
return;
}
},
});
}
function viewUserDet() {
$("#adduser").hide();
$("#viewuser").show();
$.ajax({
type: "GET",
url: $host_url + "viewUserDet",
success: function ($responce) {
$responce = eval("(" + $responce + ")");
$("#viewuser").html($responce.data.html);
},
});
}
function editUserDet(uname, name, mob, email) {
$("#adduser").show();
$("#viewuser").hide();
$("#screen").val("Edit");
$("#usrname").val(uname);
$("#name").val(name);
$("#mob").val(mob);
$("#email").val(email);
document.getElementById("usrname").disabled = true;
document.getElementById("pws").disabled = true;
document.getElementById("fpws1").disabled = true;
}
function DeleteUserDet(code, uname, name, mob, email) {
let text = "Are you sure you want to delete " + uname + "'s ID?";
if (confirm(text) == true) {
$.ajax({
type: "GET",
url: $host_url + "DeleteUserDet",
data: {
code: code,
usrname: uname,
mob: mob,
email: email,
name: name,
},
success: function (responce) {
var res = JSON.parse(responce);
if (res.error_code == 0) {
alert(res.data.msg);
viewUserDet();
return;
} else {
alert(res.data.msg);
return;
}
},
});
} else {
}
}
|