First Initial
This commit is contained in:
220
wwwroot/js/eva_create_evaluation/eva_create_evaluation.js
Normal file
220
wwwroot/js/eva_create_evaluation/eva_create_evaluation.js
Normal file
@@ -0,0 +1,220 @@
|
||||
var eva_create_evaluation_editMode = "CREATE";
|
||||
var eva_create_evaluation_API = "/api/eva_create_evaluation/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_GetSearchParameter() {
|
||||
var eva_create_evaluationSearchObject = new Object();
|
||||
eva_create_evaluationSearchObject.performance_plan_id = $("#s_eva_create_evaluation_performance_plan_id").val();
|
||||
eva_create_evaluationSearchObject.evaluation_group_id = $("#s_eva_create_evaluation_evaluation_group_id").val();
|
||||
|
||||
return eva_create_evaluationSearchObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_FeedDataToSearchForm(data) {
|
||||
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_performance_plan_id"), data, "id", "fiscal_year", "item_performance_plan_id", data.performance_plan_id);
|
||||
DropDownClearFormAndFeedWithData($("#s_eva_create_evaluation_evaluation_group_id"), data, "id", "thegroup", "item_evaluation_group_id", data.evaluation_group_id);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_id").val(data.id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_performance_plan_id"), data, "id", "fiscal_year", "item_performance_plan_id", data.performance_plan_id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
|
||||
$("#eva_create_evaluation_score1").val(data.score1);
|
||||
$("#eva_create_evaluation_score2").val(data.score2);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_evaluation_group_id"), data, "id", "thegroup", "item_evaluation_group_id", data.evaluation_group_id);
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GetFromForm() {
|
||||
var eva_create_evaluationObject = new Object();
|
||||
eva_create_evaluationObject.id = $("#eva_create_evaluation_id").val();
|
||||
eva_create_evaluationObject.performance_plan_id = $("#eva_create_evaluation_performance_plan_id").val();
|
||||
eva_create_evaluationObject.employee_id = $("#eva_create_evaluation_employee_id").val();
|
||||
eva_create_evaluationObject.score1 = $("#eva_create_evaluation_score1").val();
|
||||
eva_create_evaluationObject.score2 = $("#eva_create_evaluation_score2").val();
|
||||
eva_create_evaluationObject.evaluation_group_id = $("#eva_create_evaluation_evaluation_group_id").val();
|
||||
|
||||
|
||||
return eva_create_evaluationObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_FeedDataToForm(result);
|
||||
eva_create_evaluation_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_create_evaluationModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_create_evaluation_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_create_evaluationView/eva_create_evaluation_d");
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GoEdit(a) {
|
||||
// Incase model popup
|
||||
//eva_create_evaluation_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
window_open(appsite + "/eva_create_evaluationView/eva_create_evaluation_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_editMode = "UPDATE";
|
||||
eva_create_evaluation_FeedDataToForm(result);
|
||||
$("#eva_create_evaluationModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_SetCreateForm(s) {
|
||||
eva_create_evaluation_editMode = "CREATE";
|
||||
eva_create_evaluation_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_create_evaluation_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_create_evaluation_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_create_evaluation_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation', eva_create_evaluation_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_create_evaluation_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_create_evaluationModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_create_evaluationModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_create_evaluationModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_create_evaluationTableV;
|
||||
|
||||
var eva_create_evaluation_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
eva_create_evaluationTableV = $('#eva_create_evaluationTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
"select": false,
|
||||
"columns": [
|
||||
{ "data": "id" },
|
||||
{ "data": "performance_plan_id_eva_performance_plan_fiscal_year" },
|
||||
{ "data": "evaluation_group_id_eva_evaluation_group_code" },
|
||||
{ "data": "employee_id_external_linkage_external_name" },
|
||||
{ "data": "score1" },
|
||||
{ "data": "score2" },
|
||||
|
||||
],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_create_evaluation_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_create_evaluation_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
|
||||
}
|
||||
}],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
},
|
||||
"paging": true,
|
||||
"searching": false
|
||||
});
|
||||
endLoad();
|
||||
};
|
||||
|
||||
function eva_create_evaluation_InitiateDataTable() {
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation/GetListBySearch", eva_create_evaluation_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_DoSearch() {
|
||||
var p = $.param(eva_create_evaluation_GetSearchParameter());
|
||||
var eva_create_evaluation_reload = function (result) {
|
||||
eva_create_evaluationTableV.destroy();
|
||||
eva_create_evaluation_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_create_evaluation/GetListBySearch?"+p, eva_create_evaluation_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GetSelect(f) {
|
||||
var eva_create_evaluation_selectitem = [];
|
||||
$.each(eva_create_evaluationTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_create_evaluation_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_create_evaluation_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
106
wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js
Normal file
106
wwwroot/js/eva_create_evaluation/eva_create_evaluation_d.js
Normal file
@@ -0,0 +1,106 @@
|
||||
var eva_create_evaluation_editMode = "CREATE";
|
||||
var eva_create_evaluation_API = "/api/eva_create_evaluation/";
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_id").val(data.id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_performance_plan_id"), data, "id", "fiscal_year", "item_performance_plan_id", data.performance_plan_id);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
|
||||
$("#eva_create_evaluation_score1").val(data.score1);
|
||||
$("#eva_create_evaluation_score2").val(data.score2);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_evaluation_group_id"), data, "id", "thegroup", "item_evaluation_group_id", data.evaluation_group_id);
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GetFromForm() {
|
||||
var eva_create_evaluationObject = new Object();
|
||||
eva_create_evaluationObject.id = $("#eva_create_evaluation_id").val();
|
||||
eva_create_evaluationObject.performance_plan_id = $("#eva_create_evaluation_performance_plan_id").val();
|
||||
eva_create_evaluationObject.employee_id = $("#eva_create_evaluation_employee_id").val();
|
||||
eva_create_evaluationObject.score1 = $("#eva_create_evaluation_score1").val();
|
||||
eva_create_evaluationObject.score2 = $("#eva_create_evaluation_score2").val();
|
||||
eva_create_evaluationObject.evaluation_group_id = $("#eva_create_evaluation_evaluation_group_id").val();
|
||||
|
||||
|
||||
return eva_create_evaluationObject;
|
||||
}
|
||||
|
||||
function eva_create_evaluation_InitialForm() {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_create_evaluation_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_editMode = "UPDATE";
|
||||
eva_create_evaluation_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_SetCreateForm() {
|
||||
eva_create_evaluation_editMode = "CREATE";
|
||||
eva_create_evaluation_InitialForm();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_create_evaluation_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation', eva_create_evaluation_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var data = eva_create_evaluation_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_create_evaluation_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_create_evaluation_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user