change load modal

This commit is contained in:
Daniel Barbero Martin 2019-11-07 09:38:52 +01:00
parent b80cb976f9
commit b18878148c
2 changed files with 68 additions and 11 deletions

View File

@ -1886,11 +1886,31 @@ function load_modal(settings) {
data.append("page", settings.onshow.page);
data.append("method", settings.onshow.method);
if (settings.target == undefined) {
var uniq = uniqId();
var div = document.createElement("div");
div.id = "div-modal-" + uniq;
div.style.display = "none";
document.getElementById("main").append(div);
var id_modal_target = "#div-modal-" + uniq;
settings.target = $(id_modal_target);
}
var width = 630;
if (settings.onshow.width) {
width = settings.onshow.width;
}
if (settings.modal.overlay == undefined) {
settings.modal.overlay = {
opacity: 0.5,
background: "black"
};
}
settings.target.html("Loading modal...");
settings.target
.dialog({
@ -2081,14 +2101,16 @@ function load_modal(settings) {
modal: true,
title: settings.modal.title,
width: width,
overlay: {
opacity: 0.5,
background: "black"
},
overlay: settings.modal.overlay,
buttons: required_buttons,
closeOnEscape: false,
open: function() {
$(".ui-dialog-titlebar-close").hide();
},
close: function() {
if (id_modal_target != undefined) {
$(id_modal_target).remove();
}
}
});
},
@ -2100,13 +2122,7 @@ function load_modal(settings) {
//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
function confirmDialog(settings) {
var randomStr =
Math.random()
.toString(36)
.substring(2, 15) +
Math.random()
.toString(36)
.substring(2, 15);
var randomStr = uniqId();
$("body").append(
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
@ -2142,6 +2158,18 @@ function confirmDialog(settings) {
.show();
}
function uniqId() {
var randomStr =
Math.random()
.toString(36)
.substring(2, 15) +
Math.random()
.toString(36)
.substring(2, 15);
return randomStr;
}
/**
* Function to show modal with message Validation.
*

View File

@ -29,3 +29,32 @@ li > input[type="text"] {
.margin_button {
margin-right: 5px;
}
.container-target {
display: flex;
flex-flow: row wrap;
}
.element-target {
width: 20px;
margin: 2px;
height: 20px;
}
.status-normal {
background-color: #add570;
}
.status-critical {
background-color: #e3485e;
}
.status-notinit {
background-color: #8bbbdd;
}
h4 {
color: #343434;
font-family: "lato-bolder", "Open Sans", sans-serif;
line-height: 18pt;
}