ldc-groupe/content/themes/ldc/page-press.php
Jérémy Munsch 2f2702caed
Closes #15
2024-06-18 16:00:55 +02:00

284 lines
16 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.

<?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">
<?= wp_kses_post($description); ?>
</div>
</div>
<?php endif; ?>
<?php
$category = 'press';
?>
<div class="posts filter-posts">
<div class="filter fw" data-posts="#<?= esc_attr($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="<?= esc_attr($category) ?>" title="<?php _e('Clear filters', 'LDC Custom string') ?>">&#10006;</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"><?= esc_html($form['title']) ?></span>
<?php endif; ?>
<?php if (!empty($form['subtitle'])) : ?>
<span class="page-press-form__subtitle subtitle-text textblock__subtitle subtitle subtitle_paint"><?= wp_kses_post($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 justify-content-center">
<div class="form__field text-center">
<?php include(get_template_directory() . '/partials/inline-cookie.php') ?>
</div>
</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'); ?>" autocomplete="organization" 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'); ?>" autocomplete="given-name" 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'); ?>" autocomplete="family-name" 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'); ?>" autocomplete="postal-code" 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'); ?>" autocomplete="address-level2" 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'); ?>" autocomplete="email" 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'); ?>" autocomplete="tel" 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="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">
<?php if (ICL_LANGUAGE_CODE === 'fr') : ?>
<span class="form__field-label-text">Les informations recueillies à partir de ce formulaire sont traitées par le Responsable de Traitement pour donner suite à votre demande de contact. Pour connaître vos droits, vous pouvez consulter <br> <a href="/politique-de-confidentialite/" target="_blank">la Charte de confidentialité</a></span>
<?php else : ?>
<span class="form__field-label-text">The information collected from this form is processed by the Data Controller to respond to your contact request. To know your rights, you can consult <br> <a href="/en/privacy-policy/" target="_blank">the Confidentiality Charter</a></span>
<?php endif; ?>
</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>
<?php
$i18NCnList = [
'must_activate_cookies' => ['Vous devez activer les cookies recaptcha', 'You must enable recaptcha cookies'],
'succeed' => ['Message envoyé !', 'Message sent !'],
'invalid_email' => ['Le format de l\'adresse email est invalide.', 'The email address format is invalid.'],
'error' => ['Une erreur est survenue, veuillez recharger la page.', 'An error has occurred, please reload the page.']
];
?>
<?php require_once(__DIR__ . '/contacts/ajax_contact.php') ?>
<script>
<?php /** TODO: Gestion newsletter */ ?>
document.addEventListener('DOMContentLoaded', function() {
const inputs = {
required: {
subject: $("select[name=Subject]"),
company: $("input[name=company]"),
lastname: $("input[name=lastname]"),
firstname: $("input[name=firstname]"),
postcode: $("input[name=postcode]"),
city: $("input[name=city]"),
email: $("input[name=email]"),
phone: $("input[name=phone]"),
message: $("textarea[name=message]"),
},
optional: {
newsletter: $("input[name=newsletter]")
}
};
// 'id': 14,
listenFormSubmit(
// INPUTS
inputs,
// DATA
() => Object.fromEntries([
...[
...Object.entries(inputs.required),
...Object.entries(inputs.optional),
].map(entry => [entry[0], entry[1].val()])
]),
// RESET
() => {
const resetFn = $input => {
if ($input.is("input[type='checkbox']")) {
$input.prop("checked", false);
return;
}
if ($input.is("select")) {
$input.val($input.children().eq(1).val())
return;
}
$input.val('');
};
[...Object.values(inputs.required)].forEach(resetFn);
[...Object.values(inputs.optional)].forEach(resetFn);
},
14
);
});
</script>
</div>
</div>
</div>
</div>
</div>
<script>
$('.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) {
setTimeout(function() {
var hh = $(document).find('.header').outerHeight();
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1, 'swing');
}, 10);
};
}
</script>
<?php get_footer(); ?>