set modal and maps right

This commit is contained in:
David Malinowski 2024-06-07 17:29:17 +02:00
parent 7545c0e25d
commit ac6b9038e9

View File

@ -8,7 +8,7 @@ function loadLeafletAndInitMap(frm, callback) {
function create_dialog_and_init_map(frm) {
const dialog = new frappe.ui.Dialog({
title: 'Show Route',
fields: [{ fieldtype: 'HTML', fieldname: 'map_html', label: 'Map', options: '<div id="map" style="height:500px;"></div>' }],
fields: [{ fieldtype: 'HTML', fieldname: 'map_html', label: 'Map', options: '<div id="map" style="height:calc(80vh - 20px);"></div>' }],
primary_action_label: 'Close',
primary_action() {
if (currentMap) {
@ -20,6 +20,14 @@ function create_dialog_and_init_map(frm) {
size: 'extra-large'
});
// Adjust the size of the dialog dynamically to 80% of the browser window
const modalDialog = dialog.$wrapper.find('.modal-content');
modalDialog.css({
"width": "85vw",
"max-width": "85vw",
"margin-left": "-25vh"
});
// Add hide event to reload the page when the dialog is closed
dialog.onhide = function () {
window.location.reload();