<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\captcha\Captcha;

$this->title = Yii::t('app', 'Create Account');

$this->registerJs("
    $('#refresh-captcha').click(function(e){
        e.preventDefault();
        $('#captcha-image').yiiCaptcha('refresh');
    });
");

?>

<div class="users-form middle-page-container">
    
    <h1><?= Html::encode($this->title) ?></h1>
    
    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'confirm_password')->passwordInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'verify_code')->widget(Captcha::className(), [
            'imageOptions' => [
                'id' => 'captcha-image'
            ]
        ]) ?>

    <p>
        <a id='refresh-captcha' href="#">
            <?= Yii::t('app', 'Refresh Captcha') ?>
        </a>
    </p>
    

    <div class="form-group middle-page-container text-align-center">
        <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success btn-expanded']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
