project column

This commit is contained in:
2023-04-20 02:07:19 +03:00
parent edea2cc3e7
commit 2482ae89f6
24 changed files with 737 additions and 18 deletions

View File

@ -0,0 +1,35 @@
<?php
use common\models\Project;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\project\models\ProjectColumn */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="project-column-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'project_id')->dropDownList(
Project::find()->select(['name', 'id'])->indexBy('id')->column(),
[
'id' => 'project-id',
'placeholder' => 'Выберите',
'prompt' => 'Выберите'
]
) ?>
<?= $form->field($model, 'status')->dropDownList(\common\models\ProjectColumn::getStatus(), ['prompt' => 'Выберите статус']) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,37 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\project\models\ProjectColumnSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="project-column-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'title') ?>
<?= $form->field($model, 'project_id') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'status') ?>
<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 backend\modules\project\models\ProjectColumn */
$this->title = 'Создать колонку';
$this->params['breadcrumbs'][] = ['label' => 'Колонки проектов', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="project-column-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\project\models\ProjectColumnSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Колонки проектов';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="project-column-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Создать', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
'title',
[
'attribute' => 'project_id',
'value' => function(\common\models\ProjectColumn $model){
return $model->project->name ?? 'Не задано';
}
],
'created_at',
'updated_at',
[
'attribute' => 'status',
'value' => function (\common\models\ProjectColumn $model) {
return \common\models\ProjectColumn::getStatus()[$model->status] ?? 'Не задано';
}
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\project\models\ProjectColumn */
$this->title = 'Редактировать колонку: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Колонки проектов', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Редактировать';
?>
<div class="project-column-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,49 @@
<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\project\models\ProjectColumn */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Колонки проектов', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="project-column-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Список', ['index'], ['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',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'title',
[
'attribute' => 'project_id',
'value' => ArrayHelper::getValue($model, 'project.name' ),
],
'created_at',
'updated_at',
[
'attribute' => 'status',
'value' => function (\common\models\ProjectColumn $model) {
return \common\models\ProjectColumn::getStatus()[$model->status] ?? 'Не задано';
}
],
],
]) ?>
</div>