Skip to content

Commit 4f2e96c

Browse files
committed
- Agregado cartel con informacion de quienes pueden votar
- Agregado la posibilidad de enviar un email cuando se verifica a alguien
1 parent 185bd36 commit 4f2e96c

9 files changed

Lines changed: 66 additions & 8 deletions

File tree

app/dependencies.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@
122122

123123
$container['adminAction'] = function ($c) {
124124
$citizenResource = new App\Resource\CitizenResource($c);
125+
$userResource = new App\Resource\UserResource($c);
125126
return new App\Action\AdminAction(
126127
$citizenResource,
128+
$userResource,
127129
$c['options'],
128130
$c['representation'],
129131
$c['helper'],

app/templates/emails/resendCompleteRegister.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
{% include 'emails/utils/paragraph.twig' with {'text':'¡Hola! No terminaste el proceso de completar tu registro en la plataforma de Presupuesto Participativo Joven de San Lorenzo'}%}
55
{% include 'emails/utils/paragraph.twig' with {'text':'Para hacerlo, ingresá al siguiente link:'}%}
66
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Completar registro'}%}
7-
{% include 'emails/utils/paragraph.twig' with {'text':'¡Tu participación es muy valiosa para la comunidad de San Lorenzo! ¡Muchas gracias!'}%}
7+
{% include 'emails/utils/paragraph.twig' with {'text':'¡Tu participación es muy valiosa para la comunidad comunidad juvenil de San Lorenzo!'}%}
88
{% endblock %}

app/templates/emails/sendPendingVote.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% block body %}
44
{% include 'emails/utils/paragraph.twig' with {'text':'¡Hola! Hemos detectado que te registraste en la plataforma de Presupuesto Participativo Joven de San Lorenzo pero todavía no votaste.'}%}
5-
{% include 'emails/utils/paragraph.twig' with {'text':'¡No pierdas la oportunidad de elegir proyectos para tú ciudad! ¡Podés elegir hasta tres por categoría!'}%}
5+
{% include 'emails/utils/paragraph.twig' with {'text':'¡No pierdas la oportunidad de elegir proyectos para los jovenes de tú ciudad!'}%}
66
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Visitá el catalogo y votá'}%}
7-
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad de San Lorenzo! ¡Muchas gracias!'}%}
7+
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad juvenil de San Lorenzo!'}%}
88
{% endblock %}

app/templates/emails/utils/footer.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
33
<tr>
44
<td class="content-block" style="font-family: sans-serif; vertical-align: top; padding:10px 5px; font-size: 10px !important; color: #999999; text-align: center;">
5-
Este es un email enviado desde la web de <a href="http://sanlorenzo.gob.ar/" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Presupuesto Participativo</a> del <a href="http://sanlorenzo.gob.ar/" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Municipio de San Lorenzo</a>. Si usted cree que no debería de haber recibido el siguiente email, por favor, ignórelo. En colaboración con <a href="https://www.santafe.gob.ar/ms/gobiernoabierto/colaboracion/santalab/" style="text-decoration: underline; color: #999999; font-size: 10px !important;">SANTALAB</a>, <a href="https:/democraciaenred.org" style="text-decoration: underline; color: #999999; font-size: 10px !important;" >Democracia en red</a> y <a href="https://virtuagora.org" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Virtuágora</a>.
5+
Este es un email enviado desde la web de <a href="https://ppjoven.sanlorenzo.gob.ar/" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Presupuesto Participativo</a> del <a href="https://sanlorenzo.gob.ar/" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Municipio de San Lorenzo</a>. Si usted cree que no debería de haber recibido el siguiente email, por favor, ignórelo. En colaboración con <a href="https://twitter.com/virtuagora" style="text-decoration: underline; color: #999999; font-size: 10px !important;">Virtuágora</a>.
66
</td>
77
</tr>
88
</table>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends 'emails/master.twig' %}
2+
3+
{% block body %}
4+
{% include 'emails/utils/paragraph.twig' with {'text':'¡Hola! ¡Queremos informarte que se te ha habilitado para votar en el Presupuesto Participativo Joven de San Lorenzo!'}%}
5+
{% include 'emails/utils/paragraph.twig' with {'text':'¡No pierdas la oportunidad de elegir proyectos para los jovenes de tú ciudad!'}%}
6+
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Visitá el catalogo y votá'}%}
7+
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad juvenil de San Lorenzo!'}%}
8+
{% endblock %}

app/templates/sl/admin/verify.twig

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
</td>
7676
<td class="has-text-centered">
7777
<form action="{{path_for('runAdminVerifyUser',{'usr': user.id})}}" method="POST">
78-
<button type="submit" class="button is-success is-small">
78+
<button type="submit" id="verifybutton-{{user.id}}" onclick="sendVerifyUser({{user.id}})" class="verifybutton button is-success is-small">
7979
<i class="fas fa-check"></i>&nbsp;Verificar</button>
8080
</form>
8181
</td>
@@ -124,8 +124,8 @@
124124
</td> #}
125125
<td class="has-text-centered">
126126
<form action="{{path_for('runAdminVerifyUser',{'usr': user.id})}}" method="POST">
127-
<button type="submit" class="button is-success is-small">
128-
<i class="fas fa-check"></i>&nbsp;Verificar</button>
127+
<button type="submit" id="verifybutton-{{user.id}}" onclick="sendVerifyUser({{user.id}})" class="verifybutton button is-success is-small">
128+
<i class="fas fa-check"></i>&nbsp;Verificar</button>
129129
</form>
130130
</td>
131131
</tr>
@@ -162,3 +162,16 @@
162162
</tbody>
163163
</table>
164164
{% endblock %}
165+
166+
{% block javascripts %}
167+
<script>
168+
function sendVerifyUser(id) {
169+
document.getElementById("verifybutton-" + id).classList.add("is-loading")
170+
let x = document.getElementsByClassName("verifybutton");
171+
let i;
172+
for (i = 0; i < x.length; i++) {
173+
x[i].disabled = true;
174+
}
175+
}
176+
</script>
177+
{% endblock %}

app/templates/sl/pages/index/states/vote.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@
5050
<p>¡Tenes tiempo de votar hasta el
5151
{{options()['vote-deadline']|date("d/m/Y")}}!
5252
</p>
53+
<br>
54+
<div class="columns is-centered">
55+
<div class="column is-9">
56+
<div class="notification is-warning is-marginless has-text-centered">
57+
<span class="is-size-4">
58+
<i class="fas fa-exclamation-triangle"></i>
59+
<b>IMPORTANTE:</b>
60+
</span><br>Solo pueden votar jovenes de 16 a 19 años con domicilio en San Lorenzo, y los que tienen domicilio en otra localidad, pero asisten a una escuela de la ciudad de San Lorenzo
61+
</div>
62+
</div>
63+
</div>
64+
5365
</div>
5466
{# <div class="column">
5567
<div class="columns is-mobile">

src/Action/AdminAction.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class AdminAction
2121
protected $view;
2222

2323
public function __construct(
24-
$citizenResource, $options, $representation, $helper, $authorization, $db, $filesystem, $pagination, $view
24+
$citizenResource, $userResource, $options, $representation, $helper, $authorization, $db, $filesystem, $pagination, $view
2525
) {
2626
$this->citizenResource = $citizenResource;
27+
$this->userResource = $userResource;
2728
$this->options = $options;
2829
$this->representation = $representation;
2930
$this->helper = $helper;
@@ -139,6 +140,10 @@ public function runVerify($request, $response, $params)
139140
$user->verified_dni = true;
140141
$user->save();
141142
$citizen = $this->citizenResource->createOneFromDni($user);
143+
// Send Email now
144+
$this->userResource->sendVerifiedUserByAdmin($subject, [
145+
'id' => $user->id
146+
]);
142147
return $response->withRedirect($request->getHeaderLine('HTTP_REFERER'));
143148
// return $this->view->render($response, 'sl/admin/verify.twig', []);
144149
}

src/Resource/UserResource.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,24 @@ public function sendPendingVoter($subject, $data) // el subject sirve para invit
226226
$this->mailer->sendMail($mailSub, $user->email, $mailMsg, 'text/html');
227227
}
228228

229+
public function sendVerifiedUserByAdmin($subject, $data) // el subject sirve para invitaciones
230+
231+
{
232+
$user = $this->db->query('App:User')
233+
->where('id',$data['id'])->firstOrFail();
234+
$user->touch();
235+
// $mailMsg = 'Accede con ' . $pending->token;
236+
237+
$mailSub = '¡Ya podes comenzar a votar en PP Joven!';
238+
$link = $this->helper->pathFor('showCatalogo', true, [], []);
239+
$mailMsg = $this->view->fetch('emails/verifiedUserByAdmin.twig', [
240+
'url' => $link,
241+
]);
242+
243+
$this->logger->info('Verified By Admin: ' . $link);
244+
$this->mailer->sendMail($mailSub, $user->email, $mailMsg, 'text/html');
245+
}
246+
229247
// public function updateProfile($subject, $user, $data)
230248
// {
231249
// $schema = [

0 commit comments

Comments
 (0)