validacion atleta
This commit is contained in:
parent
e6a45a0369
commit
b8513f370b
|
@ -270,8 +270,21 @@ tipoPiscinaSelect.addEventListener('change', async () => {
|
|||
}
|
||||
|
||||
const idAtleta = select.dataset.id;
|
||||
const rol = document.getElementById('rolAtleta').value.trim().toLowerCase();
|
||||
const idPersonalizado = document.getElementById('idPersonalizado').value.trim();
|
||||
|
||||
// 🚫 Validación para evitar duplicados
|
||||
const yaExiste = formacionActual.some(a => a.atletaId === idAtleta || a.idPersonalizado === idPersonalizado);
|
||||
if (yaExiste) {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Atleta ya asignado',
|
||||
text: 'Este atleta ya fue agregado a esta formación.',
|
||||
confirmButtonText: 'Entendido'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const rol = document.getElementById('rolAtleta').value.trim().toLowerCase();
|
||||
const figura = inputFigura?.value.trim();
|
||||
const tipoElemento = document.getElementById('tipoElemento').value;
|
||||
const codigoElemento = document.getElementById('codigoElemento').value.trim();
|
||||
|
@ -289,9 +302,11 @@ tipoPiscinaSelect.addEventListener('change', async () => {
|
|||
tipoElemento,
|
||||
codigoElemento
|
||||
};
|
||||
|
||||
alert('Haz clic en la piscina para colocarlo');
|
||||
});
|
||||
|
||||
|
||||
stage.on('click', () => {
|
||||
if (!currentAtleta || modoDireccion) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue