gabarit.php
This commit is contained in:
parent
deea375d56
commit
f85868677a
|
|
@ -46020,9 +46020,23 @@ $(function(){
|
||||||
datafiltre();
|
datafiltre();
|
||||||
filtreTab();
|
filtreTab();
|
||||||
|
|
||||||
$('.js-example-basic-single').select2();
|
// Initialiser Select2
|
||||||
$('.selectpicker').selectpicker();
|
$('.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
|
// Rafraîchir les notifications toutes les 2 secondes
|
||||||
setInterval(raffraichier_gabarit, 2000);
|
setInterval(raffraichier_gabarit, 2000);
|
||||||
|
|
|
||||||
269
Vue/gabarit.php
269
Vue/gabarit.php
|
|
@ -219,15 +219,13 @@ $retourVue = $infovue['lienRetour'];
|
||||||
<!-- ======= Scripts ======= -->
|
<!-- ======= Scripts ======= -->
|
||||||
<script src="Bootstrap/js/jquery.min.js"></script>
|
<script src="Bootstrap/js/jquery.min.js"></script>
|
||||||
<script src="Bootstrap/js/jquery-ui.js"></script>
|
<script src="Bootstrap/js/jquery-ui.js"></script>
|
||||||
|
|
||||||
<!-- Bootstrap 5 Bundle -->
|
<!-- 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>
|
<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) -->
|
<!-- Bootstrap Select JS - DOIT être chargé AVANT fonctions.js -->
|
||||||
<?php if (isset($needSelectPicker) && $needSelectPicker): ?>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.14.0-beta3/dist/js/bootstrap-select.min.js"></script>
|
||||||
<script src="Bootstrap_new/select/js/bootstrap-select.min.js"></script>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<!-- DataTables -->
|
<!-- DataTables -->
|
||||||
<script src="Bootstrap_new/datatables/datatable.min.js"></script>
|
<script src="Bootstrap_new/datatables/datatable.min.js"></script>
|
||||||
|
|
||||||
|
|
@ -256,113 +254,203 @@ $retourVue = $infovue['lienRetour'];
|
||||||
<script src="Js/datepicker-fr.js"></script>
|
<script src="Js/datepicker-fr.js"></script>
|
||||||
<?php endif; ?>
|
<?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="Js/fonctions.js?ver=<?= date('Y.m.d.H') ?>"></script>
|
||||||
<script src="<?= $_SESSION['dossierSociete'] . '/Js/societe.js' ?>"></script>
|
<script src="<?= $_SESSION['dossierSociete'] . '/Js/societe.js' ?>"></script>
|
||||||
|
|
||||||
<!-- Script d'initialisation -->
|
<!-- Script d'initialisation corrigé -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
// Fonction pour patcher temporairement le problème dans fonctions.js
|
||||||
console.log("Document ready - Initialisation du gabarit");
|
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') {
|
if (typeof $.fn.selectpicker !== 'undefined') {
|
||||||
$('.selectpicker').selectpicker();
|
try {
|
||||||
console.log("Bootstrap Select initialisé");
|
$('.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 {
|
} 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') {
|
if (typeof $.fn.select2 !== 'undefined') {
|
||||||
$('.select2').select2({
|
$('.select2').select2({
|
||||||
theme: 'bootstrap-5'
|
theme: 'bootstrap-5'
|
||||||
});
|
});
|
||||||
console.log("Select2 initialisé");
|
console.log("✅ Select2 initialisé");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion du sidebar
|
// 3. Gestion du sidebar
|
||||||
$('.toggle-sidebar-btn').on('click', function() {
|
$('.toggle-sidebar-btn').on('click', function() {
|
||||||
console.log("Toggle sidebar cliqué");
|
|
||||||
$('body').toggleClass('toggle-sidebar');
|
$('body').toggleClass('toggle-sidebar');
|
||||||
|
console.log("Sidebar togglé");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Gestion de la barre de contexte
|
// 4. Gestion de la barre de contexte - VERSION SIMPLIFIÉE ET ROBUSTE
|
||||||
$(document).on('click', '#showSideNav', function(e) {
|
function initContextPanel() {
|
||||||
console.log("Show context panel cliqué");
|
console.log("Initialisation du panneau de contexte...");
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
if ($('#barre_laterale_d').length) {
|
var $panel = $('#barre_laterale_d');
|
||||||
$('#barre_laterale_d').addClass('active');
|
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();
|
$(this).hide();
|
||||||
console.log("Panel de contexte activé");
|
|
||||||
} else {
|
// Ajouter une classe au body pour empêcher le scroll
|
||||||
console.error("Élément #barre_laterale_d non trouvé");
|
$('body').addClass('context-panel-open');
|
||||||
}
|
|
||||||
});
|
return false;
|
||||||
|
});
|
||||||
$(document).on('click', '#hideSideNav', function(e) {
|
|
||||||
console.log("Hide context panel cliqué");
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
$('#barre_laterale_d').removeClass('active');
|
// Événement pour cacher le panel
|
||||||
$('#showSideNav').show();
|
$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
|
// Ajouter un bouton de test debug (à enlever en production)
|
||||||
$(document).on('click', function(e) {
|
if (typeof modeDev !== 'undefined' && modeDev == "1") {
|
||||||
if ($('#barre_laterale_d').hasClass('active') &&
|
$('body').append(
|
||||||
!$(e.target).closest('#barre_laterale_d').length &&
|
'<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>'
|
||||||
!$(e.target).closest('#showSideNav').length) {
|
);
|
||||||
$('#barre_laterale_d').removeClass('active');
|
|
||||||
$('#showSideNav').show();
|
$('#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
|
// 6. Synchronisation du badge de notifications
|
||||||
$('#barre_laterale_d').on('click', function(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Synchronisation du badge de notifications
|
|
||||||
function syncBadge() {
|
function syncBadge() {
|
||||||
var count = parseInt($("#msgNonLus").val()) || 0;
|
var count = parseInt($("#msgNonLus").val()) || 0;
|
||||||
var badge = $("#badge_notif_msg");
|
var badge = $("#badge_notif_msg");
|
||||||
|
|
||||||
if(count > 0) {
|
if (badge.length) {
|
||||||
badge.text(count).show();
|
if(count > 0) {
|
||||||
badge.data('last-count', count);
|
badge.text(count).show();
|
||||||
} else {
|
badge.data('last-count', count);
|
||||||
badge.hide();
|
} else {
|
||||||
|
badge.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérifier toutes les 2 secondes
|
|
||||||
setInterval(syncBadge, 2000);
|
setInterval(syncBadge, 2000);
|
||||||
syncBadge();
|
syncBadge();
|
||||||
|
|
||||||
// Rafraîchir le gabarit
|
// 7. Toastr configuration
|
||||||
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
|
|
||||||
if (typeof toastr !== 'undefined') {
|
if (typeof toastr !== 'undefined') {
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
"closeButton": true,
|
"closeButton": true,
|
||||||
|
|
@ -371,25 +459,32 @@ $retourVue = $infovue['lienRetour'];
|
||||||
"timeOut": "5000",
|
"timeOut": "5000",
|
||||||
"extendedTimeOut": "1000"
|
"extendedTimeOut": "1000"
|
||||||
};
|
};
|
||||||
|
console.log("✅ Toastr configuré");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("=== GABARIT INITIALISATION TERMINÉE ===");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fonction pour ouvrir le panneau depuis d'autres scripts
|
// Fonctions globales pour le panneau de contexte
|
||||||
function ouvrirPanneauContexte() {
|
window.ouvrirPanneauContexte = function() {
|
||||||
$('#barre_laterale_d').addClass('active');
|
$('#barre_laterale_d').addClass('active');
|
||||||
$('#showSideNav').hide();
|
$('#showSideNav').hide();
|
||||||
}
|
$('body').addClass('context-panel-open');
|
||||||
|
};
|
||||||
|
|
||||||
// Fonction pour fermer le panneau depuis d'autres scripts
|
window.fermerPanneauContexte = function() {
|
||||||
function fermerPanneauContexte() {
|
|
||||||
$('#barre_laterale_d').removeClass('active');
|
$('#barre_laterale_d').removeClass('active');
|
||||||
$('#showSideNav').show();
|
$('#showSideNav').show();
|
||||||
}
|
$('body').removeClass('context-panel-open');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Appliquer le patch après le chargement
|
||||||
|
setTimeout(patchFunctionsJS, 500);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- AJAX Container -->
|
<!-- AJAX Container -->
|
||||||
<div id="div_ajaxgabarit" class="d-none"></div>
|
<div id="div_ajaxgabarit" class="d-none"></div>
|
||||||
|
|
||||||
<!-- Global Loading Overlay -->
|
<!-- Global Loading Overlay -->
|
||||||
<div id="globalLoading" class="global-loading-overlay">
|
<div id="globalLoading" class="global-loading-overlay">
|
||||||
<div class="spinner-border text-primary global-loading-spinner" role="status">
|
<div class="spinner-border text-primary global-loading-spinner" role="status">
|
||||||
|
|
|
||||||
92
Vue/head.php
92
Vue/head.php
|
|
@ -1,13 +1,14 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<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="description" content="INTER SANTÉ - Gestionnaire de santé">
|
||||||
<meta name="author" content="INTER SANTÉ">
|
<meta name="author" content="INTER SANTÉ">
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<meta name="theme-color" content="#0088cf">
|
<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-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
<meta name="apple-mobile-web-app-title" content="INTER SANTÉ">
|
<meta name="apple-mobile-web-app-title" content="INTER SANTÉ">
|
||||||
|
|
@ -59,7 +60,12 @@
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
|
|
||||||
<!-- Animate.css -->
|
<!-- 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) -->
|
<!-- Vendor CSS spécifiques (chargement conditionnel) -->
|
||||||
<?php
|
<?php
|
||||||
|
|
@ -67,6 +73,7 @@
|
||||||
$needQuill = strpos($current_page, 'quill') !== false;
|
$needQuill = strpos($current_page, 'quill') !== false;
|
||||||
$needDatatables = isset($needDatatables) ? $needDatatables : false;
|
$needDatatables = isset($needDatatables) ? $needDatatables : false;
|
||||||
$needSelect2 = isset($needSelect2) ? $needSelect2 : false;
|
$needSelect2 = isset($needSelect2) ? $needSelect2 : false;
|
||||||
|
$needBootstrapSelect = isset($needBootstrapSelect) ? $needBootstrapSelect : false;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ($needQuill): ?>
|
<?php if ($needQuill): ?>
|
||||||
|
|
@ -87,45 +94,86 @@
|
||||||
|
|
||||||
<title><?= htmlspecialchars($_SESSION['vue'] ?? 'Dashboard') ?> - INTER SANTÉ</title>
|
<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">
|
<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') ?>;
|
var modeDev = <?= json_encode($modeDev ?? '0') ?>;
|
||||||
|
|
||||||
|
// Protection en mode production seulement
|
||||||
if (modeDev != "1") {
|
if (modeDev != "1") {
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var toastr = window.safeToastr();
|
||||||
|
|
||||||
// Prévention clic droit
|
// Prévention clic droit
|
||||||
document.addEventListener('contextmenu', function(e) {
|
document.addEventListener('contextmenu', function(e) {
|
||||||
e.preventDefault();
|
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
|
// 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) {
|
document.addEventListener('keydown', function(e) {
|
||||||
// Ctrl+U (code source)
|
// Ctrl+U, Ctrl+Shift+I, etc.
|
||||||
if (e.ctrlKey && e.keyCode === 85) {
|
if (e.ctrlKey && blockedKeys[e.keyCode]) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (typeof toastr !== 'undefined') {
|
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>: ' + blockedKeys[e.keyCode]);
|
||||||
toastr.warning('<?= _("Cette fonctionnalité est désactivée") ?>');
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// F12 (outils de développement)
|
|
||||||
|
// F12 seul
|
||||||
if (e.keyCode === 123) {
|
if (e.keyCode === 123) {
|
||||||
e.preventDefault();
|
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)) {
|
if (e.ctrlKey && e.shiftKey && [73, 74, 67].includes(e.keyCode)) {
|
||||||
e.preventDefault();
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
Loading…
Reference in New Issue
Block a user