First Initial
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
var eva_create_evaluation_detail_agreement_editMode = "CREATE";
|
||||
var eva_create_evaluation_detail_agreement_API = "/api/eva_create_evaluation_detail_agreement/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GetSearchParameter() {
|
||||
var eva_create_evaluation_detail_agreementSearchObject = new Object();
|
||||
eva_create_evaluation_detail_agreementSearchObject.create_evaluation_id = $("#s_eva_create_evaluation_detail_agreement_create_evaluation_id").val();
|
||||
eva_create_evaluation_detail_agreementSearchObject.org_id = $("#s_eva_create_evaluation_detail_agreement_org_id").val();
|
||||
eva_create_evaluation_detail_agreementSearchObject.search_employee_code = $("#s_eva_create_evaluation_detail_agreement_search_employee_code").val();
|
||||
eva_create_evaluation_detail_agreementSearchObject.search_employee_fullname = $("#s_eva_create_evaluation_detail_agreement_search_employee_fullname").val();
|
||||
|
||||
return eva_create_evaluation_detail_agreementSearchObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_FeedDataToSearchForm(data) {
|
||||
$("#s_eva_create_evaluation_detail_agreement_create_evaluation_id").val(data.create_evaluation_id);
|
||||
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_detail_agreement_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
|
||||
$("#s_eva_create_evaluation_detail_agreement_search_employee_code").val(data.search_employee_code);
|
||||
$("#s_eva_create_evaluation_detail_agreement_search_employee_fullname").val(data.search_employee_fullname);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_agreement_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_detail_agreement_id").val(data.id);
|
||||
$("#eva_create_evaluation_detail_agreement_evaluation_round").text(data.evaluation_round);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_code").text(data.employee_code);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_fullname").text(data.employee_fullname);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position").text(data.employee_position);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position_type").text(data.employee_position_type);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position_level").text(data.employee_position_level);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_org").text(data.employee_org);
|
||||
$("#eva_create_evaluation_detail_agreement_chief_fullname").text(data.chief_fullname);
|
||||
$("#eva_create_evaluation_detail_agreement_chief_position").text(data.chief_position);
|
||||
$("#eva_create_evaluation_detail_agreement_create_evaluation_id").val(data.create_evaluation_id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_agreement_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
|
||||
$("#eva_create_evaluation_detail_agreement_search_employee_code").val(data.search_employee_code);
|
||||
$("#eva_create_evaluation_detail_agreement_search_employee_fullname").val(data.search_employee_fullname);
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GetFromForm() {
|
||||
var eva_create_evaluation_detail_agreementObject = new Object();
|
||||
eva_create_evaluation_detail_agreementObject.id = $("#eva_create_evaluation_detail_agreement_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.evaluation_round = $("#eva_create_evaluation_detail_agreement_evaluation_round").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_code = $("#eva_create_evaluation_detail_agreement_employee_code").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_fullname = $("#eva_create_evaluation_detail_agreement_employee_fullname").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position = $("#eva_create_evaluation_detail_agreement_employee_position").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position_type = $("#eva_create_evaluation_detail_agreement_employee_position_type").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position_level = $("#eva_create_evaluation_detail_agreement_employee_position_level").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_org = $("#eva_create_evaluation_detail_agreement_employee_org").text();
|
||||
eva_create_evaluation_detail_agreementObject.chief_fullname = $("#eva_create_evaluation_detail_agreement_chief_fullname").text();
|
||||
eva_create_evaluation_detail_agreementObject.chief_position = $("#eva_create_evaluation_detail_agreement_chief_position").text();
|
||||
eva_create_evaluation_detail_agreementObject.create_evaluation_id = $("#eva_create_evaluation_detail_agreement_create_evaluation_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.org_id = $("#eva_create_evaluation_detail_agreement_org_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.search_employee_code = $("#eva_create_evaluation_detail_agreement_search_employee_code").val();
|
||||
eva_create_evaluation_detail_agreementObject.search_employee_fullname = $("#eva_create_evaluation_detail_agreement_search_employee_fullname").val();
|
||||
|
||||
|
||||
return eva_create_evaluation_detail_agreementObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_agreement_FeedDataToForm(result);
|
||||
eva_create_evaluation_detail_agreement_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_create_evaluation_detail_agreementModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_agreement_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_detail_agreement_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d");
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GoEdit(a) {
|
||||
// Incase model popup
|
||||
//eva_create_evaluation_detail_agreement_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
window_open(appsite + "/eva_create_evaluation_detail_agreementView/eva_create_evaluation_detail_agreement_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_agreement_editMode = "UPDATE";
|
||||
eva_create_evaluation_detail_agreement_FeedDataToForm(result);
|
||||
$("#eva_create_evaluation_detail_agreementModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_agreement_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_SetCreateForm(s) {
|
||||
eva_create_evaluation_detail_agreement_editMode = "CREATE";
|
||||
eva_create_evaluation_detail_agreement_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_detail_agreement_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_create_evaluation_detail_agreement_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_create_evaluation_detail_agreement_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_agreement_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation_detail_agreement', eva_create_evaluation_detail_agreement_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_create_evaluation_detail_agreement_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_detail_agreement_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_create_evaluation_detail_agreementModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_detail_agreement_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_detail_agreement_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_create_evaluation_detail_agreementModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_detail_agreement_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_detail_agreement_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_create_evaluation_detail_agreementModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_detail_agreement_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_agreement_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_create_evaluation_detail_agreementTableV;
|
||||
|
||||
var eva_create_evaluation_detail_agreement_setupTable = function (result) {
|
||||
console.log(result);
|
||||
|
||||
tmp = '"';
|
||||
eva_create_evaluation_detail_agreementTableV = $('#eva_create_evaluation_detail_agreementTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
"select": false,
|
||||
"columns": [
|
||||
{ "data": "id" },
|
||||
|
||||
{ "data": "employee_code" },
|
||||
{ "data": "employee_fullname" },
|
||||
{ "data": "employee_position" },
|
||||
{ "data": "employee_position_level" },
|
||||
{ "data": "org_id_external_linkage_external_name" },
|
||||
{ "data": "status_chief" },
|
||||
{ "data": "status_supervisor" },
|
||||
|
||||
],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_create_evaluation_detail_agreement_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> ";
|
||||
}
|
||||
}],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
},
|
||||
"paging": true,
|
||||
"searching": false
|
||||
});
|
||||
endLoad();
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_agreement_InitiateDataTable() {
|
||||
startLoad();
|
||||
var p = $.param(eva_create_evaluation_detail_agreement_GetSearchParameter());
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_agreement/GetListBySearch?"+p, eva_create_evaluation_detail_agreement_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_DoSearch() {
|
||||
var p = $.param(eva_create_evaluation_detail_agreement_GetSearchParameter());
|
||||
var eva_create_evaluation_detail_agreement_reload = function (result) {
|
||||
eva_create_evaluation_detail_agreementTableV.destroy();
|
||||
eva_create_evaluation_detail_agreement_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail_agreement/GetListBySearch?"+p, eva_create_evaluation_detail_agreement_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GetSelect(f) {
|
||||
var eva_create_evaluation_detail_agreement_selectitem = [];
|
||||
$.each(eva_create_evaluation_detail_agreementTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_create_evaluation_detail_agreement_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_create_evaluation_detail_agreement_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
var eva_create_evaluation_detail_agreement_editMode = "CREATE";
|
||||
var eva_create_evaluation_detail_agreement_API = "/api/eva_create_evaluation_detail_agreement/";
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_agreement_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_detail_agreement_id").val(data.id);
|
||||
$("#eva_create_evaluation_detail_agreement_evaluation_round").text(data.evaluation_round);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_code").text(data.employee_code);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_fullname").text(data.employee_fullname);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position").text(data.employee_position);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position_type").text(data.employee_position_type);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_position_level").text(data.employee_position_level);
|
||||
$("#eva_create_evaluation_detail_agreement_employee_org").text(data.employee_org);
|
||||
$("#eva_create_evaluation_detail_agreement_chief_fullname").text(data.chief_fullname);
|
||||
$("#eva_create_evaluation_detail_agreement_chief_position").text(data.chief_position);
|
||||
$("#eva_create_evaluation_detail_agreement_create_evaluation_id").val(data.create_evaluation_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GetFromForm() {
|
||||
var eva_create_evaluation_detail_agreementObject = new Object();
|
||||
eva_create_evaluation_detail_agreementObject.id = $("#eva_create_evaluation_detail_agreement_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.evaluation_round = $("#eva_create_evaluation_detail_agreement_evaluation_round").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_code = $("#eva_create_evaluation_detail_agreement_employee_code").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_fullname = $("#eva_create_evaluation_detail_agreement_employee_fullname").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position = $("#eva_create_evaluation_detail_agreement_employee_position").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position_type = $("#eva_create_evaluation_detail_agreement_employee_position_type").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_position_level = $("#eva_create_evaluation_detail_agreement_employee_position_level").text();
|
||||
eva_create_evaluation_detail_agreementObject.employee_org = $("#eva_create_evaluation_detail_agreement_employee_org").text();
|
||||
eva_create_evaluation_detail_agreementObject.chief_fullname = $("#eva_create_evaluation_detail_agreement_chief_fullname").text();
|
||||
eva_create_evaluation_detail_agreementObject.chief_position = $("#eva_create_evaluation_detail_agreement_chief_position").text();
|
||||
eva_create_evaluation_detail_agreementObject.create_evaluation_id = $("#eva_create_evaluation_detail_agreement_create_evaluation_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.org_id = $("#eva_create_evaluation_detail_agreement_org_id").val();
|
||||
eva_create_evaluation_detail_agreementObject.search_employee_code = $("#eva_create_evaluation_detail_agreement_search_employee_code").val();
|
||||
eva_create_evaluation_detail_agreementObject.search_employee_fullname = $("#eva_create_evaluation_detail_agreement_search_employee_fullname").val();
|
||||
|
||||
|
||||
return eva_create_evaluation_detail_agreementObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_InitialForm() {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_agreement_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_agreement_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_create_evaluation_detail_agreement_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_agreement_editMode = "UPDATE";
|
||||
eva_create_evaluation_detail_agreement_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_agreement_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_SetCreateForm() {
|
||||
eva_create_evaluation_detail_agreement_editMode = "CREATE";
|
||||
eva_create_evaluation_detail_agreement_InitialForm();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_create_evaluation_detail_agreement_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_agreement_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation_detail_agreement', eva_create_evaluation_detail_agreement_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var data = eva_create_evaluation_detail_agreement_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_detail_agreement_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_detail_agreement_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_detail_agreement_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_agreement_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_detail_agreement_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_agreement_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user