This commit is contained in:
KONE SOREL 2026-02-26 14:39:56 +00:00
parent 05203829af
commit 83dc807640
3 changed files with 58 additions and 31 deletions

View File

@ -1230,9 +1230,13 @@ h6 a:hover {
/* --- FIX SELECTPICKER GLOBAL --- */
/* Cache l'élément select original que le plugin est censé remplacer */
/* Cache l'élément select original de manière invisible pour le DOM */
select.selectpicker {
display: none !important;
visibility: hidden !important;
height: 0 !important;
padding: 0 !important;
border: none !important;
}
/* Si Bootstrap-Select crée une copie invisible mais qui prend de la place */
@ -1246,13 +1250,11 @@ select.selectpicker {
.btn-form-select {
background-color: #fff !important;
border: 1px solid #e2e8f0 !important;
color: #4a5568 !important;
color: var(--color-primary) !important;
font-size: 0.82rem !important;
padding: 0.45rem 0.75rem !important;
padding: 0.5rem 0.75rem !important;
border-radius: var(--radius-sm) !important;
width: 100%;
text-align: left;
display: flex;
display: flex !important;
align-items: center;
justify-content: space-between;
}
@ -1262,3 +1264,10 @@ select.selectpicker {
border-color: var(--color-primary-light) !important;
box-shadow: 0 0 0 3px var(--color-primary-ghost) !important;
}
/* Ajustement de la zone de recherche dans le dropdown */
.bootstrap-select .bs-searchbox .form-control {
border: 1px solid #ced4da !important;
background-color: #fff !important;
font-size: 0.8rem !important;
}

View File

@ -46023,25 +46023,7 @@ $(function(){
// Initialiser Select2
$('.js-example-basic-single').select2();
// On vérifie si Bootstrap Select est chargé
if (typeof $.fn.selectpicker !== 'undefined') {
// Optionnel : On détruit d'éventuelles instances précédentes pour éviter les doublons
$('.selectpicker').selectpicker('destroy');
// On initialise avec les paramètres de style
$('.selectpicker').selectpicker({
style: 'btn-form-select',
noneSelectedText: 'Aucune sélection'
});
}
// Si Bootstrap Select manque, on utilise Select2 uniquement en dernier recours
else if (typeof $.fn.select2 !== 'undefined') {
console.warn("Bootstrap Select manquant, repli sur Select2.");
$('.selectpicker').select2({
theme: 'bootstrap-5',
width: '100%'
});
}
initSelectPicker();
// Rafraîchir les notifications toutes les 2 secondes
setInterval(raffraichier_gabarit, 2000);
@ -74785,8 +74767,7 @@ function liste_villes()
},
success: function(data) {
$("#div_ville").html(data);
$("#ville" ).selectpicker();
ui_refresh_select("#ville");
}
});
}
@ -91559,4 +91540,44 @@ function init_revoquer_htagcarte(idHtagcarte) {
$("#idHtagcarte").val(idHtagcarte);
$("#div_revoquer_carte").modal({backdrop: 'static', keyboard: false, show: true });
$("#div_revoquer_carte").modal("show");
}
/**
* Initialisation globale au chargement
*/
function initSelectPicker() {
// Appel direct de la fonction générique sur la classe
ui_refresh_select('.selectpicker');
}
/**
* Fonction GÉNÉRIQUE Maître
* Gère la langue, évite les doublons et active la recherche
*/
function ui_refresh_select(selector) {
let $el = $(selector);
if ($el.length === 0) return;
// Récupération de la langue (via un input hidden ou une variable globale)
let codeLangue = $("#codeLangue").val();
let placeholder = (codeLangue === "en_US") ? 'Search...' : 'Rechercher...';
let noneText = (codeLangue === "en_US") ? 'Nothing selected' : 'Rien de sélectionné';
if (typeof $.fn.selectpicker !== 'undefined') {
// Nettoyage et réinitialisation
$el.selectpicker('destroy').selectpicker({
style: 'btn-form-select',
liveSearch: true,
liveSearchPlaceholder: placeholder,
noneSelectedText: noneText,
width: '100%',
container: 'body' // Recommandé pour éviter les problèmes de scroll
});
} else if (typeof $.fn.select2 !== 'undefined') {
// Fallback Select2
$el.select2({
theme: 'bootstrap-5',
width: '100%'
});
}
}

View File

@ -46,8 +46,7 @@
<div class="col-md-4">
<label class="form-label small fw-bold text-muted required"><?= _("Type de Structure") ?></label>
<select class="selectpicker w-100"
data-live-search="true"
data-style="btn-form-select"
data-live-search="true"
id="codeTypeSociete"
name="codeTypeSociete"
required>
@ -79,7 +78,6 @@
<select onchange="liste_villes();"
class="selectpicker w-100"
data-live-search="true"
data-style="btn-form-select"
id="codePays"
name="codePays"
required>
@ -91,7 +89,6 @@
<div id="div_ville">
<select class="selectpicker w-100"
data-live-search="true"
data-style="btn-form-select"
id="ville"
name="ville"
required>