ปรับโครงสร้างระบบ ให้รองรับ การไปช่วยปฏิบัติงาน

This commit is contained in:
Nakorn Rientrakrunchai
2021-03-09 18:46:05 +07:00
parent fcc5146085
commit 2952c1fc2a
40 changed files with 2188 additions and 1176 deletions

View File

@@ -5,31 +5,33 @@ var eva_evaluation_group_API = "/api/eva_evaluation_group/";
function eva_evaluation_group_GetSearchParameter() {
var eva_evaluation_groupSearchObject = new Object();
eva_evaluation_groupSearchObject.code = $("#s_eva_evaluation_group_code").val();
eva_evaluation_groupSearchObject.code = $("#s_eva_evaluation_group_code").val();
return eva_evaluation_groupSearchObject;
}
function eva_evaluation_group_FeedDataToSearchForm(data) {
$("#s_eva_evaluation_group_code").val(data.code);
$("#s_eva_evaluation_group_code").val(data.code);
}
//================= Form Data Customizaiton =========================================
function eva_evaluation_group_FeedDataToForm(data) {
$("#eva_evaluation_group_id").val(data.id);
$("#eva_evaluation_group_code").val(data.code);
$("#eva_evaluation_group_thegroup").val(data.thegroup);
$("#eva_evaluation_group_id").val(data.id);
$("#eva_evaluation_group_code").val(data.code);
$("#eva_evaluation_group_thegroup").val(data.thegroup);
DropDownClearFormAndFeedWithData($("#eva_evaluation_group_main_dept_id"), data, "id", "external_name", "item_main_dept_id", data.main_dept_id);
$("#eva_evaluation_group_percentage").val(data.percentage);
}
function eva_evaluation_group_GetFromForm() {
var eva_evaluation_groupObject = new Object();
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
eva_evaluation_groupObject.main_dept_id = $("#eva_evaluation_group_main_dept_id").val();
eva_evaluation_groupObject.percentage = $("#eva_evaluation_group_percentage").val();
return eva_evaluation_groupObject;
}
@@ -37,14 +39,14 @@ eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
function eva_evaluation_group_InitialForm(s) {
var successFunc = function (result) {
eva_evaluation_group_FeedDataToForm(result);
eva_evaluation_group_FeedDataToSearchForm(result);
eva_evaluation_group_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_evaluation_groupModel").modal("show");
}
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_API + "GetBlankItem", successFunc, AlertDanger);
}
@@ -71,15 +73,15 @@ function eva_evaluation_group_SetEditForm(a) {
eva_evaluation_group_editMode = "UPDATE";
eva_evaluation_group_FeedDataToForm(result);
$("#eva_evaluation_groupModel").modal("show");
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_API + a, successFunc, AlertDanger);
}
function eva_evaluation_group_SetCreateForm(s) {
eva_evaluation_group_editMode = "CREATE";
eva_evaluation_group_InitialForm(s);
eva_evaluation_group_InitialForm(s);
}
function eva_evaluation_group_RefreshTable() {
@@ -97,8 +99,7 @@ var eva_evaluation_group_customValidation = function (group) {
};
function eva_evaluation_group_PutUpdate() {
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation))
{
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation)) {
return;
}
@@ -110,9 +111,9 @@ function eva_evaluation_group_PutUpdate() {
$("#eva_evaluation_groupModel").modal("hide");
AlertSuccess(result.message);
eva_evaluation_group_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPutRequest(apisite + eva_evaluation_group_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
@@ -121,9 +122,9 @@ function eva_evaluation_group_PutUpdate() {
$("#eva_evaluation_groupModel").modal("hide");
AlertSuccess(result.message);
eva_evaluation_group_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPostRequest(apisite + eva_evaluation_group_API, data, successFunc2, AlertDanger);
}
}
@@ -134,9 +135,9 @@ function eva_evaluation_group_GoDelete(a) {
$("#eva_evaluation_groupModel").modal("hide");
AlertSuccess(result.message);
eva_evaluation_group_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxDeleteRequest(apisite + eva_evaluation_group_API + a, null, successFunc, AlertDanger);
}
}
@@ -146,16 +147,18 @@ function eva_evaluation_group_GoDelete(a) {
var eva_evaluation_groupTableV;
var eva_evaluation_group_setupTable = function (result) {
tmp = '"';
tmp = '"';
eva_evaluation_groupTableV = $('#eva_evaluation_groupTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "code" },
{ "data": "thegroup" },
{ "data": "id" },
{ "data": "code" },
{ "data": "thegroup" },
{ "data": "main_dept_id_external_linkage_external_name" },
{ "data": "percentage" },
],
"columnDefs": [
{
@@ -169,13 +172,13 @@ var eva_evaluation_group_setupTable = function (result) {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
"searching": false
});
endLoad();
endLoad();
};
function eva_evaluation_group_InitiateDataTable() {
startLoad();
startLoad();
AjaxGetRequest(apisite + "/api/eva_evaluation_group/GetListBySearch", eva_evaluation_group_setupTable, AlertDanger);
}
@@ -184,10 +187,10 @@ function eva_evaluation_group_DoSearch() {
var eva_evaluation_group_reload = function (result) {
eva_evaluation_groupTableV.destroy();
eva_evaluation_group_setupTable(result);
endLoad();
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_evaluation_group/GetListBySearch?"+p, eva_evaluation_group_reload, AlertDanger);
startLoad();
AjaxGetRequest(apisite + "/api/eva_evaluation_group/GetListBySearch?" + p, eva_evaluation_group_reload, AlertDanger);
}
function eva_evaluation_group_GetSelect(f) {

View File

@@ -4,18 +4,20 @@ var eva_evaluation_group_API = "/api/eva_evaluation_group/";
//================= Form Data Customizaiton =========================================
function eva_evaluation_group_FeedDataToForm(data) {
$("#eva_evaluation_group_id").val(data.id);
$("#eva_evaluation_group_code").val(data.code);
$("#eva_evaluation_group_thegroup").val(data.thegroup);
$("#eva_evaluation_group_id").val(data.id);
$("#eva_evaluation_group_code").val(data.code);
$("#eva_evaluation_group_thegroup").val(data.thegroup);
DropDownClearFormAndFeedWithData($("#eva_evaluation_group_main_dept_id"), data, "id", "external_name", "item_main_dept_id", data.main_dept_id);
$("#eva_evaluation_group_percentage").val(data.percentage);
}
function eva_evaluation_group_GetFromForm() {
var eva_evaluation_groupObject = new Object();
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
eva_evaluation_groupObject.main_dept_id = $("#eva_evaluation_group_main_dept_id").val();
eva_evaluation_groupObject.percentage = $("#eva_evaluation_group_percentage").val();
return eva_evaluation_groupObject;
}
@@ -23,9 +25,9 @@ eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
function eva_evaluation_group_InitialForm() {
var successFunc = function (result) {
eva_evaluation_group_FeedDataToForm(result);
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_API + "GetBlankItem", successFunc, AlertDanger);
}
@@ -35,15 +37,15 @@ function eva_evaluation_group_SetEditForm(a) {
var successFunc = function (result) {
eva_evaluation_group_editMode = "UPDATE";
eva_evaluation_group_FeedDataToForm(result);
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_API + a, successFunc, AlertDanger);
}
function eva_evaluation_group_SetCreateForm() {
eva_evaluation_group_editMode = "CREATE";
eva_evaluation_group_InitialForm();
eva_evaluation_group_InitialForm();
}
//================= Update and Delete =========================================
@@ -53,8 +55,7 @@ var eva_evaluation_group_customValidation = function (group) {
};
function eva_evaluation_group_PutUpdate() {
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation))
{
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation)) {
return;
}
var data = eva_evaluation_group_GetFromForm();
@@ -63,18 +64,18 @@ function eva_evaluation_group_PutUpdate() {
if (eva_evaluation_group_editMode === "UPDATE") {
var successFunc1 = function (result) {
AlertSuccess(result.message);
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPutRequest(apisite + eva_evaluation_group_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
AlertSuccess(result.message);
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxPostRequest(apisite + eva_evaluation_group_API, data, successFunc2, AlertDanger);
}
}
@@ -84,9 +85,9 @@ function eva_evaluation_group_GoDelete(a) {
var successFunc = function (result) {
AlertSuccess(result.message);
eva_evaluation_group_RefreshTable();
endLoad();
endLoad();
};
startLoad();
startLoad();
AjaxDeleteRequest(apisite + eva_evaluation_group_API + a, null, successFunc, AlertDanger);
}
}

View File

@@ -21,7 +21,7 @@ function eva_limit_frame_employee_FeedDataToSearchForm(data) {
function eva_limit_frame_employee_FeedDataToForm(data) {
$("#eva_limit_frame_employee_id").val(data.id);
$("#eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_frame_group_guid"), data, "id_guid", "external_name", "item_frame_group_guid", data.frame_group_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
$("#eva_limit_frame_employee_position_text").val(data.position_text);
@@ -31,13 +31,14 @@ function eva_limit_frame_employee_FeedDataToForm(data) {
$("#eva_limit_frame_employee_monthly_remuneration").val(data.monthly_remuneration);
$("#eva_limit_frame_employee_cost_of_living").val(data.cost_of_living);
$("#eva_limit_frame_employee_order_of_data").val(data.order_of_data);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_help_org_id"), data, "id", "external_name", "item_help_org_id", data.help_org_id);
console.log(data);
}
function eva_limit_frame_employee_GetFromForm() {
var eva_limit_frame_employeeObject = new Object();
eva_limit_frame_employeeObject.id = $("#eva_limit_frame_employee_id").val();
eva_limit_frame_employeeObject.frame_group_guid = getUrlParameter("id");
eva_limit_frame_employeeObject.frame_group_guid = $("#eva_limit_frame_employee_frame_group_guid").val();
eva_limit_frame_employeeObject.employee_id = $("#eva_limit_frame_employee_employee_id").val();
eva_limit_frame_employeeObject.org_id = $("#eva_limit_frame_employee_org_id").val();
eva_limit_frame_employeeObject.position_text = $("#eva_limit_frame_employee_position_text").val();
@@ -47,6 +48,7 @@ function eva_limit_frame_employee_GetFromForm() {
eva_limit_frame_employeeObject.monthly_remuneration = $("#eva_limit_frame_employee_monthly_remuneration").val();
eva_limit_frame_employeeObject.cost_of_living = $("#eva_limit_frame_employee_cost_of_living").val();
eva_limit_frame_employeeObject.order_of_data = $("#eva_limit_frame_employee_order_of_data").val();
eva_limit_frame_employeeObject.help_org_id = $("#eva_limit_frame_employee_help_org_id").val();
return eva_limit_frame_employeeObject;
@@ -184,7 +186,7 @@ var eva_limit_frame_employee_setupTable = function (result) {
{ "data": "position_allowance" },
{ "data": "monthly_remuneration" },
{ "data": "cost_of_living" },
{ "data": "help_org_id_external_linkage_external_name" },
],
"columnDefs": [
{

View File

@@ -1,116 +0,0 @@
var eva_limit_frame_employee_editMode = "CREATE";
var eva_limit_frame_employee_API = "/api/eva_limit_frame_employee/";
//================= Form Data Customizaiton =========================================
function eva_limit_frame_employee_FeedDataToForm(data) {
$("#eva_limit_frame_employee_id").val(data.id);
$("#eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id"), data, "id", "external_name", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
$("#eva_limit_frame_employee_position_text").val(data.position_text);
$("#eva_limit_frame_employee_level_text").val(data.level_text);
$("#eva_limit_frame_employee_salary").val(data.salary);
$("#eva_limit_frame_employee_position_allowance").val(data.position_allowance);
$("#eva_limit_frame_employee_monthly_remuneration").val(data.monthly_remuneration);
$("#eva_limit_frame_employee_cost_of_living").val(data.cost_of_living);
$("#eva_limit_frame_employee_order_of_data").val(data.order_of_data);
}
function eva_limit_frame_employee_GetFromForm() {
var eva_limit_frame_employeeObject = new Object();
eva_limit_frame_employeeObject.id = $("#eva_limit_frame_employee_id").val();
eva_limit_frame_employeeObject.frame_group_guid = $("#eva_limit_frame_employee_frame_group_guid").val();
eva_limit_frame_employeeObject.employee_id = $("#eva_limit_frame_employee_employee_id").val();
eva_limit_frame_employeeObject.org_id = $("#eva_limit_frame_employee_org_id").val();
eva_limit_frame_employeeObject.position_text = $("#eva_limit_frame_employee_position_text").val();
eva_limit_frame_employeeObject.level_text = $("#eva_limit_frame_employee_level_text").val();
eva_limit_frame_employeeObject.salary = $("#eva_limit_frame_employee_salary").val();
eva_limit_frame_employeeObject.position_allowance = $("#eva_limit_frame_employee_position_allowance").val();
eva_limit_frame_employeeObject.monthly_remuneration = $("#eva_limit_frame_employee_monthly_remuneration").val();
eva_limit_frame_employeeObject.cost_of_living = $("#eva_limit_frame_employee_cost_of_living").val();
eva_limit_frame_employeeObject.order_of_data = $("#eva_limit_frame_employee_order_of_data").val();
return eva_limit_frame_employeeObject;
}
function eva_limit_frame_employee_InitialForm() {
var successFunc = function (result) {
eva_limit_frame_employee_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_employee_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_employee_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_employee_editMode = "UPDATE";
eva_limit_frame_employee_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_employee_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_employee_SetCreateForm() {
eva_limit_frame_employee_editMode = "CREATE";
eva_limit_frame_employee_InitialForm();
}
//================= Update and Delete =========================================
var eva_limit_frame_employee_customValidation = function (group) {
return "";
};
function eva_limit_frame_employee_PutUpdate() {
if (!ValidateForm('eva_limit_frame_employee', eva_limit_frame_employee_customValidation))
{
return;
}
var data = eva_limit_frame_employee_GetFromForm();
//Update Mode
if (eva_limit_frame_employee_editMode === "UPDATE") {
var successFunc1 = function (result) {
AlertSuccess(result.code+" "+result.message);
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_employee_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
AlertSuccess(result.code+" "+result.message);
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_limit_frame_employee_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_employee_GoDelete(a) {
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
var successFunc = function (result) {
AlertSuccess(result.code+" "+result.message);
eva_limit_frame_employee_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_employee_API + a, null, successFunc, AlertDanger);
}
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -1,173 +0,0 @@
function eva_limit_frame_employee_ClearForm(i, blankItem) {
var data = blankItem;
$("#eva_limit_frame_employee_id_" + i).val("");
$("#eva_limit_frame_employee_frame_group_guid_" + i).val("");
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id_" + i), blankItem, "id", "external_name", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id_" + i), blankItem, "id", "external_name", "item_org_id", data.org_id);
$("#eva_limit_frame_employee_position_text_" + i).val("");
$("#eva_limit_frame_employee_level_text_" + i).val("");
$("#eva_limit_frame_employee_salary_" + i).val("");
$("#eva_limit_frame_employee_position_allowance_" + i).val("");
$("#eva_limit_frame_employee_monthly_remuneration_" + i).val("");
$("#eva_limit_frame_employee_cost_of_living_" + i).val("");
$("#eva_limit_frame_employee_order_of_data_" + i).val("");
}
function eva_limit_frame_employee_FeedDataToForm(data, i, blankItem) {
$("#eva_limit_frame_employee_id_" + i).val(data.id);
$("#eva_limit_frame_employee_frame_group_guid_" + i).val(data.frame_group_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_employee_id_" + i), blankItem, "id", "external_name", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_org_id_" + i), blankItem, "id", "external_name", "item_org_id", data.org_id);
$("#eva_limit_frame_employee_position_text_" + i).val(data.position_text);
$("#eva_limit_frame_employee_level_text_" + i).val(data.level_text);
$("#eva_limit_frame_employee_salary_" + i).val(data.salary);
$("#eva_limit_frame_employee_position_allowance_" + i).val(data.position_allowance);
$("#eva_limit_frame_employee_monthly_remuneration_" + i).val(data.monthly_remuneration);
$("#eva_limit_frame_employee_cost_of_living_" + i).val(data.cost_of_living);
$("#eva_limit_frame_employee_order_of_data_" + i).val(data.order_of_data);
}
function eva_limit_frame_employee_GetFromForm(obj, i) {
var eva_limit_frame_employeeObject = new Object();
eva_limit_frame_employeeObject.id = obj.find("#eva_limit_frame_employee_id_" + i).val();
eva_limit_frame_employeeObject.frame_group_guid = obj.find("#eva_limit_frame_employee_frame_group_guid_" + i).val();
eva_limit_frame_employeeObject.employee_id = obj.find("#eva_limit_frame_employee_employee_id_" + i).val();
eva_limit_frame_employeeObject.org_id = obj.find("#eva_limit_frame_employee_org_id_" + i).val();
eva_limit_frame_employeeObject.position_text = obj.find("#eva_limit_frame_employee_position_text_" + i).val();
eva_limit_frame_employeeObject.level_text = obj.find("#eva_limit_frame_employee_level_text_" + i).val();
eva_limit_frame_employeeObject.salary = obj.find("#eva_limit_frame_employee_salary_" + i).val();
eva_limit_frame_employeeObject.position_allowance = obj.find("#eva_limit_frame_employee_position_allowance_" + i).val();
eva_limit_frame_employeeObject.monthly_remuneration = obj.find("#eva_limit_frame_employee_monthly_remuneration_" + i).val();
eva_limit_frame_employeeObject.cost_of_living = obj.find("#eva_limit_frame_employee_cost_of_living_" + i).val();
eva_limit_frame_employeeObject.order_of_data = obj.find("#eva_limit_frame_employee_order_of_data_" + i).val();
eva_limit_frame_employeeObject.active_mode = obj.find("#isActive_" + i + "_eva_limit_frame_employee").val();
return eva_limit_frame_employeeObject;
}
function eva_limit_frame_employee_GetAllData() {
//Insert eva_limit_frame_employee List
var eva_limit_frame_employee = [];
$('#eva_limit_frame_employeeBody tr').each(function () {
var i = $(this).find("#rowCount").text();
var eacheva_limit_frame_employee = eva_limit_frame_employee_GetFromForm($(this), i);
eva_limit_frame_employee.push(eacheva_limit_frame_employee);
});
return eva_limit_frame_employee;
}
function eva_limit_frame_employee_Save(id) {
//Insert eva_limit_frame_employee List
var eva_limit_frame_employee = eva_limit_frame_employee_GetAllData();
var successFunc = function (result) {
AlertSuccess("ปรับปรุงข้อมูลเรียบร้อยแล้ว");
endLoad();
};
startLoad();
AjaxPutRequest(apisite + '/api/eva_limit_frame_employee/UpdateMultiple', eva_limit_frame_employee, successFunc, AlertDanger);
}
function eva_limit_frame_employee_Get(id, blankItem) {
$('#eva_limit_frame_employeeBody').empty();
var successFunc = function (response) {
//console.log(response);
$.each(response, function (i, data) {
var tag = '<tr>';
tag += '<td><label id="rowCount">' + (i + 1) + '</label><input type="hidden" id="isActive_' + (i + 1) + '_eva_limit_frame_employee" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_employee_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_employee_frame_group_guid_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_employee_id_' + (i + 1) +'"></select></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_org_id_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_employee_position_text_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_employee_level_text_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_salary_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_position_allowance_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_monthly_remuneration_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_cost_of_living_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_order_of_data_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_employee_Removeeva_limit_frame_employee(this)" id="removeBtn"><i class="fa fa-trash-o" style="color:white;"></i></a><a href="javascript:;" class="btn btn-primary btn-sm" onclick="javascript:eva_limit_frame_employee_Restoreeva_limit_frame_employee(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_employeeBody').append($(tag));
eva_limit_frame_employee_FeedDataToForm(data, (i + 1), blankItem);
});
eva_limit_frame_employee_Summary();
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_employee", successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_employee/GetListByframe_group_guid/' + a, successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_employee/GetListByemployee_id/' + a, successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_employee/GetListByorg_id/' + a, successFunc, AlertDanger);
}
function eva_limit_frame_employee_Add() {
var successFunc = function (result) {
var i = $("#eva_limit_frame_employeeBody tr").length;
var tag = '<tr>';
tag += '<td><label id="rowCount">' + (i + 1) + '</label><input type="hidden" id="isActive_' + (i + 1) + '_eva_limit_frame_employee" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_employee_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_employee_frame_group_guid_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_employee_id_' + (i + 1) +'"></select></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_org_id_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_employee_position_text_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_employee_level_text_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_salary_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_position_allowance_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_monthly_remuneration_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_cost_of_living_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_employee_order_of_data_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_employee_Removeeva_limit_frame_employee(this)" id="removeBtn"><i class="fa fa-trash-o" style="color:white;"></i></a><a href="javascript:;" class="btn btn-primary btn-sm" onclick="javascript:eva_limit_frame_employee_Restoreeva_limit_frame_employee(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_employeeBody').append($(tag));
eva_limit_frame_employee_ClearForm(i + 1, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/" + "GetBlankItem", successFunc, AlertDanger);
}
function eva_limit_frame_employee_Removeeva_limit_frame_employee(e) {
if (confirm('กรุณากดตกลง เพื่อยืนยันการลบ?')) {
$(e).closest('tr').find("input,select,textarea").attr('disabled', true);
$(e).closest('tr').find("input,select,textarea").css({ opacity: '0.5' });
$(e).hide();
$(e).closest('tr').find("#restoreBtn").show();
$(e).closest('tr').find("input").first().val("0");
console.log($(e).closest('tr').find("input").first().val());
eva_limit_frame_employee_Summary();
}
}
function eva_limit_frame_employee_Restoreeva_limit_frame_employee(e) {
if (confirm('กรุณากดตกลง เพื่อยืนยันการกู้คืน?')) {
$(e).closest('tr').find("input,select,textarea").attr('disabled', false);
$(e).closest('tr').find("input,select,textarea").css({ opacity: '1' });
$(e).hide();
$(e).closest('tr').find("#removeBtn").show();
$(e).closest('tr').find("input").first().val("1");
console.log($(e).closest('tr').find("input").first().val());
eva_limit_frame_employee_Summary();
}
}
function eva_limit_frame_employee_Summary() {
var sum = 0;
$(".input_score").each(function () {
sum += +$(this).val();
});
$("#score_label").text("ผลรวม: " + sum);
}
function eva_limit_frame_employee_InitialForm(id) {
var successFunc = function (result) {
eva_limit_frame_employee_Get(id, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/" + "GetBlankItem", successFunc, AlertDanger);
}

View File

@@ -1,60 +0,0 @@
var eva_limit_frame_employee_API = "/api/eva_limit_frame_employee/";
//================= Search Customizaiton =========================================
function eva_limit_frame_employee_GetSearchParameter(fileType) {
var eva_limit_frame_employeeSearchObject = new Object();
eva_limit_frame_employeeSearchObject.frame_group_guid = $("#s_eva_limit_frame_employee_frame_group_guid").val();
eva_limit_frame_employeeSearchObject.employee_id = $("#s_eva_limit_frame_employee_employee_id").val();
eva_limit_frame_employeeSearchObject.fileType = fileType;
console.log(eva_limit_frame_employeeSearchObject);
return eva_limit_frame_employeeSearchObject;
}
function eva_limit_frame_employee_FeedDataToSearchForm(data) {
$("#s_eva_limit_frame_employee_frame_group_guid").val(data.frame_group_guid);
DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_employee_employee_id"), data, "id", "external_name", "item_employee_id", data.employee_id);
}
//================= Form Data Customizaiton =========================================
function eva_limit_frame_employee_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_employee_FeedDataToSearchForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_employee_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Data Table =========================================
var s_eva_limit_frame_employee_customValidation = function (group) {
return "";
};
function eva_limit_frame_employee_DoSearch(fileType) {
if (!ValidateForm('s_eva_limit_frame_employee', s_eva_limit_frame_employee_customValidation)) {
return;
}
var p = $.param(eva_limit_frame_employee_GetSearchParameter(fileType));
var report_url = apisite + "/api/eva_limit_frame_employee/eva_limit_frame_employee_report?" + p;
if (fileType === "pdf") {
$("#report_result").attr("src", report_url);
$("#report_result").show();
//window.open(report_url);
} else {
$("#report_result").hide();
window.open(report_url);
}
}