diff --git a/apps/school/templates/blocks/day_pay_btn.html b/apps/school/templates/blocks/day_pay_btn.html
index 155b8827..f4cd2f40 100644
--- a/apps/school/templates/blocks/day_pay_btn.html
+++ b/apps/school/templates/blocks/day_pay_btn.html
@@ -1,7 +1,5 @@
купить
diff --git a/apps/school/templates/blocks/schedule_item.html b/apps/school/templates/blocks/schedule_item.html
index 7860e437..27d4fcd4 100644
--- a/apps/school/templates/blocks/schedule_item.html
+++ b/apps/school/templates/blocks/schedule_item.html
@@ -5,17 +5,17 @@
{{ school_schedule }}
- {% if purchased and live_lesson %}
+ {% if is_purchased and live_lesson %}
{{ live_lesson.date }}
{% endif %}
{{ school_schedule.start_at }} (МСК)
- {% if purchased %}
- {% if school_schedule.weekday in school_schedules_purchased %}
- {% if live_lesson and live_lesson.title %}
- {% include './open_lesson.html' %}
- {% endif %}
+ {% if is_purchased %}
+ {% if school_schedule.weekday in school_schedules_purchased and live_lesson and live_lesson.title %}
+ {% include './open_lesson.html' %}
{% endif %}
+ {% else %}
+ {% include './day_pay_btn.html' %}
{% endif %}
diff --git a/apps/school/templates/summer/promo.html b/apps/school/templates/summer/promo.html
index 6995c7b9..3d52d65b 100644
--- a/apps/school/templates/summer/promo.html
+++ b/apps/school/templates/summer/promo.html
@@ -10,11 +10,7 @@
@@ -53,7 +53,7 @@
или
-
+
ЧЕРЕЗ FACEBOOK
@@ -96,10 +96,10 @@
-
+
-
+
@@ -122,7 +122,7 @@
или
-
+
ЧЕРЕЗ FACEBOOK
diff --git a/project/templates/blocks/popup_buy.html b/project/templates/blocks/popup_buy.html
index 96b3b29d..d3080ec9 100644
--- a/project/templates/blocks/popup_buy.html
+++ b/project/templates/blocks/popup_buy.html
@@ -89,7 +89,7 @@
diff --git a/web/src/js/modules/auth.js b/web/src/js/modules/auth.js
index 07f65cda..09a9bae6 100644
--- a/web/src/js/modules/auth.js
+++ b/web/src/js/modules/auth.js
@@ -4,7 +4,7 @@ import isEmpty from 'validator/lib/isEmpty';
import isLength from 'validator/lib/isLength';
$(document).ready(function () {
- let auth = $('.js-auth'),
+ let popup = $('.js-popup-auth'),
type = auth.find('.js-auth-type'),
tab = auth.find('.js-auth-tab'),
login = auth.find('.js-auth-login'),
@@ -153,7 +153,13 @@ $(document).ready(function () {
})
.done(function (data) {
if (data.success === true) {
- location.reload();
+ const nextUrl = popup.data('next-url');
+ if(nextUrl){
+ window.location.href = nextUrl;
+ }
+ else{
+ window.location.reload();
+ }
} else {
authButton.removeClass('loading');
}
@@ -234,7 +240,13 @@ $(document).ready(function () {
})
.done(function (data) {
if (data.success === true) {
- location.reload();
+ const nextUrl = popup.data('next-url');
+ if(nextUrl){
+ window.location.href = nextUrl;
+ }
+ else{
+ window.location.reload();
+ }
} else {
registrationButton.removeClass('loading');
}
@@ -275,7 +287,7 @@ $(document).ready(function () {
if (facebookResponse) {
if (facebookResponse.status === 'connected') {
- login_with_facebook(facebookResponse.authResponse.accessToken);
+ login_with_facebook(facebookResponse.authResponse.accessToken, popup.data('next-url'));
return;
}
}
@@ -305,14 +317,19 @@ function load_facebook() {
});
}
-function login_with_facebook(accessToken) {
+function login_with_facebook(accessToken, nextUrl) {
$.ajax('/auth/facebook_login/', {
method: 'POST',
data: {'access_token': accessToken},
})
.done(function (data) {
if (data.success === true) {
- location.reload();
+ if(nextUrl){
+ window.location.href = nextUrl;
+ }
+ else{
+ window.location.reload();
+ }
}
})
.fail(function (xhr) {
diff --git a/web/src/js/modules/popup.js b/web/src/js/modules/popup.js
index a1a91d9f..425f81cd 100644
--- a/web/src/js/modules/popup.js
+++ b/web/src/js/modules/popup.js
@@ -31,6 +31,24 @@ $(document).ready(function () {
});
is_extend = true;
}
+ if(! window.LIL_STORE.user.id) {
+ const $btn = popup.find('.buy__btn');
+ $btn.click(function(event) {
+ event.preventDefault();
+ hidePopup().then(() => {
+ popup = $('.js-popup-auth');
+ popup.data('next-url', $btn.attr('href'));
+ showPopup();
+ });
+ });
+ }
+ }
+ if( data === '.js-popup-auth') {
+ let nextUrl = $(this).data('auth-next-url');
+ if(nextUrl === 'href') {
+ nextUrl = $(this).attr('href');
+ }
+ popup.data('next-url', nextUrl);
}
if($(this).data('day')) {
@@ -70,21 +88,28 @@ $(document).ready(function () {
function showPopup(){
body.addClass('no-scroll');
popup.addClass('open');
- setTimeout(function(){
- popup.addClass('visible');
- }, 100);
+ return new Promise((resolve) => {
+ setTimeout(function(){
+ popup.addClass('visible');
+ resolve();
+ }, 100);
+ });
}
function hidePopup(){
body.removeClass('no-scroll');
popup.removeClass('visible');
- setTimeout(function(){
- popup.removeClass('open');
- }, 300);
+ popup.data('next-url', null);
if($('#password-reset__sent').is(':visible')) {
window.location.reload();
}
+ return new Promise((resolve) => {
+ setTimeout(function(){
+ popup.removeClass('open');
+ resolve();
+ }, 300);
+ });
}
$(document).on('change', '[data-day]', function(){