diff --git a/htdocs/public/webportal/css/btn.css b/htdocs/public/webportal/css/btn.css new file mode 100644 index 00000000000..035d55a143f --- /dev/null +++ b/htdocs/public/webportal/css/btn.css @@ -0,0 +1,56 @@ + +/* + * BUTTON With Low emphasis + */ + +button.btn-low-emphasis{ + text-align: center; + display: inline-block; + border: none; + outline: none; + cursor: pointer; + margin: 0; + padding: 0; + width: auto; + min-width: 1.5em; + min-height: 1.5em; + line-height: 1.5em; + + overflow: visible; + background: transparent; + background-position: center; /* used for hover ripple effect */ + background-size: 0%; + color: var(--colortextlink, inherit); + font: inherit; + line-height: normal; + + /* Corrects font smoothing for webkit */ + -webkit-font-smoothing: inherit; + -moz-osx-font-smoothing: inherit; + + /* Corrects inability to style clickable input types in iOS */ + -webkit-appearance: none; + + + transition: background 0.8s;/* used for hover ripple effect */ + background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%; +} + +button.btn-low-emphasis.--btn-icon{ + border-radius: 100%; +} + +button.btn-low-emphasis :is(.fa, .fas){ + color: var(--colortextlink, inherit); + opacity: 0.4; +} + +button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){ + opacity: 0.8; +} + +button.btn-low-emphasis.--btn-icon:active { + background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1); + background-size: 100%; + transition: background 0s;/* used for hover ripple effect */ +} diff --git a/htdocs/public/webportal/css/dialog.css b/htdocs/public/webportal/css/dialog.css new file mode 100644 index 00000000000..50e42c99e82 --- /dev/null +++ b/htdocs/public/webportal/css/dialog.css @@ -0,0 +1,91 @@ +/* Dialog container */ +.dialog-full-screen article { + width: 80vw; + max-width: 95vw; + height: 90vh; + max-height: 95vh; + + position: fixed; + margin: 0 auto; + + display: flex; + flex-direction: column; + flex-wrap: nowrap; + justify-content: normal; + align-items: normal; + align-content: normal; +} + +.dialog-full-screen article:has(.dialog-header) { + padding: 0; +} + + +.dialog-full-screen article .dialog-body { + display: block; + flex-grow: 2; + flex-shrink: 1; + flex-basis: auto; + align-self: auto; + order: 0; +} + +@media (min-width: 576px) { + dialog.dialog-full-screen article { + max-width: 95%; + } +} +@media (min-width: 768px) { + dialog.dialog-full-screen article { + max-width: 95%; + } +} + +/* Iframe */ +.dialog-iframe { + border: none; + width: 100%; + height: 100%; +} + + + +/*!* Header *!*/ +.dialog-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.5em 1em; + border-bottom: 1px solid rgba(0,0,0,0.1); +} + +.dialog-header-title-container { + flex: 1; + overflow: hidden; +} + +.dialog-header-title { + margin: 0; + text-overflow: ellipsis; + overflow: hidden; +} + +.dialog-header-action-container { + flex: 0 0 auto; + white-space: nowrap; + display: flex; + flex-direction: row-reverse; + gap: 0.5em; +} + +/* Header title */ +.dialog-header h2 { + margin: 0; + font-size: 1.2em; +} + +/* Close button */ +dialog article .dialog-header-btn.close { + margin-top: 0; + margin-bottom: 0; +} diff --git a/htdocs/public/webportal/css/style.css.php b/htdocs/public/webportal/css/style.css.php index 84b52b4c378..1e034f2ae97 100644 --- a/htdocs/public/webportal/css/style.css.php +++ b/htdocs/public/webportal/css/style.css.php @@ -99,6 +99,8 @@ if (empty($dolibarr_nocache)) { @import "badges.css"; @import "title-buttons.css"; @import "nav.css"; +@import "dialog.css"; +@import "btn.css"; /** This file can overwrite default pico css */ diff --git a/htdocs/public/webportal/tpl/footer.tpl.php b/htdocs/public/webportal/tpl/footer.tpl.php index 75f0a7e1c3d..f4358235dfc 100644 --- a/htdocs/public/webportal/tpl/footer.tpl.php +++ b/htdocs/public/webportal/tpl/footer.tpl.php @@ -117,44 +117,60 @@ if (empty($conf->browser->layout) || $conf->browser->layout != 'phone') { ?> jQuery(document).ready(function () { jQuery(".modal_card").click(function (event) { console.log("We click on card link for element with href=" + $(this).attr('href')); - modal_card($(this).attr('href')); + const modalTitle = $(this).data('modal-title') || $(this).attr('title') || ''; + modal_card($(this).attr('href'), modalTitle); event.preventDefault(); return false; }); }); /** - * Function show modal card. It uses the "modal" function. + * Show modal card using Pico.css modal system * - * @param url Url - * @param title Dialog box title - * @return void - * @see newpopup() + * @param {string} url - URL to load in the iframe + * @param {string} title - Modal title */ - function modal_card(url, title) { - console.log("modal_card A click was done: url=" + url); + function modal_card(url, title = '') { + console.log("modal_card called: url=" + url); - let width = "85%"; - let object_width = '100%'; - let height = ($(window).height() - 60) * 0.90; - let object_height = '98%'; - let newElem = ''; + const modal = document.getElementById('modalforcard'); // Pico.css modal container + if (!modal) { + console.error('Modal container not found'); + return; + } - $('#modalforcard article').css('width', width).css('height', height).html(newElem); - let modal = document.getElementById('modalforcard'); + // Insert structured modal content + modal.querySelector('article').innerHTML = ` +
+
+

${title}

+
+
+ +
+
+
+ +
+ `; + + // Add close button handler + const closeBtn = modal.querySelector('.dialog-close-btn'); + if (closeBtn) { + closeBtn.addEventListener('click', () => close_modal_card()); + } + + // Open modal via Pico.css function openModal(modal); } /** - * Function close modal card. It uses the "modal" function. - * - * @return void + * Close modal card using Pico.css modal system */ function close_modal_card() { - console.log("close_modal_card A click was done"); + const modal = document.getElementById('modalforcard'); + if (!modal) return; - let modal = document.getElementById('modalforcard'); closeModal(modal); } @@ -215,6 +231,7 @@ if (empty($conf->browser->layout) || $conf->browser->layout != 'phone') { ?> } function show_preview(mode) { + // TODO : rebuild dialog tpl show modal_card let newElem = ''; if (mode == 'image' && showOriginalSizeButton) { @@ -252,8 +269,8 @@ if (empty($conf->browser->layout) || $conf->browser->layout != 'phone') { ?> -
-
+
+
diff --git a/htdocs/public/webportal/tpl/header.tpl.php b/htdocs/public/webportal/tpl/header.tpl.php index 07b05a30609..cd13ea7d3ce 100644 --- a/htdocs/public/webportal/tpl/header.tpl.php +++ b/htdocs/public/webportal/tpl/header.tpl.php @@ -19,6 +19,8 @@ /** * @var Context $context Object context for webportal * @var Translate $langs + * @@var string[] $vars['body-class'] more CSS classes for body + * @@var string[] $vars['body-theme'] theme css to apply default is custom */ // Protection to avoid direct call of template @@ -85,6 +87,18 @@ top_httphead(); // Common dolibarr js functions $jQueryUIJSUrl = $context->rootUrl.'js/lib_head.js.php'; print ''."\n"; + + $bodyAttributes = [ + 'data-theme' => $vars['body-theme']??'custom', + 'data-controller' => $context->controller, + ]; + + if (!empty($vars['body-class'])) { + $bodyAttributes['class'] = $vars['body-class']; + } + + $bodyCompiledAttributes = commonHtmlAttributeBuilder($bodyAttributes); + ?> - + > diff --git a/htdocs/webportal/controllers/abstractcard.controller.class.php b/htdocs/webportal/controllers/abstractcard.controller.class.php index 709570f67f9..ccc4f507201 100644 --- a/htdocs/webportal/controllers/abstractcard.controller.class.php +++ b/htdocs/webportal/controllers/abstractcard.controller.class.php @@ -47,7 +47,10 @@ abstract class AbstractCardController extends Controller return; } - $this->loadTemplate('header'); + $this->loadTemplate('header', [ + 'body-class' => empty($this->formCard->modal) ? '' : '--is-modal' + ]); + if (empty($this->formCard->modal)) { $this->loadTemplate('menu'); $this->loadTemplate('hero-header-banner');