<?php

use backend\widgets\ActiveForm;
use common\models\Circle;
use common\models\CircleCat;
use common\modules\attachment\widgets\SingleWidget;
use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\Circle */
/* @var $form ActiveForm */
?>

<div class="box box-success">
    <div class="box-body">
        <?php $form = ActiveForm::begin([
            'enableClientValidation' => false,
            'enableAjaxValidation' => true, // 需要使用 backend\widgets\ActiveForm 后台自定义表单
        ]); ?>


        <?= $form->field($model, 'cat_id')->dropDownList(CircleCat::getDropDownList(CircleCat::lists())) ?>

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

        <?= $form->field($model, 'avatar')->hint('规格：80px * 80px，<a target="blank" href="https://www.iconfont.cn/">下载图标库</a>')->widget(SingleWidget::className()) ?>


        <?= $form->field($model, 'type')->dropDownList(Circle::$typeList) ?>

        <?= $form->field($model, 'url')->hint('非 "'. Circle::$typeList[Circle::TYPE_QRCODE] .'" 必填')->textInput() ?>

        <?= $form->field($model, 'qrcode')->hint('"'. Circle::$typeList[Circle::TYPE_QRCODE] .'" 必填')->widget(SingleWidget::className()) ?>

        <div class="form-group">
            <?= Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>
        </div>

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