radiantrh/Contestation/Contesterdossier.php

361 lines
9.7 KiB
PHP
Executable File

<?php
session_start();
session_unset();
function afficherMessage($message) {
echo "<!DOCTYPE html>
<html lang='fr'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Erreur</title>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css' rel='stylesheet'>
<style>
.error-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.error-card {
background: white;
border-radius: 12px;
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
padding: 2rem;
max-width: 500px;
width: 100%;
border-left: 4px solid #dc3545;
}
</style>
</head>
<body class='bg-light'>
<div class='error-container'>
<div class='error-card'>
<div class='text-center mb-3'>
<i class='bi bi-exclamation-triangle-fill text-danger' style='font-size: 3rem;'></i>
</div>
<h4 class='text-center text-danger mb-3'>Erreur</h4>
<p class='text-center text-muted'>{$message}</p>
</div>
</div>
</body>
</html>";
exit();
}
if (!isset($_GET['lg'])) {
afficherMessage("Paramètre langue absent de la requête!");
}
$lg = $_GET['lg'];
$codeLangue = base64_decode($lg);
$tab_code_langue = ["fr_FR", "en_US"];
if (!in_array($codeLangue, $tab_code_langue)) {
afficherMessage("Langue inconnue!");
}
if (!isset($_GET['codeEntite'])) {
$msg = $codeLangue == 'en_US' ? "Entity parameter missing from query!" : "Paramètre entité absent de la requête!";
afficherMessage($msg);
}
if (!isset($_GET['idAdherent'])) {
$msg = $codeLangue == 'en_US' ? "Family parameter missing from query!" : "Paramètre famille absent de la requête!";
afficherMessage($msg);
}
if (!isset($_GET['dossier'])) {
$msg = $codeLangue == 'en_US' ? "Entity dossier missing from query!" : "Paramètre dossier absent de la requête!";
afficherMessage($msg);
}
$_SESSION['codeLangue'] = $lg;
$_SESSION['codeEntite'] = $_GET['codeEntite'];
$_SESSION['idAdherent'] = $_GET['idAdherent'];
$_SESSION['dossier'] = $_GET['dossier'];
$codeEntite = $_GET['codeEntite'];
$idAdherent = $_GET['idAdherent'];
$dossier = $_GET['dossier'];
$title = $codeLangue == 'en_US' ? "Contest a medical record" : "Contester un dossier médical";
$label = $codeLangue == 'en_US' ? "Submit" : "Soumettre";
$labelMotifContestation = $codeLangue == 'en_US' ? "Reason for the contestation:" : "Motif de la contestation:";
$placeholder = $codeLangue == 'en_US' ? "Please describe in detail the reason for your contestation..." : "Veuillez décrire en détail le motif de votre contestation...";
$action = "/Contestation/Validercontestation.php?" .
"codeEntite=" . urlencode($codeEntite) .
"&idAdherent=" . urlencode($idAdherent) .
"&dossier=" . urlencode($dossier) .
"&lg=" . urlencode($lg);
?>
<!doctype html>
<html lang="<?= $codeLangue == 'en_US' ? 'en' : 'fr' ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($title) ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<link rel="icon" href="/Contestation/favicon.ico"/>
<style>
.contestation-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
}
.contestation-card {
background: white;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
overflow: hidden;
max-width: 700px;
margin: 40px auto;
}
.contestation-header {
background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
color: white;
padding: 2rem;
text-align: center;
position: relative;
}
.contestation-header::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="rgba(255,255,255,0.1)"/></svg>');
background-size: cover;
}
.contestation-header h1 {
font-weight: 600;
margin: 0;
font-size: 1.8rem;
position: relative;
z-index: 1;
}
.contestation-body {
padding: 2.5rem;
}
.form-label {
font-weight: 600;
color: #333;
margin-bottom: 1rem;
font-size: 1.1rem;
}
.required::after {
content: " *";
color: #dc3545;
}
.form-control {
border: 2px solid #e9ecef;
border-radius: 10px;
padding: 1rem;
font-size: 1rem;
transition: all 0.3s ease;
}
.form-control:focus {
border-color: #4caf50;
box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
}
.btn-submit {
background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
color: white;
border: none;
border-radius: 10px;
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 600;
transition: all 0.3s ease;
width: 100%;
margin-top: 1rem;
}
.btn-submit:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}
.character-count {
text-align: right;
font-size: 0.875rem;
color: #6c757d;
margin-top: 0.5rem;
}
.info-section {
background: #f8f9fa;
border-radius: 10px;
padding: 1.5rem;
margin-bottom: 2rem;
border-left: 4px solid #4caf50;
display: none;
}
.info-item {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
}
.info-item:last-child {
margin-bottom: 0;
}
.info-item i {
color: #4caf50;
margin-right: 0.75rem;
font-size: 1.1rem;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.contestation-container {
padding: 15px;
}
.contestation-card {
margin: 20px auto;
}
.contestation-header {
padding: 1.5rem;
}
.contestation-header h1 {
font-size: 1.5rem;
}
.contestation-body {
padding: 1.5rem;
}
}
@media (max-width: 576px) {
.contestation-container {
padding: 10px;
}
.contestation-header {
padding: 1.25rem;
}
.contestation-header h1 {
font-size: 1.3rem;
}
.contestation-body {
padding: 1.25rem;
}
.info-section {
padding: 1rem;
}
}
</style>
</head>
<body>
<div class="contestation-container">
<div class="contestation-card">
<div class="contestation-header">
<h1>
<i class="bi bi-clipboard-x me-2"></i>
<?= htmlspecialchars($title) ?>
</h1>
</div>
<div class="contestation-body">
<!-- Information Section -->
<div class="info-section">
<div class="info-item">
<i class="bi bi-info-circle"></i>
<strong><?= $codeLangue == 'en_US' ? 'Information:' : 'Information :' ?></strong>
</div>
<div class="info-item">
<i class="bi bi-building"></i>
<span><?= $codeLangue == 'en_US' ? 'Entity:' : 'Entité :' ?> <?= htmlspecialchars($codeEntite) ?></span>
</div>
<div class="info-item">
<i class="bi bi-person"></i>
<span><?= $codeLangue == 'en_US' ? 'Family ID:' : 'ID Famille :' ?> <?= htmlspecialchars($idAdherent) ?></span>
</div>
<div class="info-item">
<i class="bi bi-folder"></i>
<span><?= $codeLangue == 'en_US' ? 'Record:' : 'Dossier :' ?> <?= htmlspecialchars($dossier) ?></span>
</div>
</div>
<!-- Contestation Form -->
<form action="<?= $action ?>" method="post">
<div class="mb-4">
<label for="motifContestation" class="form-label required">
<?= htmlspecialchars($labelMotifContestation) ?>
</label>
<textarea
id="motifContestation"
name="motifContestation"
class="form-control border border-success"
rows="8"
required
placeholder="<?= htmlspecialchars($placeholder) ?>"
maxlength="1000"
oninput="updateCharacterCount(this)"></textarea>
<div class="character-count">
<span id="charCount">0</span>/1000 <?= $codeLangue == 'en_US' ? 'characters' : 'caractères' ?>
</div>
</div>
<button type="submit" class="btn-submit">
<i class="bi bi-send-check me-2"></i>
<?= htmlspecialchars($label) ?>
</button>
</form>
</div>
</div>
</div>
<script>
function updateCharacterCount(textarea) {
const charCount = textarea.value.length;
document.getElementById('charCount').textContent = charCount;
// Change color when approaching limit
const charCountElement = document.getElementById('charCount');
if (charCount > 900) {
charCountElement.style.color = '#dc3545';
charCountElement.style.fontWeight = 'bold';
} else if (charCount > 750) {
charCountElement.style.color = '#ffc107';
charCountElement.style.fontWeight = 'bold';
} else {
charCountElement.style.color = '#6c757d';
charCountElement.style.fontWeight = 'normal';
}
}
// Initialize character count on page load
document.addEventListener('DOMContentLoaded', function() {
const textarea = document.getElementById('motifContestation');
updateCharacterCount(textarea);
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>