1.1.21 add function for checking the status of the switch finish_subscribe_msg
This commit is contained in:
@@ -804,6 +804,30 @@ function send_subscribe (el, id, for_movers, subscribe){
|
||||
}
|
||||
}
|
||||
|
||||
function updSwitchState(el){
|
||||
let stateToSend = el.checked
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/subscribes/receive_finish_subscribe_msg/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: { receive_finish_subscribe_msg: stateToSend },
|
||||
success: function(response){
|
||||
alert(response)
|
||||
|
||||
},
|
||||
error: function (data, exception){
|
||||
console.error('Произошла ошибка при выполнении AJAX запроса:', exception);
|
||||
console.log(data.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var last_open_curtain = null
|
||||
|
||||
function open_curtain_w_btn_profile () {
|
||||
|
||||
@@ -32,7 +32,13 @@
|
||||
<label for="id_email_toggle">{% translate "Получать уведомление на почту о завершении подписки" %}</label>
|
||||
</div>
|
||||
<div class="toggle_switch_cont">
|
||||
<input class="input_toggle_switch" id="id_email_toggle" name="email_toggle" type="checkbox">
|
||||
<input class="input_toggle_switch"
|
||||
onchange="updSwitchState(this)"
|
||||
id="id_email_toggle"
|
||||
name="email_toggle"
|
||||
type="checkbox"
|
||||
{% if subscribe_for_user.receive_finish_subscribe_msg == True %}checked{% endif %}
|
||||
>
|
||||
<div class="input_toggle_switch_display"></div>
|
||||
<div class="toggler_input_switch"></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user