First Initial
This commit is contained in:
208
wwwroot/js/eva_evaluation_group/eva_evaluation_group.js
Normal file
208
wwwroot/js/eva_evaluation_group/eva_evaluation_group.js
Normal file
@@ -0,0 +1,208 @@
|
||||
var eva_evaluation_group_editMode = "CREATE";
|
||||
var eva_evaluation_group_API = "/api/eva_evaluation_group/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_evaluation_group_GetSearchParameter() {
|
||||
var eva_evaluation_groupSearchObject = new Object();
|
||||
eva_evaluation_groupSearchObject.code = $("#s_eva_evaluation_group_code").val();
|
||||
|
||||
return eva_evaluation_groupSearchObject;
|
||||
}
|
||||
|
||||
function eva_evaluation_group_FeedDataToSearchForm(data) {
|
||||
$("#s_eva_evaluation_group_code").val(data.code);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_evaluation_group_FeedDataToForm(data) {
|
||||
$("#eva_evaluation_group_id").val(data.id);
|
||||
$("#eva_evaluation_group_code").val(data.code);
|
||||
$("#eva_evaluation_group_thegroup").val(data.thegroup);
|
||||
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GetFromForm() {
|
||||
var eva_evaluation_groupObject = new Object();
|
||||
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
|
||||
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
|
||||
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
|
||||
|
||||
|
||||
return eva_evaluation_groupObject;
|
||||
}
|
||||
|
||||
function eva_evaluation_group_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_group_FeedDataToForm(result);
|
||||
eva_evaluation_group_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_evaluation_groupModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_group_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_evaluation_group_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_evaluation_group_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_evaluation_groupView/eva_evaluation_group_d");
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GoEdit(a) {
|
||||
// Incase model popup
|
||||
//eva_evaluation_group_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
window_open(appsite + "/eva_evaluation_groupView/eva_evaluation_group_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_group_editMode = "UPDATE";
|
||||
eva_evaluation_group_FeedDataToForm(result);
|
||||
$("#eva_evaluation_groupModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_group_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_SetCreateForm(s) {
|
||||
eva_evaluation_group_editMode = "CREATE";
|
||||
eva_evaluation_group_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_evaluation_group_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_evaluation_group_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_evaluation_group_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_evaluation_group_PutUpdate() {
|
||||
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_evaluation_group_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_evaluation_group_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_evaluation_groupModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_evaluation_group_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_evaluation_group_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_evaluation_groupModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_evaluation_group_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_evaluation_group_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_evaluation_groupModel").modal("hide");
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_evaluation_group_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_evaluation_group_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_evaluation_groupTableV;
|
||||
|
||||
var eva_evaluation_group_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
eva_evaluation_groupTableV = $('#eva_evaluation_groupTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
"select": false,
|
||||
"columns": [
|
||||
{ "data": "id" },
|
||||
{ "data": "code" },
|
||||
{ "data": "thegroup" },
|
||||
],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:eva_evaluation_group_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_evaluation_group_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_InitiateDataTable() {
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_evaluation_group/GetListBySearch", eva_evaluation_group_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_DoSearch() {
|
||||
var p = $.param(eva_evaluation_group_GetSearchParameter());
|
||||
var eva_evaluation_group_reload = function (result) {
|
||||
eva_evaluation_groupTableV.destroy();
|
||||
eva_evaluation_group_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_evaluation_group/GetListBySearch?"+p, eva_evaluation_group_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GetSelect(f) {
|
||||
var eva_evaluation_group_selectitem = [];
|
||||
$.each(eva_evaluation_groupTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_evaluation_group_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_evaluation_group_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
100
wwwroot/js/eva_evaluation_group/eva_evaluation_group_d.js
Normal file
100
wwwroot/js/eva_evaluation_group/eva_evaluation_group_d.js
Normal file
@@ -0,0 +1,100 @@
|
||||
var eva_evaluation_group_editMode = "CREATE";
|
||||
var eva_evaluation_group_API = "/api/eva_evaluation_group/";
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_evaluation_group_FeedDataToForm(data) {
|
||||
$("#eva_evaluation_group_id").val(data.id);
|
||||
$("#eva_evaluation_group_code").val(data.code);
|
||||
$("#eva_evaluation_group_thegroup").val(data.thegroup);
|
||||
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GetFromForm() {
|
||||
var eva_evaluation_groupObject = new Object();
|
||||
eva_evaluation_groupObject.id = $("#eva_evaluation_group_id").val();
|
||||
eva_evaluation_groupObject.code = $("#eva_evaluation_group_code").val();
|
||||
eva_evaluation_groupObject.thegroup = $("#eva_evaluation_group_thegroup").val();
|
||||
|
||||
|
||||
return eva_evaluation_groupObject;
|
||||
}
|
||||
|
||||
function eva_evaluation_group_InitialForm() {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_group_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_group_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_evaluation_group_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_group_editMode = "UPDATE";
|
||||
eva_evaluation_group_FeedDataToForm(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_group_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_group_SetCreateForm() {
|
||||
eva_evaluation_group_editMode = "CREATE";
|
||||
eva_evaluation_group_InitialForm();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_evaluation_group_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_evaluation_group_PutUpdate() {
|
||||
if (!ValidateForm('eva_evaluation_group', eva_evaluation_group_customValidation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var data = eva_evaluation_group_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_evaluation_group_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_evaluation_group_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_evaluation_group_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_evaluation_group_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
eva_evaluation_group_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_evaluation_group_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user