import React, { useState } from 'react'; import { FileText, Download, Calendar, Clock, MapPin, Users, FileWarning, Scale } from 'lucide-react'; const PoliceReportForm = () => { const [formData, setFormData] = useState({ date: '', heure: '', lieu: '', intervenants: '', faits: '', mesures: '', articles: '' }); const handleChange = (e) => { setFormData({ ...formData, [e.target.name]: e.target.value }); }; const generatePDF = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Header doc.setFontSize(18); doc.setFont(undefined, 'bold'); doc.text('RAPPORT DE POLICE MUNICIPALE', 105, 20, { align: 'center' }); doc.text('NOUVELLE-CALÉDONIE', 105, 28, { align: 'center' }); doc.setLineWidth(0.5); doc.line(20, 32, 190, 32); let y = 45; doc.setFontSize(12); // Date et Heure doc.setFont(undefined, 'bold'); doc.text('DATE :', 20, y); doc.setFont(undefined, 'normal'); doc.text(formData.date || 'Non renseigné', 50, y); doc.setFont(undefined, 'bold'); doc.text('HEURE :', 120, y); doc.setFont(undefined, 'normal'); doc.text(formData.heure || 'Non renseignée', 145, y); y += 10; // Lieu doc.setFont(undefined, 'bold'); doc.text('LIEU DE L\'INTERVENTION :', 20, y); y += 7; doc.setFont(undefined, 'normal'); const lieuLines = doc.splitTextToSize(formData.lieu || 'Non renseigné', 170); doc.text(lieuLines, 20, y); y += lieuLines.length * 7 + 8; // Intervenants doc.setFont(undefined, 'bold'); doc.text('INTERVENANTS :', 20, y); y += 7; doc.setFont(undefined, 'normal'); const intervenantLines = doc.splitTextToSize(formData.intervenants || 'Non renseigné', 170); doc.text(intervenantLines, 20, y); y += intervenantLines.length * 7 + 8; // Faits constatés doc.setFont(undefined, 'bold'); doc.text('FAITS CONSTATÉS :', 20, y); y += 7; doc.setFont(undefined, 'normal'); const faitsLines = doc.splitTextToSize(formData.faits || 'Non renseigné', 170); doc.text(faitsLines, 20, y); y += faitsLines.length * 7 + 8; // Check if new page needed if (y > 240) { doc.addPage(); y = 20; } // Mesures prises doc.setFont(undefined, 'bold'); doc.text('MESURES PRISES :', 20, y); y += 7; doc.setFont(undefined, 'normal'); const mesuresLines = doc.splitTextToSize(formData.mesures || 'Non renseigné', 170); doc.text(mesuresLines, 20, y); y += mesuresLines.length * 7 + 8; // Check if new page needed if (y > 240) { doc.addPage(); y = 20; } // Articles de loi doc.setFont(undefined, 'bold'); doc.text('ARTICLES DE LOI APPLICABLES (NC) :', 20, y); y += 7; doc.setFont(undefined, 'normal'); const articlesLines = doc.splitTextToSize(formData.articles || 'Non renseigné', 170); doc.text(articlesLines, 20, y); y += articlesLines.length * 7 + 15; // Signature area if (y > 250) { doc.addPage(); y = 20; } doc.setFont(undefined, 'bold'); doc.text('Fait à _________________, le _________________', 20, y); y += 15; doc.text('Signature et cachet :', 20, y); // Download doc.save(`rapport_police_NC_${formData.date || 'sans_date'}.pdf`); }; return (

Rapport de Police Municipale

Nouvelle-Calédonie