{% set textblock = pimcore_textarea('textblock', {
'width': 800,
'height': 100,
'placeholder': 'Text ...'
}) %}
{% set delay = pimcore_input('delay', {
'width': 152,
'placeholder': '3 (default)'
}) %}
{% if document.getProperty('mailJobPopup') != null and document.getProperty('mailJobPopup') is not empty %}
{% set email = document.getProperty('mailJobPopup') %}
{% else %}
{% set email = null %}
{% endif %}
{% if editmode %}
{% set image = pimcore_image('image', {
'width': 800,
'height': 450
}) %}
<div class="flex-col offset-bottom-single">
<div class="col xs-12">
<span class="hint"><big>Job-Popup</big><small><br/><br/></small><strong>Bild:</strong> ( 16:9 )</span>
<div>{{ image | raw }}</div>
</div>
<div class="col xs-12">
<span class="hint"><strong>Text:</strong></span>
<div>{{ textblock | raw }}</div>
</div>
<div class="col xs-12">
<span class="hint"><strong>Verzögerung:</strong><br/><small>Nach wie viel Sekunden soll das Popup öffnen?<br/>( Default 3s / nur ganze Sekunden! )<br/> </small></span>
<div>{{ delay | raw }}</div>
<div> </div>
</div>
<div class="col xs-12">
<span class="hint"><strong>E-Mail:</strong><br/><span
style="color:#666"><small>aus der Page-Property "mailJobPopup"<br/> </small></span></span>
{% if email is empty %}
<div style="color:red">Bitte Page-Property setzten! (s.u.)</div>
{% else %}
<div style="color:#666">{{ email | raw }}</div>
{% endif %}
<div> </div>
</div>
<div class="col xs-12" style="color:#002a44">
<br/>Dieses Snippet muss in die Page-Property "snippetJobPopup" vom Typ "Document" gezogen werden. Diese Property kann auf Root des
Sprachbaumes liegen.<small><br/><br/></small>
Das Popup wird dargestellt, wenn auf der Seite eine Page-Property "showJobPopup" vom Typ "Checkbox" gesetzt ist. Bitte diese Property nicht
vererben!<small><br/><br/></small>
Die Mail wird an die E-MailAdresse in der Page-Property "mailJobPopup" vom Typ "Text" gesendet. Diese Property kann ebenfalls auf Root des
Sprachbaumes liegen.<br/><br/>
</div>
</div>
{% else %}
{% set image = pimcore_image('image', {
'thumbnail': 'jobPopup',
'disableWidthHeightAttributes': true,
'cacheBuster': true,
'imgAttributes': {
'class': 'job-popup_img',
},
}) %}
{% set delayHtml = '3000' %}
{% if delay.getData() is not empty %}
{% set delayHtml = delay.getData() ~ '000' %}
{% endif %}
{% if email is not empty %}
<div class="job-popup">
<div class="bb-flex-1 js-job-popup_close"></div>
<div class="bb-flex-col">
<div class="bb-flex-1 js-job-popup_close"></div>
<div class="job-popup_box">
{% if image.getId() != null %}
<div>{{ image | raw }}</div>
<div class="job-popup_closer js-job-popup_close">
<svg xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"></path>
<path fill="currentColor"
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>
</svg>
</div>
{% endif %}
<div class="job-popup_body">
{% if textblock.getData() is not empty %}
<div class="bb-pb-2 text-center">{{ textblock.getData() | raw }}</div>
{% endif %}
<div class="job-popup_form active">
<form>
<div class="form-field job-popup_field-gender">
<label for="gender" class="required">Anrede</label>
<select class="job-popup_field" id="gender" name="gender">
<option value="">Bitte wählen ...</option>
<option value="male">Herr</option>
<option value="female">Frau</option>
<option value="divers">Divers</option>
</select>
<div class="job-popup_error">Bitte Anrede auswählen.</div>
</div>
<div class="form-field job-popup_field-firstname">
<label class="required" for="firstname">Vorname</label>
<input class="job-popup_field" id="firstname" name="firstname" type="text" autocomplete="given-name"/>
<div class="job-popup_error">Bitte Vorname angeben.</div>
</div>
<div class="form-field job-popup_field-lastname">
<label class="required" for="lastname">Nachname</label>
<input class="job-popup_field" id="lastname" name="lastname" type="text" autocomplete="family-name"/>
<div class="job-popup_error">Bitte Nachname angeben.</div>
</div>
<div class="form-field job-popup_field-email">
<label class="required" for="email">E-Mail</label>
<input class="job-popup_field" id="email" name="email" type="email" autocomplete="email"/>
<div class="job-popup_error">Bitte E-Mail-Adresse angeben.</div>
</div>
<div class="form-field job-popup_field-phone">
<label class="required" for="phone">Telefon</label>
<input class="job-popup_field" id="phone" name="phone" type="text" autocomplete="tel"/>
<div class="job-popup_error">Bitte Telefon-Nummer angeben.</div>
</div>
<div class="form-field job-popup_field-recall">
<label for="recall" class="required">Gewünschter Kontakt</label>
<select class="job-popup_field" id="recall" name="recall">
<option value="phone">per Telefon</option>
<option value="email">per E-Mail</option>
</select>
<div class="job-popup_error">Bitte gewünschte Kontaktaufnahme wählen.</div>
</div>
<div class="form-field job-popup_field-message">
<label class="required" for="message">Gewünschte Stelle / Nachricht</label>
<textarea class="job-popup_field" id="message" name="message" type="message"></textarea>
<div class="job-popup_error">Bitte eine Nachricht eingeben.</div>
</div>
<div class="checkout-confirm-container agreement-check job-popup_field-confirm">
<input class="job-popup_field job-popup_checkbox" type="checkbox" name="confirm" id="confirm">
<label for="confirm">
<span>Ich habe die
{% if document.getProperty('dsPageJobPopup') != null and document.getProperty('dsPageJobPopup') is not empty %}
<a href="{{ document.getProperty('dsPageJobPopup').getFullPath() | raw }}" target="_blank">Datenschutzerklärung</a>
{% else %}Datenschutzerklärung{% endif %}
zur Kenntnis genommen.
</span>
</label>
<div class="job-popup_error">Bitte der Datenschutz­erklärung zustimmen.</div>
</div>
<div class="job-popup_field-send">
<div class="job-popup_error">Ihre E-Mail konnte nicht gesendet werden.</div>
</div>
<div class="bb-pt-4">
<div class="job-popup_btn js-job-popup_send" role="button">Senden</div>
</div>
</form>
</div>
<div class="job-popup_success text-center">
{{ 'job.popup.success.hint' | trans }}
<br/><br/>
<div class="job-popup_btn job-popup_btn-m-0 js-job-popup_close" role="button">{{ 'Schließen' | trans }}</div>
</div>
</div>
</div>
<div class="bb-flex-1 js-job-popup_close"></div>
</div>
<div class="bb-flex-1 js-job-popup_close"></div>
</div>
<script>
let jobPopupRequest = false
window.onload = function () {
$(document).on('click', '.js-job-popup_close', function () {
$('body').removeClass('job-popup_open')
}).on('click', '.js-job-popup_send', function () {
if (jobPopupRequest) {
return
}
$('.job-popup_body').addClass('job-popup_request')
jobPopupRequest = true
let jobPopupValid = true
$('.job-popup_has-error').removeClass('job-popup_has-error')
$('.job-popup_field').map(function () {
if ($(this).hasClass('job-popup_checkbox')) {
if ($(this)[0].checked !== true) {
$('.job-popup_field-' + $(this)[0].name).addClass('job-popup_has-error')
jobPopupValid = false
}
} else {
if ($(this)[0].value.length < 3) {
$('.job-popup_field-' + $(this)[0].name).addClass('job-popup_has-error')
jobPopupValid = false
}
}
})
if (jobPopupValid) {
let data = {}
$('.job-popup_field').map(function () {
if ($(this).hasClass('job-popup_checkbox')) {
data[$(this)[0].name] = $(this)[0].checked
} else {
data[$(this)[0].name] = $(this)[0].value
}
})
data['brand'] = 'Born'
data['recipients'] = '{{ document.getProperty('mailJobPopup') }}'
$.ajax({
type: 'post',
url: '/api/send-job-popup-mail',
data: JSON.stringify(data),
dataType: 'json',
success: function (response) {
if (response.success === false) {
if (response.errors.length > 0) {
response.errors.map(function (item) {
$('.job-popup_field-' + item).addClass('job-popup_has-error')
})
}
if (response.sendFailed) {
$('.job-popup_field-send').addClass('job-popup_has-error')
}
} else {
$('.job-popup_form').removeClass('active')
$('.job-popup_success').addClass('active')
}
$('.job-popup_body').removeClass('job-popup_request')
jobPopupRequest = false
},
error: function (response) {
$('.job-popup_field-send').addClass('job-popup_has-error')
$('.job-popup_body').removeClass('job-popup_request')
jobPopupRequest = false
}
})
} else {
$('.job-popup_body').removeClass('job-popup_request')
jobPopupRequest = false
}
})
window.setTimeout(() => {
$('body').addClass('job-popup_open')
}, {{ delayHtml | raw }})
}
</script>
{% endif %}
{% endif %}