_vacancy_form.php 2.31 KB
<?php
    /**
     * @var Vacancy $vacancy
     * @var Employment[] $employment
     */
    use common\models\Employment;
    use common\models\Vacancy;
    use common\widgets\FieldEditor;
    use common\widgets\ImageUploader;
    use kartik\select2\Select2;
    use mihaildev\ckeditor\CKEditor;
    use yii\helpers\Html;
    use yii\web\JsExpression;
    use yii\widgets\ActiveForm;

    $this->title = 'Вакансии';
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="login-left-column-title"><?= $this->title ?></div>

<?php
    $form = ActiveForm::begin();
?>

<?= $form->field($vacancy, 'name')
         ->textInput() ?>

<?= $form->field($vacancy, 'link')
         ->textInput() ?>

<?= $form->field($vacancy, 'user_name')
         ->textInput() ?>

<div class="input-blocks-wrapper">
    <div class="input-blocks">
        <?=
            $form->field($vacancy, 'city')->widget(Select2::classname(), [
                'options' => ['placeholder' => 'Выбор города ...'],
                'pluginOptions' => [
                    'allowClear' => true,
                    'minimumInputLength' => 3,
                    'ajax' => [
                        'url' => \yii\helpers\Url::to(['site/city']),
                        'dataType' => 'json',
                        'data' => new JsExpression('function(params) { return {q:params.term}; }')
                    ],
                    'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
                    'templateResult' => new JsExpression('function(city) { return city.text; }'),
                    'templateSelection' => new JsExpression('function (city) { return city.text; }'),
                ],
            ]);
        ?>

    </div>
</div>

<?= $form->field($vacancy, 'employmentInput')
         ->checkboxList($employment) ?>

<?= FieldEditor::widget (
    [
        'template' => 'requirements', 'item_id' => $vacancy->vacancy_id, 'model' => 'common\models\Vacancy', 'language' => 'ru',
    ]
); ?>
<div class="input-blocks-wrapper full-blocks admin-editor-bl">
    <div class="input-blocks">
        <?= $form->field($vacancy, 'description')->widget(CKEditor::className()) ?>
    </div>
</div>

<div class="admin-save-btn skills-save-btn  style">
    <?= Html::submitButton('Добавить') ?>
</div>


<?php
    $form->end();
?>