Spaces:
Running
Running
Download index.html from nestasoft/admin-module-site: direct link, hf CLI and curl.
- Browser
- Download file 24.6 kB
-
https://huggingface.co/spaces/nestasoft/admin-module-site/resolve/main/index.html
- Command line
-
hf download hf://spaces/nestasoft/admin-module-site/index.html
-
curl -L -o index.html https://huggingface.co/spaces/nestasoft/admin-module-site/resolve/main/index.html
24.6 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Admin Événements - Église Semence AMour</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| :root { | |
| --primary: #4F6F52; | |
| --secondary: #739072; | |
| --accent: #ECE3CE; | |
| } | |
| .sidebar { | |
| min-height: 100vh; | |
| background-color: var(--primary); | |
| } | |
| .sidebar-link:hover { | |
| background-color: var(--secondary); | |
| } | |
| .btn-primary { | |
| background-color: var(--primary); | |
| } | |
| .btn-primary:hover { | |
| background-color: var(--secondary); | |
| } | |
| .event-image-preview { | |
| max-height: 200px; | |
| object-fit: cover; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="flex"> | |
| <!-- Sidebar --> | |
| <div class="sidebar w-64 text-white fixed h-full"> | |
| <div class="p-4 border-b border-green-700"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-church text-2xl mr-2"></i> | |
| <span class="text-xl font-semibold">Semence AMour</span> | |
| </div> | |
| <p class="text-sm text-green-200 mt-1">Administration</p> | |
| </div> | |
| <nav class="mt-4"> | |
| <a href="#" class="sidebar-link block py-2 px-4 bg-green-700"> | |
| <i class="fas fa-tachometer-alt mr-2"></i> Tableau de bord | |
| </a> | |
| <a href="#" class="sidebar-link block py-2 px-4 hover:bg-green-700"> | |
| <i class="fas fa-calendar-alt mr-2"></i> Événements | |
| </a> | |
| <a href="#" class="sidebar-link block py-2 px-4 hover:bg-green-700"> | |
| <i class="fas fa-users mr-2"></i> Membres | |
| </a> | |
| <a href="#" class="sidebar-link block py-2 px-4 hover:bg-green-700"> | |
| <i class="fas fa-file-alt mr-2"></i> Sermons | |
| </a> | |
| <a href="#" class="sidebar-link block py-2 px-4 hover:bg-green-700"> | |
| <i class="fas fa-cog mr-2"></i> Paramètres | |
| </a> | |
| </nav> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="ml-64 flex-1 p-8"> | |
| <div class="flex justify-between items-center mb-8"> | |
| <h1 class="text-2xl font-bold text-gray-800"> | |
| <i class="fas fa-calendar-alt mr-2 text-green-700"></i> Gestion des Événements | |
| </h1> | |
| <button id="add-event-btn" class="btn-primary px-4 py-2 rounded text-white font-medium"> | |
| <i class="fas fa-plus mr-1"></i> Ajouter un événement | |
| </button> | |
| </div> | |
| <!-- Event List --> | |
| <div class="bg-white rounded-lg shadow overflow-hidden"> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Image</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Titre</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Statut</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody id="events-list" class="bg-white divide-y divide-gray-200"> | |
| <!-- Events will be loaded here --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Event Modal --> | |
| <div id="event-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50"> | |
| <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-screen overflow-y-auto"> | |
| <div class="p-6"> | |
| <div class="flex justify-between items-center border-b pb-4"> | |
| <h3 id="modal-title" class="text-xl font-bold text-gray-800">Nouvel Événement</h3> | |
| <button id="close-modal" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <form id="event-form" class="mt-4 space-y-4"> | |
| <input type="hidden" id="event-id"> | |
| <div> | |
| <label for="event-title" class="block text-sm font-medium text-gray-700">Titre de l'événement</label> | |
| <input type="text" id="event-title" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label for="event-date" class="block text-sm font-medium text-gray-700">Date</label> | |
| <input type="date" id="event-date" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"> | |
| </div> | |
| <div> | |
| <label for="event-time" class="block text-sm font-medium text-gray-700">Heure</label> | |
| <input type="time" id="event-time" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"> | |
| </div> | |
| </div> | |
| <div> | |
| <label for="event-location" class="block text-sm font-medium text-gray-700">Lieu</label> | |
| <input type="text" id="event-location" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"> | |
| </div> | |
| <div> | |
| <label for="event-description" class="block text-sm font-medium text-gray-700">Description</label> | |
| <textarea id="event-description" rows="4" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"></textarea> | |
| </div> | |
| <div> | |
| <label for="event-image" class="block text-sm font-medium text-gray-700">Image</label> | |
| <input type="file" id="event-image" accept="image/*" class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-green-50 file:text-green-700 hover:file:bg-green-100"> | |
| <div id="image-preview-container" class="mt-2 hidden"> | |
| <img id="image-preview" class="event-image-preview w-full rounded-md"> | |
| </div> | |
| </div> | |
| <div> | |
| <label for="event-status" class="block text-sm font-medium text-gray-700">Statut</label> | |
| <select id="event-status" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500"> | |
| <option value="published">Publié</option> | |
| <option value="draft">Brouillon</option> | |
| </select> | |
| </div> | |
| <div class="flex justify-end space-x-3 pt-4"> | |
| <button type="button" id="cancel-event" class="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"> | |
| Annuler | |
| </button> | |
| <button type="submit" id="save-event" class="btn-primary px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-green-700 hover:bg-green-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"> | |
| Enregistrer | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Confirmation Modal --> | |
| <div id="confirm-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50"> | |
| <div class="bg-white rounded-lg shadow-xl w-full max-w-md"> | |
| <div class="p-6"> | |
| <div class="flex justify-between items-center border-b pb-4"> | |
| <h3 class="text-xl font-bold text-gray-800">Confirmation</h3> | |
| <button id="close-confirm-modal" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="mt-4"> | |
| <p id="confirm-message">Êtes-vous sûr de vouloir supprimer cet événement ?</p> | |
| </div> | |
| <div class="flex justify-end space-x-3 pt-6"> | |
| <button type="button" id="cancel-delete" class="px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"> | |
| Annuler | |
| </button> | |
| <button type="button" id="confirm-delete" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"> | |
| Supprimer | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Local storage key for events | |
| const EVENTS_STORAGE_KEY = 'semence_amour_events'; | |
| // DOM Elements | |
| const eventsList = document.getElementById('events-list'); | |
| const addEventBtn = document.getElementById('add-event-btn'); | |
| const eventModal = document.getElementById('event-modal'); | |
| const confirmModal = document.getElementById('confirm-modal'); | |
| const eventForm = document.getElementById('event-form'); | |
| const closeModalBtn = document.getElementById('close-modal'); | |
| const closeConfirmModalBtn = document.getElementById('close-confirm-modal'); | |
| const cancelEventBtn = document.getElementById('cancel-event'); | |
| const cancelDeleteBtn = document.getElementById('cancel-delete'); | |
| const confirmDeleteBtn = document.getElementById('confirm-delete'); | |
| const eventImageInput = document.getElementById('event-image'); | |
| const imagePreviewContainer = document.getElementById('image-preview-container'); | |
| const imagePreview = document.getElementById('image-preview'); | |
| // State variables | |
| let currentEventId = null; | |
| let events = []; | |
| // Initialize the app | |
| function init() { | |
| loadEvents(); | |
| renderEvents(); | |
| setupEventListeners(); | |
| } | |
| // Load events from local storage | |
| function loadEvents() { | |
| const storedEvents = localStorage.getItem(EVENTS_STORAGE_KEY); | |
| if (storedEvents) { | |
| events = JSON.parse(storedEvents); | |
| } else { | |
| // Sample data for demo | |
| events = [ | |
| { | |
| id: '1', | |
| title: 'Retraite Spirituelle', | |
| date: '2023-09-15', | |
| time: '09:00', | |
| location: 'Centre de retraite', | |
| description: 'Un weekend de ressourcement spirituel dans la nature pour approfondir votre relation avec Dieu.', | |
| imageUrl: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1399&q=80', | |
| status: 'published', | |
| createdAt: new Date().toISOString() | |
| }, | |
| { | |
| id: '2', | |
| title: 'Concert de Louange', | |
| date: '2023-09-30', | |
| time: '19:30', | |
| location: 'Église Semence AMour', | |
| description: 'Une soirée spéciale de louange avec des artistes chrétiens locaux et internationaux.', | |
| imageUrl: 'https://images.unsplash.com/photo-1529107386315-e1a2ed48a620?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80', | |
| status: 'published', | |
| createdAt: new Date().toISOString() | |
| } | |
| ]; | |
| saveEvents(); | |
| } | |
| } | |
| // Save events to local storage | |
| function saveEvents() { | |
| localStorage.setItem(EVENTS_STORAGE_KEY, JSON.stringify(events)); | |
| // In a real app, you would also update the main website here | |
| updateWebsiteEvents(); | |
| } | |
| // Update the main website events (simulated) | |
| function updateWebsiteEvents() { | |
| console.log('Mise à jour des événements sur le site principal...'); | |
| // In a real implementation, this would update your main website | |
| } | |
| // Render events in the table | |
| function renderEvents() { | |
| eventsList.innerHTML = ''; | |
| if (events.length === 0) { | |
| eventsList.innerHTML = ` | |
| <tr> | |
| <td colspan="5" class="px-6 py-4 text-center text-gray-500">Aucun événement trouvé</td> | |
| </tr> | |
| `; | |
| return; | |
| } | |
| events.sort((a, b) => new Date(a.date) - new Date(b.date)).forEach(event => { | |
| const eventDate = new Date(event.date); | |
| const formattedDate = eventDate.toLocaleDateString('fr-FR', { | |
| weekday: 'long', | |
| year: 'numeric', | |
| month: 'long', | |
| day: 'numeric' | |
| }); | |
| const statusBadge = event.status === 'published' ? | |
| '<span class="px-2 py-1 text-xs font-semibold leading-5 text-green-800 bg-green-100 rounded-full">Publié</span>' : | |
| '<span class="px-2 py-1 text-xs font-semibold leading-5 text-gray-800 bg-gray-100 rounded-full">Brouillon</span>'; | |
| const row = document.createElement('tr'); | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="flex-shrink-0 h-10 w-10"> | |
| <img class="h-10 w-10 rounded-full object-cover" src="${event.imageUrl || 'https://via.placeholder.com/150'}" alt="${event.title}"> | |
| </div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="text-sm font-medium text-gray-900">${event.title}</div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="text-sm text-gray-500">${formattedDate} à ${event.time}</div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| ${statusBadge} | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button data-id="${event.id}" class="edit-event text-green-600 hover:text-green-900 mr-3">Modifier</button> | |
| <button data-id="${event.id}" class="delete-event text-red-600 hover:text-red-900">Supprimer</button> | |
| </td> | |
| `; | |
| eventsList.appendChild(row); | |
| }); | |
| // Add event listeners to the new buttons | |
| document.querySelectorAll('.edit-event').forEach(btn => { | |
| btn.addEventListener('click', (e) => { | |
| const eventId = e.target.getAttribute('data-id'); | |
| editEvent(eventId); | |
| }); | |
| }); | |
| document.querySelectorAll('.delete-event').forEach(btn => { | |
| btn.addEventListener('click', (e) => { | |
| const eventId = e.target.getAttribute('data-id'); | |
| showDeleteConfirmation(eventId); | |
| }); | |
| }); | |
| } | |
| // Show the event form modal | |
| function showEventModal(title, isEdit = false) { | |
| document.getElementById('modal-title').textContent = title; | |
| eventModal.classList.remove('hidden'); | |
| } | |
| // Hide the event form modal | |
| function hideEventModal() { | |
| eventModal.classList.add('hidden'); | |
| eventForm.reset(); | |
| imagePreviewContainer.classList.add('hidden'); | |
| currentEventId = null; | |
| } | |
| // Show the confirmation modal | |
| function showConfirmModal(message) { | |
| document.getElementById('confirm-message').textContent = message; | |
| confirmModal.classList.remove('hidden'); | |
| } | |
| // Hide the confirmation modal | |
| function hideConfirmModal() { | |
| confirmModal.classList.add('hidden'); | |
| currentEventId = null; | |
| } | |
| // Add a new event | |
| function addNewEvent() { | |
| showEventModal('Nouvel Événement', false); | |
| } | |
| // Edit an existing event | |
| function editEvent(eventId) { | |
| const event = events.find(e => e.id === eventId); | |
| if (!event) return; | |
| currentEventId = eventId; | |
| showEventModal('Modifier Événement', true); | |
| // Fill the form with event data | |
| document.getElementById('event-id').value = event.id; | |
| document.getElementById('event-title').value = event.title; | |
| document.getElementById('event-date').value = event.date; | |
| document.getElementById('event-time').value = event.time; | |
| document.getElementById('event-location').value = event.location; | |
| document.getElementById('event-description').value = event.description; | |
| document.getElementById('event-status').value = event.status; | |
| // Show image preview if available | |
| if (event.imageUrl) { | |
| imagePreview.src = event.imageUrl; | |
| imagePreviewContainer.classList.remove('hidden'); | |
| } | |
| } | |
| // Show delete confirmation | |
| function showDeleteConfirmation(eventId) { | |
| currentEventId = eventId; | |
| const event = events.find(e => e.id === eventId); | |
| showConfirmModal(`Êtes-vous sûr de vouloir supprimer l'événement "${event.title}" ?`); | |
| } | |
| // Delete an event | |
| function deleteEvent() { | |
| events = events.filter(e => e.id !== currentEventId); | |
| saveEvents(); | |
| renderEvents(); | |
| hideConfirmModal(); | |
| } | |
| // Save event (add or update) | |
| function saveEvent(eventData) { | |
| if (currentEventId) { | |
| // Update existing event | |
| const index = events.findIndex(e => e.id === currentEventId); | |
| if (index !== -1) { | |
| events[index] = { ...events[index], ...eventData }; | |
| } | |
| } else { | |
| // Add new event | |
| const newEvent = { | |
| id: Date.now().toString(), | |
| ...eventData, | |
| createdAt: new Date().toISOString() | |
| }; | |
| events.unshift(newEvent); | |
| } | |
| saveEvents(); | |
| renderEvents(); | |
| hideEventModal(); | |
| } | |
| // Handle image upload preview | |
| function handleImageUpload(e) { | |
| const file = e.target.files[0]; | |
| if (file) { | |
| const reader = new FileReader(); | |
| reader.onload = function(event) { | |
| imagePreview.src = event.target.result; | |
| imagePreviewContainer.classList.remove('hidden'); | |
| }; | |
| reader.readAsDataURL(file); | |
| } | |
| } | |
| // Setup event listeners | |
| function setupEventListeners() { | |
| // Add event button | |
| addEventBtn.addEventListener('click', addNewEvent); | |
| // Close modal buttons | |
| closeModalBtn.addEventListener('click', hideEventModal); | |
| closeConfirmModalBtn.addEventListener('click', hideConfirmModal); | |
| cancelEventBtn.addEventListener('click', hideEventModal); | |
| cancelDeleteBtn.addEventListener('click', hideConfirmModal); | |
| // Confirm delete button | |
| confirmDeleteBtn.addEventListener('click', deleteEvent); | |
| // Image upload preview | |
| eventImageInput.addEventListener('change', handleImageUpload); | |
| // Form submission | |
| eventForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const eventData = { | |
| title: document.getElementById('event-title').value, | |
| date: document.getElementById('event-date').value, | |
| time: document.getElementById('event-time').value, | |
| location: document.getElementById('event-location').value, | |
| description: document.getElementById('event-description').value, | |
| status: document.getElementById('event-status').value | |
| }; | |
| // Handle image upload (in a real app, you would upload to a server) | |
| if (eventImageInput.files.length > 0) { | |
| // For demo purposes, we'll just use a placeholder | |
| // In a real app, you would upload the image and get a URL | |
| eventData.imageUrl = 'https://via.placeholder.com/150'; | |
| } | |
| saveEvent(eventData); | |
| }); | |
| } | |
| // Initialize the application | |
| document.addEventListener('DOMContentLoaded', init); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=nestasoft/admin-module-site" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |