<link rel="stylesheet" href="{{ asset('build/css/annonces/elite/list_recherche_standard.css') }}">
<link rel="stylesheet" href="{{ asset('build/css/annonces/elite/liste_profils_strategiques.css') }}">
<input type="hidden" id="identifiant_profil" name="identifiant_profil" value=""/>
<script>
function toggleDropdown(dropdownId) {
const dropdown = document.getElementById(dropdownId);
const header = dropdown ? dropdown.previousElementSibling : null;
// Fermer toutes les autres dropdowns
document.querySelectorAll('.dropdown-list').forEach(otherDropdown => {
if (otherDropdown.id !== dropdownId) {
otherDropdown.classList.remove('active');
const otherHeader = otherDropdown.previousElementSibling;
if (otherHeader && otherHeader.classList.contains('select-header')) {
otherHeader.classList.remove('active');
}
}
});
// Toggle la dropdown ciblée
if (dropdown) {
dropdown.classList.toggle('active');
}
if (header && header.classList.contains('select-header')) {
header.classList.toggle('active');
}
}
function selectOption(element, dropdownId) {
const dropdown = document.getElementById(dropdownId);
if (!dropdown) {
return;
}
if (element) {
let identifiantProfil = element.getAttribute('data-key');
const inputHidden = document.getElementById("identifiant_profil");
if (inputHidden) {
inputHidden.value = identifiantProfil;
}
}
// Retirer la sélection précédente dans cette dropdown uniquement
dropdown.querySelectorAll('.option-item').forEach(item => {
item.classList.remove('selected');
});
// Ajouter la sélection à l'élément cliqué
element.classList.add('selected');
// Trouver le header correspondant à cette dropdown
const header = dropdown.previousElementSibling;
if (header && header.classList.contains('select-header')) {
const text = element.textContent.trim().replace('→', '').trim();
header.innerHTML = `<span class="selected-value">${text}</span>`;
}
// Fermer la dropdown
toggleDropdown(dropdownId);
}
// Fermer les dropdowns si on clique ailleurs
document.addEventListener('click', function (event) {
const customSelects = document.querySelectorAll('.custom-select');
let clickedInsideAnySelect = false;
// Vérifier si le clic est à l'intérieur d'une des custom-select
customSelects.forEach(customSelect => {
if (customSelect.contains(event.target)) {
clickedInsideAnySelect = true;
}
});
// Si le clic est en dehors de toutes les custom-select, fermer toutes les dropdowns
if (!clickedInsideAnySelect) {
document.querySelectorAll('.dropdown-list').forEach(dropdown => {
dropdown.classList.remove('active');
const header = dropdown.previousElementSibling;
if (header && header.classList.contains('select-header')) {
header.classList.remove('active');
}
});
}
if (!clickedInsideAnySelect) {
let dropdownId = null;
dropdownId = document.getElementById('dropdown2');
if (dropdownId) {
dropdownId.classList.remove('active');
}
dropdownId = document.getElementById('dropdown3');
if (dropdownId) {
dropdownId.classList.remove('active');
}
}
});
// Fonction utilitaire pour obtenir la valeur sélectionnée d'une dropdown
function getSelectedValue(dropdownId) {
const dropdown = document.getElementById(dropdownId);
if (!dropdown)
{
return null;
}
const selectedOption = dropdown.querySelector('.option-item.selected');
return selectedOption ? selectedOption.textContent.trim().replace('→', '').trim() : null;
}
// Fonction utilitaire pour définir la valeur sélectionnée d'une dropdown
function setSelectedValue(dropdownId, value) {
const dropdown = document.getElementById(dropdownId);
if (!dropdown)
{
return;
}
const options = dropdown.querySelectorAll('.option-item');
const header = dropdown.previousElementSibling;
options.forEach(option => {
const optionText = option.textContent.trim().replace('→', '').trim();
if (optionText === value) {
// Retirer les sélections précédentes
dropdown.querySelectorAll('.option-item').forEach(item => {
item.classList.remove('selected');
});
// Sélectionner cette option
option.classList.add('selected');
// Mettre à jour le header
if (header && header.classList.contains('select-header')) {
header.innerHTML = `<span class="selected-value">${value}</span>`;
}
}
});
}
function resetSelection(selectId) {
// Retirer toutes les sélections
document.querySelectorAll(`#${selectId} .option-item`).forEach(item => {
item.classList.remove('selected');
});
// Réinitialiser le header avec le texte par défaut
const header = document.querySelector(`#${selectId} .select-header`);
const placeholderText = selectId === 'select1'
? 'Voir tous les critères disponibles'
: 'Voir tous les profils stratégiques';
header.innerHTML = `<span class="placeholder">${placeholderText}</span>`;
const inputHidden = document.getElementById("identifiant_profil");
if (inputHidden) {
inputHidden.value = "";
}
toggleDropdown("dropdown2");
}
</script>
{% if app.user|default %}
{% if app.user is hasService(elite_provider.codeServices) %}
{# OK !! #}
{% else %}
<script>
document.addEventListener('DOMContentLoaded', function () {
const btnRechercher = document.getElementById('rechercher');
const inputHidden = document.getElementById("identifiant_profil");
if (inputHidden && btnRechercher) {
btnRechercher.addEventListener('click', function (e) {
if (inputHidden.value) {
e.preventDefault(); // Empêche la soumission du formulaire
// AUTHENTIFIÉ non autorisé
$("#ModalElite").modal("show");
return false;
} else {
//const form = document.getElementById("form_reprendre");
//form.submit();
}
});
}
});
</script>
{% endif %}
{% else %}
<script>
document.addEventListener('DOMContentLoaded', function () {
const btnRechercher = document.getElementById('rechercher');
const inputHidden = document.getElementById("identifiant_profil");
if (inputHidden && btnRechercher) {
btnRechercher.addEventListener('click', function (e) {
if (inputHidden.value) {
e.preventDefault(); // Empêche la soumission du formulaire
// AUTHENTIFIÉ non autorisé
$("#ModalElite").modal("show");
return false;
} else {
//const form = document.getElementById("form_reprendre");
//form.submit();
}
});
}
});
</script>
{% endif %}
{% set profils = elite_provider.listProfilsStrategiques %}
<div class="form-row">
<div class="col-10 offset-1 col-md-4 offset-md-1 mr-2 mt-2 pt-2 text-left text-md-right nowrap_custom">
Quel type d’entreprise vous intéresse ?
</div>
<div class="col-10 offset-1 col-md-5 offset-md-0 mt-2 input-group">
<div class="custom-select restore-native" id="select2" style="border: 1px solid #003366;">
<div class="select-header d-flex" onclick="toggleDropdown('dropdown2');" >
<div class="placeholder" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; ">Choisissez parmi 14 profils</div>
<div class="logo d-none d-lg-block" style="flex-basis:30%"> </div>
</div>
<div class="select-dropdown" id="dropdown2">
<div class="reset-option" onclick="resetSelection('select2');">
<i class="fas fa-times-circle reset-icon"></i>
<span>Réinitialiser la sélection</span>
</div>
{% for categorie,profil in profils %}
<div class="option-category">
{{ categorie }}
</div>
{% for k,p in profil %}
<div class="option-item" data-key="{{ k }}" onclick="selectOption(this, 'dropdown2');">
• {{ p[0] }}
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>
<div class="col-12 col-md-1 text-center text-md-left mt-2 d-md-none">
<a href="{{ lienElitePresentation }}" title="FUSACQ Elite">
<img src="/FUSACQ2020/images/fusacq_elite.gif" alt="FUSACQ Elite">
</a>
</div>
</div>
{% include 'elite/includes/elite_profil_access.html.twig' %}