First Initial

This commit is contained in:
Nakorn Rientrakrunchai
2020-02-20 15:02:39 +07:00
commit 8b98125e49
3048 changed files with 760804 additions and 0 deletions

View File

@@ -0,0 +1,224 @@
var eva_create_evaluation_detail_editMode = "CREATE";
var eva_create_evaluation_detail_API = "/api/eva_create_evaluation_detail/";
//================= Search Customizaiton =========================================
function eva_create_evaluation_detail_GetSearchParameter() {
var eva_create_evaluation_detailSearchObject = new Object();
eva_create_evaluation_detailSearchObject.create_evaluation_id = getUrlParameter("id"); //$("#s_eva_create_evaluation_detail_create_evaluation_id").val();
return eva_create_evaluation_detailSearchObject;
}
function eva_create_evaluation_detail_FeedDataToSearchForm(data) {
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
}
//================= Form Data Customizaiton =========================================
function eva_create_evaluation_detail_FeedDataToForm(data) {
$("#eva_create_evaluation_detail_id").val(data.id);
$("#eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_chief"), data, "id", "fullname", "item_chief", data.chief);
}
function eva_create_evaluation_detail_GetFromForm() {
var eva_create_evaluation_detailObject = new Object();
eva_create_evaluation_detailObject.id = $("#eva_create_evaluation_detail_id").val();
eva_create_evaluation_detailObject.create_evaluation_id = $("#eva_create_evaluation_detail_create_evaluation_id").val();
eva_create_evaluation_detailObject.employee_id = $("#eva_create_evaluation_detail_employee_id").val();
eva_create_evaluation_detailObject.chief = $("#eva_create_evaluation_detail_chief").val();
return eva_create_evaluation_detailObject;
}
function eva_create_evaluation_detail_InitialForm(s) {
var successFunc = function (result) {
eva_create_evaluation_detail_FeedDataToForm(result);
eva_create_evaluation_detail_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_create_evaluation_detailModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_create_evaluation_detail_GoCreate() {
window_open(appsite + "/external_employeeview/external_employee");
// Incase model popup
//eva_create_evaluation_detail_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_create_evaluation_detailView/eva_create_evaluation_detail_d");
}
function eva_create_evaluation_detail_GoEdit(a) {
// Incase model popup
eva_create_evaluation_detail_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_create_evaluation_detailView/eva_create_evaluation_detail_d?id=" + a);
}
function eva_create_evaluation_detail_SetEditForm(a) {
var successFunc = function (result) {
eva_create_evaluation_detail_editMode = "UPDATE";
eva_create_evaluation_detail_FeedDataToForm(result);
$("#eva_create_evaluation_detailModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + a, successFunc, AlertDanger);
}
function eva_create_evaluation_detail_SetCreateForm(s) {
eva_create_evaluation_detail_editMode = "CREATE";
eva_create_evaluation_detail_InitialForm(s);
}
function eva_create_evaluation_detail_RefreshTable() {
// Incase model popup
eva_create_evaluation_detail_DoSearch();
// Incase open new page
//window.parent.eva_create_evaluation_detail_DoSearch();
}
//================= Update and Delete =========================================
var eva_create_evaluation_detail_customValidation = function (group) {
return "";
};
function eva_create_evaluation_detail_PutUpdate() {
if (!ValidateForm('eva_create_evaluation_detail', eva_create_evaluation_detail_customValidation))
{
return;
}
var data = eva_create_evaluation_detail_GetFromForm();
//Update Mode
if (eva_create_evaluation_detail_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_create_evaluation_detail_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_create_evaluation_detail_API, data, successFunc2, AlertDanger);
}
}
function eva_create_evaluation_detail_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_create_evaluation_detailTableV;
var eva_create_evaluation_detail_setupTable = function (result) {
tmp = '"';
eva_create_evaluation_detailTableV = $('#eva_create_evaluation_detailTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "employee_id_external_linkage_external_name" },
{ "data": "chief_external_linkage_external_name" },
],
"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_detail_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_create_evaluation_detail_GoDelete(" + tmp + data + tmp + ")'><i class='fa fa-trash-o '></i></button> ";
}
}],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
});
endLoad();
};
function eva_create_evaluation_detail_InitiateDataTable(id) {
startLoad();
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(id);
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_setupTable, AlertDanger);
}
function eva_create_evaluation_detail_DoSearch() {
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
var eva_create_evaluation_detail_reload = function (result) {
eva_create_evaluation_detailTableV.destroy();
eva_create_evaluation_detail_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_reload, AlertDanger);
}
function eva_create_evaluation_detail_GetSelect(f) {
var eva_create_evaluation_detail_selectitem = [];
$.each(eva_create_evaluation_detailTableV.rows('.selected').data(), function (key, value) {
eva_create_evaluation_detail_selectitem.push(value[f]);
});
alert(eva_create_evaluation_detail_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================
function AddMultiple(data) {
var successFunc1 = function (result) {
AlertSuccess(result.code + " " + result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
var id = getUrlParameter("id");
AjaxPostRequest(apisite + eva_create_evaluation_detail_API + "AddMultiple?create_evaluation_id=" + id, data, successFunc1, AlertDanger);
}

View File

@@ -0,0 +1,219 @@
var eva_create_evaluation_detail_editMode = "CREATE";
var eva_create_evaluation_detail_API = "/api/eva_create_evaluation_detail/";
//================= Search Customizaiton =========================================
function eva_create_evaluation_detail_GetSearchParameter() {
var eva_create_evaluation_detailSearchObject = new Object();
eva_create_evaluation_detailSearchObject.create_evaluation_id = getUrlParameter("id"); //$("#s_eva_create_evaluation_detail_create_evaluation_id").val();
return eva_create_evaluation_detailSearchObject;
}
function eva_create_evaluation_detail_FeedDataToSearchForm(data) {
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
}
//================= Form Data Customizaiton =========================================
function eva_create_evaluation_detail_FeedDataToForm(data) {
$("#eva_create_evaluation_detail_id").val(data.id);
$("#eva_create_evaluation_detail_create_evaluation_id").val(data.create_evaluation_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_employee_id"), data, "id", "fullname", "item_employee_id", data.employee_id);
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_chief"), data, "id", "fullname", "item_chief", data.chief);
}
function eva_create_evaluation_detail_GetFromForm() {
var eva_create_evaluation_detailObject = new Object();
eva_create_evaluation_detailObject.id = $("#eva_create_evaluation_detail_id").val();
eva_create_evaluation_detailObject.create_evaluation_id = $("#eva_create_evaluation_detail_create_evaluation_id").val();
eva_create_evaluation_detailObject.employee_id = $("#eva_create_evaluation_detail_employee_id").val();
eva_create_evaluation_detailObject.chief = $("#eva_create_evaluation_detail_chief").val();
return eva_create_evaluation_detailObject;
}
function eva_create_evaluation_detail_InitialForm(s) {
var successFunc = function (result) {
eva_create_evaluation_detail_FeedDataToForm(result);
eva_create_evaluation_detail_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_create_evaluation_detailModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_create_evaluation_detail_GoCreate() {
window_open(appsite + "/external_employeeview/external_employee");
// Incase model popup
//eva_create_evaluation_detail_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_create_evaluation_detailView/eva_create_evaluation_detail_d");
}
function eva_create_evaluation_detail_GoEdit(a) {
// Incase model popup
eva_create_evaluation_detail_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_create_evaluation_detailView/eva_create_evaluation_detail_d?id=" + a);
}
function eva_create_evaluation_detail_SetEditForm(a) {
var successFunc = function (result) {
eva_create_evaluation_detail_editMode = "UPDATE";
eva_create_evaluation_detail_FeedDataToForm(result);
$("#eva_create_evaluation_detailModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_create_evaluation_detail_API + a, successFunc, AlertDanger);
}
function eva_create_evaluation_detail_SetCreateForm(s) {
eva_create_evaluation_detail_editMode = "CREATE";
eva_create_evaluation_detail_InitialForm(s);
}
function eva_create_evaluation_detail_RefreshTable() {
// Incase model popup
eva_create_evaluation_detail_DoSearch();
// Incase open new page
//window.parent.eva_create_evaluation_detail_DoSearch();
}
//================= Update and Delete =========================================
var eva_create_evaluation_detail_customValidation = function (group) {
return "";
};
function eva_create_evaluation_detail_PutUpdate() {
if (!ValidateForm('eva_create_evaluation_detail', eva_create_evaluation_detail_customValidation))
{
return;
}
var data = eva_create_evaluation_detail_GetFromForm();
//Update Mode
if (eva_create_evaluation_detail_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_create_evaluation_detail_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_create_evaluation_detail_API, data, successFunc2, AlertDanger);
}
}
function eva_create_evaluation_detail_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_create_evaluation_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_create_evaluation_detailTableV;
var eva_create_evaluation_detail_setupTable = function (result) {
tmp = '"';
eva_create_evaluation_detailTableV = $('#eva_create_evaluation_detailTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"columns": [
{ "data": "employee_id_external_linkage_external_name" },
{ "data": "chief_external_linkage_external_name" },
{ "data": "status_chief" },
{ "data": "status_supervisor" }
],
"columnDefs": [
],
"language": {
"url": appsite + "/DataTables-1.10.16/thai.json"
},
"paging": true,
"searching": false
});
endLoad();
};
function eva_create_evaluation_detail_InitiateDataTable(id) {
startLoad();
$("#s_eva_create_evaluation_detail_create_evaluation_id").val(id);
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_setupTable, AlertDanger);
}
function eva_create_evaluation_detail_DoSearch() {
var p = $.param(eva_create_evaluation_detail_GetSearchParameter());
var eva_create_evaluation_detail_reload = function (result) {
eva_create_evaluation_detailTableV.destroy();
eva_create_evaluation_detail_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_create_evaluation_detail/GetListBySearch?"+p, eva_create_evaluation_detail_reload, AlertDanger);
}
function eva_create_evaluation_detail_GetSelect(f) {
var eva_create_evaluation_detail_selectitem = [];
$.each(eva_create_evaluation_detailTableV.rows('.selected').data(), function (key, value) {
eva_create_evaluation_detail_selectitem.push(value[f]);
});
alert(eva_create_evaluation_detail_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================
function AddMultiple(data) {
var successFunc1 = function (result) {
AlertSuccess(result.code + " " + result.message);
eva_create_evaluation_detail_RefreshTable();
endLoad();
};
startLoad();
var id = getUrlParameter("id");
AjaxPostRequest(apisite + eva_create_evaluation_detail_API + "AddMultiple?create_evaluation_id=" + id, data, successFunc1, AlertDanger);
}