garant/Vue/Ajaxlistecartebeneficiaire/index.php
2025-12-01 19:18:15 +00:00

231 lines
6.3 KiB
PHP

<style>
.custom-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f8f9fa;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
flex-direction: column;
}
.custom-insurance-card {
width: 325px;
height: 204px;
background: linear-gradient(135deg, #4a90e2, #5c6bc0);
color: white;
border-radius: 10px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
padding: 15px;
position: relative;
overflow: hidden;
display: flex;
flex-direction: row;
align-items: center;
border: 2px solid rgba(255, 255, 255, 0.3);
}
.custom-profile-picture {
width: 80px;
height: 80px;
object-fit: cover;
border-radius: 10px;
border: 2px solid white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
margin-right: 10px;
}
.custom-profile-info {
text-align: left;
flex: 1;
}
.custom-profile-info h1 {
font-size: 16px;
margin: 0 0 5px;
font-weight: bold;
}
.custom-profile-info p {
margin: 4px 0;
font-size: 12px;
font-weight: 300;
}
.custom-details-section {
margin-top: 5px;
font-size: 10px;
}
.custom-details-section p {
margin: 5px 0;
}
.custom-details-section span {
font-weight: bold;
}
.custom-footer {
font-size: 8px;
color: #c5cae9;
text-align: center;
margin-top: 10px;
}
.custom-export-btn {
margin-top: 30px;
background-color: #4a90e2;
color: white;
border: none;
padding: 10px 20px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
width: 180px;
transition: background-color 0.3s;
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}
.custom-export-btn:hover {
background-color: #3b78d4;
}
.custom-export-btn:active {
transform: scale(0.98);
}
.custom-color-picker-container {
margin-bottom: 20px;
display: flex;
gap: 20px;
align-items: center;
}
.custom-color-picker-container label {
font-size: 12px;
}
@media (max-width: 768px) {
.custom-insurance-card {
flex-direction: column;
text-align: center;
}
.custom-profile-picture {
margin: 0 auto 10px;
}
}
</style>
<div class="custom-container">
<div class="custom-color-picker-container">
<div>
<label for="bgColor1">Couleur 1 :</label>
<input type="color" id="bgColor1" value="#4a90e2">
</div>
<div>
<label for="bgColor2">Couleur 2 :</label>
<input type="color" id="bgColor2" value="#5c6bc0">
</div>
</div>
<button class="btn btn-secondary mb-3" id="resetColors">Remettre les couleurs par défaut</button>
<button class="btn btn-light mb-3" id="whiteTheme">Thème blanc</button>
<div class="custom-insurance-card" id="card">
<img class="custom-profile-picture" src="https://via.placeholder.com/60" alt="Photo de profil de l'assuré">
<div>
<div class="custom-profile-info">
<h1 id="assureName">KOUAME FRANCK</h1>
<p id="assureMatricule">Matricule: OP8844</p>
<p id="assurePrivilege">Privilège: 80%</p>
</div>
<div class="custom-details-section">
<p><span>(e) le:</span> <span id="assureDob">01/01/1995</span></p>
<p><span>Centre d'appel:</span> <span id="assureCallCenter">24 24 04 31 04 / 46</span></p>
<p><span>WhatsApp:</span> <span id="assureWhatsApp">07 47 85 83 34</span></p>
</div>
<div class="custom-footer">
Carte d'assurance | Ebene Solutions Informatiques
</div>
</div>
</div>
<button class="custom-export-btn" onclick="downloadPDF()">Télécharger en PDF</button>
</div>
<script>
let listecarte = <?= json_encode($listecarte); ?>; // Assuming the PHP array is converted to JSON
function displayBeneficiaries(beneficiaries) {
const cardContainer = document.getElementById('cardContainer');
cardContainer.innerHTML = '';
beneficiaries.forEach(beneficiary => {
const card = document.createElement('div');
card.classList.add('custom-insurance-card');
card.innerHTML = `
<img class="custom-profile-picture" src="${beneficiary.photo}" alt="Photo de profil de ${beneficiary.nom} ${beneficiary.prenoms}">
<div>
<div class="custom-profile-info">
<h1>${beneficiary.nom} ${beneficiary.prenoms}</h1>
<p>Matricule: ${beneficiary.numero}</p>
<p>Privilège: 80%</p>
</div>
<div class="custom-details-section">
<p><span>Né(e) le:</span> ${beneficiary.date_naissance}</p>
</div>
</div>
`;
cardContainer.appendChild(card);
});
}
// Initialisation des données
updateCardData();
function updateCardData() {
// You can populate the profile data here
}
// Functions for changing colors and themes
document.getElementById('bgColor1').addEventListener('input', function() {
updateCardColors();
});
document.getElementById('bgColor2').addEventListener('input', function() {
updateCardColors();
});
function updateCardColors() {
const color1 = document.getElementById('bgColor1').value;
const color2 = document.getElementById('bgColor2').value;
const card = document.getElementById('card');
card.style.background = `linear-gradient(135deg, ${color1}, ${color2})`;
}
document.getElementById('resetColors').addEventListener('click', function() {
document.getElementById('bgColor1').value = '#4a90e2';
document.getElementById('bgColor2').value = '#5c6bc0';
updateCardColors();
});
document.getElementById('whiteTheme').addEventListener('click', function() {
document.getElementById('card').style.background = 'white';
document.getElementById('card').style.color = 'black';
document.querySelectorAll('.custom-footer, .custom-profile-info p, .custom-details-section p').forEach(function(el) {
el.style.color = 'black';
});
document.getElementById('bgColor1').disabled = true;
document.getElementById('bgColor2').disabled = true;
});
function downloadPDF() {
console.log("Téléchargement du PDF...");
}
</script>