Spaces:
Running

reservation / index.html
masterseb's picture
l'historique doit comporter toutes les réservations pour tous les appareils alors que "mes réservations" doit donner uniquement la liste des réservations de l'utilisateur sélectionné - Initial Deployment
fe51781 verified
Raw History Blame Contribute Delete
26.5 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gestion Équipements - Maison du Monde</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-database.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.global.min.js"></script>
<style>
.device-card {
transition: all 0.3s ease;
}
.device-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.reservation-badge {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
</style>
</head>
<body class="bg-gray-50">
<!-- Firebase Configuration -->
<script>
const firebaseConfig = {
apiKey: "AIzaSyDEXAMPLEKEY",
authDomain: "mdm-equipements.firebaseapp.com",
databaseURL: "https://mdm-equipements.firebaseio.com",
projectId: "mdm-equipements",
storageBucket: "mdm-equipements.appspot.com",
messagingSenderId: "1234567890",
appId: "1:1234567890:web:abcdef1234567890"
};
firebase.initializeApp(firebaseConfig);
const database = firebase.database();
</script>
<!-- Navigation -->
<nav class="bg-indigo-600 text-white shadow-lg">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16 items-center">
<div class="flex items-center">
<i data-feather="home" class="mr-2"></i>
<span class="text-xl font-semibold">Maison du Monde</span>
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<a href="#" class="px-3 py-2 rounded-md text-sm font-medium bg-indigo-700">Tableau de bord</a>
<a href="mes-reservations.html" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-500">Mes réservations</a>
<a href="historique.html" class="px-3 py-2 rounded-md text-sm font-medium hover:bg-indigo-500">Historique</a>
</div>
</div>
<div class="flex items-center">
<div class="relative">
<button id="user-menu" class="flex items-center text-sm focus:outline-none">
<span class="mr-2">Mélinda</span>
<i data-feather="user"></i>
</button>
</div>
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-800">Gestion des équipements</h1>
<p class="text-gray-600">Réservez et gérez les appareils disponibles</p>
</div>
<!-- Quick Stats -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600">
<i data-feather="tablet"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Appareils disponibles</p>
<p class="text-2xl font-semibold text-gray-800">3/5</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
<i data-feather="calendar"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Réservations aujourd'hui</p>
<p class="text-2xl font-semibold text-gray-800">2</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
<i data-feather="clock"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Prochaine réservation</p>
<p class="text-xl font-semibold text-gray-800">14:00 - iPad MDM1</p>
</div>
</div>
</div>
</div>
<!-- Devices Grid -->
<div class="mb-8">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Appareils disponibles</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- iPad MDM1 -->
<div class="device-card bg-white rounded-lg shadow overflow-hidden">
<div class="p-6">
<div class="flex justify-between items-start">
<div>
<h3 class="text-lg font-semibold text-gray-800">iPad MDM1</h3>
<p class="text-gray-500">Dernière utilisation: Aujourd'hui 10:00</p>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Disponible
</span>
</div>
<div class="mt-4">
<p class="text-sm text-gray-600">Prochaine réservation: Demain 09:00</p>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 flex justify-end">
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
<i data-feather="plus" class="mr-2"></i> Réserver
</button>
</div>
</div>
<!-- iPad MDM2 -->
<div class="device-card bg-white rounded-lg shadow overflow-hidden">
<div class="p-6">
<div class="flex justify-between items-start">
<div>
<h3 class="text-lg font-semibold text-gray-800">iPad MDM2</h3>
<p class="text-gray-500">Dernière utilisation: Hier 16:30</p>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Disponible
</span>
</div>
<div class="mt-4">
<p class="text-sm text-gray-600">Aucune réservation à venir</p>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 flex justify-end">
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
<i data-feather="plus" class="mr-2"></i> Réserver
</button>
</div>
</div>
<!-- iPad MDM3 -->
<div class="device-card bg-white rounded-lg shadow overflow-hidden">
<div class="p-6">
<div class="flex justify-between items-start">
<div>
<h3 class="text-lg font-semibold text-gray-800">iPad MDM3</h3>
<p class="text-gray-500">Dernière utilisation: Aujourd'hui 11:45</p>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
Occupé maintenant
</span>
</div>
<div class="mt-4">
<p class="text-sm text-gray-600">Réservé par Susanne jusqu'à 15:00</p>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 flex justify-end">
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
<i data-feather="plus" class="mr-2"></i> Réserver
</button>
</div>
</div>
<!-- iPad Cours Alpha -->
<div class="device-card bg-white rounded-lg shadow overflow-hidden">
<div class="p-6">
<div class="flex justify-between items-start">
<div>
<h3 class="text-lg font-semibold text-gray-800">iPad Cours Alpha</h3>
<p class="text-gray-500">Dernière utilisation: Lundi 14:00</p>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
Disponible
</span>
</div>
<div class="mt-4">
<p class="text-sm text-gray-600">Aucune réservation à venir</p>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 flex justify-end">
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
<i data-feather="plus" class="mr-2"></i> Réserver
</button>
</div>
</div>
<!-- Beamer -->
<div class="device-card bg-white rounded-lg shadow overflow-hidden">
<div class="p-6">
<div class="flex justify-between items-start">
<div>
<h3 class="text-lg font-semibold text-gray-800">Beamer</h3>
<p class="text-gray-500">Dernière utilisation: Aujourd'hui 09:30</p>
</div>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
Réservé bientôt
</span>
</div>
<div class="mt-4">
<p class="text-sm text-gray-600">Réservé par Rachida à 16:00</p>
</div>
</div>
<div class="bg-gray-50 px-6 py-4 flex justify-end">
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none">
<i data-feather="plus" class="mr-2"></i> Réserver
</button>
</div>
</div>
</div>
</div>
<!-- Calendar Section -->
<div class="mb-8">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Planning des réservations</h2>
<div class="bg-white rounded-lg shadow overflow-hidden">
<div id="calendar" class="p-4"></div>
</div>
</div>
<!-- Recent Reservations -->
<div>
<h2 class="text-xl font-semibold text-gray-800 mb-4">Dernières réservations</h2>
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Appareil</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Utilisatrice</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Durée</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">iPad MDM1</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Mélinda</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 10:00-12:00</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 heures</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">iPad MDM3</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Susanne</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 13:00-15:00</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 heures</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Beamer</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Rachida</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Aujourd'hui, 16:00-17:30</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1.5 heures</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Reservation Modal -->
<div id="reservationModal" class="fixed z-10 inset-0 overflow-y-auto hidden">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<h3 class="text-lg leading-6 font-medium text-gray-900 mb-4" id="modalTitle">Nouvelle réservation</h3>
<div class="mt-2">
<form>
<div class="mb-4">
<label for="device" class="block text-sm font-medium text-gray-700">Appareil</label>
<select id="device" name="device" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
<option>iPad MDM1</option>
<option>iPad MDM2</option>
<option>iPad MDM3</option>
<option>iPad Cours Alpha</option>
<option>Beamer</option>
</select>
</div>
<div class="mb-4">
<label for="date" class="block text-sm font-medium text-gray-700">Date</label>
<input type="date" id="date" name="date" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label for="startTime" class="block text-sm font-medium text-gray-700">Heure de début</label>
<input type="time" id="startTime" name="startTime" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
</div>
<div>
<label for="endTime" class="block text-sm font-medium text-gray-700">Heure de fin</label>
<input type="time" id="endTime" name="endTime" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
</div>
</div>
<div class="mb-4">
<label for="user" class="block text-sm font-medium text-gray-700">Utilisatrice</label>
<select id="user" name="user" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
<option>Mélinda</option>
<option>Susanne</option>
<option>Leyla</option>
<option>Rachida</option>
<option>Animatrice</option>
<option>Stagiaire</option>
</select>
</div>
<div class="mb-4">
<label for="notes" class="block text-sm font-medium text-gray-700">Notes (optionnel)</label>
<textarea id="notes" name="notes" rows="3" class="mt-1 block w-full shadow-sm sm:text-sm focus:ring-indigo-500 focus:border-indigo-500 border border-gray-300 rounded-md"></textarea>
</div>
</form>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" id="confirmReservation" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm">
Confirmer la réservation
</button>
<button type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Annuler
</button>
</div>
</div>
</div>
</div>
<script>
// Initialize Calendar
document.addEventListener('DOMContentLoaded', function() {
const calendarEl = document.getElementById('calendar');
const calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
events: [
{
title: 'iPad MDM1 - Mélinda',
start: new Date().toISOString().split('T')[0] + 'T10:00:00',
end: new Date().toISOString().split('T')[0] + 'T12:00:00',
color: '#6366F1'
},
{
title: 'iPad MDM3 - Susanne',
start: new Date().toISOString().split('T')[0] + 'T13:00:00',
end: new Date().toISOString().split('T')[0] + 'T15:00:00',
color: '#EC4899'
},
{
title: 'Beamer - Rachida',
start: new Date().toISOString().split('T')[0] + 'T16:00:00',
end: new Date().toISOString().split('T')[0] + 'T17:30:00',
color: '#10B981'
}
]
});
calendar.render();
// Initialize modal
const modal = document.getElementById('reservationModal');
const reserveButtons = document.querySelectorAll('.device-card button:not([disabled])');
reserveButtons.forEach(button => {
button.addEventListener('click', () => {
modal.classList.remove('hidden');
});
});
// Close modal when clicking cancel or outside
const cancelButton = document.querySelector('#reservationModal button:last-child');
cancelButton.addEventListener('click', () => {
modal.classList.add('hidden');
});
modal.addEventListener('click', (e) => {
if (e.target === modal) {
modal.classList.add('hidden');
}
});
});
// Handle reservation confirmation
document.getElementById('confirmReservation').addEventListener('click', function() {
const device = document.getElementById('device').value;
const date = document.getElementById('date').value;
const startTime = document.getElementById('startTime').value;
const endTime = document.getElementById('endTime').value;
const user = document.getElementById('user').value;
const notes = document.getElementById('notes').value;
const reservation = {
device: device,
date: date,
startTime: startTime,
endTime: endTime,
user: user,
notes: notes,
timestamp: new Date().toISOString()
};
saveReservation(reservation);
document.getElementById('reservationModal').classList.add('hidden');
alert('Réservation confirmée avec succès!');
});
// Initialize Firebase
function saveReservation(reservation) {
console.log('Saving reservation:', reservation);
// In a real app, we would use:
// database.ref('reservations').push(reservation);
}
// Initialize feather icons
feather.replace();
AOS.init();
</script>
</body>
</html>