<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;

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

<div class="providers-form">

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

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

    <?= $form->field($model, 'details')->textarea(['rows' => 6]) ?>

     <?php echo '<label class="control-label">Add Image</label>';
    echo FileInput::widget([
        'model' => $model,
        'attribute' => 'image',
        'options' => [
            'multiple' => false,
            'accept'=>'image/*'
        ],
        'pluginOptions'=>['allowedFileExtensions'=>['jpg','gif','png']]
    ]);
    ?>

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

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

</div>
