Skip to content

Commit

Permalink
Merge pull request #80 from fuegoaustral/feature/preload-email-upon-t…
Browse files Browse the repository at this point in the history
…ransfer

Preloads email upon trasnfer to a new account
  • Loading branch information
guillermodoghel authored Nov 3, 2024
2 parents 826d221 + fa9a5ee commit c3ef3b6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tickets/templates/emails/new_transfer_no_account.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
{% endblock %}
{% block content %}
<p>
Te han enviado un bono de Fuego Austral. Para completar la transferencia y recibir tu bono,
Te han enviado {{ ticket_count }} {% if ticket_count > 1 %}bonos{% else %}bono{% endif %} de Fuego Austral.
Para completar la transferencia y recibir tu{% if ticket_count > 1 %}s bonos{% else %} bono{% endif %},
necesitas crear una cuenta en nuestra plataforma.
</p>

Expand All @@ -22,7 +23,7 @@
</p>

<p>
Cualquier problema que tengas con tu bono, podés escribirnos a <a href="mailto:[email protected]">[email protected]</a>
Cualquier problema que tengas con tu{% if ticket_count > 1 %}s bonos{% else %} bono{% endif %}, podés escribirnos a <a href="mailto:[email protected]">[email protected]</a>
o chatearnos desde la web.
</p>
<p>
Expand Down
5 changes: 4 additions & 1 deletion tickets/views/new_ticket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from urllib.parse import urlencode

from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
Expand Down Expand Up @@ -58,12 +59,14 @@ def transfer_ticket(request):
)
new_ticket_transfer.save()
# send email

send_mail(
template_name='new_transfer_no_account',
recipient_list=[email],
context={
'ticket_count': 1,
'destination_email': email,
'sign_up_link': reverse('account_signup')
'sign_up_link': f"{reverse('account_signup')}?{urlencode({'email': email})}"
}
)
else:
Expand Down
11 changes: 10 additions & 1 deletion user_profile/templates/account/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h1>Crear cuenta</h1>
{% for error in errors %}
{{ field }}: {{ error }}
{% endfor %}
{% if not forloop.last %}<br />{% endif %}
{% if not forloop.last %}<br/>{% endif %}
{% endfor %}
</div>
{% endif %}
Expand Down Expand Up @@ -78,10 +78,19 @@ <h1>Crear cuenta</h1>
</div>
</div>
<script>
window.onload = function () {
const email = new URLSearchParams(window.location.search).get('email');
if (email) {
document.getElementById('id_email').value = email;
}
};

document.getElementById('signup-form').addEventListener('submit', function () {
var submitButton = document.getElementById('submit-button');
submitButton.disabled = true;
submitButton.innerHTML = 'Cargando...';
});


</script>
{% endblock %}
5 changes: 4 additions & 1 deletion utils/direct_sales.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.parse import urlencode

from django.db import transaction
from django.urls import reverse

Expand Down Expand Up @@ -119,8 +121,9 @@ def direct_sales_new_user(destination_email, template_tickets, order_type, notes
template_name='new_transfer_no_account',
recipient_list=[destination_email],
context={
'ticket_count': emitted_tickets,
'destination_email': destination_email,
'sign_up_link': reverse('account_signup')
'sign_up_link': f"{reverse('account_signup')}?{urlencode({'email': destination_email})}"
}
)
return order.id

0 comments on commit c3ef3b6

Please sign in to comment.