src/Develey/BornBundle/Resources/views/Snippet/job-popup-modal.html.twig line 1

Open in your IDE?
  1. {% set textblock = pimcore_textarea('textblock', {
  2.     'width': 800,
  3.     'height': 100,
  4.     'placeholder': 'Text ...'
  5. }) %}
  6. {% set delay = pimcore_input('delay', {
  7.     'width': 152,
  8.     'placeholder': '3 (default)'
  9. }) %}
  10. {% if document.getProperty('mailJobPopup') != null and document.getProperty('mailJobPopup') is not empty %}
  11.     {% set email = document.getProperty('mailJobPopup') %}
  12. {% else %}
  13.     {% set email = null %}
  14. {% endif %}
  15. {% if editmode %}
  16.     {% set image = pimcore_image('image', {
  17.         'width': 800,
  18.         'height': 450
  19.     }) %}
  20.     <div class="flex-col offset-bottom-single">
  21.         <div class="col xs-12">
  22.             <span class="hint"><big>Job-Popup</big><small><br/><br/></small><strong>Bild:</strong>&nbsp; ( 16:9 )</span>
  23.             <div>{{ image | raw }}</div>
  24.         </div>
  25.         <div class="col xs-12">
  26.             <span class="hint"><strong>Text:</strong></span>
  27.             <div>{{ textblock | raw }}</div>
  28.         </div>
  29.         <div class="col xs-12">
  30.             <span class="hint"><strong>Verzögerung:</strong><br/><small>Nach wie viel Sekunden soll das Popup öffnen?<br/>( Default 3s / nur ganze Sekunden! )<br/>&nbsp;</small></span>
  31.             <div>{{ delay | raw }}</div>
  32.             <div>&nbsp;</div>
  33.         </div>
  34.         <div class="col xs-12">
  35.             <span class="hint"><strong>E-Mail:</strong><br/><span
  36.                         style="color:#666"><small>aus der Page-Property "mailJobPopup"<br/>&nbsp;</small></span></span>
  37.             {% if email is empty %}
  38.                 <div style="color:red">Bitte Page-Property setzten! (s.u.)</div>
  39.             {% else %}
  40.                 <div style="color:#666">{{ email | raw }}</div>
  41.             {% endif %}
  42.             <div>&nbsp;</div>
  43.         </div>
  44.         <div class="col xs-12" style="color:#002a44">
  45.             &nbsp;<br/>Dieses Snippet muss in die Page-Property "snippetJobPopup" vom Typ "Document" gezogen werden. Diese Property kann auf Root des
  46.             Sprachbaumes liegen.<small><br/><br/></small>
  47.             Das Popup wird dargestellt, wenn auf der Seite eine Page-Property "showJobPopup" vom Typ "Checkbox" gesetzt ist. Bitte diese Property nicht
  48.             vererben!<small><br/><br/></small>
  49.             Die Mail wird an die E-MailAdresse in der Page-Property "mailJobPopup" vom Typ "Text" gesendet. Diese Property kann ebenfalls auf Root des
  50.             Sprachbaumes liegen.<br/><br/>&nbsp;
  51.         </div>
  52.     </div>
  53. {% else %}
  54.     {% set image = pimcore_image('image', {
  55.         'thumbnail': 'jobPopup',
  56.         'disableWidthHeightAttributes':  true,
  57.         'cacheBuster': true,
  58.         'imgAttributes': {
  59.             'class': 'job-popup_img',
  60.         },
  61.     }) %}
  62.     {% set delayHtml = '3000' %}
  63.     {% if delay.getData() is not empty %}
  64.         {% set delayHtml = delay.getData() ~ '000' %}
  65.     {% endif %}
  66.     {% if email is not empty %}
  67.         <div class="job-popup">
  68.             <div class="bb-flex-1 js-job-popup_close"></div>
  69.             <div class="bb-flex-col">
  70.                 <div class="bb-flex-1 js-job-popup_close"></div>
  71.                 <div class="job-popup_box">
  72.                     {% if image.getId() != null %}
  73.                         <div>{{ image | raw }}</div>
  74.                         <div class="job-popup_closer js-job-popup_close">
  75.                             <svg xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 24 24">
  76.                                 <path d="M0 0h24v24H0z" fill="none"></path>
  77.                                 <path fill="currentColor"
  78.                                       d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
  79.                             </svg>
  80.                         </div>
  81.                     {% endif %}
  82.                     <div class="job-popup_body">
  83.                         {% if textblock.getData() is not empty %}
  84.                             <div class="bb-pb-2 text-center">{{ textblock.getData() | raw }}</div>
  85.                         {% endif %}
  86.                         <div class="job-popup_form active">
  87.                             <form>
  88.                                 <div class="form-field job-popup_field-gender">
  89.                                     <label for="gender" class="required">Anrede</label>
  90.                                     <select class="job-popup_field" id="gender" name="gender">
  91.                                         <option value="">Bitte wählen ...</option>
  92.                                         <option value="male">Herr</option>
  93.                                         <option value="female">Frau</option>
  94.                                         <option value="divers">Divers</option>
  95.                                     </select>
  96.                                     <div class="job-popup_error">Bitte Anrede auswählen.</div>
  97.                                 </div>
  98.                                 <div class="form-field job-popup_field-firstname">
  99.                                     <label class="required" for="firstname">Vorname</label>
  100.                                     <input class="job-popup_field" id="firstname" name="firstname" type="text" autocomplete="given-name"/>
  101.                                     <div class="job-popup_error">Bitte Vorname angeben.</div>
  102.                                 </div>
  103.                                 <div class="form-field job-popup_field-lastname">
  104.                                     <label class="required" for="lastname">Nachname</label>
  105.                                     <input class="job-popup_field" id="lastname" name="lastname" type="text" autocomplete="family-name"/>
  106.                                     <div class="job-popup_error">Bitte Nachname angeben.</div>
  107.                                 </div>
  108.                                 <div class="form-field job-popup_field-email">
  109.                                     <label class="required" for="email">E-Mail</label>
  110.                                     <input class="job-popup_field" id="email" name="email" type="email" autocomplete="email"/>
  111.                                     <div class="job-popup_error">Bitte E-Mail-Adresse angeben.</div>
  112.                                 </div>
  113.                                 <div class="form-field job-popup_field-phone">
  114.                                     <label class="required" for="phone">Telefon</label>
  115.                                     <input class="job-popup_field" id="phone" name="phone" type="text" autocomplete="tel"/>
  116.                                     <div class="job-popup_error">Bitte Telefon-Nummer angeben.</div>
  117.                                 </div>
  118.                                 <div class="form-field job-popup_field-recall">
  119.                                     <label for="recall" class="required">Gewünschter Kontakt</label>
  120.                                     <select class="job-popup_field" id="recall" name="recall">
  121.                                         <option value="phone">per Telefon</option>
  122.                                         <option value="email">per E-Mail</option>
  123.                                     </select>
  124.                                     <div class="job-popup_error">Bitte gewünschte Kontaktaufnahme wählen.</div>
  125.                                 </div>
  126.                                 <div class="form-field job-popup_field-message">
  127.                                     <label class="required" for="message">Gewünschte Stelle / Nachricht</label>
  128.                                     <textarea class="job-popup_field" id="message" name="message" type="message"></textarea>
  129.                                     <div class="job-popup_error">Bitte eine Nachricht eingeben.</div>
  130.                                 </div>
  131.                                 <div class="checkout-confirm-container agreement-check job-popup_field-confirm">
  132.                                     <input class="job-popup_field job-popup_checkbox" type="checkbox" name="confirm" id="confirm">
  133.                                     <label for="confirm">
  134.                                         <span>Ich habe die
  135.                                         {% if document.getProperty('dsPageJobPopup') != null and document.getProperty('dsPageJobPopup') is not empty %}
  136.                                             <a href="{{ document.getProperty('dsPageJobPopup').getFullPath() | raw }}" target="_blank">Datenschutzerklärung</a>
  137.                                         {% else %}Datenschutzerklärung{% endif %}
  138.                                         zur Kenntnis genommen.
  139.                                         </span>
  140.                                     </label>
  141.                                     <div class="job-popup_error">Bitte der Datenschutz&shy;erklärung zustimmen.</div>
  142.                                 </div>
  143.                                 <div class="job-popup_field-send">
  144.                                     <div class="job-popup_error">Ihre E-Mail konnte nicht gesendet werden.</div>
  145.                                 </div>
  146.                                 <div class="bb-pt-4">
  147.                                     <div class="job-popup_btn js-job-popup_send" role="button">Senden</div>
  148.                                 </div>
  149.                             </form>
  150.                         </div>
  151.                         <div class="job-popup_success text-center">
  152.                             {{ 'job.popup.success.hint' | trans }}
  153.                             <br/><br/>
  154.                             <div class="job-popup_btn job-popup_btn-m-0  js-job-popup_close" role="button">{{ 'Schließen' | trans }}</div>
  155.                         </div>
  156.                     </div>
  157.                 </div>
  158.                 <div class="bb-flex-1 js-job-popup_close"></div>
  159.             </div>
  160.             <div class="bb-flex-1 js-job-popup_close"></div>
  161.         </div>
  162.         <script>
  163.           let jobPopupRequest = false
  164.           window.onload = function () {
  165.             $(document).on('click', '.js-job-popup_close', function () {
  166.               $('body').removeClass('job-popup_open')
  167.             }).on('click', '.js-job-popup_send', function () {
  168.               if (jobPopupRequest) {
  169.                 return
  170.               }
  171.               $('.job-popup_body').addClass('job-popup_request')
  172.               jobPopupRequest = true
  173.               let jobPopupValid = true
  174.               $('.job-popup_has-error').removeClass('job-popup_has-error')
  175.               $('.job-popup_field').map(function () {
  176.                 if ($(this).hasClass('job-popup_checkbox')) {
  177.                   if ($(this)[0].checked !== true) {
  178.                     $('.job-popup_field-' + $(this)[0].name).addClass('job-popup_has-error')
  179.                     jobPopupValid = false
  180.                   }
  181.                 } else {
  182.                   if ($(this)[0].value.length < 3) {
  183.                     $('.job-popup_field-' + $(this)[0].name).addClass('job-popup_has-error')
  184.                     jobPopupValid = false
  185.                   }
  186.                 }
  187.               })
  188.               if (jobPopupValid) {
  189.                 let data = {}
  190.                 $('.job-popup_field').map(function () {
  191.                   if ($(this).hasClass('job-popup_checkbox')) {
  192.                     data[$(this)[0].name] = $(this)[0].checked
  193.                   } else {
  194.                     data[$(this)[0].name] = $(this)[0].value
  195.                   }
  196.                 })
  197.                 data['brand'] = 'Born'
  198.                 data['recipients'] = '{{ document.getProperty('mailJobPopup') }}'
  199.                 $.ajax({
  200.                   type: 'post',
  201.                   url: '/api/send-job-popup-mail',
  202.                   data: JSON.stringify(data),
  203.                   dataType: 'json',
  204.                   success: function (response) {
  205.                     if (response.success === false) {
  206.                       if (response.errors.length > 0) {
  207.                         response.errors.map(function (item) {
  208.                           $('.job-popup_field-' + item).addClass('job-popup_has-error')
  209.                         })
  210.                       }
  211.                       if (response.sendFailed) {
  212.                         $('.job-popup_field-send').addClass('job-popup_has-error')
  213.                       }
  214.                     } else {
  215.                       $('.job-popup_form').removeClass('active')
  216.                       $('.job-popup_success').addClass('active')
  217.                     }
  218.                     $('.job-popup_body').removeClass('job-popup_request')
  219.                     jobPopupRequest = false
  220.                   },
  221.                   error: function (response) {
  222.                     $('.job-popup_field-send').addClass('job-popup_has-error')
  223.                     $('.job-popup_body').removeClass('job-popup_request')
  224.                     jobPopupRequest = false
  225.                   }
  226.                 })
  227.               } else {
  228.                 $('.job-popup_body').removeClass('job-popup_request')
  229.                 jobPopupRequest = false
  230.               }
  231.             })
  232.             window.setTimeout(() => {
  233.               $('body').addClass('job-popup_open')
  234.             }, {{ delayHtml | raw }})
  235.           }
  236.         </script>
  237.     {% endif %}
  238. {% endif %}