1
0
Fork 0
mirror of https://github.com/janickiy/yii2-nomer synced 2025-03-09 15:39:59 +00:00
yii2-nomer/views/site/confirm.php
2020-02-05 06:34:26 +03:00

66 lines
No EOL
2.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/* @var $this \yii\web\View */
use yii\helpers\Url;
$this->title = \Yii::$app->name.' - получение бесплатных проверок';
/* @var $user \app\models\User */
//$user = \Yii::$app->getUser()->getIdentity();
?>
<div class="registration">
<div class="clfix">
<h2>Получение бесплатных проверок</h2>
<?php if(!$user->is_confirm): ?>
<p>Для получения бесплатных 5 проверок, вам нужно подтвердить e-mail адрес.</p>
<?php else: ?>
<p>Ваш E-mail адрес успешно подтвержден</p>
<?php endif; ?>
<?php if($user->is_test): ?>
<p>К сожалению вы уже получили 5 бесплатных проверок</p>
<?php else: ?>
<div class="fLine">
<input type="button" class="button" id="getFree" value="Получить 5 проверок" <?=(!$user->is_confirm)?"disabled":"";?>>
<?php if(!$user->is_confirm): ?>
<input type="button" class="button" id="confirmEmail" value="Подтвердить e-mail">
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php if(false):?><script language="JavaScript"><?php endif; ?>
<?php ob_start(); ?>
$("#confirmEmail").on("click", function() {
var self = $(this);
self.attr("disabled", "disabled");
self.css("cursor", "wait");
$.getJSON("<?=Url::toRoute(["site/send-confirm"]);?>", {}, function() {
self.val("Письмо отправлено");
setTimeout(function() {
self.removeAttr("disabled").val("Отправить письмо ещё раз");
self.css("cursor", "pointer");
}, 60000);
})
});
$("#getFree").on("click", function() {
var self = $(this);
self.attr("disabled", "disabled");
self.css("cursor", "wait");
$.getJSON("<?=Url::toRoute(["site/free"]);?>", {}, function(response) {
self.val("Проверки начислены");
if(response.success) {
$('.tarif span').html(response.checks);
}
self.css("cursor", "pointer");
})
});
<?php $js = ob_get_contents(); ob_end_clean(); $this->registerJs($js); ?>