ปรับปรุงให้แนบไฟล์ ผลสัมฤทธิ์ของงาน ได้หลายไฟล์
This commit is contained in:
@@ -22,7 +22,7 @@ function eva_evaluation_achievement_FeedDataToForm(data) {
|
||||
$("#eva_evaluation_achievement_create_evaluation_detail_id").val(data.create_evaluation_detail_id);
|
||||
$("#eva_evaluation_achievement_achievement").val(data.achievement);
|
||||
$("#eva_evaluation_achievement_weight").val(data.weight);
|
||||
feedFileToControl(data.thefile, data.thefileDisplay, "eva_evaluation_achievement_thefile", "file");
|
||||
//feedFileToControl(data.thefile, data.thefileDisplay, "eva_evaluation_achievement_thefile", "file");
|
||||
$("#eva_evaluation_achievement_target_score1").val(data.target_score1);
|
||||
$("#eva_evaluation_achievement_target_score2").val(data.target_score2);
|
||||
$("#eva_evaluation_achievement_target_score3").val(data.target_score3);
|
||||
@@ -36,11 +36,11 @@ function eva_evaluation_achievement_GetFromForm() {
|
||||
eva_evaluation_achievementObject.create_evaluation_detail_id = getUrlParameter("id"); //$("#eva_evaluation_achievement_create_evaluation_detail_id").val();
|
||||
eva_evaluation_achievementObject.achievement = $("#eva_evaluation_achievement_achievement").val();
|
||||
eva_evaluation_achievementObject.weight = $("#eva_evaluation_achievement_weight").val();
|
||||
if ($("#eva_evaluation_achievement_thefile_hidURL").val() !== null) {
|
||||
eva_evaluation_achievementObject.thefile = $("#eva_evaluation_achievement_thefile_hidURL").val();
|
||||
} else {
|
||||
eva_evaluation_achievementObject.thefile = "";
|
||||
}
|
||||
//if ($("#eva_evaluation_achievement_thefile_hidURL").val() !== null) {
|
||||
// eva_evaluation_achievementObject.thefile = $("#eva_evaluation_achievement_thefile_hidURL").val();
|
||||
//} else {
|
||||
// eva_evaluation_achievementObject.thefile = "";
|
||||
//}
|
||||
eva_evaluation_achievementObject.target_score1 = $("#eva_evaluation_achievement_target_score1").val();
|
||||
eva_evaluation_achievementObject.target_score2 = $("#eva_evaluation_achievement_target_score2").val();
|
||||
eva_evaluation_achievementObject.target_score3 = $("#eva_evaluation_achievement_target_score3").val();
|
||||
@@ -208,6 +208,13 @@ var eva_evaluation_achievement_setupTable = function (result) {
|
||||
}, {
|
||||
targets: [3, 4, 5, 6, 7],
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
"targets": -1,
|
||||
"data": "id",
|
||||
"render": function (data, type, row, meta) {
|
||||
return "<button type='button' class='btn btn-warning btn-sm' onclick='javascript:open_manage_file_id(" + tmp + row.id + tmp + ")'><i class='fa fa-pencil'></i></button>";
|
||||
}
|
||||
}],
|
||||
"language": {
|
||||
"url": appsite + "/DataTables-1.10.16/thai.json"
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
var eva_evaluation_achievement_attach_editMode = "CREATE";
|
||||
var eva_evaluation_achievement_attach_API = "/api/eva_evaluation_achievement_attach/";
|
||||
|
||||
//================= Search Customizaiton =========================================
|
||||
|
||||
function eva_evaluation_achievement_attach_GetSearchParameter() {
|
||||
var eva_evaluation_achievement_attachSearchObject = new Object();
|
||||
eva_evaluation_achievement_attachSearchObject.achievement_id = getUrlParameter("id");
|
||||
|
||||
return eva_evaluation_achievement_attachSearchObject;
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_FeedDataToSearchForm(data) {
|
||||
$("#s_eva_evaluation_achievement_attach_achievement_id").val(data.achievement_id);
|
||||
|
||||
}
|
||||
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_evaluation_achievement_attach_FeedDataToForm(data) {
|
||||
$("#eva_evaluation_achievement_attach_id").val(data.id);
|
||||
$("#eva_evaluation_achievement_attach_achievement_id").val(data.achievement_id);
|
||||
feedFileToControl(data.the_file, data.the_fileDisplay, "eva_evaluation_achievement_attach_the_file", "file");
|
||||
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_GetFromForm() {
|
||||
var eva_evaluation_achievement_attachObject = new Object();
|
||||
eva_evaluation_achievement_attachObject.id = $("#eva_evaluation_achievement_attach_id").val();
|
||||
eva_evaluation_achievement_attachObject.achievement_id = getUrlParameter("id");
|
||||
if ($("#eva_evaluation_achievement_attach_the_file_hidURL").val() !== null) {
|
||||
eva_evaluation_achievement_attachObject.the_file = $("#eva_evaluation_achievement_attach_the_file_hidURL").val();
|
||||
} else {
|
||||
eva_evaluation_achievement_attachObject.the_file = "";
|
||||
}
|
||||
|
||||
|
||||
return eva_evaluation_achievement_attachObject;
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_InitialForm(s) {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_achievement_attach_FeedDataToForm(result);
|
||||
eva_evaluation_achievement_attach_FeedDataToSearchForm(result);
|
||||
if (s) {
|
||||
// Incase model popup
|
||||
$("#eva_evaluation_achievement_attachModel").modal("show");
|
||||
}
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_achievement_attach_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
//================= Form Mode Setup and Flow =========================================
|
||||
|
||||
function eva_evaluation_achievement_attach_GoCreate() {
|
||||
// Incase model popup
|
||||
eva_evaluation_achievement_attach_SetCreateForm(true);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_evaluation_achievement_attachView/eva_evaluation_achievement_attach_d");
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_GoEdit(a) {
|
||||
// Incase model popup
|
||||
eva_evaluation_achievement_attach_SetEditForm(a);
|
||||
|
||||
// Incase open new page
|
||||
//window_open(appsite + "/eva_evaluation_achievement_attachView/eva_evaluation_achievement_attach_d?id=" + a);
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_evaluation_achievement_attach_editMode = "UPDATE";
|
||||
eva_evaluation_achievement_attach_FeedDataToForm(result);
|
||||
$("#eva_evaluation_achievement_attachModel").modal("show");
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_evaluation_achievement_attach_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_SetCreateForm(s) {
|
||||
eva_evaluation_achievement_attach_editMode = "CREATE";
|
||||
eva_evaluation_achievement_attach_InitialForm(s);
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_RefreshTable() {
|
||||
// Incase model popup
|
||||
eva_evaluation_achievement_attach_DoSearch();
|
||||
|
||||
// Incase open new page
|
||||
//window.parent.eva_evaluation_achievement_attach_DoSearch();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
|
||||
var eva_evaluation_achievement_attach_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_evaluation_achievement_attach_PutUpdate() {
|
||||
if (!ValidateForm('eva_evaluation_achievement_attach', eva_evaluation_achievement_attach_customValidation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = eva_evaluation_achievement_attach_GetFromForm();
|
||||
|
||||
//Update Mode
|
||||
if (eva_evaluation_achievement_attach_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
$("#eva_evaluation_achievement_attachModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_evaluation_achievement_attach_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_evaluation_achievement_attach_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
$("#eva_evaluation_achievement_attachModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_evaluation_achievement_attach_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_evaluation_achievement_attach_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบข้อมูล ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
$("#eva_evaluation_achievement_attachModel").modal("hide");
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_evaluation_achievement_attach_RefreshTable();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_evaluation_achievement_attach_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
//================= Data Table =========================================
|
||||
|
||||
var eva_evaluation_achievement_attachTableV;
|
||||
|
||||
var eva_evaluation_achievement_attach_setupTable = function (result) {
|
||||
tmp = '"';
|
||||
eva_evaluation_achievement_attachTableV = $('#eva_evaluation_achievement_attachTable').DataTable({
|
||||
"processing": true,
|
||||
"serverSide": false,
|
||||
"data": result,
|
||||
//"select": {
|
||||
// "style": 'multi'
|
||||
//},
|
||||
"columns": [
|
||||
//{ "data": "" },
|
||||
{ "data": "id" },
|
||||
//{ "data": "id" },
|
||||
//{ "data": "achievement_id_eva_evaluation_achievement_create_evaluation_detail_id" },
|
||||
{ "data": "txt_the_file" },
|
||||
],
|
||||
"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_evaluation_achievement_attach_GoEdit(" + tmp + data + tmp + ")'><i class='fa fa-pencil'></i></button> <button type='button' class='btn btn-danger btn-sm' onclick='javascript:eva_evaluation_achievement_attach_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_evaluation_achievement_attach_InitiateDataTable() {
|
||||
startLoad();
|
||||
var p = $.param(eva_evaluation_achievement_attach_GetSearchParameter());
|
||||
AjaxGetRequest(apisite + "/api/eva_evaluation_achievement_attach/GetListBySearch?" + p, eva_evaluation_achievement_attach_setupTable, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_DoSearch() {
|
||||
var p = $.param(eva_evaluation_achievement_attach_GetSearchParameter());
|
||||
var eva_evaluation_achievement_attach_reload = function (result) {
|
||||
eva_evaluation_achievement_attachTableV.destroy();
|
||||
eva_evaluation_achievement_attach_setupTable(result);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + "/api/eva_evaluation_achievement_attach/GetListBySearch?" + p, eva_evaluation_achievement_attach_reload, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_evaluation_achievement_attach_GetSelect(f) {
|
||||
var eva_evaluation_achievement_attach_selectitem = [];
|
||||
$.each(eva_evaluation_achievement_attachTableV.rows('.selected').data(), function (key, value) {
|
||||
eva_evaluation_achievement_attach_selectitem.push(value[f]);
|
||||
});
|
||||
alert(eva_evaluation_achievement_attach_selectitem);
|
||||
}
|
||||
|
||||
//================= File Upload =========================================
|
||||
|
||||
$('#eva_evaluation_achievement_attach_the_file_file').change(function () {
|
||||
UploadImage($('#eva_evaluation_achievement_attach_the_file_file'), 'eva_evaluation_achievement_attach_the_file');
|
||||
});
|
||||
|
||||
|
||||
//================= Multi-Selection Function =========================================
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user