skill category

This commit is contained in:
andrey
2021-06-08 17:05:54 +03:00
parent 9f1db817a5
commit 23773eff4e
13 changed files with 487 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\SkillCategory */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="skill-category-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,29 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\settings\models\SkillCategorySearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="skill-category-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'name') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\SkillCategory */
$this->title = 'Create Skill Category';
$this->params['breadcrumbs'][] = ['label' => 'Skill Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="skill-category-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,34 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\settings\models\SkillCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Skill Categories';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="skill-category-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Добавить категорию', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Навыки', ['/settings/skill'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\SkillCategory */
$this->title = 'Update Skill Category: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Skill Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="skill-category-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\SkillCategory */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Skill Categories', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="skill-category-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
],
]) ?>
</div>

View File

@ -13,6 +13,9 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'category_id')->dropDownList(
\yii\helpers\ArrayHelper::map(\common\models\SkillCategory::getAll(), 'id', 'name')
); ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>

View File

@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Категории', ['/settings/skill-category'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
@ -26,6 +27,12 @@ $this->params['breadcrumbs'][] = $this->title;
'id',
'name',
[
'attribute' => 'category_id',
'value' => function ($model) {
return $model->category ? $model->category->name : '-';
}
],
['class' => 'yii\grid\ActionColumn'],
],