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,227 @@
var eva_evaluation_group_detail_editMode = "CREATE";
var eva_evaluation_group_detail_API = "/api/eva_evaluation_group_detail/";
//================= Search Customizaiton =========================================
function eva_evaluation_group_detail_GetSearchParameter() {
var eva_evaluation_group_detailSearchObject = new Object();
eva_evaluation_group_detailSearchObject.evaluation_group_id = $("#s_eva_evaluation_group_detail_evaluation_group_id").val();
return eva_evaluation_group_detailSearchObject;
}
function eva_evaluation_group_detail_FeedDataToSearchForm(data) {
$("#s_eva_evaluation_group_detail_evaluation_group_id").val(data.evaluation_group_id);
}
//================= Form Data Customizaiton =========================================
function eva_evaluation_group_detail_FeedDataToForm(data) {
$("#eva_evaluation_group_detail_id").val(data.id);
$("#eva_evaluation_group_detail_evaluation_group_id").val(data.evaluation_group_id);
$("#eva_evaluation_group_detail_employee_id").val(data.employee_id);
}
function eva_evaluation_group_detail_GetFromForm() {
var eva_evaluation_group_detailObject = new Object();
eva_evaluation_group_detailObject.id = $("#eva_evaluation_group_detail_id").val();
eva_evaluation_group_detailObject.evaluation_group_id = $("#eva_evaluation_group_detail_evaluation_group_id").val();
eva_evaluation_group_detailObject.employee_id = $("#eva_evaluation_group_detail_employee_id").val();
return eva_evaluation_group_detailObject;
}
function eva_evaluation_group_detail_InitialForm(s) {
var successFunc = function (result) {
eva_evaluation_group_detail_FeedDataToForm(result);
eva_evaluation_group_detail_FeedDataToSearchForm(result);
if (s) {
// Incase model popup
$("#eva_evaluation_group_detailModel").modal("show");
}
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_detail_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Form Mode Setup and Flow =========================================
function eva_evaluation_group_detail_GoCreate() {
window_open(appsite + "/external_employeeview/external_employee");
// Incase model popup
//eva_evaluation_group_detail_SetCreateForm(true);
// Incase open new page
//window_open(appsite + "/eva_evaluation_group_detailView/eva_evaluation_group_detail_d");
}
function eva_evaluation_group_detail_GoEdit(a) {
// Incase model popup
eva_evaluation_group_detail_SetEditForm(a);
// Incase open new page
//window_open(appsite + "/eva_evaluation_group_detailView/eva_evaluation_group_detail_d?id=" + a);
}
function eva_evaluation_group_detail_SetEditForm(a) {
var successFunc = function (result) {
eva_evaluation_group_detail_editMode = "UPDATE";
eva_evaluation_group_detail_FeedDataToForm(result);
$("#eva_evaluation_group_detailModel").modal("show");
endLoad();
};
startLoad();
AjaxGetRequest(apisite + eva_evaluation_group_detail_API + a, successFunc, AlertDanger);
}
function eva_evaluation_group_detail_SetCreateForm(s) {
eva_evaluation_group_detail_editMode = "CREATE";
eva_evaluation_group_detail_InitialForm(s);
}
function eva_evaluation_group_detail_RefreshTable() {
// Incase model popup
eva_evaluation_group_detail_DoSearch();
// Incase open new page
//window.parent.eva_evaluation_group_detail_DoSearch();
}
//================= Update and Delete =========================================
var eva_evaluation_group_detail_customValidation = function (group) {
return "";
};
function eva_evaluation_group_detail_PutUpdate() {
if (!ValidateForm('eva_evaluation_group_detail', eva_evaluation_group_detail_customValidation))
{
return;
}
var data = eva_evaluation_group_detail_GetFromForm();
//Update Mode
if (eva_evaluation_group_detail_editMode === "UPDATE") {
var successFunc1 = function (result) {
$("#eva_evaluation_group_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_evaluation_group_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPutRequest(apisite + eva_evaluation_group_detail_API + data.id, data, successFunc1, AlertDanger);
}
// Create mode
else {
var successFunc2 = function (result) {
$("#eva_evaluation_group_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_evaluation_group_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxPostRequest(apisite + eva_evaluation_group_detail_API, data, successFunc2, AlertDanger);
}
}
function eva_evaluation_group_detail_GoDelete(a) {
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
var successFunc = function (result) {
$("#eva_evaluation_group_detailModel").modal("hide");
AlertSuccess(result.code+" "+result.message);
eva_evaluation_group_detail_RefreshTable();
endLoad();
};
startLoad();
AjaxDeleteRequest(apisite + eva_evaluation_group_detail_API + a, null, successFunc, AlertDanger);
}
}
//================= Data Table =========================================
var eva_evaluation_group_detailTableV;
var eva_evaluation_group_detail_setupTable = function (result) {
tmp = '"';
eva_evaluation_group_detailTableV = $('#eva_evaluation_group_detailTable').DataTable({
"processing": true,
"serverSide": false,
"data": result,
"select": false,
"columns": [
{ "data": "id" },
{ "data": "position_number" },
{ "data": "position_name" },
{ "data": "fullname" },
],
"columnDefs": [
{
"targets": 0,
"data": "id",
"render": function (data, type, row, meta) {
return "<button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_evaluation_group_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_evaluation_group_detail_InitiateDataTable(id) {
startLoad();
$("#s_eva_evaluation_group_detail_evaluation_group_id").val(id);
var p = $.param(eva_evaluation_group_detail_GetSearchParameter());
AjaxGetRequest(apisite + "/api/eva_evaluation_group_detail/GetListBySearch?"+p, eva_evaluation_group_detail_setupTable, AlertDanger);
}
function eva_evaluation_group_detail_DoSearch() {
var p = $.param(eva_evaluation_group_detail_GetSearchParameter());
var eva_evaluation_group_detail_reload = function (result) {
eva_evaluation_group_detailTableV.destroy();
eva_evaluation_group_detail_setupTable(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + "/api/eva_evaluation_group_detail/GetListBySearch?"+p, eva_evaluation_group_detail_reload, AlertDanger);
}
function eva_evaluation_group_detail_GetSelect(f) {
var eva_evaluation_group_detail_selectitem = [];
$.each(eva_evaluation_group_detailTableV.rows('.selected').data(), function (key, value) {
eva_evaluation_group_detail_selectitem.push(value[f]);
});
alert(eva_evaluation_group_detail_selectitem);
}
//================= File Upload =========================================
//================= Multi-Selection Function =========================================
function AddMultiple(data) {
var successFunc1 = function (result) {
AlertSuccess(result.code + " " + result.message);
eva_evaluation_group_detail_RefreshTable();
endLoad();
};
startLoad();
var id = getUrlParameter("id");
AjaxPostRequest(apisite + eva_evaluation_group_detail_API + "AddMultiple?evaluation_group_id=" + id, data, successFunc1, AlertDanger);
}