<?php

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

/* @var $this yii\web\View */
/* @var $model app\models\Admins */
/* @var $form yii\widgets\ActiveForm */

?>

<?php $form = ActiveForm::begin(); ?>

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

<?= $form->field($model, 'username')->textInput(['maxlength' => true, 'class' => 'form-control rounded-input']) ?>
    
<?php if(Yii::$app->controller->action->id != 'update'): ?>

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

<?= $form->field($model, 'confirm_password')->passwordInput([ 'class' => 'form-control rounded-input']) ?>

<?php endif; ?>

<div class="form-group">
    <?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn  submit-btn']) ?>
</div>

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

<?php

    if($model->hasErrors('already_exist')){
        echo '<div class="alert alert-danger">';
        echo $model->getErrors()['already_exist'][0];
        echo '</div>';
    }

?>