509 lines
21 KiB
PHP
Executable File
509 lines
21 KiB
PHP
Executable File
<?php
|
|
require_once 'gabarit_queries.php';
|
|
$gabary = new Gabary();
|
|
$_SESSION['firstLevelMenu'] = '';
|
|
$current_url = $_SERVER['REQUEST_URI'];
|
|
$elements = explode("/", $current_url);
|
|
$activeLink = $elements[1] ?? '';
|
|
$_SESSION['firstLevelMenu'] = $activeLink;
|
|
|
|
$companyDisplayName = htmlspecialchars($_SESSION['nomSociete'], ENT_QUOTES);
|
|
$imgData = $_SESSION['photoAssureCrypte'] ?? '';
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr" data-bs-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<base href="<?= $racineWeb ?>">
|
|
|
|
<title><?= htmlspecialchars($_SESSION['vue'] ?? 'INTER SANTE') ?></title>
|
|
|
|
<!-- Bootstrap 5 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
<!-- Bootstrap Icons -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
|
|
|
|
<!-- Font Awesome -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
|
|
<!-- Select2 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/@ttskch/select2-bootstrap5-theme@1.3.0/dist/select2-bootstrap5.min.css" rel="stylesheet">
|
|
|
|
<!-- DataTables -->
|
|
<link href="https://cdn.datatables.net/v/bs5/dt-1.13.6/datatables.min.css" rel="stylesheet">
|
|
|
|
<!-- SweetAlert2 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" rel="stylesheet">
|
|
|
|
<!-- Office/PowerPoint Inspired Styles -->
|
|
<link href="Bootstrap_new/css/style_office.css?ver=2025.12.20.00" rel="stylesheet">
|
|
|
|
<script>
|
|
const modeDev = <?= $_SESSION['modeDev_C'] ?? 0 ?>;
|
|
if (modeDev != "1") {
|
|
document.addEventListener('contextmenu', function(e) {
|
|
e.preventDefault();
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<!-- Header -->
|
|
<header class="app-header">
|
|
<div class="header-content">
|
|
<div class="logo-container">
|
|
<button class="header-btn sidebar-toggle d-lg-none">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<a href="#" class="app-logo">
|
|
<img src="Bootstrap_new/images/new/favicon.png" alt="Inter Santé">
|
|
<span class="ms-2">INTER-SANTÉ</span>
|
|
</a>
|
|
|
|
<?php if($_SESSION['bdTests_C'] == "1"): ?>
|
|
<div class="test-indicator">
|
|
<i class="fas fa-flask"></i>
|
|
<span>MODE TEST</span>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="header-controls">
|
|
<!-- Notifications -->
|
|
<button class="header-btn notification-btn" onclick="pop_messagerie()">
|
|
<i class="bi bi-bell"></i>
|
|
<span class="notification-badge" id="notificationCount">0</span>
|
|
</button>
|
|
|
|
<!-- Company Info -->
|
|
<div class="language-selector" onclick="changer_langue()">
|
|
<?php
|
|
$flag = est_anglophone() ? 'england.png' : 'france.png';
|
|
$lib = est_anglophone() ? 'EN' : 'FR';
|
|
?>
|
|
<img src="Bootstrap_new/images/<?= $flag ?>" alt="Language" class="language-flag">
|
|
<span class="text-white"><?= $lib ?></span>
|
|
</div>
|
|
|
|
<!-- User Menu -->
|
|
<div class="user-menu dropdown-toggle" data-bs-toggle="dropdown">
|
|
<div class="user-avatar">
|
|
<?= $_SESSION['userInitials_C'] ?? 'U' ?>
|
|
</div>
|
|
<div class="user-info">
|
|
<div class="user-name"><?= $_SESSION['utilisateur_C'] ?? _('Utilisateur') ?></div>
|
|
<div class="user-role"><?= $_SESSION['nomClient_C'] ?? _('Client') ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- User Dropdown -->
|
|
<div class="dropdown-menu dropdown-menu-end">
|
|
<div class="dropdown-header">
|
|
<div class="user-avatar mx-auto mb-2">
|
|
<?= $_SESSION['userInitials_C'] ?? 'U' ?>
|
|
</div>
|
|
<div class="text-center">
|
|
<div class="fw-bold"><?= $_SESSION['utilisateur_C'] ?? _('Utilisateur') ?></div>
|
|
<small class="text-muted"><?= $_SESSION['nomClient_C'] ?? _('Client') ?></small>
|
|
</div>
|
|
</div>
|
|
<div class="dropdown-divider"></div>
|
|
<a class="dropdown-item" href="javascript:change_password()">
|
|
<i class="fas fa-user-circle me-2"></i> <?= _('Mon compte') ?>
|
|
</a>
|
|
<a class="dropdown-item" href="javascript:gerer_messagerie()">
|
|
<i class="fas fa-envelope me-2"></i> <?= _('Messagerie') ?>
|
|
</a>
|
|
<div class="dropdown-divider"></div>
|
|
<a class="dropdown-item text-danger" href="#">
|
|
<i class="fas fa-sign-out-alt me-2"></i> <?= _('Déconnexion') ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Sidebar -->
|
|
<aside class="app-sidebar" id="sidebar">
|
|
<nav class="sidebar-nav">
|
|
<div class="nav-section">
|
|
<div class="nav-title"> <?= _('Navigation principale') ?></div>
|
|
<?php foreach ($menus as $key0 => $menuParent):
|
|
$menuChildrenLevelOne = $gabary->get_menus_by_parent_code($menuParent['vue']);
|
|
$isActive = false;
|
|
|
|
// Check if any child is active
|
|
foreach ($menuChildrenLevelOne as $menuChild) {
|
|
if ((explode('/', $menuChild['lienMenu'])[0] ?? '') == $activeLink) {
|
|
$isActive = true;
|
|
break;
|
|
}
|
|
}
|
|
?>
|
|
<div class="nav-item">
|
|
<?php if (sizeof($menuChildrenLevelOne) > 0): ?>
|
|
<a href="#submenu<?= $key0 ?>"
|
|
class="nav-link <?= $isActive ? 'active' : '' ?>"
|
|
data-bs-toggle="collapse"
|
|
aria-expanded="<?= $isActive ? 'true' : 'false' ?>">
|
|
<i class="<?= $menuParent['icone'] ?>"></i>
|
|
<span class="nav-text"><?= $menuParent['libeleMenu'] ?></span>
|
|
<i class="nav-arrow bi bi-chevron-right"></i>
|
|
</a>
|
|
|
|
<div class="nav-submenu collapse <?= $isActive ? 'show' : '' ?>" id="submenu<?= $key0 ?>">
|
|
<?php foreach ($menuChildrenLevelOne as $key1 => $menuChild):
|
|
$childActive = (explode('/', $menuChild['lienMenu'])[0] ?? '') == $activeLink;
|
|
?>
|
|
<a href="<?= $menuChild['lienMenu'] ?>"
|
|
class="nav-link <?= $childActive ? 'active' : '' ?>">
|
|
<?= $menuChild['libeleMenu'] ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<a href="<?= $menuParent['lienMenu'] ?>" class="nav-link">
|
|
<i class="<?= $menuParent['icone'] ?>"></i>
|
|
<span class="nav-text"><?= $menuParent['libeleMenu'] ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</nav>
|
|
</aside>
|
|
|
|
<!-- Main Content -->
|
|
<main class="app-main" id="mainContent">
|
|
<!-- Navigation Tabs -->
|
|
<div class="content-area">
|
|
<?php if(!empty($menusvue)): ?>
|
|
<div class="nav-bar">
|
|
<div class="nav-tabs">
|
|
<?php foreach ($menusvue as $menu):
|
|
$isActive = ($_SESSION['vue'] ?? '') == $menu['libeleMenu'];
|
|
?>
|
|
<a href="<?= $menu['lienMenu'] ?>"
|
|
class="nav-tab <?= $isActive ? 'active' : '' ?>"
|
|
title="<?= $menu['descriptionMenu'] ?? '' ?>">
|
|
<i class="bi bi-arrow-right-circle"></i>
|
|
<?= $menu['libeleMenu'] ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Hidden Inputs -->
|
|
<input type="hidden" id="racineWeb" value="<?= $racineWeb ?>">
|
|
<input type="hidden" id="dureeSession" value="<?= $_SESSION['dureeSession'] ?>">
|
|
<input type="hidden" id="nomSociete" value="<?= $_SESSION['nomSociete'] ?>">
|
|
<input type="hidden" id="nomClient" value="<?= htmlspecialchars($_SESSION['nomClient_C']) ?>">
|
|
|
|
<!-- Content Container -->
|
|
<div class="content-card">
|
|
<div class="card-body">
|
|
<div id="contenu">
|
|
<div id="div_test_gabarit"></div>
|
|
<?= $contenu ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Context Panel -->
|
|
<aside class="context-panel" id="contextPanel">
|
|
<div class="context-header">
|
|
<div class="context-title">
|
|
<i class="bi bi-info-circle"></i>
|
|
<span><?= _('Contexte de la session') ?></span>
|
|
</div>
|
|
<button class="context-close" onclick="toggleContextPanel()">
|
|
<i class="bi bi-x-lg"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="context-body">
|
|
<!-- Souscripteur -->
|
|
<div class="context-section">
|
|
<div class="section-title">
|
|
<i class="bi bi-building"></i>
|
|
<span><?= _('Souscripteur') ?></span>
|
|
</div>
|
|
<div class="info-box">
|
|
<div class="info-value">
|
|
<?= $this->nettoyer($_SESSION['nomClient_C']) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Adhérent principal -->
|
|
<div class="context-section">
|
|
<div class="section-title">
|
|
<i class="bi bi-person-badge"></i>
|
|
<span><?= _('Assuré principal') ?></span>
|
|
</div>
|
|
<div class="info-box">
|
|
<div class="info-value">
|
|
<?= $this->nettoyer($_SESSION['adherent_C']) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Patient -->
|
|
<div class="context-section">
|
|
<div class="section-title">
|
|
<i class="bi bi-person-heart"></i>
|
|
<span><?= _('Bénéficiaire') ?></span>
|
|
</div>
|
|
|
|
<button class="action-btn" onclick="afficher_beneficiaire_id()">
|
|
<i class="bi bi-person"></i>
|
|
<span><?= _('Bénéficiaire').' : '.$this->nettoyer($_SESSION['numeroBeneficiaire_C']) ?></span>
|
|
</button>
|
|
|
|
<div class="info-box">
|
|
<div class="info-value">
|
|
<?= $this->nettoyer($_SESSION['beneficiaire_C']) ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Photo patient -->
|
|
<?php if ($_SESSION['faceRegistered_C'] == "1" && ($_SESSION['idBeneficiaire_C'] ?? 0) > 0): ?>
|
|
<div class="context-section">
|
|
<div class="section-title">
|
|
<i class="bi bi-camera"></i>
|
|
<span><?= _('Photo du bénéficiaire') ?></span>
|
|
</div>
|
|
<div class="photo-container">
|
|
<img src="data:image/jpg;base64,<?= $imgData ?>"
|
|
class="patient-photo"
|
|
onclick="openPhotoModal()"
|
|
alt="<?= _('Photo du bénéficiaire') ?>">
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Actions -->
|
|
<div class="context-section">
|
|
<div class="section-title">
|
|
<i class="bi bi-lightning"></i>
|
|
<span><?= _('Actions rapides') ?></span>
|
|
</div>
|
|
|
|
<button class="action-btn" onclick="gerer_messagerie()">
|
|
<i class="bi bi-chat-dots"></i>
|
|
<span><?= _('Gérer les notifications') ?></span>
|
|
</button>
|
|
|
|
<button class="action-btn" onclick="change_password()">
|
|
<i class="bi bi-key"></i>
|
|
<span><?= _('Changer le mot de passe') ?></span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Messages -->
|
|
<div id="nbMessagesNonLus" class="d-none">
|
|
<input type="hidden" id="msgNonLus" value="0">
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- Toggle Button -->
|
|
<button class="context-toggle" onclick="toggleContextPanel()">
|
|
<i class="bi bi-info-circle"></i>
|
|
</button>
|
|
|
|
<!-- Modals -->
|
|
<!-- Photo Modal -->
|
|
<div class="modal fade modal-office" id="photoModal" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><?= _('Photo du bénéficiaire') ?></h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body text-center">
|
|
<?php if ($_SESSION['faceRegistered_C'] == "1"): ?>
|
|
<img src="data:image/jpg;base64,<?= $imgData ?>"
|
|
class="img-fluid rounded"
|
|
style="max-height: 70vh; max-width: 100%;">
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Messages Modal -->
|
|
<div class="modal fade modal-office" id="messagesModal" tabindex="-1">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title"><?= _('Notifications non lus') ?></h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div id="div_messagerie"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- JavaScript Libraries -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
|
<script src="https://cdn.datatables.net/v/bs5/dt-1.13.6/datatables.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
<!-- Application Scripts -->
|
|
<script src="Js/fonctions.js?ver=2025.12.20.00"></script>
|
|
|
|
<?php if (est_anglophone()): ?>
|
|
<script src="Js/datepicker-eng.js"></script>
|
|
<?php else: ?>
|
|
<script src="Js/datepicker-fr.js"></script>
|
|
<?php endif; ?>
|
|
|
|
<script>
|
|
// DOM Ready
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Toggle Sidebar on Mobile
|
|
document.querySelector('.sidebar-toggle').addEventListener('click', function() {
|
|
document.getElementById('sidebar').classList.toggle('open');
|
|
});
|
|
|
|
// Initialize tooltips
|
|
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
|
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
|
});
|
|
|
|
// Initialize select2
|
|
$('.select2').select2({
|
|
theme: 'bootstrap-5',
|
|
width: '100%'
|
|
});
|
|
|
|
// Initialize DataTables
|
|
$('.datatable').DataTable({
|
|
responsive: true,
|
|
language: {
|
|
url: '//cdn.datatables.net/plug-ins/1.13.6/i18n/fr-FR.json'
|
|
},
|
|
dom: '<"row"<"col-sm-12 col-md-6"l><"col-sm-12 col-md-6"f>>' +
|
|
'<"row"<"col-sm-12"tr>>' +
|
|
'<"row"<"col-sm-12 col-md-5"i><"col-sm-12 col-md-7"p>>'
|
|
});
|
|
|
|
// Simulate notification count
|
|
updateNotificationCount();
|
|
|
|
// Auto-refresh notifications every 60 seconds
|
|
setInterval(updateNotificationCount, 60000);
|
|
|
|
// Auto-refresh sidebar content
|
|
setInterval(raffraichier_gabarit, 30000);
|
|
});
|
|
|
|
// Toggle Context Panel
|
|
function toggleContextPanel() {
|
|
document.getElementById('contextPanel').classList.toggle('open');
|
|
}
|
|
|
|
// Open Photo Modal
|
|
function openPhotoModal() {
|
|
var modal = new bootstrap.Modal(document.getElementById('photoModal'));
|
|
modal.show();
|
|
}
|
|
|
|
// Show Messages Modal
|
|
function pop_messagerie() {
|
|
var modal = new bootstrap.Modal(document.getElementById('messagesModal'));
|
|
modal.show();
|
|
|
|
// Load messages via AJAX
|
|
$.ajax({
|
|
url: 'load_messages.php',
|
|
method: 'GET',
|
|
success: function(data) {
|
|
$('#div_messagerie').html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
// Update Notification Count
|
|
function updateNotificationCount() {
|
|
// Simulate notification count update
|
|
// In production, this would be an AJAX call
|
|
var count = Math.floor(Math.random() * 10);
|
|
var badge = document.getElementById('notificationCount');
|
|
badge.textContent = count;
|
|
badge.style.display = count > 0 ? 'flex' : 'none';
|
|
}
|
|
|
|
// Change Language
|
|
function changer_langue() {
|
|
Swal.fire({
|
|
title: 'Changer de langue',
|
|
text: 'Sélectionnez la langue souhaitée:',
|
|
icon: 'question',
|
|
showCancelButton: true,
|
|
confirmButtonText: 'Français',
|
|
cancelButtonText: 'English',
|
|
reverseButtons: true
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
// Switch to French
|
|
window.location.href = '?lang=fr_FR';
|
|
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
|
// Switch to English
|
|
window.location.href = '?lang=en_US';
|
|
}
|
|
});
|
|
}
|
|
|
|
// Format dates based on locale
|
|
function formatOfficeDate(dateString) {
|
|
const date = new Date(dateString);
|
|
const options = {
|
|
year: 'numeric',
|
|
month: 'short',
|
|
day: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit'
|
|
};
|
|
|
|
if (est_anglophone()) {
|
|
return date.toLocaleDateString('en-US', options);
|
|
} else {
|
|
return date.toLocaleDateString('fr-FR', options);
|
|
}
|
|
}
|
|
|
|
// Close sidebar when clicking outside on mobile
|
|
document.addEventListener('click', function(event) {
|
|
const sidebar = document.getElementById('sidebar');
|
|
const toggleBtn = document.querySelector('.sidebar-toggle');
|
|
|
|
if (window.innerWidth < 768 &&
|
|
!sidebar.contains(event.target) &&
|
|
!toggleBtn.contains(event.target) &&
|
|
sidebar.classList.contains('open')) {
|
|
sidebar.classList.remove('open');
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<!-- AJAX Content Area -->
|
|
<div id="div_ajaxgabarit"></div>
|
|
</body>
|
|
</html>
|