diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 8a1965268f..6b0274229e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1562,4 +1562,68 @@ function round_with_decimals (value, multiplier = 1) { return Math.round(value * multiplier) / multiplier; } return round_with_decimals (value, multiplier * 10); +} + +/* + + $("body").append('

' + '' + '

'); + $("#event_delete_confirm_dialog").dialog({ + resizable: false, + draggable: false, + modal: true, + height: 280, + width: 330, + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: false, + open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); } + }); +*/ + +/** + * Display a confirm dialog box + * + * @param string Text to display + * @param string Ok button text + * @param string Cancel button text + * @param function Callback to action when ok button is pressed +*/ +function display_confirm_dialog ( + message = '', + ok_text = '', + cancel_text = '', + ok_function = function () {} +) { + // Clean function to close the dialog + var clean_function = function () { + $("#pandora_confirm_dialog_text").hide(); + $("#pandora_confirm_dialog_text").remove(); + } + + // Modify the ok function to close the dialog too + var ok_function_clean = function () { + ok_function(); + clean_function(); + } + + // Display the dialog + $("body").append('

' + message + '

'); + $("#pandora_confirm_dialog_text").dialog({ + resizable: false, + draggable: true, + modal: true, + dialogClass: "pandora_confirm_dialog", + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: true, + modal: true, + buttons: { + Cancel: clean_function, + "Confirm": ok_function_clean + } + }); } \ No newline at end of file diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 9b39270e66..7badf707b7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4633,3 +4633,19 @@ form ul.form_flex li ul li{ line-height: 1.05em!important; } +.pandora_confirm_dialog .ui-dialog-buttonset { + display: flex; + width: 100%; + margin-left: 10px; + float: none !important; +} + +.pandora_confirm_dialog .ui-dialog-buttonset button{ + flex: 50%; +} + +#pandora_confirm_dialog_text h3{ + margin-left: 20px; + margin-right: 20px; + text-align: center; +} \ No newline at end of file