Skip to content

Commit

Permalink
Agregado "Oficiales", un usuario puede funcionar como staff para perm…
Browse files Browse the repository at this point in the history
…itir la votacion presencial
  • Loading branch information
guillecro committed Aug 25, 2023
1 parent d9c2dd6 commit 325cf5e
Show file tree
Hide file tree
Showing 13 changed files with 613 additions and 12 deletions.
21 changes: 15 additions & 6 deletions ext/lib/site/home-propuestas/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class HomePropuestas extends Component {
})
})
.then((res) => {
if (forum.privileges && forum.privileges.canEdit) {
if ((forum.privileges && forum.privileges.canEdit) || (user && user.state && user.state.value && user.state.value.oficialMesa)) {
this.checkPadron()
}
})
Expand Down Expand Up @@ -390,7 +390,15 @@ class HomePropuestas extends Component {
handlerVotacion = (e) => {
e.preventDefault()

this.setState({ dialogVotacion: !this.state.dialogVotacion, dialogMessage: null, dniP: '', facultadP: null, claustroP: null, votesP: [], isDNIInPadron: false }) //, () => this.fetchTopics());
this.setState({
dialogVotacion: !this.state.dialogVotacion,
dialogMessage: null,
dniP: '',
facultadP: null,
claustroP: null,
votesP: [],
isDNIInPadron: false
}) //, () => this.fetchTopics());
}

checkPadron = () => {
Expand Down Expand Up @@ -431,19 +439,20 @@ class HomePropuestas extends Component {
let votes = []
if (forum) {
votacion = forum.config.votacion
if (userLoggedIn && forum.privileges && forum.privileges.canEdit) {
if ((userLoggedIn && forum.privileges && forum.privileges.canEdit) || (userLoggedIn && user && user.state && user.state.value && user.state.value.oficialMesa)) {
if (isDNIInPadron) {
dni = dniP
votes = votesP
} else {
dni = ''
votes = []
}
} else if (user && user.state && user.state.value && !forum.privileges.canEdit) {
} else if (user && user.state && user.state.value && !forum.privileges.canEdit && !user.state.value.oficialMesa) {
dni = user.state.value.dni
votes = userLoggedIn && user.state.value && user.state.value.voto
}
}
console.log( { userLoggedIn, dni, votes, votacion })

return { userLoggedIn, dni, votes, votacion }
}
Expand Down Expand Up @@ -471,7 +480,7 @@ class HomePropuestas extends Component {
open>
<span onClick={this.handlerVotacion}>&times;</span>
<p className='intro text-center'>* Módulo de votación presencial, para administradores</p>
<h4 className='text-center'>Bienvenida/o a la votación de PPUNR 2022</h4>
<h4 className='text-center'>Bienvenida/o a la votación de PPUNR</h4>
<h5 className='text-center'>Ingrese los datos del Votante</h5>
<label htmlFor='dniP'>DNI</label>
<input id='dniP' type='text' name='dniP' className='form-control' onChange={(e) => this.setState({ dniP: e.target.value })} />
Expand All @@ -496,7 +505,7 @@ class HomePropuestas extends Component {
btnText={forum.config.propuestasAbiertas ? 'Subí tu idea' : undefined}
btnLink={forum.config.propuestasAbiertas ? '/formulario-idea' : undefined}
title={texts['foro-titulo']}
handlerVotacion={forum && forum.config.votacion && forum && forum.privileges && forum.privileges.canEdit && this.handlerVotacion}
handlerVotacion={((forum && forum.config.votacion && forum.privileges && forum.privileges.canEdit) || (user && user.state && user.state.value && user.state.value.oficialMesa)) && this.handlerVotacion}
user={user}
voterInformation={voterInformation} />}

Expand Down
Loading

0 comments on commit 325cf5e

Please sign in to comment.