Spaces:
Running

fce-compta / index.html
ELHASSOUNI's picture
ok merci. le tranfert des pièces justificatives est très long, ç'est même bloquant. merci de corriger - Follow Up Deployment
26352da verified
Raw History Blame Contribute Delete
17.4 kB
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FC Ensisheim - Gestion Comptable</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>
<style>
.bg-fc-red {
background-color: #d62828;
}
.text-fc-red {
color: #d62828;
}
.border-fc-red {
border-color: #d62828;
}
.bg-fc-white {
background-color: #ffffff;
}
.hover\:bg-fc-red:hover {
background-color: #d62828;
}
.hover\:text-fc-white:hover {
color: #ffffff;
}
.file-input-label:hover {
background-color: #f3f4f6;
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<div id="app" class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-fc-red text-white shadow-md">
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
<div class="flex items-center space-x-2">
<img src="https://enzostvs-deepsite.hf.space/_next/image?url=https%3A%2F%2Fhuggingface.co%2Fspaces%2FELHASSOUNI%2Ffce-compta%2Fresolve%2Fmain%2Fimages%2Flogo__FCE%202.jpg&w=64&q=75" alt="Logo FC Ensisheim" class="h-12 w-12 rounded-full border-2 border-white">
<h1 class="text-xl font-bold">FC Ensisheim</h1>
</div>
<nav>
<ul class="flex space-x-6">
<li><a href="index.html" class="hover:text-gray-200 transition">Accueil</a></li>
<li><a href="admin.html" class="hover:text-gray-200 transition">Admin</a></li>
<li><button onclick="shareApp()" class="hover:text-gray-200 transition">Partager</button></li>
<li><a href="#" class="hover:text-gray-200 transition">Déconnexion</a></li>
</ul>
</nav>
</div>
</header>
<!-- Main Content -->
<main class="flex-grow container mx-auto px-4 py-8">
<div class="max-w-3xl mx-auto">
<div class="bg-white rounded-lg shadow-md overflow-hidden" data-aos="fade-up">
<div class="bg-fc-red text-white px-6 py-4">
<h2 class="text-xl font-semibold">Formulaire Comptable</h2>
<p class="text-sm opacity-90">Transmettez vos documents comptables</p>
</div>
<form class="p-6 space-y-6" id="accountingForm">
<!-- Nom -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Nom</label>
<select id="name" name="name" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
<option value="" disabled selected>Sélectionnez un nom</option>
<option value="Jean Dupont">Jean Dupont</option>
<option value="Marie Martin">Marie Martin</option>
<option value="Pierre Durand">Pierre Durand</option>
<option value="Sophie Lambert">Sophie Lambert</option>
</select>
</div>
<!-- Type -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Type</label>
<div class="flex space-x-4">
<label class="inline-flex items-center">
<input type="radio" name="type" value="depense" class="text-fc-red focus:ring-fc-red" checked>
<span class="ml-2">Dépense</span>
</label>
<label class="inline-flex items-center">
<input type="radio" name="type" value="recette" class="text-fc-red focus:ring-fc-red">
<span class="ml-2">Recette</span>
</label>
</div>
</div>
<!-- Date -->
<div>
<label for="date" class="block text-sm font-medium text-gray-700 mb-1">Date</label>
<input type="date" id="date" name="date" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
</div>
<!-- Montants -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div>
<label for="cb_amount" class="block text-sm font-medium text-gray-700 mb-1">Montant CB (€)</label>
<input type="number" step="0.01" id="cb_amount" name="cb_amount" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
</div>
<div>
<label for="cash_amount" class="block text-sm font-medium text-gray-700 mb-1">Montant Espèce (€)</label>
<input type="number" step="0.01" id="cash_amount" name="cash_amount" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
</div>
<div>
<label for="check_amount" class="block text-sm font-medium text-gray-700 mb-1">Montant Billets (€)</label>
<input type="number" step="0.01" id="check_amount" name="check_amount" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
</div>
<div>
<label for="cheque_amount" class="block text-sm font-medium text-gray-700 mb-1">Montant Chèque (€)</label>
<input type="number" step="0.01" id="cheque_amount" name="cheque_amount" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border">
</div>
</div>
<!-- Remarque -->
<div>
<label for="remarks" class="block text-sm font-medium text-gray-700 mb-1">Remarque</label>
<textarea id="remarks" name="remarks" rows="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-fc-red focus:ring focus:ring-fc-red focus:ring-opacity-50 p-2 border"></textarea>
</div>
<!-- Pièce Justificative -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Pièce Justificative</label>
<div id="drop-zone" class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md hover:border-fc-red transition">
<div class="space-y-1 text-center">
<div class="flex text-sm text-gray-600 justify-center">
<label for="file-upload" class="relative cursor-pointer bg-white rounded-md font-medium text-fc-red hover:text-red-500 focus-within:outline-none">
<span>Choisir un fichier</span>
<input id="file-upload" name="file-upload" type="file" class="sr-only" accept="image/*,application/pdf">
</label>
<p class="pl-1">ou glisser-déposer</p>
</div>
<p id="file-name" class="text-xs text-gray-500 mt-2 hidden">Aucun fichier sélectionné</p>
<p class="text-xs text-gray-500">PNG, JPG, JPEG, PDF jusqu'à 10MB</p>
</div>
</div>
</div>
<!-- Bouton Validation -->
<div class="pt-4">
<button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-fc-red hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-fc-red transition">
Valider le document
<i data-feather="check" class="ml-2"></i>
</button>
</div>
</form>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-6">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<img src="https://enzostvs-deepsite.hf.space/_next/image?url=https%3A%2F%2Fhuggingface.co%2Fspaces%2FELHASSOUNI%2Ffce-compta%2Fresolve%2Fmain%2Fimages%2Flogo__FCE%202.jpg&w=64&q=75" alt="Logo FC Ensisheim" class="h-10 w-10 rounded-full border border-white inline-block mr-2">
<span class="font-semibold">FC Ensisheim</span>
</div>
<div class="text-sm">
<p>&copy; 2025 FC Ensisheim. Tous droits réservés.</p>
</div>
<div class="flex space-x-4 mt-4 md:mt-0">
<a href="#" class="hover:text-gray-300 transition"><i data-feather="facebook"></i></a>
<a href="#" class="hover:text-gray-300 transition"><i data-feather="twitter"></i></a>
<a href="#" class="hover:text-gray-300 transition"><i data-feather="instagram"></i></a>
</div>
</div>
</div>
</footer>
</div>
<script>
AOS.init();
feather.replace();
function shareApp() {
const shareUrl = window.location.href;
const shareData = {
title: 'FC Ensisheim - Gestion Comptable',
text: 'Utilisez cette application pour transmettre vos documents comptables',
url: shareUrl
};
if (navigator.share) {
navigator.share(shareData)
.catch(err => {
// Fallback to clipboard if share fails
navigator.clipboard.writeText(shareUrl)
.then(() => alert('Lien copié dans le presse-papiers !\n' + shareUrl))
.catch(() => {
// Final fallback if clipboard also fails
prompt('Copiez ce lien pour partager:', shareUrl);
});
});
} else {
// Web Share API not supported
navigator.clipboard.writeText(shareUrl)
.then(() => alert('Lien copié dans le presse-papiers !\n' + shareUrl))
.catch(() => {
prompt('Copiez ce lien pour partager:', shareUrl);
});
}
}
// Store documents in localStorage
function storeDocument(documentData) {
let documents = JSON.parse(localStorage.getItem('accountingDocuments')) || [];
documents.push(documentData);
localStorage.setItem('accountingDocuments', JSON.stringify(documents));
}
async function processFile(file) {
return new Promise((resolve) => {
if (!file) {
resolve(null);
return;
}
// Store only essential file info to avoid performance issues
const fileInfo = {
name: file.name,
type: file.type,
size: file.size,
lastModified: file.lastModified
};
resolve(fileInfo);
});
}
document.getElementById('accountingForm').addEventListener('submit', async function(e) {
e.preventDefault();
const submitBtn = e.target.querySelector('button[type="submit"]');
const originalText = submitBtn.innerHTML;
submitBtn.disabled = true;
submitBtn.innerHTML = '<span>Envoi en cours...</span>';
// Get form data
const formData = {
name: document.getElementById('name').value,
type: document.querySelector('input[name="type"]:checked').value,
date: document.getElementById('date').value,
cb_amount: parseFloat(document.getElementById('cb_amount').value) || 0,
cash_amount: parseFloat(document.getElementById('cash_amount').value) || 0,
check_amount: parseFloat(document.getElementById('check_amount').value) || 0,
cheque_amount: parseFloat(document.getElementById('cheque_amount').value) || 0,
remarks: document.getElementById('remarks').value,
file: await processFile(document.getElementById('file-upload').files[0]),
timestamp: new Date().toISOString()
};
// Store document
storeDocument(formData);
setTimeout(() => {
alert('Document enregistré avec succès !');
submitBtn.disabled = false;
submitBtn.innerHTML = originalText;
e.target.reset();
fileNameDisplay.classList.add('hidden');
}, 500);
});
// Handle file upload and drag & drop
const fileInput = document.getElementById('file-upload');
const dropZone = document.getElementById('drop-zone');
const fileNameDisplay = document.getElementById('file-name');
fileInput.addEventListener('change', handleFileSelect);
// Prevent default drag behaviors
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
dropZone.addEventListener(eventName, preventDefaults, false);
});
// Highlight drop zone when item is dragged over it
['dragenter', 'dragover'].forEach(eventName => {
dropZone.addEventListener(eventName, highlight, false);
});
['dragleave', 'drop'].forEach(eventName => {
dropZone.addEventListener(eventName, unhighlight, false);
});
// Handle dropped files
dropZone.addEventListener('drop', handleDrop, false);
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
function highlight() {
dropZone.classList.add('border-fc-red', 'bg-gray-50');
}
function unhighlight() {
dropZone.classList.remove('border-fc-red', 'bg-gray-50');
}
function handleDrop(e) {
const dt = e.dataTransfer;
const files = dt.files;
fileInput.files = files;
handleFileSelect({ target: fileInput });
}
function handleFileSelect(e) {
const files = e.target.files;
if (files.length > 0) {
const file = files[0];
fileNameDisplay.textContent = `Fichier sélectionné: ${file.name} (${(file.size / 1024 / 1024).toFixed(2)} MB)`;
fileNameDisplay.classList.remove('hidden');
// Validate file size
if (file.size > 10 * 1024 * 1024) {
alert('Le fichier est trop volumineux (max 10MB)');
fileInput.value = '';
fileNameDisplay.classList.add('hidden');
}
} else {
fileNameDisplay.classList.add('hidden');
}
}
</script>
</body>
</html>