Skip to content

Commit

Permalink
- Agregado cartel con informacion de quienes pueden votar
Browse files Browse the repository at this point in the history
- Agregado la posibilidad de enviar un email cuando se verifica a alguien
  • Loading branch information
guillecro committed Aug 12, 2021
1 parent 185bd36 commit 4f2e96c
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@

$container['adminAction'] = function ($c) {
$citizenResource = new App\Resource\CitizenResource($c);
$userResource = new App\Resource\UserResource($c);
return new App\Action\AdminAction(
$citizenResource,
$userResource,
$c['options'],
$c['representation'],
$c['helper'],
Expand Down
2 changes: 1 addition & 1 deletion app/templates/emails/resendCompleteRegister.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
{% 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'}%}
{% include 'emails/utils/paragraph.twig' with {'text':'Para hacerlo, ingresá al siguiente link:'}%}
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Completar registro'}%}
{% include 'emails/utils/paragraph.twig' with {'text':'¡Tu participación es muy valiosa para la comunidad de San Lorenzo! ¡Muchas gracias!'}%}
{% include 'emails/utils/paragraph.twig' with {'text':'¡Tu participación es muy valiosa para la comunidad comunidad juvenil de San Lorenzo!'}%}
{% endblock %}
4 changes: 2 additions & 2 deletions app/templates/emails/sendPendingVote.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block body %}
{% 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.'}%}
{% 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!'}%}
{% include 'emails/utils/paragraph.twig' with {'text':'¡No pierdas la oportunidad de elegir proyectos para los jovenes de tú ciudad!'}%}
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Visitá el catalogo y votá'}%}
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad de San Lorenzo! ¡Muchas gracias!'}%}
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad juvenil de San Lorenzo!'}%}
{% endblock %}
2 changes: 1 addition & 1 deletion app/templates/emails/utils/footer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
<tr>
<td class="content-block" style="font-family: sans-serif; vertical-align: top; padding:10px 5px; font-size: 10px !important; color: #999999; text-align: center;">
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>.
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>.
</td>
</tr>
</table>
Expand Down
8 changes: 8 additions & 0 deletions app/templates/emails/verifiedUserByAdmin.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends 'emails/master.twig' %}

{% block body %}
{% 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!'}%}
{% include 'emails/utils/paragraph.twig' with {'text':'¡No pierdas la oportunidad de elegir proyectos para los jovenes de tú ciudad!'}%}
{% include 'emails/utils/button.twig' with {'url': url ,'label': 'Visitá el catalogo y votá'}%}
{% include 'emails/utils/paragraph.twig' with {'text': '¡Tu participación es muy valiosa para la comunidad juvenil de San Lorenzo!'}%}
{% endblock %}
19 changes: 16 additions & 3 deletions app/templates/sl/admin/verify.twig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</td>
<td class="has-text-centered">
<form action="{{path_for('runAdminVerifyUser',{'usr': user.id})}}" method="POST">
<button type="submit" class="button is-success is-small">
<button type="submit" id="verifybutton-{{user.id}}" onclick="sendVerifyUser({{user.id}})" class="verifybutton button is-success is-small">
<i class="fas fa-check"></i>&nbsp;Verificar</button>
</form>
</td>
Expand Down Expand Up @@ -124,8 +124,8 @@
</td> #}
<td class="has-text-centered">
<form action="{{path_for('runAdminVerifyUser',{'usr': user.id})}}" method="POST">
<button type="submit" class="button is-success is-small">
<i class="fas fa-check"></i>&nbsp;Verificar</button>
<button type="submit" id="verifybutton-{{user.id}}" onclick="sendVerifyUser({{user.id}})" class="verifybutton button is-success is-small">
<i class="fas fa-check"></i>&nbsp;Verificar</button>
</form>
</td>
</tr>
Expand Down Expand Up @@ -162,3 +162,16 @@
</tbody>
</table>
{% endblock %}

{% block javascripts %}
<script>
function sendVerifyUser(id) {
document.getElementById("verifybutton-" + id).classList.add("is-loading")
let x = document.getElementsByClassName("verifybutton");
let i;
for (i = 0; i < x.length; i++) {
x[i].disabled = true;
}
}
</script>
{% endblock %}
12 changes: 12 additions & 0 deletions app/templates/sl/pages/index/states/vote.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
<p>¡Tenes tiempo de votar hasta el
{{options()['vote-deadline']|date("d/m/Y")}}!
</p>
<br>
<div class="columns is-centered">
<div class="column is-9">
<div class="notification is-warning is-marginless has-text-centered">
<span class="is-size-4">
<i class="fas fa-exclamation-triangle"></i>
<b>IMPORTANTE:</b>
</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
</div>
</div>
</div>

</div>
{# <div class="column">
<div class="columns is-mobile">
Expand Down
7 changes: 6 additions & 1 deletion src/Action/AdminAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ class AdminAction
protected $view;

public function __construct(
$citizenResource, $options, $representation, $helper, $authorization, $db, $filesystem, $pagination, $view
$citizenResource, $userResource, $options, $representation, $helper, $authorization, $db, $filesystem, $pagination, $view
) {
$this->citizenResource = $citizenResource;
$this->userResource = $userResource;
$this->options = $options;
$this->representation = $representation;
$this->helper = $helper;
Expand Down Expand Up @@ -139,6 +140,10 @@ public function runVerify($request, $response, $params)
$user->verified_dni = true;
$user->save();
$citizen = $this->citizenResource->createOneFromDni($user);
// Send Email now
$this->userResource->sendVerifiedUserByAdmin($subject, [
'id' => $user->id
]);
return $response->withRedirect($request->getHeaderLine('HTTP_REFERER'));
// return $this->view->render($response, 'sl/admin/verify.twig', []);
}
Expand Down
18 changes: 18 additions & 0 deletions src/Resource/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ public function sendPendingVoter($subject, $data) // el subject sirve para invit
$this->mailer->sendMail($mailSub, $user->email, $mailMsg, 'text/html');
}

public function sendVerifiedUserByAdmin($subject, $data) // el subject sirve para invitaciones

{
$user = $this->db->query('App:User')
->where('id',$data['id'])->firstOrFail();
$user->touch();
// $mailMsg = 'Accede con ' . $pending->token;

$mailSub = '¡Ya podes comenzar a votar en PP Joven!';
$link = $this->helper->pathFor('showCatalogo', true, [], []);
$mailMsg = $this->view->fetch('emails/verifiedUserByAdmin.twig', [
'url' => $link,
]);

$this->logger->info('Verified By Admin: ' . $link);
$this->mailer->sendMail($mailSub, $user->email, $mailMsg, 'text/html');
}

// public function updateProfile($subject, $user, $data)
// {
// $schema = [
Expand Down

0 comments on commit 4f2e96c

Please sign in to comment.