|
|
|
@ -1,3 +1,58 @@
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 동기식 대화상자
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
async function confirm2(msg){
|
|
|
|
|
return await dialog2(msg, "confirm");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function alert2(msg){
|
|
|
|
|
return await dialog2(msg, "alert");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function dialog2(msg, type){
|
|
|
|
|
var dlgId = "dlg-" + uuid();
|
|
|
|
|
var resp = await fetch(wctx.url("/resources/html/dialog.html"));
|
|
|
|
|
var template = await resp.text();
|
|
|
|
|
var container = "<div class='container-fluid text-center' style='font-size:1.4em;'>{content}</div>";
|
|
|
|
|
content = container.replace(/{content}/g, msg);
|
|
|
|
|
var backdropID = dlgId + "-backdrop";
|
|
|
|
|
var tmpl = template.replace(/{id}/g, dlgId).replace(/{title}/g, "").replace(/{size}/, "").replace("","");
|
|
|
|
|
tmpl = tmpl.replace("data-bs-backdrop=\"static\"", "data-bs-backdrop=\"static\" data-bs-keyboard=\"false\"");
|
|
|
|
|
tmpl = tmpl.replace("text-end hidden","text-end");
|
|
|
|
|
tmpl = tmpl.replace("btn-primary","btn-primary btn-ok");
|
|
|
|
|
var dlg = $(tmpl).appendTo("body");
|
|
|
|
|
if(type == "confirm"){
|
|
|
|
|
dlg.find(".modal-footer").append('<button type="button" class="btn btn-primary btn-cancel">취소</button>');
|
|
|
|
|
}
|
|
|
|
|
dlg.find(".modal-header").remove();
|
|
|
|
|
dlg.find(".modal-body").html(content).fadeIn();
|
|
|
|
|
dlg.on("hidden.bs.modal", function() {
|
|
|
|
|
$("#" + dlgId +",#" + backdropID).remove();
|
|
|
|
|
});
|
|
|
|
|
dlg.modal("show");
|
|
|
|
|
$(".modal-backdrop").each(function() {
|
|
|
|
|
var backdrop = $(this);
|
|
|
|
|
if (!backdrop.prop("id")){
|
|
|
|
|
backdrop.prop("id", backdropID);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setDialogZindex();
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
dlg[0].querySelector(".btn-ok").addEventListener("click", () => {
|
|
|
|
|
dlg.modal("hide");
|
|
|
|
|
resolve(true);
|
|
|
|
|
});
|
|
|
|
|
if(type == "confirm"){
|
|
|
|
|
dlg[0].querySelector(".btn-cancel").addEventListener("click", () => {
|
|
|
|
|
dlg.modal("hide");
|
|
|
|
|
resolve(false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 모달창 z-index 초기화
|
|
|
|
|
**************************************************************************/
|
|
|
|
@ -40,18 +95,6 @@ function focusOK() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 파일 다운로드
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
function downloadFile(filePath, fileName, tempAreaId){
|
|
|
|
|
var a = document.createElement("a");
|
|
|
|
|
a.href = resp.filePath;
|
|
|
|
|
a.download = resp.fileName;
|
|
|
|
|
document.getElementById(tempAreaId).appendChild(a);
|
|
|
|
|
a.click();
|
|
|
|
|
document.getElementById(tempAreaId).removeChild(a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* pdf파일 미리보기 창
|
|
|
|
|
**************************************************************************/
|
|
|
|
|