178 lines
5.1 KiB
PHP
178 lines
5.1 KiB
PHP
<? global $lang;?>
|
|
|
|
<div id="newsletter" class="newsletter-2">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<h3>Chcesz być ciągle na bieżąco?</h3>
|
|
<h2>Zaufany Newsletter <span>czeka na Ciebie!</span></h2>
|
|
|
|
<form method="POST" data-toggle="validator" role="form" id="newsletter-form">
|
|
<div class="form-group">
|
|
<label for="newsletter-email"><?= ucfirst( $lang['email'] );?><span class='red'>*</span>:</label>
|
|
<input type='email' id="email" name="email" class="form-control" required />
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
|
|
<div class="form-check">
|
|
<input type="checkbox" class="form-check-input" name="check" id="agreement" required/>
|
|
<label class="form-check-label" for="agreement">
|
|
<?= $lang['newsletter-zgoda'];?>
|
|
</label>
|
|
</div>
|
|
|
|
<a href="#" class="btn1 text-center" id="newsletter-signin">Zapisz się</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript" class="footer">
|
|
$( function()
|
|
{
|
|
$( 'body' ).on( 'click', '#newsletter-form #toggle-data', function()
|
|
{
|
|
if ( $( '#newsletter-form #second' ).hasClass( 'hidden' ) )
|
|
{
|
|
$( '#newsletter-form #second' ).removeClass( 'hidden' );
|
|
$( '#newsletter-form #toggle-data' ).html( '<?= $lang['zwin'];?>' );
|
|
}
|
|
else
|
|
{
|
|
$( '#newsletter-form #second' ).addClass( 'hidden' );
|
|
$( '#newsletter-form #toggle-data' ).html( '<?= $lang['rozwin'];?>' );
|
|
}
|
|
return false;
|
|
});
|
|
|
|
$( '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',
|
|
columnClass: 'col-sm-6 col-sm-offset-3',
|
|
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',
|
|
columnClass: 'col-sm-6 col-sm-offset-3',
|
|
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',
|
|
columnClass: 'col-sm-6 col-sm-offset-3',
|
|
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',
|
|
columnClass: 'col-sm-6 col-sm-offset-3',
|
|
buttons:
|
|
{
|
|
confirm:
|
|
{
|
|
text: '<?= $lang['zamknij'];?>',
|
|
btnClass: 'btn-blue',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|