ปรับปรุงรายงานกรอบวงเงิน
This commit is contained in:
240
wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js
Normal file
240
wwwroot/js/eva_limit_frame_employee/eva_limit_frame_employee.js
Normal 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 =========================================
|
||||
|
||||
|
||||
|
||||
@@ -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 =========================================
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user