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.22.27.41
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/task_update.js |
function load_page() {
load_page_data(
window.location.href.substr(window.location.href.lastIndexOf("/") + 1)
);
cncl_data();
load_grid_data(20, 1);
}
function cncl_data() {
$("#btn_addn").show();
$("#btn_save").hide();
$("#btn_cncl").hide();
$("#page-container-main").show();
$("#page-container-grid").show();
$("#page-container-form").hide();
}
function clrs_data() {
$("#btn_addn").hide();
$("#btn_save").show();
$("#btn_cncl").show();
$("#page-container-main").hide();
$("#page-container-grid").hide();
$("#page-container-form").show();
$(function () {
$("#txtcompdate").datepicker({ dateFormat: "dd/mm/yy" });
});
document.getElementById("txtpagemode").value = "";
document.getElementById("txtworkcode").value = "";
document.getElementById("txtworktitl").value = "";
document.getElementById("txtworkdesc").value = "";
document.getElementById("txtworkstat").selectedIndex = 0;
$("#txtemplassn").empty();
$("#txtemplwork").empty();
document.getElementById("txtstrtdate").value = "";
document.getElementById("txtlastdate").value = "";
document.getElementById("txtcompdate").value = "";
document.getElementById("txtworkremk").value = "";
}
function load_grid_data(page_limt, page_numb) {
$.ajax({
type: "POST",
url: "src/task_review.php",
data: {
load_data: "grid_data",
page_limt: page_limt,
page_numb: page_numb,
grid_type: document.getElementById("selgridtype").value,
work_stat: document.getElementById("selworkstat").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 edit_data(prim_data) {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Edit";
document.getElementById("txtpagemode").value = "edit";
document.getElementById("txtemplassn").disabled = true;
document.getElementById("txtemplwork").disabled = true;
load_empl_assn();
load_empl_work();
$.ajax({
type: "POST",
url: "src/task_review.php",
data: {
load_data: "disp_data",
work_code: prim_data,
},
cache: false,
success: function (data) {
var data = JSON.parse(data);
document.getElementById("txtworkcode").value = data.fworkcode;
$("#txtworkdate").html(get_format_date(data.fworkdate));
$("#txtworktitl").html(data.fworktitl);
$("#txtworkdesc").html(data.fworkdesc);
$("#txtstrtdate").html(get_format_date(data.fstrtdate));
$("#txtlastdate").html(get_format_date(data.flastdate));
document.getElementById("txtemplassn").value = data.femplassn;
document.getElementById("txtemplwork").value = data.femplwork;
document.getElementById("txtworkstat").value = data.fworkstat;
document.getElementById("txtcompdate").value = get_format_date(
data.fcompdate
);
},
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/task_review.php",
data: {
load_data: "dele_data",
dele_code: prim_data,
},
success: function (data) {
load_grid_data(20, 1);
},
});
}
}
function load_empl_assn() {
$.ajax({
type: "POST",
url: "src/task_review.php",
data: {
load_data: "empl_assn",
},
cache: false,
success: function (data) {
$("#txtemplassn").html(data);
$("#txtemplrept").html(data);
if ($("#txtpagemode").val() == "add") {
document.getElementById("txtemplassn").value = document.getElementById(
"empl_id"
).value;
}
},
error: function (data) {
$("#txtemplassn").html("Error: " + data);
},
});
}
function load_empl_work() {
$.ajax({
type: "POST",
url: "src/task_review.php",
data: {
load_data: "empl_work",
},
cache: false,
success: function (data) {
$("#txtemplwork").html(data);
},
});
}
function save_data() {
if (document.getElementById("txtworktitl").value == "") {
alert("Please enter work title!");
txtworktitl.focus();
return false;
}
if (document.getElementById("txtworkdesc").value == "") {
alert("Please enter work description!");
txtworkdesc.focus();
return false;
}
if (document.getElementById("txtemplassn").value == 0) {
alert("Please select work assiner!");
txtemplassn.focus();
return false;
}
if (document.getElementById("txtemplwork").value == 0) {
alert("Please select work assinee!");
txtemplwork.focus();
return false;
}
$.ajax({
type: "POST",
url: "src/task_review.php",
data: {
load_data: "save_data",
page_mode: document.getElementById("txtpagemode").value,
work_code: document.getElementById("txtworkcode").value,
work_date: document.getElementById("txtworkdate").value,
work_titl: document.getElementById("txtworktitl").value,
work_desc: document.getElementById("txtworkdesc").value,
work_stat: document.getElementById("txtworkstat").value,
empl_assn: document.getElementById("txtemplassn").value,
empl_work: document.getElementById("txtemplwork").value,
strt_date: document.getElementById("txtstrtdate").value,
last_date: document.getElementById("txtlastdate").value,
comp_date: document.getElementById("txtcompdate").value,
work_remk: document.getElementById("txtworkremk").value,
},
cache: false,
success: function (data) {
console.log(data);
alert(data.mesg);
cncl_data();
load_grid_data(20, 1);
},
error: function (data) {
$("#page-container-form").html("Error:" + data);
},
});
}
|