templates/areas/popper/view.html.twig line 1

Open in your IDE?
  1. {% if editmode %}
  2.     {% set message = 'Popup maker' %}
  3.     {% set type = 'info' %}
  4.     {% include 'includes/basicBlocks/admin/message/tip.html.twig' with {'message': message, 'type' : type} %}
  5.     <p><strong>{{ 'Popup fixed.'|trans({}, 'admin') }}</strong>: {{ pimcore_checkbox('persistentModalPopperOff') }}</p>
  6.     <p><strong>{{ 'Title Box'|trans({}, 'admin') }}</strong>: {{ pimcore_input('modalTitlePopper') }}</p>
  7.     <p><strong>{{ 'Content Box'|trans({}, 'admin') }}</strong>: {{ pimcore_wysiwyg('modalContentPopper') }}</p>
  8.     <br>
  9.     {% set messageTwo = 'If no date is filled in, popup is always activated.' %}
  10.     {% set typeTwo = 'primary' %}
  11.     {% include 'includes/basicBlocks/admin/message/tip.html.twig' with {'message': messageTwo, 'type' : typeTwo} %}
  12.     {{ 'Start date'|trans({}, 'admin') }}
  13.     {{ pimcore_date('modalStartDate', {
  14.         'outputFormat': '%d.%m.%Y',
  15.         'format': 'd.m.Y'
  16.     })
  17.     }}
  18.     {{ 'End date'|trans({}, 'admin') }}
  19.     {{ pimcore_date('modalEndDate', {
  20.         'outputFormat': '%d.%m.%Y',
  21.         'format': 'd.m.Y'
  22.     })
  23.     }}
  24. {% endif %}
  25. {% if not editmode %}
  26.     {% set currentDate = 'now'|date('Ymd') %}
  27.     {% set startDate = pimcore_date('modalStartDate', {'outputFormat': '%Y%m%d'}) %}
  28.     {% set endDate = pimcore_date('modalEndDate', {'outputFormat': '%Y%m%d'}) %}
  29.     {% set popperIdName = uniqid('popper-') %}
  30.     {% if (startDate == '' and endDate == '') or (currentDate >= startDate and currentDate <= endDate )%}
  31.         <div class="modal" tabindex="-1" id="modalPopper{{ popperIdName }}">
  32.             <div class="modal-dialog">
  33.                 <div class="modal-content">
  34.                     <div class="modal-header">
  35.                         <h5 class="modal-title">{{ pimcore_input('modalTitlePopper') }}</h5>
  36.                         <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{ 'Close'|trans }}"></button>
  37.                     </div>
  38.                     <div class="modal-body">
  39.                         {{ pimcore_wysiwyg('modalContentPopper') }}
  40.                     </div>
  41.                     <div class="modal-footer">
  42.                         <button type="button" class="btn btn-primary" data-bs-dismiss="modal">{{ 'Close'|trans }}</button>
  43.                     </div>
  44.                 </div>
  45.             </div>
  46.         </div>
  47.         <script>
  48.             $(document).ready(function() {
  49.                 {% if pimcore_checkbox("persistentModalPopperOff").isChecked() %}
  50.                 localStorage['popupModalPopper{{ popperIdName }}'] = "showalways";
  51.                 {% endif %}
  52.                 if(localStorage.getItem("popupModalPopper{{ popperIdName }}") && localStorage.getItem("popupModalPopper{{ popperIdName }}") != "showonetime"){
  53.                     $('#modalPopper{{ popperIdName }}').modal('show');
  54.                 }
  55.                 {% if not pimcore_checkbox("persistentModalPopperOff").isChecked() %}
  56.                 localStorage['popupModalPopper{{ popperIdName }}'] = "showonetime";
  57.                 {% endif %}
  58.             });
  59.         </script>
  60.     {% endif %}
  61. {% endif %}