Пример #1
0
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\ProductCat $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="product-cat-search">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'action' => ['index'], 'method' => 'get']);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Название категории...', 'maxlength' => 255]], 'parent_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\ProductCat::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]]]]);
?>
    <div class="form-group">
        <?php 
echo Html::a(Yii::t('app', 'Reset'), ['index'], ['class' => 'btn btn-default', 'style' => 'margin-left: 15px; margin-right: 10px']);
?>
        <?php 
echo Html::submitButton(Yii::t('app', Yii::t('app', 'Search')), ['class' => 'btn btn-default', 'onclick' => ' $.pjax.reload({container: "#w2", data: $("#w0").serialize()  }); return false;']);
?>
  
    </div>

    <?php 
ActiveForm::end();
?>
Пример #2
0
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
use common\widgets\edit\InputFile;
use common\widgets\edit\Redactor;
/**
 * @var yii\web\View $this
 * @var common\models\ProductType $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="product-type-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['cat_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\ProductCat::find()->where(['>', 'parent_id', '0'])->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Название типа продукта...', 'maxlength' => 255]], 'icon_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'image']], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Redactor::className(), 'options' => ['filemanager' => ['webpath' => '/'], 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Полное описание...', 'rows' => 6]]], 'type_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\ProductType())->getTypeIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'diagnoses_list' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(\common\models\Diagnos::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...', 'multiple' => true], 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 10]]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>