ปรับปรุง รายงานประวัติการเลื่อนเงินเดือนรายบุคคล #1
This commit is contained in:
213
wwwroot/js/vw_eva_performance_plan/vw_eva_performance_plan.js
Normal file
213
wwwroot/js/vw_eva_performance_plan/vw_eva_performance_plan.js
Normal file
@@ -0,0 +1,213 @@
|
||||
var vw_eva_performance_plan_editMode = "CREATE";
|
||||
var vw_eva_performance_plan_API = "/api/vw_eva_performance_plan/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function vw_eva_performance_plan_GetSearchParameter() {
|
||||
var vw_eva_performance_planSearchObject = new Object();
|
||||
vw_eva_performance_planSearchObject.fiscal_year = $("#s_vw_eva_performance_plan_fiscal_year").val();
|
||||
vw_eva_performance_planSearchObject.theTime = $("#s_vw_eva_performance_plan_theTime").val();
|
||||
|
||||
return vw_eva_performance_planSearchObject;
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_FeedDataToSearchForm(data) {
|
||||
$("#s_vw_eva_performance_plan_fiscal_year").val(data.fiscal_year);
|
||||
$("#s_vw_eva_performance_plan_theTime").val(data.theTime);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function vw_eva_performance_plan_FeedDataToForm(data) {
|
||||
$("#vw_eva_performance_plan_id").val(data.id);
|
||||
$("#vw_eva_performance_plan_fiscal_year").val(data.fiscal_year);
|
||||
$("#vw_eva_performance_plan_theTime").val(data.theTime);
|
||||
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_GetFromForm() {
|
||||
var vw_eva_performance_planObject = new Object();
|
||||
vw_eva_performance_planObject.id = $("#vw_eva_performance_plan_id").val();
|
||||
vw_eva_performance_planObject.fiscal_year = $("#vw_eva_performance_plan_fiscal_year").val();
|
||||
vw_eva_performance_planObject.theTime = $("#vw_eva_performance_plan_theTime").val();
|
||||
|
||||
|
||||
return vw_eva_performance_planObject;
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
vw_eva_performance_plan_FeedDataToForm(result);
|
||||
vw_eva_performance_plan_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#vw_eva_performance_planModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + vw_eva_performance_plan_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function vw_eva_performance_plan_GoAll() {
|
||||
window.location = appsite + "/rep_eva_self_review_allView/rep_eva_self_review_all_report";
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_GoEdit(a) {
|
||||
alert("กำลังจัดทำ");
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
vw_eva_performance_plan_editMode = "UPDATE";
|
||||
vw_eva_performance_plan_FeedDataToForm(result);
|
||||
$("#vw_eva_performance_planModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + vw_eva_performance_plan_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_SetCreateForm(s) {
|
||||
vw_eva_performance_plan_editMode = "CREATE";
|
||||
vw_eva_performance_plan_InitialForm(s);
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_RefreshTable() {
|
||||
// Incase model popup
|
||||
vw_eva_performance_plan_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.vw_eva_performance_plan_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var vw_eva_performance_plan_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function vw_eva_performance_plan_PutUpdate() {
|
||||
if (!ValidateForm('vw_eva_performance_plan', vw_eva_performance_plan_customValidation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = vw_eva_performance_plan_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (vw_eva_performance_plan_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#vw_eva_performance_planModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
vw_eva_performance_plan_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + vw_eva_performance_plan_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#vw_eva_performance_planModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
vw_eva_performance_plan_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + vw_eva_performance_plan_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#vw_eva_performance_planModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
vw_eva_performance_plan_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + vw_eva_performance_plan_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var vw_eva_performance_planTableV;
|
||||
|
||||
var vw_eva_performance_plan_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
vw_eva_performance_planTableV = $('#vw_eva_performance_planTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
//"select": {
|
||||
// "style": 'multi'
|
||||
//},
|
||||
"columns": [
|
||||
//{ "data": "" },
|
||||
{ "data": "id" },
|
||||
{ "data": "fiscal_year" },
|
||||
{ "data": "theTime" },
|
||||
],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0, //1,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:vw_eva_performance_plan_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil-alt'></i></button> ";
|
||||
}
|
||||
},
|
||||
//{
|
||||
// targets: 0,
|
||||
// data: "",
|
||||
// defaultContent: '',
|
||||
// orderable: false,
|
||||
// className: 'select-checkbox'
|
||||
//}
|
||||
],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
},
|
||||
"paging": true,
|
||||
"searching": false
|
||||
});
|
||||
endLoad();
|
||||
};
|
||||
|
||||
function vw_eva_performance_plan_InitiateDataTable() {
|
||||
startLoad();
|
||||
var p = $.param(vw_eva_performance_plan_GetSearchParameter());
|
||||
AjaxGetRequest(apisite + "/api/vw_eva_performance_plan/GetListBySearch?" + p, vw_eva_performance_plan_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_DoSearch() {
|
||||
var p = $.param(vw_eva_performance_plan_GetSearchParameter());
|
||||
var vw_eva_performance_plan_reload = function (result) {
|
||||
vw_eva_performance_planTableV.destroy();
|
||||
vw_eva_performance_plan_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/vw_eva_performance_plan/GetListBySearch?" + p, vw_eva_performance_plan_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function vw_eva_performance_plan_GetSelect(f) {
|
||||
var vw_eva_performance_plan_selectitem = [];
|
||||
$.each(vw_eva_performance_planTableV.rows('.selected').data(), function (key, value) {
|
||||
vw_eva_performance_plan_selectitem.push(value[f]);
|
||||
});
|
||||
alert(vw_eva_performance_plan_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user