<%- include('header.html', { pageTitle, extraStyles, extraScripts }) %> <% function getAge(date){ const diff = Date.now() - new Date(date).getTime(); const ageDate = new Date(diff); return Math.abs(ageDate.getUTCFullYear() - 1970); } function onlyDate(date=null){ if(!date){ return new Date().toJSON().substr(0,10) } return date.toJSON().substr(0,10) } function getPoints(sport, pickle, padel, beach){ switch(sport){ case 'pickleball': return pickle; case 'padel': return padel; case 'beach_tennis': return beach; default: return 0; } } %>

Lista de Jugadores

Editar Jugador

<% if (typeof allPlayers !== 'undefined' && allPlayers && allPlayers.length > 0) { %> <% let counter = 0; allPlayers.forEach(function(p) { counter += 1 %> <% }) %>
Nombre Cédula Sexo Edad Pickleball Padel Beach Tennis  
<%= p.name %> <%= p.legal_id %> <%= p.sex %> <%= getAge(p.date_of_birth) %> <%= p.points_pickle > 0 ? parseFloat(p.points_pickle).toFixed(2) : '' %> <%= p.points_padel > 0 ? p.points_padel : '' %> <%= p.points_beach > 0 ? p.points_beach : '' %>
<%=counter%> <%=counter==1?'Jugador':'Jugadores'%>
<% } %>
<%- include('footer.html', { extraScripts }) %>