ทำ flow เสด
This commit is contained in:
@@ -23,6 +23,8 @@ function eva_create_evaluation_detail_firstdoc_FeedDataToForm(data) {
|
||||
|
||||
status_self_a = data.status_self_a;
|
||||
status_chief_a = data.status_chief_a;
|
||||
role_code = data.role_code;
|
||||
|
||||
CheckPermission();
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
@@ -4,23 +4,23 @@ var eva_create_evaluation_detail_review0A_API = "/api/eva_create_evaluation_deta
|
||||
//================= Form Data Customizaiton =========================================
|
||||
|
||||
function eva_create_evaluation_detail_review0A_FeedDataToForm(data) {
|
||||
$("#eva_create_evaluation_detail_review0A_id").val(data.id);
|
||||
$("#eva_create_evaluation_detail_review0A_create_evaluation_id").val(data.create_evaluation_id);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a").val(data.chief_a);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_review0A_chief_a_result"), data, "id", "external_name", "item_chief_a_result", data.chief_a_result);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a_remark").val(data.chief_a_remark);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a_date").val(formatDate(data.chief_a_date));
|
||||
$("#eva_create_evaluation_detail_review0A_id").val(data.id);
|
||||
$("#eva_create_evaluation_detail_review0A_create_evaluation_id").val(data.create_evaluation_id);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a").val(data.chief_a);
|
||||
DropDownClearFormAndFeedWithData($("#eva_create_evaluation_detail_review0A_chief_a_result"), data, "id", "external_name", "item_chief_a_result", data.chief_a_result);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a_remark").val(data.chief_a_remark);
|
||||
$("#eva_create_evaluation_detail_review0A_chief_a_date").val(formatDate(data.chief_a_date));
|
||||
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_review0A_GetFromForm() {
|
||||
var eva_create_evaluation_detail_review0AObject = new Object();
|
||||
eva_create_evaluation_detail_review0AObject.id = $("#eva_create_evaluation_detail_review0A_id").val();
|
||||
eva_create_evaluation_detail_review0AObject.create_evaluation_id = $("#eva_create_evaluation_detail_review0A_create_evaluation_id").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a = $("#eva_create_evaluation_detail_review0A_chief_a").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_result = $("#eva_create_evaluation_detail_review0A_chief_a_result").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_remark = $("#eva_create_evaluation_detail_review0A_chief_a_remark").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_date = getDate($("#eva_create_evaluation_detail_review0A_chief_a_date").val());
|
||||
eva_create_evaluation_detail_review0AObject.id = $("#eva_create_evaluation_detail_review0A_id").val();
|
||||
eva_create_evaluation_detail_review0AObject.create_evaluation_id = $("#eva_create_evaluation_detail_review0A_create_evaluation_id").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a = $("#eva_create_evaluation_detail_review0A_chief_a").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_result = $("#eva_create_evaluation_detail_review0A_chief_a_result").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_remark = $("#eva_create_evaluation_detail_review0A_chief_a_remark").val();
|
||||
eva_create_evaluation_detail_review0AObject.chief_a_date = getDate($("#eva_create_evaluation_detail_review0A_chief_a_date").val());
|
||||
|
||||
|
||||
return eva_create_evaluation_detail_review0AObject;
|
||||
@@ -29,9 +29,9 @@ eva_create_evaluation_detail_review0AObject.chief_a_date = getDate($("#eva_creat
|
||||
function eva_create_evaluation_detail_review0A_InitialForm() {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_review0A_FeedDataToForm(result);
|
||||
endLoad();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_review0A_API + "GetBlankItem", successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ function eva_create_evaluation_detail_review0A_SetEditForm(a) {
|
||||
var successFunc = function (result) {
|
||||
eva_create_evaluation_detail_review0A_editMode = "UPDATE";
|
||||
eva_create_evaluation_detail_review0A_FeedDataToForm(result);
|
||||
endLoad();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
startLoad();
|
||||
AjaxGetRequest(apisite + eva_create_evaluation_detail_review0A_API + a, successFunc, AlertDanger);
|
||||
}
|
||||
|
||||
function eva_create_evaluation_detail_review0A_SetCreateForm() {
|
||||
eva_create_evaluation_detail_review0A_editMode = "CREATE";
|
||||
eva_create_evaluation_detail_review0A_InitialForm();
|
||||
eva_create_evaluation_detail_review0A_InitialForm();
|
||||
}
|
||||
|
||||
//================= Update and Delete =========================================
|
||||
@@ -58,9 +58,8 @@ var eva_create_evaluation_detail_review0A_customValidation = function (group) {
|
||||
return "";
|
||||
};
|
||||
|
||||
function eva_create_evaluation_detail_review0A_PutUpdate() {
|
||||
if (!ValidateForm('eva_create_evaluation_detail_review0A', eva_create_evaluation_detail_review0A_customValidation))
|
||||
{
|
||||
function eva_create_evaluation_detail_review0A_PutUpdate(flag) {
|
||||
if (!ValidateForm('eva_create_evaluation_detail_review0A', eva_create_evaluation_detail_review0A_customValidation)) {
|
||||
return;
|
||||
}
|
||||
var data = eva_create_evaluation_detail_review0A_GetFromForm();
|
||||
@@ -68,19 +67,23 @@ function eva_create_evaluation_detail_review0A_PutUpdate() {
|
||||
//Update Mode
|
||||
if (eva_create_evaluation_detail_review0A_editMode === "UPDATE") {
|
||||
var successFunc1 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
if (flag !== "save") {
|
||||
eva_create_evaluation_detail_status_PutUpdate(flag)
|
||||
} else {
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
endLoad();
|
||||
}
|
||||
};
|
||||
startLoad();
|
||||
startLoad();
|
||||
AjaxPutRequest(apisite + eva_create_evaluation_detail_review0A_API + data.id, data, successFunc1, AlertDanger);
|
||||
}
|
||||
// Create mode
|
||||
else {
|
||||
var successFunc2 = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
endLoad();
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
startLoad();
|
||||
AjaxPostRequest(apisite + eva_create_evaluation_detail_review0A_API, data, successFunc2, AlertDanger);
|
||||
}
|
||||
}
|
||||
@@ -88,11 +91,11 @@ function eva_create_evaluation_detail_review0A_PutUpdate() {
|
||||
function eva_create_evaluation_detail_review0A_GoDelete(a) {
|
||||
if (confirm('คุณต้องการลบ ' + a + ' ใช่หรือไม่?')) {
|
||||
var successFunc = function (result) {
|
||||
AlertSuccess(result.code+" "+result.message);
|
||||
AlertSuccess(result.code + " " + result.message);
|
||||
eva_create_evaluation_detail_review0A_RefreshTable();
|
||||
endLoad();
|
||||
endLoad();
|
||||
};
|
||||
startLoad();
|
||||
startLoad();
|
||||
AjaxDeleteRequest(apisite + eva_create_evaluation_detail_review0A_API + a, null, successFunc, AlertDanger);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ function eva_create_evaluation_detail_status_PutUpdate(a) {
|
||||
data.status_mode = a;
|
||||
if (a === "nextA") {
|
||||
data.status_self_a = "Y";
|
||||
data.status_chief_a = "";
|
||||
}
|
||||
else if (a === "backB") {
|
||||
data.status_chief_a = "N";
|
||||
|
||||
Reference in New Issue
Block a user