first commit
This commit is contained in:
196
templates_user/site/contact.php
Normal file
196
templates_user/site/contact.php
Normal file
@@ -0,0 +1,196 @@
|
||||
<? global $settings, $lang, $config;?>
|
||||
<? if ( $settings['google_maps'] and $settings['firm_adress'] ):?>
|
||||
<script class="footer" type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&key=<?=$settings['google_map_key']?>"></script>
|
||||
<script class="footer" type="text/javascript">
|
||||
google.maps.event.addDomListener(window, 'load', init);
|
||||
function init() {
|
||||
var mapOptions = {
|
||||
zoom: 15,
|
||||
scrollwheel: false
|
||||
};
|
||||
var mapElement = document.getElementById('google-map');
|
||||
var map = new google.maps.Map(mapElement, mapOptions);
|
||||
var myLatLng = { lat: 50.079740, lng: 22.103477 };
|
||||
|
||||
map.setCenter( myLatLng );
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
position: myLatLng
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<div id='google-map'></div>
|
||||
<? endif;?>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<div id="contact-additional-info"><?= $settings['additional_info'];?></div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<? if ( $settings['contact_form'] ):?>
|
||||
<form class="form-horizontal" id="contact-form">
|
||||
<div id="contact-form">
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-12"><?= ucfirst( $lang['imie-i-nawzisko-lub-nazwa-firmy'] );?> <span class='red'>*</span>:</label>
|
||||
<div class="col-12">
|
||||
<input type='text' id="name" name="name" class="form-control" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emai" class="col-12"><?= ucfirst( $lang['email'] );?> <span class='red'>*</span>:</label>
|
||||
<div class="col-12">
|
||||
<input type='text' id="email" name="email" class="form-control" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emai" class="col-12"><?= ucfirst( $lang['nr-telefonu'] );?>:</label>
|
||||
<div class="col-12">
|
||||
<input type='text' id="phone" name="phone" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="subject" class="col-12"><?= ucfirst( $lang['temat'] );?>:</label>
|
||||
<div class="col-12">
|
||||
<input type='text' id="subject" name="subject" value="Zapytanie ze strony <?= preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );?>" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="text" class="col-12"><?= ucfirst( $lang['wiadomosc'] );?> <span class='red'>*</span>:</label>
|
||||
<div class="col-12">
|
||||
<textarea id="text" name="text" required class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-12">
|
||||
<a class='btn btn-success' id="contact-form-send" onclick="send_message(); return false;"><?= $lang['wyslij-wiadomosc'];?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<? endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<script class="footer" type="text/javascript">
|
||||
function send_message()
|
||||
{
|
||||
var email = $.trim( $( '#contact-form #email' ).val() );
|
||||
var name = $.trim( $( '#contact-form #name' ).val() );
|
||||
var phone = $.trim( $( '#contact-form #phone' ).val() );
|
||||
var subject = $.trim( $( '#contact-form #subject' ).val() );
|
||||
var text = $.trim( $( '#contact-form #text' ).val() );
|
||||
|
||||
if ( email === '' || name === '' || text === '' )
|
||||
{
|
||||
$.alert(
|
||||
{
|
||||
title: '<?= ucfirst( $lang['blad'] );?>',
|
||||
icon: 'fa fa-exclamation',
|
||||
content: '<?= $lang['prosze-uzupelnic-wymagane-pola'];?>',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
autoClose: 'confirm|10000',
|
||||
columnClass: 'large',
|
||||
theme: 'modern',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: '<?= $lang['zamknij'];?>',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/',
|
||||
data:
|
||||
{
|
||||
a: 'contact_form_send',
|
||||
email: email,
|
||||
name: name,
|
||||
phone: phone,
|
||||
subject: subject,
|
||||
text: text
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
alert1 = $.alert(
|
||||
{
|
||||
title: '<?= ucfirst( $lang['informacja'] );?>',
|
||||
icon: 'fa fa-exclamation',
|
||||
content: '<?= $lang['prosze-czekac'];?>',
|
||||
type: 'blue',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
autoClose: 'confirm|10000',
|
||||
columnClass: 'large',
|
||||
theme: 'modern',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: '<?= $lang['zamknij'];?>',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
response = jQuery.parseJSON( data );
|
||||
|
||||
if ( response.status === 'ok' )
|
||||
{
|
||||
var msg = '<?= $lang['wiadomosc-zostala-wyslana'];?>';
|
||||
$( '#contact-form input, #contact-form textarea' ).each( function()
|
||||
{
|
||||
$( this ).val( '' );
|
||||
});
|
||||
}
|
||||
else
|
||||
var msg = '<?= $lang['wiadomosc-niezostala-wyslana'];?>';
|
||||
|
||||
alert1.close();
|
||||
|
||||
$.alert(
|
||||
{
|
||||
title: '<?= ucfirst( $lang['informacja'] );?>',
|
||||
icon: 'fa fa-exclamation',
|
||||
content: msg,
|
||||
type: 'blue',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
autoClose: 'confirm|10000',
|
||||
columnClass: 'large',
|
||||
theme: 'modern',
|
||||
buttons:
|
||||
{
|
||||
confirm:
|
||||
{
|
||||
text: '<?= $lang['zamknij'];?>',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user