177 lines
5.3 KiB
PHP
177 lines
5.3 KiB
PHP
<? global $lang;?>
|
|
|
|
<div class="box-newsletter">
|
|
<div class="container">
|
|
<div class="box-newsletter-inner">
|
|
<div class="_row-1">
|
|
<div class="_col-1">
|
|
<?= \front\view\Scontainers::scontainer( 12 );?>
|
|
</div>
|
|
<div class="_col-2">
|
|
<form action="" method="POST" id="newsletter-form">
|
|
<div class="form_row_1">
|
|
<input type='email' id="email" name="email" placeholder="Twój adres email" required />
|
|
<a href="#" class="newsletter_btn" id="newsletter-signin">Zapisz się!</a>
|
|
</div>
|
|
<div class="form_row_2">
|
|
<input type="checkbox" id="agreement" />
|
|
<div>
|
|
<label for="agreement" id="zgod_first"><?= $lang['newsletter-zgoda-1'];?></label>
|
|
<label for="agreement" id="zgod_second"><?= $lang['newsletter-zgoda-2'];?></label>
|
|
<p id="toggle-data1">Pokaż więcej</p>
|
|
</div>
|
|
</div>
|
|
<div class="form_row_3">
|
|
<span id="adm_first" class="bold"><?= $lang['newsletter-administrator-danych-1'];?></span>
|
|
<span id="adm_second" class="hidden"><?= $lang['newsletter-administrator-danych-2'];?></span>
|
|
<p id="toggle-data2"><?= $lang['rozwin'];?></p>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script class="footer" type="text/javascript">
|
|
$(function() {
|
|
|
|
$('body').on('click', '#newsletter-form #toggle-data1', function() {
|
|
$(".form_row_2 #zgod_second").slideToggle(function() {
|
|
if ($(this).is(':visible'))
|
|
$('#newsletter-form #toggle-data1').html('<?= $lang['zwin']; ?>');
|
|
else
|
|
$('#newsletter-form #toggle-data1').html('<?= $lang['rozwin']; ?>');
|
|
})
|
|
});
|
|
$('body').on('click', '#newsletter-form #toggle-data2', function() {
|
|
$(".form_row_3 #adm_second").slideToggle(function() {
|
|
if ($(this).is(':visible'))
|
|
$('#newsletter-form #toggle-data2').html('<?= $lang['zwin']; ?>');
|
|
else
|
|
$('#newsletter-form #toggle-data2').html('<?= $lang['rozwin']; ?>');
|
|
})
|
|
});
|
|
|
|
$('body').on('click', '#newsletter-form #newsletter-signin', function() {
|
|
if (!$('#newsletter-form #agreement').is(':checked')) {
|
|
$.alert({
|
|
title: '<?= ucfirst($lang['blad']); ?>',
|
|
content: '<?= $lang['newsletter-zgoda-komunikat']; ?>',
|
|
type: 'orange',
|
|
closeIcon: true,
|
|
closeIconClass: 'fa fa-close',
|
|
typeAnimated: true,
|
|
animation: 'opacity',
|
|
autoClose: 'confirm|10000',
|
|
boxWidth: '650px',
|
|
useBootstrap: false,
|
|
theme: 'modern',
|
|
buttons: {
|
|
confirm: {
|
|
text: '<?= $lang['zamknij']; ?>',
|
|
btnClass: 'btn-blue',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
|
|
var email = $.trim($('#newsletter-form #email').val());
|
|
var token = $.trim($('#newsletter-form #token').val());
|
|
|
|
if (email === '') {
|
|
$.alert({
|
|
title: '<?= ucfirst($lang['blad']); ?>',
|
|
content: '<?= $lang['newsletter-prosze-uzupelnic-email']; ?>',
|
|
type: 'orange',
|
|
closeIcon: true,
|
|
closeIconClass: 'fa fa-close',
|
|
typeAnimated: true,
|
|
animation: 'opacity',
|
|
autoClose: 'confirm|10000',
|
|
boxWidth: '650px',
|
|
useBootstrap: false,
|
|
theme: 'modern',
|
|
buttons: {
|
|
confirm: {
|
|
text: '<?= $lang['zamknij']; ?>',
|
|
btnClass: 'btn-blue',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
}
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/newsletter/signin',
|
|
data: {
|
|
email: email
|
|
},
|
|
beforeSend: function() {
|
|
alert1 = $.alert({
|
|
title: '<?= $lang['informacja']; ?>',
|
|
content: '<?= $lang['prosze-czekac']; ?>',
|
|
type: 'blue',
|
|
closeIcon: true,
|
|
closeIconClass: 'fa fa-close',
|
|
typeAnimated: true,
|
|
animation: 'opacity',
|
|
autoClose: 'confirm|60000',
|
|
boxWidth: '650px',
|
|
useBootstrap: false,
|
|
theme: 'modern',
|
|
buttons: {
|
|
confirm: {
|
|
text: '<?= $lang['zamknij']; ?>',
|
|
btnClass: 'btn-blue',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
success: function(data) {
|
|
response = jQuery.parseJSON(data);
|
|
$('.jqibox').remove();
|
|
|
|
if (response.status === 'ok')
|
|
var msg = '<?= $lang['newsletter-potwierdzenie-dodania']; ?>';
|
|
else
|
|
var msg = '<?= $lang['newsletter-potwierdzenie-dodania-blad']; ?>';
|
|
|
|
alert1.close();
|
|
|
|
$.alert({
|
|
title: '<?= $lang['informacja']; ?>',
|
|
content: msg,
|
|
type: 'blue',
|
|
closeIcon: true,
|
|
closeIconClass: 'fa fa-close',
|
|
typeAnimated: true,
|
|
animation: 'opacity',
|
|
autoClose: 'confirm|10000',
|
|
boxWidth: '650px',
|
|
useBootstrap: false,
|
|
theme: 'modern',
|
|
buttons: {
|
|
confirm: {
|
|
text: '<?= $lang['zamknij']; ?>',
|
|
btnClass: 'btn-blue',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|