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.118.7.18
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/work_assign.js |
function load_page() {
load_page_data(window.location.href.substr(window.location.href.lastIndexOf("/") + 1));
cncl_data();
}
function cncl_data() {
$("#page-container-body").load("work_assign_grid.php", function () {
$("#btn_addn").show();
$("#btn_save").hide();
$("#btn_cncl").hide();
load_grid_data(20, 1);
});
}
function load_grid_data(page_limt, page_numb) {
$.ajax({
type: "POST",
url: "src/work_assign.php",
data: {
load_data: "grid_data",
page_limt: page_limt,
page_numb: page_numb,
assn_empl: document.getElementById("selassnempl").value,
work_empl: document.getElementById("selworkempl").value,
work_stat: document.getElementById("selworkstat").value,
view_stat: document.getElementById("selviewstat").value,
work_find: document.getElementById("txtworkfind").value,
},
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_grid_data(page_limt, 1);
}
function clrs_data() {
$("#btn_addn").hide();
$("#btn_save").show();
$("#btn_cncl").show();
$(function () {
$("#txtassndate").datepicker({ dateFormat: "dd/mm/yy" });
});
$(function () {
$("#txtlastdate").datepicker({ dateFormat: "dd/mm/yy" });
});
}
function addn_data() {
$("#page-container-body").load("work_assign_form.php", function () {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Add";
document.getElementById("txtpagemode").value = "add";
document.getElementById("txtassncode").value = "<AUTO>";
document.getElementById("txtassnempl").value =
"[" + document.getElementById("empl_id").value + "] " + document.getElementById("name_id").value;
document.getElementById("txtassndate").value = get_today_date();
document.getElementById("txtlastdate").value = get_today_date();
document.getElementById("txtworkstat").value = "PENDING";
document.getElementById("txtworkdate").value = "-";
document.getElementById("txtviewstat").value = "PENDING";
document.getElementById("txtviewtime").value = "-";
document.getElementById("txtworkempl").focus();
});
}
function edit_data(prim_data) {
$("#page-container-body").load("work_assign_form.php", function () {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Edit";
document.getElementById("txtpagemode").value = "edit";
document.getElementById("txtassnname").focus();
$.ajax({
type: "POST",
url: "src/work_assign.php",
data: {
load_data: "disp_data",
assn_code: prim_data,
},
cache: false,
success: function (data) {
var data = JSON.parse(data);
document.getElementById("txtassncode").value = data.fassncode;
document.getElementById("txtassndate").value = get_format_date(data.fassndate);
document.getElementById("txtlastdate").value = get_format_date(data.flastdate);
document.getElementById("txtassnname").value = data.fassnname;
document.getElementById("txtassnempl").value = data.lassnempl;
document.getElementById("txtworkempl").value = data.fworkempl;
document.getElementById("txtworkstat").value = data.fworkstat;
document.getElementById("txtworkdate").value = data.fworkdate;
document.getElementById("txtviewstat").value = data.fviewstat;
document.getElementById("txtviewtime").value = data.fviewtime;
},
error: function (data) {
$("#page-container-form").html("Error: " + data);
},
});
});
}
function dele_data(prim_data) {
var r = confirm("Delete Record?");
if (r == true) {
$.ajax({
type: "POST",
url: "src/work_assign.php",
data: {
load_data: "dele_data",
dele_code: prim_data,
},
success: function (data) {
load_grid_data(20, 1);
},
});
}
}
function save_data() {
if (document.getElementById("txtassndate").value == "" ||document.getElementById("txtassndate").value == "00/00/0000") {
alert("Please select assignement date!");
txtassndate.focus();
return false;
}
if (document.getElementById("txtlastdate").value == "" ||document.getElementById("txtlastdate").value == "00/00/0000") {
alert("Please select due date!");
txtlastdate.focus();
return false;
}
if (document.getElementById("txtassnname").value == "") {
alert("Please enter assignment name!");
txtassnname.focus();
return false;
}
if (document.getElementById("txtworkempl").value == 0) {
alert("Please employee for work assignement!");
txtworkempl.focus();
return false;
}
$.ajax({
type: "POST",
url: "src/work_assign.php",
dataType: "json",
data: {
load_data: "save_data",
page_mode: document.getElementById("txtpagemode").value,
assn_code: document.getElementById("txtassncode").value,
assn_date: document.getElementById("txtassndate").value,
last_date: document.getElementById("txtlastdate").value,
assn_name: document.getElementById("txtassnname").value,
assn_empl: document.getElementById("txtassnempl").value,
work_empl: document.getElementById("txtworkempl").value,
},
cache: false,
beforeSend: function () {
show_process();
},
success: function (data) {
hide_process();
alert(data.mesg);
if (data.stat == "T") {
addn_data();
}
},
error: function (data) {
$("#page-container-form").html("Error:" + data);
hide_process();
},
});
}
|