แก้บัก ไฟล์หาย

This commit is contained in:
nakorn
2021-09-29 17:05:12 +07:00
parent c520fb9a99
commit 64f6c4b1af

View File

@@ -0,0 +1,94 @@
var rep_eva01_API = "/api/rep_eva01/";
function array_to_string_comma(a) {
var x = "";
$.each(a, function (index, value) {
if (x !== "") x += ",";
x += value;
});
return x;
}
//================= Search Customizaiton =========================================
function rep_eva01_GetSearchParameter(fileType) {
var rep_eva01SearchObject = new Object();
rep_eva01SearchObject.org_id = $("#s_rep_eva01_org_id").val();
rep_eva01SearchObject.round_id = $("#s_rep_eva01_round_id").val();
rep_eva01SearchObject.round_text = $("#s_rep_eva01_round_id option:selected").text();
rep_eva01SearchObject.fileType = fileType;
console.log(rep_eva01SearchObject);
return rep_eva01SearchObject;
}
function rep_eva01_FeedDataToSearchForm(data) {
DropDownClearFormAndFeedWithDataOrg($("#s_rep_eva01_org_id"), data, "id", "external_name", "item_org_id", data.org_id);
DropDownClearFormAndFeedWithData($("#s_rep_eva01_round_id"), data, "id", "external_name", "item_round_id", data.id_guid);
}
function DropDownClearFormAndFeedWithDataOrg(d, result, x, y, z, i) {
$(d).html('');
$(d).append($("<option></option>")
.attr("value", "")
.text("กรุณาเลือก"));
$(d).append($("<option></option>")
.attr("value", "-1")
.text("เนติบัณฑิตยสภา ในพระบรมราชูปถัมภ์"));
if (z !== "") {
$.each(result[z], function (key, value) {
$(d).append($("<option></option>")
.attr("value", value[x])
.text(value[y]));
});
} else {
$.each(result, function (key, value) {
$(d).append($("<option></option>")
.attr("value", value[x])
.text(value[y]));
});
}
$(d).val(i);
}
//================= Form Data Customizaiton =========================================
function rep_eva01_InitialForm(s) {
var successFunc = function (result) {
rep_eva01_FeedDataToSearchForm(result);
endLoad();
};
startLoad();
AjaxGetRequest(apisite + rep_eva01_API + "GetBlankItem", successFunc, AlertDanger);
}
//================= Data Table =========================================
var s_rep_eva01_customValidation = function (group) {
return "";
};
function rep_eva01_DoSearch(fileType) {
if (!ValidateForm('s_rep_eva01', s_rep_eva01_customValidation)) {
return;
}
var p = $.param(rep_eva01_GetSearchParameter(fileType));
var report_url = apisite + "/api/rep_eva01/rep_eva01_report?" + p;
console.log(report_url);
if (fileType === "pdf") {
$("#report_result").attr("src", report_url);
$("#report_result").show();
//window.open(report_url);
} else {
$("#report_result").hide();
window.open(report_url);
}
}