<?php

use common\models\Compere;
use common\models\Master;
use common\models\Region;
use common\modules\attachment\widgets\MultipleWidget;
use common\modules\attachment\widgets\SingleWidget;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

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

<div class="box box-success">
    <div class="box-body">
        <?php $form = ActiveForm::begin(); ?>

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


        <?= $form->field($model, 'compere_id')->dropDownList(ArrayHelper::map(Compere::lists(), 'id', 'name')) ?>
        <?= $form->field($model, 'master_id')->dropDownList(ArrayHelper::map(Master::lists(), 'id', 'name')) ?>

        <?= $form->field($model, 'desc')->textarea(['maxlength' => true]) ?>
        <?= $form->field($model, 'vid')->label(Html::label('腾讯视频vid（去上传：https://v.qq.com/）',null, ['style' => 'color:#009688;cursor: pointer;','target'=>'_blank',' onclick'=>'window.open("https://v.qq.com/");return false']))->textInput(['maxlength' => true]) ?>
        <?= $form->field($model, 'area')->label('省市区')->widget(\chenkby\region\Region::className(), [
            'model' => $model,
            'url' => \yii\helpers\Url::toRoute(['get-region']),
            'province' => [
                'attribute' => 'province',
                'items' => Region::getRegion(),
                'options' => ['class' => 'form-control form-control-inline', 'prompt' => '选择省份']
            ],
            'city' => [
                'attribute' => 'city',
                'items' => Region::getRegion($model['province']),
                'options' => ['class' => 'form-control form-control-inline', 'prompt' => '选择城市']
            ],
            'district' => [
                'attribute' => 'area',
                'items' => Region::getRegion($model['city']),
                'options' => ['class' => 'form-control form-control-inline', 'prompt' => '选择县/区']
            ]
        ]);
        ?>


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

        <?= $form->field($model, 'cover')->widget(SingleWidget::className()) ?>
        <?= $form->field($model, 'banner')->widget(MultipleWidget::className()) ?>
        <?= $form->field($model, 'picture')->widget(MultipleWidget::className()) ?>
        <div class="form-group form-submit">
            <?= Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-success']) ?>
        </div>

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