import React from 'react'; import { Document, Page, Text, View, StyleSheet, Font, Image } from '@react-pdf/renderer'; Font.register({ family: 'Open Sans', fonts: [{ src: '/fonts/OpenSans.ttf', fontWeight: 'normal' }] }); const styles = StyleSheet.create({ page: { padding: 25, fontSize: 14, fontFamily: 'Open Sans', backgroundColor: '#F8F9FA', }, headerContainer: { flexDirection: 'row', alignItems: 'center', marginBottom: 25, justifyContent: 'left', }, headerText: { flexDirection: 'column', justifyContent: 'left', alignItems: 'center', marginLeft: 25, }, logo: { width: 60, height: 60, }, header: { fontSize: 28, fontWeight: 'bold', color: '#2C3E50', letterSpacing: 1.5, }, subHeader: { fontSize: 14, marginTop: 5, color: '#34495E' }, tableHeader: { flexDirection: 'row', backgroundColor: '#3E8F5A', fontWeight: 'bold', paddingVertical: 8, paddingHorizontal: 5, borderTopLeftRadius: 10, borderTopRightRadius: 10, }, headerCell: { paddingHorizontal: 5, color: '#ffffff', fontWeight: 'bold', fontSize: 12, }, row: { flexDirection: 'row', paddingVertical: 6, paddingHorizontal: 5, borderBottomWidth: 1, borderBottomColor: '#D5D8DC' }, cell: { paddingHorizontal: 5, fontSize: 9, color: '#2C3E50' } }); const parseDate = (dateStr) => { if (!dateStr) return ''; const [y, m, d] = dateStr.split('-'); return `${d}/${m}/${y}`; }; export const SociosPDF = ({ socios }) => ( Listado de socios Asociación Huertos La Salud - Bellavista • Generado el {new Date().toLocaleDateString()} a las {new Date().toLocaleTimeString()} S H Nombre DNI Teléfono Email Alta Tipo {socios.map((socio, idx) => ( {socio?.memberNumber} {socio?.plotNumber} {socio?.displayName} {socio?.dni} {socio?.phone} {socio?.email || ''} {parseDate(socio?.createdAt?.split('T')[0] || '')} {(() => { switch (socio?.type) { case 0: return 'L. Espera'; case 1: return 'Hortelano'; case 2: return 'Invernadero'; case 3: return 'Colaborador'; default: return 'Desconocido'; } })()} ))} );