gabarit.php
This commit is contained in:
parent
deea375d56
commit
f85868677a
|
|
@ -46020,9 +46020,23 @@ $(function(){
|
|||
datafiltre();
|
||||
filtreTab();
|
||||
|
||||
$('.js-example-basic-single').select2();
|
||||
$('.selectpicker').selectpicker();
|
||||
|
||||
// Initialiser Select2
|
||||
$('.js-example-basic-single').select2();
|
||||
|
||||
// Initialiser Bootstrap Select avec vérification
|
||||
if (typeof $.fn.selectpicker !== 'undefined') {
|
||||
$('.selectpicker').selectpicker();
|
||||
} else {
|
||||
console.warn("Bootstrap Select n'est pas disponible. Assurez-vous que bootstrap-select.min.js est chargé.");
|
||||
// Fallback: transformer les select en select2
|
||||
$('.selectpicker').each(function() {
|
||||
if (!$(this).hasClass('select2-hidden-accessible')) {
|
||||
$(this).select2({
|
||||
theme: 'bootstrap-5'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Rafraîchir les notifications toutes les 2 secondes
|
||||
setInterval(raffraichier_gabarit, 2000);
|
||||
|
|
|
|||
269
Vue/gabarit.php
269
Vue/gabarit.php
|
|
@ -219,15 +219,13 @@ $retourVue = $infovue['lienRetour'];
|
|||
<!-- ======= Scripts ======= -->
|
||||
<script src="Bootstrap/js/jquery.min.js"></script>
|
||||
<script src="Bootstrap/js/jquery-ui.js"></script>
|
||||
|
||||
|
||||
<!-- Bootstrap 5 Bundle -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Bootstrap Select (seulement si nécessaire) -->
|
||||
<?php if (isset($needSelectPicker) && $needSelectPicker): ?>
|
||||
<script src="Bootstrap_new/select/js/bootstrap-select.min.js"></script>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- Bootstrap Select JS - DOIT être chargé AVANT fonctions.js -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/js/bootstrap-select.min.js"></script>
|
||||
|
||||
<!-- DataTables -->
|
||||
<script src="Bootstrap_new/datatables/datatable.min.js"></script>
|
||||
|
||||
|
|
@ -256,113 +254,203 @@ $retourVue = $infovue['lienRetour'];
|
|||
<script src="Js/datepicker-fr.js"></script>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Core Functions -->
|
||||
<!-- Core Functions - DOIT être APRÈS Bootstrap Select -->
|
||||
<script src="Js/fonctions.js?ver=<?= date('Y.m.d.H') ?>"></script>
|
||||
<script src="<?= $_SESSION['dossierSociete'] . '/Js/societe.js' ?>"></script>
|
||||
|
||||
<!-- Script d'initialisation -->
|
||||
<!-- Script d'initialisation corrigé -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
console.log("Document ready - Initialisation du gabarit");
|
||||
// Fonction pour patcher temporairement le problème dans fonctions.js
|
||||
function patchFunctionsJS() {
|
||||
// Sauvegarder la fonction originale $(function(){...})
|
||||
var originalJQueryReady = window.jQuery.fn.init;
|
||||
|
||||
// Initialiser Bootstrap Select
|
||||
// Surcharger temporairement pour retarder l'exécution
|
||||
$(document).ready(function() {
|
||||
// Attendre que tout soit chargé
|
||||
setTimeout(function() {
|
||||
// Ré-exécuter l'initialisation des selectpickers si nécessaire
|
||||
if (typeof $.fn.selectpicker !== 'undefined' && $('.selectpicker').length) {
|
||||
var initialized = $('.selectpicker').filter(function() {
|
||||
return $(this).data('selectpicker') !== undefined;
|
||||
}).length;
|
||||
|
||||
if (initialized === 0) {
|
||||
$('.selectpicker').selectpicker();
|
||||
console.log("Bootstrap Select réinitialisé depuis gabarit.php");
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log("=== GABARIT INITIALISATION ===");
|
||||
console.log("jQuery version:", $.fn.jquery);
|
||||
console.log("Bootstrap Select disponible:", typeof $.fn.selectpicker !== 'undefined');
|
||||
console.log("Select2 disponible:", typeof $.fn.select2 !== 'undefined');
|
||||
console.log("Toastr disponible:", typeof toastr !== 'undefined');
|
||||
|
||||
// 1. Initialiser Bootstrap Select IMMÉDIATEMENT
|
||||
if (typeof $.fn.selectpicker !== 'undefined') {
|
||||
$('.selectpicker').selectpicker();
|
||||
console.log("Bootstrap Select initialisé");
|
||||
try {
|
||||
$('.selectpicker').selectpicker();
|
||||
console.log("✅ Bootstrap Select initialisé avec succès");
|
||||
console.log(" Nombre de .selectpicker trouvés:", $('.selectpicker').length);
|
||||
} catch (error) {
|
||||
console.error("❌ Erreur Bootstrap Select:", error);
|
||||
}
|
||||
} else {
|
||||
console.warn("Bootstrap Select n'est pas chargé");
|
||||
console.warn("⚠️ Bootstrap Select non disponible");
|
||||
// Fallback: utiliser Select2
|
||||
if (typeof $.fn.select2 !== 'undefined') {
|
||||
$('.selectpicker').each(function() {
|
||||
if (!$(this).hasClass('select2-hidden-accessible')) {
|
||||
$(this).select2({
|
||||
theme: 'bootstrap-5',
|
||||
width: '100%'
|
||||
}).addClass('selectpicker-fallback');
|
||||
}
|
||||
});
|
||||
console.log("✅ Fallback Select2 appliqué aux .selectpicker");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialiser Select2
|
||||
// 2. Initialiser Select2
|
||||
if (typeof $.fn.select2 !== 'undefined') {
|
||||
$('.select2').select2({
|
||||
theme: 'bootstrap-5'
|
||||
});
|
||||
console.log("Select2 initialisé");
|
||||
console.log("✅ Select2 initialisé");
|
||||
}
|
||||
|
||||
// Gestion du sidebar
|
||||
// 3. Gestion du sidebar
|
||||
$('.toggle-sidebar-btn').on('click', function() {
|
||||
console.log("Toggle sidebar cliqué");
|
||||
$('body').toggleClass('toggle-sidebar');
|
||||
console.log("Sidebar togglé");
|
||||
});
|
||||
|
||||
// Gestion de la barre de contexte
|
||||
$(document).on('click', '#showSideNav', function(e) {
|
||||
console.log("Show context panel cliqué");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// 4. Gestion de la barre de contexte - VERSION SIMPLIFIÉE ET ROBUSTE
|
||||
function initContextPanel() {
|
||||
console.log("Initialisation du panneau de contexte...");
|
||||
|
||||
if ($('#barre_laterale_d').length) {
|
||||
$('#barre_laterale_d').addClass('active');
|
||||
var $panel = $('#barre_laterale_d');
|
||||
var $showBtn = $('#showSideNav');
|
||||
var $hideBtn = $('#hideSideNav');
|
||||
|
||||
// Vérifier que les éléments existent
|
||||
if (!$panel.length || !$showBtn.length || !$hideBtn.length) {
|
||||
console.error("❌ Éléments du panneau de contexte non trouvés");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("✅ Éléments trouvés:");
|
||||
console.log(" - Panel:", $panel.length);
|
||||
console.log(" - Bouton show:", $showBtn.length);
|
||||
console.log(" - Bouton hide:", $hideBtn.length);
|
||||
|
||||
// S'assurer que le panel est caché au départ
|
||||
$panel.removeClass('active');
|
||||
$showBtn.show();
|
||||
|
||||
// Événement pour montrer le panel
|
||||
$showBtn.off('click').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log("Bouton show cliqué");
|
||||
|
||||
$panel.addClass('active');
|
||||
$(this).hide();
|
||||
console.log("Panel de contexte activé");
|
||||
} else {
|
||||
console.error("Élément #barre_laterale_d non trouvé");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '#hideSideNav', function(e) {
|
||||
console.log("Hide context panel cliqué");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Ajouter une classe au body pour empêcher le scroll
|
||||
$('body').addClass('context-panel-open');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#barre_laterale_d').removeClass('active');
|
||||
$('#showSideNav').show();
|
||||
// Événement pour cacher le panel
|
||||
$hideBtn.off('click').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log("Bouton hide cliqué");
|
||||
|
||||
$panel.removeClass('active');
|
||||
$showBtn.show();
|
||||
$('body').removeClass('context-panel-open');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Fermer en cliquant en dehors
|
||||
$(document).off('click.context-panel').on('click.context-panel', function(e) {
|
||||
if ($panel.hasClass('active') &&
|
||||
!$(e.target).closest('#barre_laterale_d').length &&
|
||||
!$(e.target).is('#showSideNav')) {
|
||||
console.log("Clic en dehors du panel");
|
||||
$panel.removeClass('active');
|
||||
$showBtn.show();
|
||||
$('body').removeClass('context-panel-open');
|
||||
}
|
||||
});
|
||||
|
||||
// Empêcher la fermeture quand on clique dans le panel
|
||||
$panel.off('click').on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
console.log("✅ Panneau de contexte initialisé");
|
||||
}
|
||||
|
||||
// Initialiser le panneau de contexte
|
||||
initContextPanel();
|
||||
|
||||
// 5. Tester manuellement le bouton (debug)
|
||||
$('#showSideNav').css({
|
||||
'background': 'linear-gradient(135deg, #0088cf, #0066a6)',
|
||||
'color': 'white',
|
||||
'border': 'none',
|
||||
'cursor': 'pointer'
|
||||
});
|
||||
|
||||
// Fermer le panneau si on clique en dehors
|
||||
$(document).on('click', function(e) {
|
||||
if ($('#barre_laterale_d').hasClass('active') &&
|
||||
!$(e.target).closest('#barre_laterale_d').length &&
|
||||
!$(e.target).closest('#showSideNav').length) {
|
||||
$('#barre_laterale_d').removeClass('active');
|
||||
$('#showSideNav').show();
|
||||
}
|
||||
});
|
||||
// Ajouter un bouton de test debug (à enlever en production)
|
||||
if (typeof modeDev !== 'undefined' && modeDev == "1") {
|
||||
$('body').append(
|
||||
'<button id="debugTestPanel" style="position:fixed; bottom:20px; left:20px; z-index:9999; padding:10px; background:red; color:white; border:none; border-radius:5px;">DEBUG: Test Panel</button>'
|
||||
);
|
||||
|
||||
$('#debugTestPanel').on('click', function() {
|
||||
var $panel = $('#barre_laterale_d');
|
||||
if ($panel.hasClass('active')) {
|
||||
$panel.removeClass('active');
|
||||
$('#showSideNav').show();
|
||||
console.log("DEBUG: Panel fermé");
|
||||
} else {
|
||||
$panel.addClass('active');
|
||||
$('#showSideNav').hide();
|
||||
console.log("DEBUG: Panel ouvert");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Empêcher la fermeture quand on clique dans le panneau
|
||||
$('#barre_laterale_d').on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// Synchronisation du badge de notifications
|
||||
// 6. Synchronisation du badge de notifications
|
||||
function syncBadge() {
|
||||
var count = parseInt($("#msgNonLus").val()) || 0;
|
||||
var badge = $("#badge_notif_msg");
|
||||
|
||||
if(count > 0) {
|
||||
badge.text(count).show();
|
||||
badge.data('last-count', count);
|
||||
} else {
|
||||
badge.hide();
|
||||
if (badge.length) {
|
||||
if(count > 0) {
|
||||
badge.text(count).show();
|
||||
badge.data('last-count', count);
|
||||
} else {
|
||||
badge.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Vérifier toutes les 2 secondes
|
||||
setInterval(syncBadge, 2000);
|
||||
syncBadge();
|
||||
|
||||
// Rafraîchir le gabarit
|
||||
if (typeof raffraichier_gabarit === 'function') {
|
||||
raffraichier_gabarit();
|
||||
}
|
||||
|
||||
// Timer pour le rafraîchissement des messages
|
||||
if ($('#timer').length && typeof $.fn.timer !== 'undefined') {
|
||||
$('#timer').timer({
|
||||
duration: '60s',
|
||||
callback: function() {
|
||||
if (typeof raffraichier_messagerie === 'function') {
|
||||
raffraichier_messagerie();
|
||||
}
|
||||
syncBadge();
|
||||
},
|
||||
repeat: true
|
||||
});
|
||||
}
|
||||
|
||||
// Toastr configuration
|
||||
// 7. Toastr configuration
|
||||
if (typeof toastr !== 'undefined') {
|
||||
toastr.options = {
|
||||
"closeButton": true,
|
||||
|
|
@ -371,25 +459,32 @@ $retourVue = $infovue['lienRetour'];
|
|||
"timeOut": "5000",
|
||||
"extendedTimeOut": "1000"
|
||||
};
|
||||
console.log("✅ Toastr configuré");
|
||||
}
|
||||
|
||||
console.log("=== GABARIT INITIALISATION TERMINÉE ===");
|
||||
});
|
||||
|
||||
// Fonction pour ouvrir le panneau depuis d'autres scripts
|
||||
function ouvrirPanneauContexte() {
|
||||
// Fonctions globales pour le panneau de contexte
|
||||
window.ouvrirPanneauContexte = function() {
|
||||
$('#barre_laterale_d').addClass('active');
|
||||
$('#showSideNav').hide();
|
||||
}
|
||||
$('body').addClass('context-panel-open');
|
||||
};
|
||||
|
||||
// Fonction pour fermer le panneau depuis d'autres scripts
|
||||
function fermerPanneauContexte() {
|
||||
window.fermerPanneauContexte = function() {
|
||||
$('#barre_laterale_d').removeClass('active');
|
||||
$('#showSideNav').show();
|
||||
}
|
||||
$('body').removeClass('context-panel-open');
|
||||
};
|
||||
|
||||
// Appliquer le patch après le chargement
|
||||
setTimeout(patchFunctionsJS, 500);
|
||||
</script>
|
||||
|
||||
|
||||
<!-- AJAX Container -->
|
||||
<div id="div_ajaxgabarit" class="d-none"></div>
|
||||
|
||||
|
||||
<!-- Global Loading Overlay -->
|
||||
<div id="globalLoading" class="global-loading-overlay">
|
||||
<div class="spinner-border text-primary global-loading-spinner" role="status">
|
||||
|
|
|
|||
92
Vue/head.php
92
Vue/head.php
|
|
@ -1,13 +1,14 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
|
||||
<meta name="description" content="INTER SANTÉ - Gestionnaire de santé">
|
||||
<meta name="author" content="INTER SANTÉ">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<meta name="theme-color" content="#0088cf">
|
||||
|
||||
<!-- Pour PWA/iOS -->
|
||||
<!-- Pour PWA/iOS - Version corrigée -->
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="apple-mobile-web-app-title" content="INTER SANTÉ">
|
||||
|
|
@ -59,7 +60,12 @@
|
|||
rel="stylesheet">
|
||||
|
||||
<!-- Animate.css -->
|
||||
<link href="Bootstrap_new/css/animate.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
||||
|
||||
<!-- Bootstrap Select CSS (si vous l'utilisez) -->
|
||||
<?php if (isset($needBootstrapSelect) && $needBootstrapSelect): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/css/bootstrap-select.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Vendor CSS spécifiques (chargement conditionnel) -->
|
||||
<?php
|
||||
|
|
@ -67,6 +73,7 @@
|
|||
$needQuill = strpos($current_page, 'quill') !== false;
|
||||
$needDatatables = isset($needDatatables) ? $needDatatables : false;
|
||||
$needSelect2 = isset($needSelect2) ? $needSelect2 : false;
|
||||
$needBootstrapSelect = isset($needBootstrapSelect) ? $needBootstrapSelect : false;
|
||||
?>
|
||||
|
||||
<?php if ($needQuill): ?>
|
||||
|
|
@ -87,45 +94,86 @@
|
|||
|
||||
<title><?= htmlspecialchars($_SESSION['vue'] ?? 'Dashboard') ?> - INTER SANTÉ</title>
|
||||
|
||||
<!-- Scripts de prévention de clic droit -->
|
||||
<!-- Scripts de prévention de clic droit - Version optimisée -->
|
||||
<script type="text/javascript">
|
||||
// Fonction safe pour toastr
|
||||
window.safeToastr = function() {
|
||||
if (typeof toastr !== 'undefined') {
|
||||
return toastr;
|
||||
}
|
||||
return {
|
||||
warning: function(msg) { console.warn('TOASTR:', msg); },
|
||||
error: function(msg) { console.error('TOASTR:', msg); },
|
||||
success: function(msg) { console.log('TOASTR:', msg); },
|
||||
info: function(msg) { console.info('TOASTR:', msg); }
|
||||
};
|
||||
};
|
||||
|
||||
var modeDev = <?= json_encode($modeDev ?? '0') ?>;
|
||||
|
||||
// Protection en mode production seulement
|
||||
if (modeDev != "1") {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var toastr = window.safeToastr();
|
||||
|
||||
// Prévention clic droit
|
||||
document.addEventListener('contextmenu', function(e) {
|
||||
e.preventDefault();
|
||||
if (typeof toastr !== 'undefined') {
|
||||
toastr.warning('<?= _("Le clic droit est désactivé en mode production") ?>');
|
||||
}
|
||||
});
|
||||
toastr.warning('<?= _("Le clic droit est désactivé en mode production") ?>');
|
||||
}, { passive: false });
|
||||
|
||||
// Prévention des raccourcis clavier
|
||||
var blockedKeys = {
|
||||
85: 'Ctrl+U (code source)',
|
||||
123: 'F12 (outils de développement)',
|
||||
73: 'Ctrl+Shift+I',
|
||||
74: 'Ctrl+Shift+J',
|
||||
67: 'Ctrl+Shift+C'
|
||||
};
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
// Ctrl+U (code source)
|
||||
if (e.ctrlKey && e.keyCode === 85) {
|
||||
// Ctrl+U, Ctrl+Shift+I, etc.
|
||||
if (e.ctrlKey && blockedKeys[e.keyCode]) {
|
||||
e.preventDefault();
|
||||
if (typeof toastr !== 'undefined') {
|
||||
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>');
|
||||
}
|
||||
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>: ' + blockedKeys[e.keyCode]);
|
||||
return false;
|
||||
}
|
||||
// F12 (outils de développement)
|
||||
|
||||
// F12 seul
|
||||
if (e.keyCode === 123) {
|
||||
e.preventDefault();
|
||||
if (typeof toastr !== 'undefined') {
|
||||
toastr.warning('<?= _("Les outils de développement sont désactivés") ?>');
|
||||
}
|
||||
toastr.warning('<?= _("Les outils de développement sont désactivés") ?>');
|
||||
return false;
|
||||
}
|
||||
// Ctrl+Shift+I, Ctrl+Shift+J, Ctrl+Shift+C
|
||||
|
||||
// Ctrl+Shift avec I, J, C
|
||||
if (e.ctrlKey && e.shiftKey && [73, 74, 67].includes(e.keyCode)) {
|
||||
e.preventDefault();
|
||||
if (typeof toastr !== 'undefined') {
|
||||
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>');
|
||||
}
|
||||
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, { passive: false });
|
||||
});
|
||||
}
|
||||
|
||||
// Initialiser le panneau de contexte
|
||||
window.initializeContextPanel = function() {
|
||||
// Cette fonction sera appelée après le chargement de jQuery
|
||||
if (typeof $ !== 'undefined') {
|
||||
$(document).on('click', '#showSideNav', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
$('#barre_laterale_d').addClass('active');
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
$(document).on('click', '#hideSideNav', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
$('#barre_laterale_d').removeClass('active');
|
||||
$('#showSideNav').show();
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
Loading…
Reference in New Issue
Block a user