324 lines
17 KiB
PHP
324 lines
17 KiB
PHP
<?php
|
||
/*
|
||
Template Name: Page Press
|
||
*/
|
||
?>
|
||
|
||
<?php
|
||
global $tp;
|
||
global $post;
|
||
get_header();
|
||
|
||
$description = get_field('description');
|
||
$form = get_field('contact_form');
|
||
|
||
?>
|
||
|
||
<div class="page-press">
|
||
|
||
<?php get_template_part('partials/hero'); ?>
|
||
<?php get_template_part('partials/breadcrumbs'); ?>
|
||
|
||
<?php if (!empty($description)) : ?>
|
||
<div class="page-press-description fw fw-container">
|
||
<div class="page-press-description__wrapper wrapper description">
|
||
<?php echo $description; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
|
||
<?php
|
||
$category = 'press';
|
||
?>
|
||
<div class="posts filter-posts">
|
||
<div class="filter fw" data-posts="#<?php echo $category ?>" data-list="list-item-press" data-limit="6">
|
||
<div class="filter__wrapper wrapper">
|
||
<div class="filter-menu">
|
||
<div class="filter__select-wrap filter-select-wrap">
|
||
<ul class="filter-select">
|
||
<li>
|
||
<a title="Afficher"><?php _e('Display', 'LDC Custom string'); ?></a>
|
||
<?php tags_filter($category) ?>
|
||
</li>
|
||
</ul>
|
||
|
||
<div class="filter-results-num">
|
||
<?php _e('Results', 'LDC Custom string'); ?> : <span class="filter-results-num__wrap"><span
|
||
class="filter-results-num__current"></span> <?php _e('documents of', 'LDC Custom string'); ?> <span
|
||
class="filter-results-num__total"></span></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="active-filters">
|
||
<div class="active-filters__list"></div>
|
||
<div class="active-filters__clear-wrap">
|
||
<div class="active-filters__item active-filters__item_clear"><a
|
||
class="active-filters__item-remove clear-all"
|
||
data-category="<?php echo $category ?>" title="Effacer les filtres">✖</a>
|
||
<?php _e('Clear filters', 'LDC Custom string'); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="posts-list fw fw-container no-top-padding">
|
||
<div class="posts-list__wrapper wrapper">
|
||
<div class="list-items posts-container" id="posts-container">
|
||
<?php echo do_shortcode('[ajax_load_more theme_repeater="list-item-press" id="press" category="' . $category . '" loading_style="infinite fading-circles" post_type="post" posts_per_page="6" max_pages="1" scroll="true" button_label="Voir plus de ressources documentaires" nester="true"]') ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="page-press-form">
|
||
<div class="page-press-form fw fw-container gray-bg">
|
||
<div class="page-press-form__wrapper wrapper">
|
||
<?php if (!empty($form['title']) || !empty($form['subtitle']['text'])) : ?>
|
||
<h2 class="page-press-form__title textblock__title title">
|
||
<?php if (!empty($form['title'])) : ?>
|
||
<span class="title-text"><?php echo $form['title']; ?></span>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($form['subtitle'])) : ?>
|
||
<span class="page-press-form__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?php echo $form['subtitle']; ?></span>
|
||
<?php endif; ?>
|
||
</h2>
|
||
<?php endif; ?>
|
||
<div class="fw-container no-bottom-padding">
|
||
|
||
<form class="wpcf7-form">
|
||
<div class="form__container">
|
||
<div class="form__title subtitle"><?php _e('Your contact details', 'LDC Custom string'); ?></div>
|
||
<div class="form__row">
|
||
<div class="form__field form__field_flex">
|
||
<div class="form__label"><?php _e('Subject', 'LDC Custom string'); ?> : </div>
|
||
<span class="wpcf7-form-control-wrap">
|
||
<select name="Subject" class="form__input form__input_notinput"
|
||
aria-required="true" aria-invalid="false">
|
||
<option value="" class="disabled"
|
||
disabled="disabled"><?php _e('Select', 'LDC Custom string'); ?></option>
|
||
<option value="Demander le logo du Groupe"><?php _e('Group logo request', 'LDC Custom string'); ?></option>
|
||
<option value="Demander un logo de filiale-société "><?php _e('Subsidiary/company logo request', 'LDC Custom string'); ?></option>
|
||
<option value="Demander un logo de marque "><?php _e('Brand logo request', 'LDC Custom string'); ?></option>
|
||
<option value="Demande de photos"><?php _e('Photo request', 'LDC Custom string'); ?></option>
|
||
<option value="Autre"><?php _e('Other', 'LDC Custom string'); ?></option>
|
||
</select>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form__row">
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Company', 'LDC Custom string'); ?> *</div>
|
||
<input type="text" name="company" size="40" class="form__input"
|
||
placeholder="<?php _e('Your company', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
</div>
|
||
<div class="form__row">
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Surname', 'LDC Custom string'); ?> *</div>
|
||
<input type="text" name="lastname" size="40" class="form__input"
|
||
placeholder="<?php _e('Your surname', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('First name', 'LDC Custom string'); ?> *</div>
|
||
<input type="text" name="firstname" size="40" class="form__input"
|
||
placeholder="<?php _e('Your first name', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
</div>
|
||
<div class="form__row">
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Postcode', 'LDC Custom string'); ?> *</div>
|
||
<input type="text" name="postcode" size="40" class="form__input"
|
||
placeholder="<?php _e('For example, TA7 8DL', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Town', 'LDC Custom string'); ?> *</div>
|
||
<input type="text" name="city" size="40" class="form__input"
|
||
placeholder="<?php _e('For example, Bridgwater', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
</div>
|
||
<div class="form__row">
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Email address', 'LDC Custom string'); ?> *</div>
|
||
<input type="email" name="email" size="40" class="form__input" aria-required="true"
|
||
aria-invalid="false" placeholder="<?php _e('Firstname.surname@mail.fr', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
<div class="form__field">
|
||
<div class="form__field-title"><?php _e('Telephone', 'LDC Custom string'); ?> *</div>
|
||
<input type="tel" name="phone" size="20" class="form__input"
|
||
placeholder="<?php _e('For example, 02 43 62 70 00', 'LDC Custom string'); ?>" required>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form__container">
|
||
<div class="form__field-title"><?php _e('Your message', 'LDC Custom string'); ?> *</div>
|
||
|
||
<div class="form__field">
|
||
<textarea name="message" cols="40" rows="10" class="form__input"
|
||
placeholder="<?php _e('Please specify what your request is', 'LDC Custom string'); ?>" required></textarea>
|
||
</div>
|
||
|
||
<div class="form__row">
|
||
<div class="form__field">
|
||
<label class="form__field-pseudolabel">
|
||
<input type="checkbox" name="agree">
|
||
<span class="form__field-pseudosquare"><?php _e('I accept the conditions of use', 'LDC Custom string'); ?> *</span>
|
||
</label>
|
||
<label class="form__field-pseudolabel">
|
||
<input type="checkbox" name="newsletter">
|
||
<span class="form__field-pseudosquare"><?php _e('I would like to subscribe to the newsletter', 'LDC Custom string'); ?></span>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="form__field">
|
||
<div class="form__tip">* <?php _e('Compulsory fields', 'LDC Custom string'); ?></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form__response" style="display: none;"><?php _e('One or more fields contain an error. Please check and try again.', 'LDC Custom string'); ?>
|
||
</div>
|
||
|
||
<div class="form__row">
|
||
<div class="form-submit">
|
||
<input type="submit" value="<?php _e('Send', 'LDC Custom string'); ?>" class="form-submit__btn btn">
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</form>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
|
||
let processing = false;
|
||
let subject = $("select[name=Subject]");
|
||
let company = $("input[name=company]");
|
||
let lastname = $("input[name=lastname]");
|
||
let firstname = $("input[name=firstname]");
|
||
let postcode = $("input[name=postcode]");
|
||
let city = $("input[name=city]");
|
||
let phone = $("input[name=phone]");
|
||
let email = $("input[name=email]");
|
||
let message = $("textarea[name=message]");
|
||
let agree = $("input[name=agree]");
|
||
// TODO : Gestion newsletter
|
||
let newsletter = $("input[name=newsletter]");
|
||
|
||
function reset() {
|
||
subject.val('');
|
||
company.val('');
|
||
lastname.val('');
|
||
firstname.val('');
|
||
postcode.val('');
|
||
city.val('');
|
||
phone.val('');
|
||
email.val('');
|
||
message.val('');
|
||
|
||
$('.geographic-checkboxes-result').html('');
|
||
|
||
agree.prop("checked", false);
|
||
newsletter.prop("checked", false);
|
||
}
|
||
|
||
$("input[type=submit]").on('click', function (e) {
|
||
e.preventDefault();
|
||
|
||
if (processing === true)
|
||
return;
|
||
|
||
if (subject.val().length > 0 && company.val().length > 0 && lastname.val().length > 0 && firstname.val().length > 0 && postcode.val().length > 0 && city.val().length > 0 && phone.val().length > 0 && email.val().length > 0 && message.val().length > 0) {
|
||
|
||
if (/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email.val())) {
|
||
|
||
$(".form__response").hide();
|
||
|
||
if (agree.is(':checked') === false) {
|
||
alert("Vous devez accepter les conditions d'utilisation.");
|
||
} else {
|
||
processing = true;
|
||
grecaptcha.ready(function () {
|
||
grecaptcha.execute('6LePZvAUAAAAABs8uGHxhSkJVPVs4yCJ3amJ1HpX', {action: 'contact'}).then(function (token) {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: window.location.origin + '/wp-admin/admin-ajax.php',
|
||
data: {
|
||
'token': token,
|
||
'action': 'ContactAjx',
|
||
'id': 14,
|
||
'firstname': firstname.val(),
|
||
'lastname': lastname.val(),
|
||
'email': email.val(),
|
||
'company': company.val(),
|
||
'subject': subject.val(),
|
||
'postcode': postcode.val(),
|
||
'city': city.val(),
|
||
'phone': phone.val(),
|
||
'message': message.val()
|
||
},
|
||
success: function (response, textStatus, jqXHR) {
|
||
reset();
|
||
alert('Message envoyé !');
|
||
processing = false;
|
||
},
|
||
error: function (jqXHR, textStatus, errorThrown) {
|
||
alert('Une erreur est survenue, veuillez recharger la page.');
|
||
processing = false;
|
||
}
|
||
});
|
||
});
|
||
});
|
||
}
|
||
} else {
|
||
alert('Le format de l\'adresse email est invalide.');
|
||
}
|
||
} else {
|
||
$(".form__response").show();
|
||
}
|
||
|
||
});
|
||
</script>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
//$(document).find("select").val($("select option:first").attr('disabled', 'disabled'));
|
||
//$(document).find('option:first').addClass('highlight');
|
||
$('.page-press-form').find("select option:first").addClass('disabled').attr('disabled', 'disabled');
|
||
var _select = $('.page-press-form').find("select");
|
||
_select.change(function () {
|
||
_select.addClass('changed');
|
||
});
|
||
|
||
|
||
if (window.location.hash) {
|
||
var hash = window.location.hash;
|
||
|
||
window.almComplete = function (alm) {
|
||
console.log('sss');
|
||
setTimeout(function () {
|
||
var hh = $(document).find('.header').outerHeight();
|
||
|
||
$('html, body').animate({
|
||
scrollTop: $(hash).offset().top
|
||
}, 1, 'swing');
|
||
}, 10);
|
||
};
|
||
}
|
||
|
||
|
||
</script>
|
||
|
||
|
||
<?php get_footer(); ?>
|