Skip to content

Commit e03de51

Browse files
moacirmodarenzon
authored andcommitted
Finished first version of webdev oto offers page
close #2405
1 parent e804948 commit e03de51

File tree

9 files changed

+130
-22
lines changed

9 files changed

+130
-22
lines changed

pythonpro/checkout/templates/checkout/webdev_landing_page.html renamed to pythonpro/checkout/templates/checkout/webdev_landing_page_oto.html

Lines changed: 112 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{% load bootstrap4 %}
33
{% load static %}
44
{% load django_pagarme %}
5+
{% load tz %}
56

67
{% block title %}MATRÍCULA REALIZADA!{% endblock %}
78
{% block description %}Curso de Python Grátis. Aprenda a programar de forma rápida, fácil e simples!{% endblock %}
@@ -14,19 +15,19 @@
1415
<div class="col hero">
1516

1617
<div class='desktop d-none d-sm-block d-md-block'>
17-
<h1 class='font-weight-bold text-light'>Sua matrícula foi realizada!</h1>
18+
<h1 class='font-weight-bold text-light'><u>SUA MATRÍCULA FOI REALIZADA!</u></h1>
1819
<p class='mb-5 text-light title-sub'>
19-
Assista o vídeo abaixo para saber como acessar os vídeos do Curso Grátis.
20+
Assista o vídeo abaixo para saber como acessar os vídeos do curso grátis.
2021
</p>
21-
<iframe width="100%" height='523px' src="https://www.youtube.com/embed/0rzm6NjyoSw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
22+
<iframe width="100%" height='523px' src="https://www.youtube.com/embed/I7ki8XTdkw4?autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2223
</div>
2324

2425
<div class='mobile d-block d-lg-none d-xl-none'>
25-
<h1 class='font-weight-bold text-light'>Sua matrícula foi realizada!</h1>
26+
<h1 class='font-weight-bold text-light'><u>SUA MATRÍCULA FOI REALIZADA!</u></h1>
2627
<p class='mb-5 text-light title-sub'>
27-
Assista o vídeo abaixo para saber como acessar os vídeos do Curso Grátis.
28+
Assista o vídeo abaixo para saber como acessar os vídeos do curso grátis.
2829
</p>
29-
<iframe width="100%" height='208px' src="https://www.youtube.com/embed/0rzm6NjyoSw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
30+
<iframe width="100%" height='208px' src="https://www.youtube.com/embed/I7ki8XTdkw4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
3031
</div>
3132
</div>
3233

@@ -36,7 +37,7 @@ <h1 class='font-weight-bold text-light'>Sua matrícula foi realizada!</h1>
3637
{% endblock %}
3738

3839
{% block second_block %}
39-
<div>
40+
<div class='show-after' style="display: none">
4041
<div class="container">
4142

4243
<div class='desktop d-none d-sm-block d-md-block'>
@@ -136,7 +137,53 @@ <h1 class='price-parcelado'>
136137
</div>
137138
</div>
138139

139-
<div class="modal fade" id="modal-waiting-capture" tabindex="-1" role="dialog"
140+
{% block countdown %}
141+
<div class='bg-black show-after' style="display: none">
142+
<div class="container">
143+
<div class="row text-light text-center">
144+
<div class="col mb-5 mt-5">
145+
{% if not is_promotion_expired %}
146+
<h2 class='font-weight-bold mb-5'>
147+
PRESTE ATENÇÃO: Essa promoção vai expirar em breve!
148+
</h2>
149+
150+
<p>
151+
Esta oferta estará disponível apenas durante 30 minutos,
152+
contando a partir do momento do seu cadastro no Python Birds.</b>
153+
</p>
154+
155+
<p>
156+
Ou seja, <b>você só possui esta chance de adquirir o Django Pro com 50% de desconto. </b>
157+
Quando o relógio abaixo chegar a zero, <b>a sua chance acabou.</b>
158+
</p>
159+
160+
<h2 class='demo countdown text-light font-weight-bold text-center'></h2>
161+
162+
{% else %}
163+
164+
<h2 class='font-weight-bold mb-5' style='font-size: 30pt'>
165+
<u>Infelizmente a promoção se encerrou...</u>
166+
</h2>
167+
168+
<div class='initiate-checkout d-none d-sm-block d-md-block mt-5 mb-5'>
169+
<a href='/pagamento/curso-de-python-intermediario' class="cta btn btn-warning initiate-checkout mt-10">
170+
<b>Comprar o PyTools pelo preço normal</b>
171+
</a>
172+
</div>
173+
174+
<div class='initiate-checkout d-block d-lg-none d-xl-none mt-5 mb-5'>
175+
<a href='/pagamento/curso-de-python-intermediario' class="cta-mobile btn initiate-checkout btn-warning mt-10">
176+
<b>Comprar o PyTools pelo preço normal</b>
177+
</a >
178+
</div>
179+
{% endif %}
180+
</div>
181+
</div>
182+
</div>
183+
</div>
184+
{% endblock %}
185+
186+
<div class="modal fade" id="modal-waiting-capture" tabindex="-1" role="dialog"
140187
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
141188
<div class="modal-dialog modal-dialog-centered" role="document">
142189
<div class="modal-content">
@@ -178,13 +225,63 @@ <h5 class="modal-title">Vamos lá!</h5>
178225
submitButton.setAttribute('disabled', 'disabled');
179226
}
180227
});
228+
229+
function showIt() {
230+
var all = document.getElementsByClassName("show-after")
231+
for (var i = 0; i < all.length; i++) {
232+
all[i].style.display = "block";
233+
}
234+
}
235+
setTimeout("showIt()", {% if request.GET.debug %}1{% else %}90{% endif %} * 1000);
236+
237+
{% localtime on %}
238+
// Set the date we're counting down to
239+
var countDownDate = new Date("{{ countdown_limit|date:"m/d/Y H:i:s" }}").getTime();
240+
{% endlocaltime %}
241+
242+
// Update the count down every 1 second
243+
var x = setInterval(function () {
244+
245+
// Get today's date and time
246+
var now = new Date().getTime();
247+
248+
// Find the distance between now and the count down date
249+
var distance = countDownDate - now;
250+
251+
// Time calculations for days, hours, minutes and seconds
252+
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
253+
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
254+
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
255+
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
256+
257+
if(hours < 10) {
258+
hours = "0" + hours
259+
}
260+
261+
if(minutes < 10) {
262+
minutes = "0" + minutes
263+
}
264+
265+
if(seconds < 10) {
266+
seconds = "0" + seconds
267+
}
268+
269+
// Display the result in the element with id="demo"
270+
$(".countdown").html(hours + ":" + minutes + ":" + seconds);
271+
272+
// If the count down is finished, write some text
273+
if (distance < 0) {
274+
clearInterval(x);
275+
$(".countdown").html("ACABOU!!!");
276+
}
277+
}, 1000);
181278
</script>
182279

183280

184281
{% endblock %}
185282

186283
{% block testimonials %}
187-
<div class='bg-secondary'>
284+
<div style="display: none" class='bg-secondary show-after'>
188285
<div class="container">
189286
<div class="row">
190287
<div class="col mt-5 mb-5">
@@ -317,6 +414,12 @@ <h5 class="modal-title">Vamos lá!</h5>
317414
padding: 20px 40px;
318415
font-size: 14pt;
319416
}
417+
.bg-black .text-light h2 {
418+
color: #C33149 !important;
419+
}
420+
.bg-black .text-light .countdown {
421+
font-size: 60pt;
422+
}
320423
</style>
321424

322425
{% endblock %}

pythonpro/checkout/tests/test_landing_page_webdev_oto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
@pytest.fixture
7-
def resp(client, db):
8-
return client.get(reverse('webdev_landing_page'), secure=True)
7+
def resp(client_with_lead, db):
8+
return client_with_lead.get(reverse('webdev_landing_page_oto'), secure=True)
99

1010

1111
def test_should_page_exists(resp):

pythonpro/checkout/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
urlpatterns = [
77
path('inscricao', views.membership_lp, name='membership_lp'),
88
path('lista-de-espera', views.waiting_list_ty, name='waiting_list_ty'),
9-
path('curso-desenvolvimento-web-django', views.webdev_landing_page, name='webdev_landing_page'),
9+
path('curso-desenvolvimento-web-django', views.webdev_landing_page_oto, name='webdev_landing_page_oto'),
1010
]

pythonpro/checkout/views.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import time
2+
from datetime import timedelta
23

4+
from django.contrib.auth.decorators import login_required
35
from django.shortcuts import render, redirect
46
from django.urls import reverse
57
from django.utils.http import urlencode
@@ -103,8 +105,8 @@ def waiting_list_ty(request):
103105
return render(request, 'checkout/waiting_list_ty.html', {'email': request.user.email})
104106

105107

106-
def webdev_landing_page(request):
107-
no_discount_item_config = facade.find_payment_item_config('webdev')
108+
@login_required
109+
def webdev_landing_page_oto(request):
108110
payment_item_config = facade.find_payment_item_config('webdev-oto')
109111
user = request.user
110112
if user.is_authenticated:
@@ -116,5 +118,6 @@ def webdev_landing_page(request):
116118
ctx = {
117119
'payment_item_config': payment_item_config,
118120
'contact_form': form,
121+
'countdown_limit': request.user.date_joined + timedelta(seconds=30 * 60)
119122
}
120-
return render(request, 'checkout/webdev_landing_page.html', ctx)
123+
return render(request, 'checkout/webdev_landing_page_oto.html', ctx)

pythonpro/core/tests/test_lead_landing_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,4 @@ def resp_lead_creation_with_no_offer(client, db, fake: Faker, create_lead_mock,
210210

211211

212212
def test_should_redirect_to_one_time_offer(resp_lead_creation):
213-
assert resp_lead_creation['Location'] == reverse('payments:webdev_landing_page')
213+
assert resp_lead_creation['Location'] == reverse('webdev_landing_page_oto')

pythonpro/core/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _lead_form(request, *args, **kwargs):
178178
return render(request, 'core/lead_form_errors.html', context={'form': e.form}, status=400)
179179

180180
login(request, user)
181-
return redirect(reverse('payments:webdev_landing_page'))
181+
return redirect(reverse('webdev_landing_page_oto'))
182182

183183

184184
def lead_form(request):

pythonpro/modules/tests/test_topics_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def resp_lead_accesing_webdev_content(client_with_lead, topic_webdev, django_use
271271
secure=True)
272272

273273

274-
def test_lead_hitting_webdev_landing_page(resp_lead_accesing_webdev_content):
274+
def test_lead_hitting_webdev_landing_page_oto(resp_lead_accesing_webdev_content):
275275
assert resp_lead_accesing_webdev_content.status_code == 302
276276
# TODO: Change after creating WebDev landing page
277277
assert resp_lead_accesing_webdev_content.url == reverse('checkout:membership_lp')
@@ -285,7 +285,7 @@ def resp_client_accessing_webdev_content(client_with_client, topic_webdev, djang
285285
secure=True)
286286

287287

288-
def test_client_hitting_webdev_landing_page(resp_client_accessing_webdev_content):
288+
def test_client_hitting_webdev_landing_page_oto(resp_client_accessing_webdev_content):
289289
assert resp_client_accessing_webdev_content.status_code == 302
290290
# TODO: Change after creating WebDev landing page
291291
assert resp_client_accessing_webdev_content.url == reverse('checkout:membership_lp')

pythonpro/payments/views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,3 @@ def membership_anonymous_notification(request):
187187
)
188188

189189
return HttpResponse('')
190-
191-

pythonpro/urls.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151
path('checkout/', include('django_pagarme.urls')),
5252
path('inscricao', payments_views.member_landing_page, name='member_landing_page'),
5353
path('pre-inscricao', payments_views.meteoric_landing_page, name='meteoric_landing_page'),
54-
path('curso-desenvolvimento-web-django', checkout_views.webdev_landing_page, name='webdev_landing_page'),
54+
path(
55+
'curso-desenvolvimento-web-django-oto',
56+
checkout_views.webdev_landing_page_oto,
57+
name='webdev_landing_page_oto'
58+
),
5559

5660
# unused pages
5761
path(

0 commit comments

Comments
 (0)