ldc-groupe/content/themes/ldc/page-press.php
Vincent BRIDIER bdc33f653c Fix typo 1.1
2020-10-13 16:21:35 +02:00

286 lines
14 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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'); ?>
<!-- TODO : breadcrumbs fix -->
<?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">Afficher</a>
<?php tags_filter($category) ?>
</li>
</ul>
<div class="filter-results-num">
Résultat : <span class="filter-results-num__wrap"><span
class="filter-results-num__current"></span> documents sur <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">&#10006;</a>
Effacer les filtres
</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">Vos coordonées</div>
<div class="form__row">
<div class="form__field form__field_flex">
<div class="form__label">Objet de votre demande :</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">Sélectionnez</option>
<option value="Demander le logo du Groupe">Demander le logo du Groupe</option>
<option value="Demander un logo de filiale-société ">Demander un logo de filiale/société</option>
<option value="Demander un logo de marque ">Demander un logo de marque</option>
<option value="Demande de photos">Demande de photos</option>
<option value="Autre">Autre</option>
</select>
</span>
</div>
</div>
<div class="form__row">
<div class="form__field">
<div class="form__field-title">Société *</div>
<input type="text" name="company" size="40" class="form__input" placeholder="Votre société" required>
</div>
</div>
<div class="form__row">
<div class="form__field">
<div class="form__field-title">Nom *</div>
<input type="text" name="lastname" size="40" class="form__input" placeholder="Votre Nom" required>
</div>
<div class="form__field">
<div class="form__field-title">Prénom *</div>
<input type="text" name="firstname" size="40" class="form__input" placeholder="Votre Prénom" required>
</div>
</div>
<div class="form__row">
<div class="form__field">
<div class="form__field-title">Code postal *</div>
<input type="text" name="postcode" size="40" class="form__input" placeholder="Par exemple, 72000" required>
</div>
<div class="form__field">
<div class="form__field-title">Ville *</div>
<input type="text" name="city" size="40" class="form__input" placeholder="Par exemple, Sablé-sur-Sarthe" required>
</div>
</div>
<div class="form__row">
<div class="form__field">
<div class="form__field-title">Adresse Email *</div>
<input type="email" name="email" size="40" class="form__input" aria-required="true" aria-invalid="false" placeholder="Prenom.nom@mail.fr" required>
</div>
<div class="form__field">
<div class="form__field-title">Téléphone *</div>
<input type="tel" name="phone" size="20" class="form__input" placeholder="Par exemple, 02 43 62 70 00" required>
</div>
</div>
</div>
<div class="form__container">
<div class="form__field-title">Votre message *</div>
<div class="form__field">
<textarea name="message" cols="40" rows="10" class="form__input" placeholder="Précisez votre demande" 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">J’accepte les conditions d’utilisation *</span>
</label>
<label class="form__field-pseudolabel">
<input type="checkbox" name="newsletter">
<span class="form__field-pseudosquare">Je souhaite m’inscrire à la newsletter</span>
</label>
</div>
<div class="form__field">
<div class="form__tip">* Champs obligatoires</div>
</div>
</div>
<div class="form__row">
<!-- TODO : Gestion recaptcha -->
<div class="form__field">[recaptcha]</div>
</div>
<div class="form__response" style="display: none;">Un ou plusieurs champs
contiennent une erreur. Veuillez vérifier et essayer à nouveau.
</div>
<div class="form__row">
<div class="form-submit">
<input type="submit" value="Envoyer" class="form-submit__btn btn">
</div>
</div>
</div>
</form>
</div>
<script>
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]");
$("input[type=submit]").on('click', function (e) {
e.preventDefault();
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) {
$(".form__response").hide();
if (agree.is(':checked') === false) {
alert("Vous devez accepter les conditions d'utilisation.");
} else {
$.ajax({
type: "POST",
url: window.location.origin + '/wp-admin/admin-ajax.php',
data: {
'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) {
alert('Message envoyé !');
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Une erreur est survenue, veuillez recharger la page.');
}
});
}
} 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(); ?>