diff --git a/src/main/webapp/resources/js/base/base-fims.js b/src/main/webapp/resources/js/base/base-fims.js
index 2453c3ca..448d31f8 100644
--- a/src/main/webapp/resources/js/base/base-fims.js
+++ b/src/main/webapp/resources/js/base/base-fims.js
@@ -9,7 +9,7 @@ async function alert2(msg){
return await dialog2(msg, "alert");
}
-async function dialog2(msg, type){
+async function dialog2(msg, type, buttons){
var dlgId = "dlg-" + uuid();
var resp = await fetch(wctx.url("/resources/html/dialog.html"));
var template = await resp.text();
@@ -18,12 +18,25 @@ async function dialog2(msg, type){
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("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('');
+ if(type == "confirm" || type == "alert"){
+ if(type == "confirm"){
+ dlg.find(".modal-footer").append('');
+ }
+ } else {
+ dlg.find(".modal-footer").find(".btn-ok").remove();
+
+ for(var i=0; i < buttons.length; i++){
+ dlg.find(".modal-footer").append(
+ '');
+ }
+
}
+
dlg.find(".modal-header").remove();
dlg.find(".modal-body").html(content).fadeIn();
dlg.on("hidden.bs.modal", function() {
@@ -40,16 +53,26 @@ async function dialog2(msg, type){
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", () => {
+ if(type == "confirm" || type == "alert"){
+ dlg[0].querySelector(".btn-ok").addEventListener("click", () => {
dlg.modal("hide");
- resolve(false);
+ resolve(true);
});
+ if(type == "confirm"){
+ dlg[0].querySelector(".btn-cancel").addEventListener("click", () => {
+ dlg.modal("hide");
+ resolve(false);
+ });
+ }
+ } else {
+ dlg.find(".btn-custom").each(function(){
+ this.addEventListener("click", () => {
+ dlg.modal("hide");
+ resolve(this.dataset.key);
+ });
+ });
}
+
});
}