ปรับปรุงหน้าจก eva detail

This commit is contained in:
Nakorn Rientrakrunchai
2021-03-12 23:22:39 +07:00
parent e179b447d7
commit 60373ede6b
20 changed files with 3303 additions and 178 deletions

View File

@@ -5,33 +5,44 @@ var eva_create_evaluation_detail_API = "/api/eva_create_evaluation_detail/";
function eva_create_evaluation_detail_GetSearchParameter() {
var eva_create_evaluation_detailSearchObject = new Object();
eva_create_evaluation_detailSearchObject.create_evaluation_id = getUrlParameter("id"); //$("#s_eva_create_evaluation_detail_create_evaluation_id").val();
eva_create_evaluation_detailSearchObject.create_evaluation_id = getUrlParameter("id"); //$("#s_eva_create_evaluation_detail_create_evaluation_id").val();
return eva_create_evaluation_detailSearchObject;
}
function eva_create_evaluation_detail_FeedDataToSearchForm(data) {
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
}
//================= Form Data Customizaiton =========================================
function eva_create_evaluation_detail_FeedDataToForm(data) {
$("#eva_create_evaluation_detail_id").val(data.id);
$("#eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_chief"), data, "id", "fullname", "item_chief", data.chief);
$("#eva_create_evaluation_detail_id").val(data.id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_create_evaluation_id"), data, "external_id", "external_name", "item_create_evaluation_id", data.create_evaluation_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_chief"), data, "id", "fullname", "item_chief", data.chief);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_eva_employee_id"), data, "id", "fullname", "item_eva_employee_id", data.eva_employee_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_supervisor1_id"), data, "id", "fullname", "item_supervisor1_id", data.supervisor1_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_supervisor2_id"), data, "id", "fullname", "item_supervisor2_id", data.supervisor2_id);
$("#eva_create_evaluation_detail_work_period").val(data.work_period);
$("#eva_create_evaluation_detail_order_of_data").val(data.order_of_data);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_help_org_id"), data, "id", "external_name", "item_help_org_id", data.help_org_id);
}
function eva_create_evaluation_detail_GetFromForm() {
var eva_create_evaluation_detailObject = new Object();
eva_create_evaluation_detailObject.id = $("#eva_create_evaluation_detail_id").val();
eva_create_evaluation_detailObject.create_evaluation_id = $("#eva_create_evaluation_detail_create_evaluation_id").val();
eva_create_evaluation_detailObject.employee_id = $("#eva_create_evaluation_detail_employee_id").val();
eva_create_evaluation_detailObject.chief = $("#eva_create_evaluation_detail_chief").val();
eva_create_evaluation_detailObject.id = $("#eva_create_evaluation_detail_id").val();
eva_create_evaluation_detailObject.create_evaluation_id = $("#eva_create_evaluation_detail_create_evaluation_id").val();
eva_create_evaluation_detailObject.employee_id = $("#eva_create_evaluation_detail_employee_id").val();
eva_create_evaluation_detailObject.chief = $("#eva_create_evaluation_detail_chief").val();
eva_create_evaluation_detailObject.eva_employee_id = $("#eva_create_evaluation_detail_eva_employee_id").val();
eva_create_evaluation_detailObject.supervisor1_id = $("#eva_create_evaluation_detail_supervisor1_id").val();
eva_create_evaluation_detailObject.supervisor2_id = $("#eva_create_evaluation_detail_supervisor2_id").val();
eva_create_evaluation_detailObject.work_period = $("#eva_create_evaluation_detail_work_period").val();
eva_create_evaluation_detailObject.order_of_data = $("#eva_create_evaluation_detail_order_of_data").val();
eva_create_evaluation_detailObject.help_org_id = $("#eva_create_evaluation_detail_help_org_id").val();
return eva_create_evaluation_detailObject;
}
@@ -39,14 +50,14 @@ eva_create_evaluation_detailObject.chief = $("#eva_create_evaluation_detail_chie
function eva_create_evaluation_detail_InitialForm(s) {
var successFunc = function (result) {
eva_create_evaluation_detail_FeedDataToForm(result);
eva_create_evaluation_detail_FeedDataToSearchForm(result);
eva_create_evaluation_detail_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_create_evaluation_detailModel").modal("show");
}
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + "GetBlankItem", successFunc, AlertDanger);
}
@@ -62,7 +73,7 @@ function eva_create_evaluation_detail_GoCreate() {
//window_open(appsite + "/eva_create_evaluation_detailView/eva_create_evaluation_detail_d");
}
function eva_create_evaluation_detail_GoEdit(a) {
function eva_create_evaluation_detail_GoEdit(a) {
// Incase model popup
eva_create_evaluation_detail_SetEditForm(a);
@@ -76,15 +87,15 @@ function eva_create_evaluation_detail_SetEditForm(a) {
eva_create_evaluation_detail_editMode = "UPDATE";
eva_create_evaluation_detail_FeedDataToForm(result);
$("#eva_create_evaluation_detailModel").modal("show");
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + a, successFunc, AlertDanger);
}
function eva_create_evaluation_detail_SetCreateForm(s) {
eva_create_evaluation_detail_editMode = "CREATE";
eva_create_evaluation_detail_InitialForm(s);
eva_create_evaluation_detail_InitialForm(s);
}
function eva_create_evaluation_detail_RefreshTable() {
@@ -102,8 +113,7 @@ var eva_create_evaluation_detail_customValidation = function (group) {
};
function eva_create_evaluation_detail_PutUpdate() {
if (!ValidateForm('eva_create_evaluation_detail', eva_create_evaluation_detail_customValidation))
{
if (!ValidateForm('eva_create_evaluation_detail', eva_create_evaluation_detail_customValidation)) {
return;
}
@@ -115,9 +125,9 @@ function eva_create_evaluation_detail_PutUpdate() {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPutRequest(apisite + eva_create_evaluation_detail_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
@@ -126,9 +136,9 @@ function eva_create_evaluation_detail_PutUpdate() {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPostRequest(apisite + eva_create_evaluation_detail_API, data, successFunc2, AlertDanger);
}
}
@@ -139,9 +149,9 @@ function eva_create_evaluation_detail_GoDelete(a) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_API + a, null, successFunc, AlertDanger);
}
}
@@ -151,25 +161,27 @@ function eva_create_evaluation_detail_GoDelete(a) {
var eva_create_evaluation_detailTableV;
var eva_create_evaluation_detail_setupTable = function (result) {
console.log(result);
var groupColumn = 8;
tmp = '"';
console.log(result);
var groupColumn = 9;
tmp = '"';
eva_create_evaluation_detailTableV = $('#eva_create_evaluation_detailTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "employee_no" },
{ "data": "employee_id_external_linkage_external_name" },
{ "data": "position_type_text" },
{ "data": "position_name" },
{ "data": "position_level_text" },
{ "data": "remark" },
{ "data": "chief_external_linkage_external_name" },
{ "data": "department_name" },
{ "data": "id" },
{ "data": "order_of_data" },
{ "data": "employee_no" },
{ "data": "employee_id_external_linkage_external_name" },
{ "data": "position_type_text" },
{ "data": "position_name" },
{ "data": "position_level_text" },
{ "data": "remark" },
{ "data": "chief_external_linkage_external_name" },
{ "data": "department_name" },
{ "data": "work_period" },
{ "data": "help_org_id_external_linkage_external_name" },
],
"columnDefs": [
{
@@ -179,36 +191,36 @@ var groupColumn = 8;
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_create_evaluation_detail_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_create_evaluation_detail_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
}
},
{ "visible": false, "targets": groupColumn }],
{ "visible": false, "targets": groupColumn }],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false,
"drawCallback": function ( settings ) {
"searching": false,
"drawCallback": function (settings) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr class="group"><td colspan="9"><b>หน่วยงาน : '+group+'</b></td></tr>'
var rows = api.rows({ page: 'current' }).nodes();
var last = null;
api.column(groupColumn, { page: 'current' }).data().each(function (group, i) {
if (last !== group) {
$(rows).eq(i).before(
'<tr class="group"><td colspan="11"><b>หน่วยงาน : ' + group + '</b></td></tr>'
);
last = group;
}
} );
});
}
});
endLoad();
endLoad();
};
function eva_create_evaluation_detail_InitiateDataTable(id) {
startLoad();
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(id);
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_setupTable, AlertDanger);
startLoad();
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(id);
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?" + p, eva_create_evaluation_detail_setupTable, AlertDanger);
}
function eva_create_evaluation_detail_DoSearch() {
@@ -216,10 +228,10 @@ function eva_create_evaluation_detail_DoSearch() {
var eva_create_evaluation_detail_reload = function (result) {
eva_create_evaluation_detailTableV.destroy();
eva_create_evaluation_detail_setupTable(result);
endLoad();
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_reload, AlertDanger);
startLoad();
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?" + p, eva_create_evaluation_detail_reload, AlertDanger);
}
function eva_create_evaluation_detail_GetSelect(f) {