<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\MenuToTheUser;

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

<div class="documents-to-the-user-form">

    <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

    <?= $form->field($model, 'menu_to_the_user_id')->dropDownList(
           ArrayHelper::map(MenuToTheUser::find()->all(),'id','menu_name'),
    ['prompt'=>'Виберіть головне меню']
    ) ?>

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


    <?= $form->field($model, 'files')->widget(\kartik\file\FileInput::classname(), [
        'model' => $model,
        'pluginOptions' => [
            //'allowedFileExtensions'=>['doc','docx','pdf', 'png', ],
            'initialCaption'=>'*.doc *.docx *.pdf *.png *.jpg *.tiff, *.zip *rar',
            'showPreview' => false,
            'showCaption' => true,
            'showRemove' => true,
            'showUpload' => false
        ],
        'options' => ['multiple' => false,],

    ])->label(Yii::t('app','Files')); ?>

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

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

</div>
