ปรับปรุงรายงานกรอบวงเงิน

This commit is contained in:
Nakorn Rientrakrunchai
2021-03-02 17:14:35 +07:00
parent a4e54a1179
commit ad14f4f664
77 changed files with 10782 additions and 4 deletions

View File

@@ -0,0 +1,240 @@
var eva_limit_frame_employee_editMode = "CREATE";
var eva_limit_frame_employee_API = "/api/eva_limit_frame_employee/";
//================= Search Customizaiton =========================================
function eva_limit_frame_employee_GetSearchParameter() {
var eva_limit_frame_employeeSearchObject = new Object();
eva_limit_frame_employeeSearchObject.frame_group_guid = getUrlParameter("id");
eva_limit_frame_employeeSearchObject.employee_id = $("#s_eva_limit_frame_employee_employee_id").val();
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_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);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_position_id"), data, "id", "external_name", "item_position_id", data.position_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_level_id"), data, "id", "external_name", "item_level_id", data.level_id);
$("#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);
}
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.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_id = $("#eva_limit_frame_employee_position_id").val();
eva_limit_frame_employeeObject.level_id = $("#eva_limit_frame_employee_level_id").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();
return eva_limit_frame_employeeObject;
}
function eva_limit_frame_employee_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_employee_FeedDataToForm(result);
eva_limit_frame_employee_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_limit_frame_employeeModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_employee_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_employee_GoCreate() {
// Incase model popup
eva_limit_frame_employee_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_limit_frame_employeeView/eva_limit_frame_employee_d");
}
function eva_limit_frame_employee_GoEdit(a) {
// Incase model popup
eva_limit_frame_employee_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_limit_frame_employeeView/eva_limit_frame_employee_d?id=" + a);
}
function eva_limit_frame_employee_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_employee_editMode = "UPDATE";
eva_limit_frame_employee_FeedDataToForm(result);
$("#eva_limit_frame_employeeModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_employee_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_employee_SetCreateForm(s) {
eva_limit_frame_employee_editMode = "CREATE";
eva_limit_frame_employee_InitialForm(s);
}
function eva_limit_frame_employee_RefreshTable() {
// Incase model popup
eva_limit_frame_employee_DoSearch();
// Incase open new page
//window.parent.eva_limit_frame_employee_DoSearch();
}
//================= 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) {
$("#eva_limit_frame_employeeModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_employee_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_employee_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_limit_frame_employeeModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_employee_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_limit_frame_employee_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_employee_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_limit_frame_employeeModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_employee_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_employee_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_limit_frame_employeeTableV;
var eva_limit_frame_employee_setupTable = function (result) {
tmp = '"';
eva_limit_frame_employeeTableV = $('#eva_limit_frame_employeeTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
//"select": {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "id" },
{ "data": "frame_group_guid_eva_limit_frame_group_group_guid" },
{ "data": "employee_id_external_linkage_external_name" },
{ "data": "org_id_external_linkage_external_name" },
{ "data": "position_id_external_linkage_external_name" },
{ "data": "level_id_external_linkage_external_name" },
{ "data": "salary" },
{ "data": "position_allowance" },
{ "data": "monthly_remuneration" },
],
"columnDefs": [
{
"targets": 0, //1,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_limit_frame_employee_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_limit_frame_employee_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></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 eva_limit_frame_employee_InitiateDataTable() {
startLoad();
var p = $.param(eva_limit_frame_employee_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?" + p, eva_limit_frame_employee_setupTable, AlertDanger);
}
function eva_limit_frame_employee_DoSearch() {
var p = $.param(eva_limit_frame_employee_GetSearchParameter());
var eva_limit_frame_employee_reload = function (result) {
eva_limit_frame_employeeTableV.destroy();
eva_limit_frame_employee_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_employee/GetListBySearch?" + p, eva_limit_frame_employee_reload, AlertDanger);
}
function eva_limit_frame_employee_GetSelect(f) {
var eva_limit_frame_employee_selectitem = [];
$.each(eva_limit_frame_employeeTableV.rows('.selected').data(), function (key, value) {
eva_limit_frame_employee_selectitem.push(value[f]);
});
alert(eva_limit_frame_employee_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -0,0 +1,112 @@
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);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_position_id"), data, "id", "external_name", "item_position_id", data.position_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_level_id"), data, "id", "external_name", "item_level_id", data.level_id);
$("#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);
}
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_id = $("#eva_limit_frame_employee_position_id").val();
eva_limit_frame_employeeObject.level_id = $("#eva_limit_frame_employee_level_id").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();
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

@@ -0,0 +1,165 @@
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);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_position_id_" + i), blankItem, "id", "external_name", "item_position_id", data.position_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_level_id_" + i), blankItem, "id", "external_name", "item_level_id", data.level_id);
$("#eva_limit_frame_employee_salary_" + i).val("");
$("#eva_limit_frame_employee_position_allowance_" + i).val("");
$("#eva_limit_frame_employee_monthly_remuneration_" + 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);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_position_id_" + i), blankItem, "id", "external_name", "item_position_id", data.position_id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_employee_level_id_" + i), blankItem, "id", "external_name", "item_level_id", data.level_id);
$("#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);
}
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_id = obj.find("#eva_limit_frame_employee_position_id_" + i).val();
eva_limit_frame_employeeObject.level_id = obj.find("#eva_limit_frame_employee_level_id_" + 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.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><select class="form-control" id="eva_limit_frame_employee_position_id_' + (i + 1) +'"></select></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_level_id_' + (i + 1) +'"></select></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><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);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_employee/GetListByposition_id/' + a, successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_employee/GetListBylevel_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><select class="form-control" id="eva_limit_frame_employee_position_id_' + (i + 1) +'"></select></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_employee_level_id_' + (i + 1) +'"></select></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><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

@@ -0,0 +1,60 @@
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);
}
}

View File

@@ -0,0 +1,234 @@
var eva_limit_frame_group_editMode = "CREATE";
var eva_limit_frame_group_API = "/api/eva_limit_frame_group/";
//================= Search Customizaiton =========================================
function eva_limit_frame_group_GetSearchParameter() {
var eva_limit_frame_groupSearchObject = new Object();
eva_limit_frame_groupSearchObject.frame_plan_guid = getUrlParameter("id");
eva_limit_frame_groupSearchObject.group_guid = $("#s_eva_limit_frame_group_group_guid").val();
return eva_limit_frame_groupSearchObject;
}
function eva_limit_frame_group_FeedDataToSearchForm(data) {
$("#s_eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid);
DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid);
}
//================= Form Data Customizaiton =========================================
function eva_limit_frame_group_FeedDataToForm(data) {
$("#eva_limit_frame_group_id").val(data.id);
$("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid);
$("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295);
$("#eva_limit_frame_group_total_salary").val(data.total_salary);
$("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit);
$("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded);
}
function eva_limit_frame_group_GetFromForm() {
var eva_limit_frame_groupObject = new Object();
eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val();
eva_limit_frame_groupObject.frame_plan_guid = getUrlParameter("id");
eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val();
eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val();
eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val();
eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val();
eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val();
return eva_limit_frame_groupObject;
}
function eva_limit_frame_group_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_group_FeedDataToForm(result);
eva_limit_frame_group_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_limit_frame_groupModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_group_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_group_GoCreate() {
// Incase model popup
eva_limit_frame_group_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_limit_frame_groupView/eva_limit_frame_group_d");
}
function eva_limit_frame_group_GoEdit(a) {
// Incase model popup
//eva_limit_frame_group_SetEditForm(a);
// Incase open new page
window_open(appsite + "/eva_limit_frame_groupView/eva_limit_frame_group_d?id=" + a);
}
function eva_limit_frame_group_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_group_editMode = "UPDATE";
eva_limit_frame_group_FeedDataToForm(result);
$("#eva_limit_frame_groupModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_group_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_group_SetCreateForm(s) {
eva_limit_frame_group_editMode = "CREATE";
eva_limit_frame_group_InitialForm(s);
}
function eva_limit_frame_group_RefreshTable() {
// Incase model popup
eva_limit_frame_group_DoSearch();
// Incase open new page
//window.parent.eva_limit_frame_group_DoSearch();
}
//================= Update and Delete =========================================
var eva_limit_frame_group_customValidation = function (group) {
return "";
};
function eva_limit_frame_group_PutUpdate() {
if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation)) {
return;
}
var data = eva_limit_frame_group_GetFromForm();
//Update Mode
if (eva_limit_frame_group_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_limit_frame_groupModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_group_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_group_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_limit_frame_groupModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_group_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_limit_frame_group_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_group_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_limit_frame_groupModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_group_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_group_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_limit_frame_groupTableV;
var eva_limit_frame_group_setupTable = function (result) {
tmp = '"';
eva_limit_frame_groupTableV = $('#eva_limit_frame_groupTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
//"select": {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "id" },
{ "data": "frame_plan_guid_eva_limit_frame_plan_executed_date" },
{ "data": "group_guid_eva_evaluation_group_code" },
{ "data": "limit_frame_295" },
{ "data": "total_salary" },
{ "data": "total_salary_limit" },
{ "data": "total_salary_limit_rounded" },
],
"columnDefs": [
{
"targets": 0, //1,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_limit_frame_group_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_limit_frame_group_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></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 eva_limit_frame_group_InitiateDataTable() {
startLoad();
var p = $.param(eva_limit_frame_group_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?" + p, eva_limit_frame_group_setupTable, AlertDanger);
}
function eva_limit_frame_group_DoSearch() {
var p = $.param(eva_limit_frame_group_GetSearchParameter());
var eva_limit_frame_group_reload = function (result) {
eva_limit_frame_groupTableV.destroy();
eva_limit_frame_group_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_group/GetListBySearch?" + p, eva_limit_frame_group_reload, AlertDanger);
}
function eva_limit_frame_group_GetSelect(f) {
var eva_limit_frame_group_selectitem = [];
$.each(eva_limit_frame_groupTableV.rows('.selected').data(), function (key, value) {
eva_limit_frame_group_selectitem.push(value[f]);
});
alert(eva_limit_frame_group_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -0,0 +1,108 @@
var eva_limit_frame_group_editMode = "CREATE";
var eva_limit_frame_group_API = "/api/eva_limit_frame_group/";
//================= Form Data Customizaiton =========================================
function eva_limit_frame_group_FeedDataToForm(data) {
$("#eva_limit_frame_group_id").val(data.id);
$("#eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid);
$("#eva_limit_frame_group_limit_frame_295").val(data.limit_frame_295);
$("#eva_limit_frame_group_total_salary").val(data.total_salary);
$("#eva_limit_frame_group_total_salary_limit").val(data.total_salary_limit);
$("#eva_limit_frame_group_total_salary_limit_rounded").val(data.total_salary_limit_rounded);
}
function eva_limit_frame_group_GetFromForm() {
var eva_limit_frame_groupObject = new Object();
eva_limit_frame_groupObject.id = $("#eva_limit_frame_group_id").val();
eva_limit_frame_groupObject.frame_plan_guid = $("#eva_limit_frame_group_frame_plan_guid").val();
eva_limit_frame_groupObject.group_guid = $("#eva_limit_frame_group_group_guid").val();
eva_limit_frame_groupObject.limit_frame_295 = $("#eva_limit_frame_group_limit_frame_295").val();
eva_limit_frame_groupObject.total_salary = $("#eva_limit_frame_group_total_salary").val();
eva_limit_frame_groupObject.total_salary_limit = $("#eva_limit_frame_group_total_salary_limit").val();
eva_limit_frame_groupObject.total_salary_limit_rounded = $("#eva_limit_frame_group_total_salary_limit_rounded").val();
return eva_limit_frame_groupObject;
}
function eva_limit_frame_group_InitialForm() {
var successFunc = function (result) {
eva_limit_frame_group_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_group_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_group_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_group_editMode = "UPDATE";
eva_limit_frame_group_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_group_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_group_SetCreateForm() {
eva_limit_frame_group_editMode = "CREATE";
eva_limit_frame_group_InitialForm();
}
//================= Update and Delete =========================================
var eva_limit_frame_group_customValidation = function (group) {
return "";
};
function eva_limit_frame_group_PutUpdate() {
if (!ValidateForm('eva_limit_frame_group', eva_limit_frame_group_customValidation))
{
return;
}
var data = eva_limit_frame_group_GetFromForm();
//Update Mode
if (eva_limit_frame_group_editMode === "UPDATE") {
var successFunc1 = function (result) {
AlertSuccess(result.code+" "+result.message);
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_group_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_group_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_group_GoDelete(a) {
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
var successFunc = function (result) {
AlertSuccess(result.code+" "+result.message);
eva_limit_frame_group_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_group_API + a, null, successFunc, AlertDanger);
}
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -0,0 +1,152 @@
function eva_limit_frame_group_ClearForm(i, blankItem) {
var data = blankItem;
$("#eva_limit_frame_group_id_" + i).val("");
$("#eva_limit_frame_group_frame_plan_guid_" + i).val("");
DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid_" + i), blankItem, "id", "code", "item_group_guid", data.group_guid);
$("#eva_limit_frame_group_limit_frame_295_" + i).val("");
$("#eva_limit_frame_group_total_salary_" + i).val("");
$("#eva_limit_frame_group_total_salary_limit_" + i).val("");
$("#eva_limit_frame_group_total_salary_limit_rounded_" + i).val("");
}
function eva_limit_frame_group_FeedDataToForm(data, i, blankItem) {
$("#eva_limit_frame_group_id_" + i).val(data.id);
$("#eva_limit_frame_group_frame_plan_guid_" + i).val(data.frame_plan_guid);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_group_group_guid_" + i), blankItem, "id", "code", "item_group_guid", data.group_guid);
$("#eva_limit_frame_group_limit_frame_295_" + i).val(data.limit_frame_295);
$("#eva_limit_frame_group_total_salary_" + i).val(data.total_salary);
$("#eva_limit_frame_group_total_salary_limit_" + i).val(data.total_salary_limit);
$("#eva_limit_frame_group_total_salary_limit_rounded_" + i).val(data.total_salary_limit_rounded);
}
function eva_limit_frame_group_GetFromForm(obj, i) {
var eva_limit_frame_groupObject = new Object();
eva_limit_frame_groupObject.id = obj.find("#eva_limit_frame_group_id_" + i).val();
eva_limit_frame_groupObject.frame_plan_guid = obj.find("#eva_limit_frame_group_frame_plan_guid_" + i).val();
eva_limit_frame_groupObject.group_guid = obj.find("#eva_limit_frame_group_group_guid_" + i).val();
eva_limit_frame_groupObject.limit_frame_295 = obj.find("#eva_limit_frame_group_limit_frame_295_" + i).val();
eva_limit_frame_groupObject.total_salary = obj.find("#eva_limit_frame_group_total_salary_" + i).val();
eva_limit_frame_groupObject.total_salary_limit = obj.find("#eva_limit_frame_group_total_salary_limit_" + i).val();
eva_limit_frame_groupObject.total_salary_limit_rounded = obj.find("#eva_limit_frame_group_total_salary_limit_rounded_" + i).val();
eva_limit_frame_groupObject.active_mode = obj.find("#isActive_" + i + "_eva_limit_frame_group").val();
return eva_limit_frame_groupObject;
}
function eva_limit_frame_group_GetAllData() {
//Insert eva_limit_frame_group List
var eva_limit_frame_group = [];
$('#eva_limit_frame_groupBody tr').each(function () {
var i = $(this).find("#rowCount").text();
var eacheva_limit_frame_group = eva_limit_frame_group_GetFromForm($(this), i);
eva_limit_frame_group.push(eacheva_limit_frame_group);
});
return eva_limit_frame_group;
}
function eva_limit_frame_group_Save(id) {
//Insert eva_limit_frame_group List
var eva_limit_frame_group = eva_limit_frame_group_GetAllData();
var successFunc = function (result) {
AlertSuccess("ปรับปรุงข้อมูลเรียบร้อยแล้ว");
endLoad();
};
startLoad();
AjaxPutRequest(apisite + '/api/eva_limit_frame_group/UpdateMultiple', eva_limit_frame_group, successFunc, AlertDanger);
}
function eva_limit_frame_group_Get(id, blankItem) {
$('#eva_limit_frame_groupBody').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_group" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_group_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_group_frame_plan_guid_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_group_group_guid_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_limit_frame_295_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_limit_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_limit_rounded_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_group_Removeeva_limit_frame_group(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_group_Restoreeva_limit_frame_group(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_groupBody').append($(tag));
eva_limit_frame_group_FeedDataToForm(data, (i + 1), blankItem);
});
eva_limit_frame_group_Summary();
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_group", successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_group/GetListByframe_plan_guid/' + a, successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_group/GetListBygroup_guid/' + a, successFunc, AlertDanger);
}
function eva_limit_frame_group_Add() {
var successFunc = function (result) {
var i = $("#eva_limit_frame_groupBody tr").length;
var tag = '<tr>';
tag += '<td><label id="rowCount">' + (i + 1) + '</label><input type="hidden" id="isActive_' + (i + 1) + '_eva_limit_frame_group" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_group_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_group_frame_plan_guid_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_group_group_guid_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_limit_frame_295_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_limit_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_group_total_salary_limit_rounded_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_group_Removeeva_limit_frame_group(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_group_Restoreeva_limit_frame_group(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_groupBody').append($(tag));
eva_limit_frame_group_ClearForm(i + 1, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_group/" + "GetBlankItem", successFunc, AlertDanger);
}
function eva_limit_frame_group_Removeeva_limit_frame_group(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_group_Summary();
}
}
function eva_limit_frame_group_Restoreeva_limit_frame_group(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_group_Summary();
}
}
function eva_limit_frame_group_Summary() {
var sum = 0;
$(".input_score").each(function () {
sum += +$(this).val();
});
$("#score_label").text("ผลรวม: " + sum);
}
function eva_limit_frame_group_InitialForm(id) {
var successFunc = function (result) {
eva_limit_frame_group_Get(id, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_group/" + "GetBlankItem", successFunc, AlertDanger);
}

View File

@@ -0,0 +1,60 @@
var eva_limit_frame_group_API = "/api/eva_limit_frame_group/";
//================= Search Customizaiton =========================================
function eva_limit_frame_group_GetSearchParameter(fileType) {
var eva_limit_frame_groupSearchObject = new Object();
eva_limit_frame_groupSearchObject.frame_plan_guid = $("#s_eva_limit_frame_group_frame_plan_guid").val();
eva_limit_frame_groupSearchObject.group_guid = $("#s_eva_limit_frame_group_group_guid").val();
eva_limit_frame_groupSearchObject.fileType = fileType;
console.log(eva_limit_frame_groupSearchObject);
return eva_limit_frame_groupSearchObject;
}
function eva_limit_frame_group_FeedDataToSearchForm(data) {
$("#s_eva_limit_frame_group_frame_plan_guid").val(data.frame_plan_guid);
DropDownClearFormAndFeedWithData($("#s_eva_limit_frame_group_group_guid"), data, "id", "code", "item_group_guid", data.group_guid);
}
//================= Form Data Customizaiton =========================================
function eva_limit_frame_group_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_group_FeedDataToSearchForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_group_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Data Table =========================================
var s_eva_limit_frame_group_customValidation = function (group) {
return "";
};
function eva_limit_frame_group_DoSearch(fileType) {
if (!ValidateForm('s_eva_limit_frame_group', s_eva_limit_frame_group_customValidation)) {
return;
}
var p = $.param(eva_limit_frame_group_GetSearchParameter(fileType));
var report_url = apisite + "/api/eva_limit_frame_group/eva_limit_frame_group_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);
}
}

View File

@@ -0,0 +1,243 @@
var eva_limit_frame_plan_editMode = "CREATE";
var eva_limit_frame_plan_API = "/api/eva_limit_frame_plan/";
//================= Search Customizaiton =========================================
function eva_limit_frame_plan_GetSearchParameter() {
var eva_limit_frame_planSearchObject = new Object();
eva_limit_frame_planSearchObject.executed_date = formatDateForGetParameter(getDate($("#s_eva_limit_frame_plan_executed_date").val()));
return eva_limit_frame_planSearchObject;
}
function eva_limit_frame_plan_FeedDataToSearchForm(data) {
$("#s_eva_limit_frame_plan_executed_date").val(formatDate(data.executed_date));
}
//================= Form Data Customizaiton =========================================
function eva_limit_frame_plan_FeedDataToForm(data) {
$("#eva_limit_frame_plan_id").val(data.id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_plan_guid"), data, "id", "fiscal_year", "item_plan_guid", data.plan_guid);
$("#eva_limit_frame_plan_executed_date").val(formatDate(data.executed_date));
$("#eva_limit_frame_plan_limit_frame_005").val(data.limit_frame_005);
$("#eva_limit_frame_plan_status_self").val(data.status_self);
$("#eva_limit_frame_plan_status_chief").val(data.status_chief);
$("#eva_limit_frame_plan_supervisor1").val(data.supervisor1);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_supervisor1_result"), data, "id", "external_name", "item_supervisor1_result", data.supervisor1_result);
$("#eva_limit_frame_plan_supervisor1_remark").val(data.supervisor1_remark);
$("#eva_limit_frame_plan_supervisor1_date").val(formatDate(data.supervisor1_date));
$("#eva_limit_frame_plan_salary_adjustment_date").val(formatDate(data.salary_adjustment_date));
}
function eva_limit_frame_plan_GetFromForm() {
var eva_limit_frame_planObject = new Object();
eva_limit_frame_planObject.id = $("#eva_limit_frame_plan_id").val();
eva_limit_frame_planObject.plan_guid = $("#eva_limit_frame_plan_plan_guid").val();
eva_limit_frame_planObject.executed_date = getDate($("#eva_limit_frame_plan_executed_date").val());
eva_limit_frame_planObject.limit_frame_005 = $("#eva_limit_frame_plan_limit_frame_005").val();
eva_limit_frame_planObject.status_self = $("#eva_limit_frame_plan_status_self").val();
eva_limit_frame_planObject.status_chief = $("#eva_limit_frame_plan_status_chief").val();
eva_limit_frame_planObject.supervisor1 = $("#eva_limit_frame_plan_supervisor1").val();
eva_limit_frame_planObject.supervisor1_result = $("#eva_limit_frame_plan_supervisor1_result").val();
eva_limit_frame_planObject.supervisor1_remark = $("#eva_limit_frame_plan_supervisor1_remark").val();
eva_limit_frame_planObject.supervisor1_date = getDate($("#eva_limit_frame_plan_supervisor1_date").val());
eva_limit_frame_planObject.salary_adjustment_date = getDate($("#eva_limit_frame_plan_salary_adjustment_date").val());
return eva_limit_frame_planObject;
}
function eva_limit_frame_plan_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_plan_FeedDataToForm(result);
eva_limit_frame_plan_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_limit_frame_planModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_plan_GoCreate() {
// Incase model popup
eva_limit_frame_plan_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_limit_frame_planView/eva_limit_frame_plan_d");
}
function eva_limit_frame_plan_GoEdit(a) {
// Incase model popup
//eva_limit_frame_plan_SetEditForm(a);
// Incase open new page
window_open(appsite + "/eva_limit_frame_planView/eva_limit_frame_plan_d?id=" + a);
}
function eva_limit_frame_plan_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_plan_editMode = "UPDATE";
eva_limit_frame_plan_FeedDataToForm(result);
$("#eva_limit_frame_planModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_plan_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_plan_SetCreateForm(s) {
eva_limit_frame_plan_editMode = "CREATE";
eva_limit_frame_plan_InitialForm(s);
}
function eva_limit_frame_plan_RefreshTable() {
// Incase model popup
eva_limit_frame_plan_DoSearch();
// Incase open new page
//window.parent.eva_limit_frame_plan_DoSearch();
}
//================= Update and Delete =========================================
var eva_limit_frame_plan_customValidation = function (group) {
return "";
};
function eva_limit_frame_plan_PutUpdate() {
if (!ValidateForm('eva_limit_frame_plan', eva_limit_frame_plan_customValidation)) {
return;
}
var data = eva_limit_frame_plan_GetFromForm();
//Update Mode
if (eva_limit_frame_plan_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_limit_frame_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_plan_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_limit_frame_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_limit_frame_plan_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_plan_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_limit_frame_planModel").modal("hide");
AlertSuccess(result.code + " " + result.message);
eva_limit_frame_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_plan_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_limit_frame_planTableV;
var eva_limit_frame_plan_setupTable = function (result) {
tmp = '"';
eva_limit_frame_planTableV = $('#eva_limit_frame_planTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
//"select": {
// "style": 'multi'
//},
"columns": [
//{ "data": "" },
{ "data": "id" },
{ "data": "plan_guid_eva_performance_plan_fiscal_year" },
{ "data": "txt_executed_date" },
{ "data": "limit_frame_005" },
{ "data": "status_self" },
{ "data": "status_chief" },
{ "data": "supervisor1" },
{ "data": "supervisor1_result_external_linkage_external_name" },
{ "data": "supervisor1_remark" },
{ "data": "txt_supervisor1_date" },
{ "data": "txt_salary_adjustment_date" },
],
"columnDefs": [
{
"targets": 0, //1,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_limit_frame_plan_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_limit_frame_plan_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></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 eva_limit_frame_plan_InitiateDataTable() {
startLoad();
var p = $.param(eva_limit_frame_plan_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_limit_frame_plan/GetListBySearch?" + p, eva_limit_frame_plan_setupTable, AlertDanger);
}
function eva_limit_frame_plan_DoSearch() {
var p = $.param(eva_limit_frame_plan_GetSearchParameter());
var eva_limit_frame_plan_reload = function (result) {
eva_limit_frame_planTableV.destroy();
eva_limit_frame_plan_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_plan/GetListBySearch?" + p, eva_limit_frame_plan_reload, AlertDanger);
}
function eva_limit_frame_plan_GetSelect(f) {
var eva_limit_frame_plan_selectitem = [];
$.each(eva_limit_frame_planTableV.rows('.selected').data(), function (key, value) {
eva_limit_frame_plan_selectitem.push(value[f]);
});
alert(eva_limit_frame_plan_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -0,0 +1,116 @@
var eva_limit_frame_plan_editMode = "CREATE";
var eva_limit_frame_plan_API = "/api/eva_limit_frame_plan/";
//================= Form Data Customizaiton =========================================
function eva_limit_frame_plan_FeedDataToForm(data) {
$("#eva_limit_frame_plan_id").val(data.id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_plan_guid"), data, "id", "fiscal_year", "item_plan_guid", data.plan_guid);
$("#eva_limit_frame_plan_executed_date").val(formatDate(data.executed_date));
$("#eva_limit_frame_plan_limit_frame_005").val(data.limit_frame_005);
$("#eva_limit_frame_plan_status_self").val(data.status_self);
$("#eva_limit_frame_plan_status_chief").val(data.status_chief);
$("#eva_limit_frame_plan_supervisor1").val(data.supervisor1);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_supervisor1_result"), data, "id", "external_name", "item_supervisor1_result", data.supervisor1_result);
$("#eva_limit_frame_plan_supervisor1_remark").val(data.supervisor1_remark);
$("#eva_limit_frame_plan_supervisor1_date").val(formatDate(data.supervisor1_date));
$("#eva_limit_frame_plan_salary_adjustment_date").val(formatDate(data.salary_adjustment_date));
}
function eva_limit_frame_plan_GetFromForm() {
var eva_limit_frame_planObject = new Object();
eva_limit_frame_planObject.id = $("#eva_limit_frame_plan_id").val();
eva_limit_frame_planObject.plan_guid = $("#eva_limit_frame_plan_plan_guid").val();
eva_limit_frame_planObject.executed_date = getDate($("#eva_limit_frame_plan_executed_date").val());
eva_limit_frame_planObject.limit_frame_005 = $("#eva_limit_frame_plan_limit_frame_005").val();
eva_limit_frame_planObject.status_self = $("#eva_limit_frame_plan_status_self").val();
eva_limit_frame_planObject.status_chief = $("#eva_limit_frame_plan_status_chief").val();
eva_limit_frame_planObject.supervisor1 = $("#eva_limit_frame_plan_supervisor1").val();
eva_limit_frame_planObject.supervisor1_result = $("#eva_limit_frame_plan_supervisor1_result").val();
eva_limit_frame_planObject.supervisor1_remark = $("#eva_limit_frame_plan_supervisor1_remark").val();
eva_limit_frame_planObject.supervisor1_date = getDate($("#eva_limit_frame_plan_supervisor1_date").val());
eva_limit_frame_planObject.salary_adjustment_date = getDate($("#eva_limit_frame_plan_salary_adjustment_date").val());
return eva_limit_frame_planObject;
}
function eva_limit_frame_plan_InitialForm() {
var successFunc = function (result) {
eva_limit_frame_plan_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_limit_frame_plan_SetEditForm(a) {
var successFunc = function (result) {
eva_limit_frame_plan_editMode = "UPDATE";
eva_limit_frame_plan_FeedDataToForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_plan_API + a, successFunc, AlertDanger);
}
function eva_limit_frame_plan_SetCreateForm() {
eva_limit_frame_plan_editMode = "CREATE";
eva_limit_frame_plan_InitialForm();
}
//================= Update and Delete =========================================
var eva_limit_frame_plan_customValidation = function (group) {
return "";
};
function eva_limit_frame_plan_PutUpdate() {
if (!ValidateForm('eva_limit_frame_plan', eva_limit_frame_plan_customValidation))
{
return;
}
var data = eva_limit_frame_plan_GetFromForm();
//Update Mode
if (eva_limit_frame_plan_editMode === "UPDATE") {
var successFunc1 = function (result) {
AlertSuccess(result.code+" "+result.message);
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_limit_frame_plan_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_plan_API, data, successFunc2, AlertDanger);
}
}
function eva_limit_frame_plan_GoDelete(a) {
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
var successFunc = function (result) {
AlertSuccess(result.code+" "+result.message);
eva_limit_frame_plan_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_limit_frame_plan_API + a, null, successFunc, AlertDanger);
}
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================

View File

@@ -0,0 +1,168 @@
function eva_limit_frame_plan_ClearForm(i, blankItem) {
var data = blankItem;
$("#eva_limit_frame_plan_id_" + i).val("");
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_plan_guid_" + i), blankItem, "id", "fiscal_year", "item_plan_guid", data.plan_guid);
$("#eva_limit_frame_plan_executed_date_" + i).val("");
$("#eva_limit_frame_plan_limit_frame_005_" + i).val("");
$("#eva_limit_frame_plan_status_self_" + i).val("");
$("#eva_limit_frame_plan_status_chief_" + i).val("");
$("#eva_limit_frame_plan_supervisor1_" + i).val("");
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_supervisor1_result_" + i), blankItem, "id", "external_name", "item_supervisor1_result", data.supervisor1_result);
$("#eva_limit_frame_plan_supervisor1_remark_" + i).val("");
$("#eva_limit_frame_plan_supervisor1_date_" + i).val("");
$("#eva_limit_frame_plan_salary_adjustment_date_" + i).val("");
}
function eva_limit_frame_plan_FeedDataToForm(data, i, blankItem) {
$("#eva_limit_frame_plan_id_" + i).val(data.id);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_plan_guid_" + i), blankItem, "id", "fiscal_year", "item_plan_guid", data.plan_guid);
$("#eva_limit_frame_plan_executed_date_" + i).val(formatDate(data.executed_date));
$("#eva_limit_frame_plan_limit_frame_005_" + i).val(data.limit_frame_005);
$("#eva_limit_frame_plan_status_self_" + i).val(data.status_self);
$("#eva_limit_frame_plan_status_chief_" + i).val(data.status_chief);
$("#eva_limit_frame_plan_supervisor1_" + i).val(data.supervisor1);
DropDownClearFormAndFeedWithData($("#eva_limit_frame_plan_supervisor1_result_" + i), blankItem, "id", "external_name", "item_supervisor1_result", data.supervisor1_result);
$("#eva_limit_frame_plan_supervisor1_remark_" + i).val(data.supervisor1_remark);
$("#eva_limit_frame_plan_supervisor1_date_" + i).val(formatDate(data.supervisor1_date));
$("#eva_limit_frame_plan_salary_adjustment_date_" + i).val(formatDate(data.salary_adjustment_date));
}
function eva_limit_frame_plan_GetFromForm(obj, i) {
var eva_limit_frame_planObject = new Object();
eva_limit_frame_planObject.id = obj.find("#eva_limit_frame_plan_id_" + i).val();
eva_limit_frame_planObject.plan_guid = obj.find("#eva_limit_frame_plan_plan_guid_" + i).val();
eva_limit_frame_planObject.executed_date = getDate(obj.find("#eva_limit_frame_plan_executed_date_" + i).val());
eva_limit_frame_planObject.limit_frame_005 = obj.find("#eva_limit_frame_plan_limit_frame_005_" + i).val();
eva_limit_frame_planObject.status_self = obj.find("#eva_limit_frame_plan_status_self_" + i).val();
eva_limit_frame_planObject.status_chief = obj.find("#eva_limit_frame_plan_status_chief_" + i).val();
eva_limit_frame_planObject.supervisor1 = obj.find("#eva_limit_frame_plan_supervisor1_" + i).val();
eva_limit_frame_planObject.supervisor1_result = obj.find("#eva_limit_frame_plan_supervisor1_result_" + i).val();
eva_limit_frame_planObject.supervisor1_remark = obj.find("#eva_limit_frame_plan_supervisor1_remark_" + i).val();
eva_limit_frame_planObject.supervisor1_date = getDate(obj.find("#eva_limit_frame_plan_supervisor1_date_" + i).val());
eva_limit_frame_planObject.salary_adjustment_date = getDate(obj.find("#eva_limit_frame_plan_salary_adjustment_date_" + i).val());
eva_limit_frame_planObject.active_mode = obj.find("#isActive_" + i + "_eva_limit_frame_plan").val();
return eva_limit_frame_planObject;
}
function eva_limit_frame_plan_GetAllData() {
//Insert eva_limit_frame_plan List
var eva_limit_frame_plan = [];
$('#eva_limit_frame_planBody tr').each(function () {
var i = $(this).find("#rowCount").text();
var eacheva_limit_frame_plan = eva_limit_frame_plan_GetFromForm($(this), i);
eva_limit_frame_plan.push(eacheva_limit_frame_plan);
});
return eva_limit_frame_plan;
}
function eva_limit_frame_plan_Save(id) {
//Insert eva_limit_frame_plan List
var eva_limit_frame_plan = eva_limit_frame_plan_GetAllData();
var successFunc = function (result) {
AlertSuccess("ปรับปรุงข้อมูลเรียบร้อยแล้ว");
endLoad();
};
startLoad();
AjaxPutRequest(apisite + '/api/eva_limit_frame_plan/UpdateMultiple', eva_limit_frame_plan, successFunc, AlertDanger);
}
function eva_limit_frame_plan_Get(id, blankItem) {
$('#eva_limit_frame_planBody').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_plan" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_status_self_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_status_chief_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_supervisor1_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_plan_plan_guid_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_executed_date_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_plan_limit_frame_005_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_plan_supervisor1_result_' + (i + 1) +'"></select></td>';
tag += '<td><textarea class="form-control" rows="2" cols="25" id="eva_limit_frame_plan_supervisor1_remark_' + (i + 1)+'" ></textarea></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_supervisor1_date_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_salary_adjustment_date_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_plan_Removeeva_limit_frame_plan(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_plan_Restoreeva_limit_frame_plan(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_planBody').append($(tag));
eva_limit_frame_plan_FeedDataToForm(data, (i + 1), blankItem);
});
eva_limit_frame_plan_Summary();
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_plan", successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_plan/GetListByplan_guid/' + a, successFunc, AlertDanger);
//AjaxGetRequest(apisite + '/api/eva_limit_frame_plan/GetListBysupervisor1_result/' + a, successFunc, AlertDanger);
}
function eva_limit_frame_plan_Add() {
var successFunc = function (result) {
var i = $("#eva_limit_frame_planBody tr").length;
var tag = '<tr>';
tag += '<td><label id="rowCount">' + (i + 1) + '</label><input type="hidden" id="isActive_' + (i + 1) + '_eva_limit_frame_plan" value="1" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_id_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_status_self_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_status_chief_' + (i + 1)+'" /><input class="form-control" type="hidden" id="eva_limit_frame_plan_supervisor1_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_plan_plan_guid_' + (i + 1) +'"></select></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_executed_date_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="number" id="eva_limit_frame_plan_limit_frame_005_' + (i + 1)+'" /></td>';
tag += '<td><select class="form-control" id="eva_limit_frame_plan_supervisor1_result_' + (i + 1) +'"></select></td>';
tag += '<td><textarea class="form-control" rows="2" cols="25" id="eva_limit_frame_plan_supervisor1_remark_' + (i + 1)+'" ></textarea></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_supervisor1_date_' + (i + 1)+'" /></td>';
tag += '<td><input class="form-control" type="text" id="eva_limit_frame_plan_salary_adjustment_date_' + (i + 1)+'" /></td>';
tag += '<td><a href="javascript:;" class="btn btn-danger btn-sm" onclick="javascript:eva_limit_frame_plan_Removeeva_limit_frame_plan(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_plan_Restoreeva_limit_frame_plan(this)" style="display: none;" id="restoreBtn"><i class="fa fa-upload" style="color:white;"></i></a></td>';
tag += '</tr>';
$('#eva_limit_frame_planBody').append($(tag));
eva_limit_frame_plan_ClearForm(i + 1, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_plan/" + "GetBlankItem", successFunc, AlertDanger);
}
function eva_limit_frame_plan_Removeeva_limit_frame_plan(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_plan_Summary();
}
}
function eva_limit_frame_plan_Restoreeva_limit_frame_plan(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_plan_Summary();
}
}
function eva_limit_frame_plan_Summary() {
var sum = 0;
$(".input_score").each(function () {
sum += +$(this).val();
});
$("#score_label").text("ผลรวม: " + sum);
}
function eva_limit_frame_plan_InitialForm(id) {
var successFunc = function (result) {
eva_limit_frame_plan_Get(id, result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_limit_frame_plan/" + "GetBlankItem", successFunc, AlertDanger);
}

View File

@@ -0,0 +1,58 @@
var eva_limit_frame_plan_API = "/api/eva_limit_frame_plan/";
//================= Search Customizaiton =========================================
function eva_limit_frame_plan_GetSearchParameter(fileType) {
var eva_limit_frame_planSearchObject = new Object();
eva_limit_frame_planSearchObject.executed_date = formatDateForGetParameter(getDate($("#s_eva_limit_frame_plan_executed_date").val()));
eva_limit_frame_planSearchObject.fileType = fileType;
console.log(eva_limit_frame_planSearchObject);
return eva_limit_frame_planSearchObject;
}
function eva_limit_frame_plan_FeedDataToSearchForm(data) {
$("#s_eva_limit_frame_plan_executed_date").val(formatDate(data.executed_date));
}
//================= Form Data Customizaiton =========================================
function eva_limit_frame_plan_InitialForm(s) {
var successFunc = function (result) {
eva_limit_frame_plan_FeedDataToSearchForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_limit_frame_plan_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Data Table =========================================
var s_eva_limit_frame_plan_customValidation = function (group) {
return "";
};
function eva_limit_frame_plan_DoSearch(fileType) {
if (!ValidateForm('s_eva_limit_frame_plan', s_eva_limit_frame_plan_customValidation)) {
return;
}
var p = $.param(eva_limit_frame_plan_GetSearchParameter(fileType));
var report_url = apisite + "/api/eva_limit_frame_plan/eva_limit_frame_plan_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);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"unread":[],"readed":[]}