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.144.252.243
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/work_entry_org.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_entry_grid.php',function()
{
$('#btn_addn').show();
$('#btn_save').hide();
$('#btn_cncl').hide();
load_grid_data(13, 1);
});
}
function load_grid_data(page_limt,page_numb)
{
$.ajax({
type: "POST",
url: "phpscript/work_entry.php",
data:
{
load_data:"grid_data",
page_limt:page_limt,
page_numb:page_numb,
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 clrs_data()
{
$('#btn_addn').hide();
$('#btn_save').show();
$('#btn_cncl').show();
$(function(){$( "#txtworkdate" ).datepicker({ dateFormat: "dd-mm-yy" });});
$(function(){$( "#txtstrtdate" ).datepicker({ dateFormat: "dd-mm-yy" });});
$(function(){$( "#txtlastdate" ).datepicker({ dateFormat: "dd-mm-yy" });});
$(function(){$( "#txtcompdate" ).datepicker({ dateFormat: "dd-mm-yy" });});
}
function addn_data()
{
$("#page-container-body").load('work_entry_form.php',function()
{
clrs_data();
document.getElementById("lblpagemode").innerHTML="Add";
document.getElementById("txtpagemode").value="add";
document.getElementById("txtworkdate").value=get_today_date();
document.getElementById("txtworkname").focus();
});
}
function edit_data(prim_data)
{
$("#page-container-body").load('work_entry_form.php',function()
{
clrs_data();
document.getElementById("lblpagemode").innerHTML="Edit";
document.getElementById("txtpagemode").value="edit";
document.getElementById("txtworkname").focus();
document.getElementById("txtworkdate").disabled=true;
$.ajax({
type: "POST",
url: "phpscript/work_entry.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;
document.getElementById("txtworkdate").value=get_format_date(data.fworkdate);
document.getElementById("txtworkname").value=data.fworkname;
document.getElementById("txtworkdetl").value=data.fworkdetl;
document.getElementById("txtworkstat").value=data.fworkstat;
document.getElementById("txtworkremk").value=data.fworkremk;
},
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: "phpscript/work_entry.php",
data:
{
load_data:"dele_data",
dele_code:prim_data
},
success: function(data)
{
load_grid_data(13,1);
}
});
}
}
function save_data()
{
if(document.getElementById("txtworkdate").value=="")
{
alert("Please select work date!");
txtworkdate.focus();
return false;
}
if(document.getElementById("txtworkname").value=="")
{
alert("Please enter work title!");
txtworkname.focus();
return false;
}
if(document.getElementById("txtworkdetl").value=="")
{
alert("Please enter work description!");
txtworkdetl.focus();
return false;
}
$.ajax({
type: "POST",
url: "phpscript/work_entry.php",
dataType:"json",
data:
{
load_data:"save_data",
page_mode:document.getElementById("txtpagemode").value,
work_code:document.getElementById("txtworkcode").value,
work_date:document.getElementById("txtworkdate").value,
work_name:document.getElementById("txtworkname").value,
work_detl:document.getElementById("txtworkdetl").value,
work_stat:document.getElementById("txtworkstat").value,
work_remk:document.getElementById("txtworkremk").value
},
cache: false,
beforeSend: function()
{
show_process();
},
success: function(data)
{
hide_process();
console.log(data);
alert(data.mesg);
cncl_data();
},
error: function(data)
{
$('#page-container-form').html('Error:'+data);
hide_process();
}
});
}
|