Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yii\helpers\Html;
- use yii\widgets\DetailView;
- use yii\grid\GridView;
- use yii\bootstrap\Modal;
- use yii\helpers\Url;
- use yii\widgets\Pjax;
- use common\models\RecordHelpers;
- /* @var $this yii\web\View */
- /* @var $model frontend\models\Project */
- $this->title = $model->name;
- $this->params['breadcrumbs'][] = ['label' => 'Projects', 'url' => ['index']];
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="project-view">
- <h1><?= Html::encode($this->title) ?></h1>
- <p>
- <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
- <?= Html::a('Delete', ['delete', 'id' => $model->id], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => 'Are you sure you want to delete this item?',
- 'method' => 'post',
- ],
- ]) ?>
- <?= Html::a('Assign User', ['project-user/create', 'project_id' => $model->id], ['class' => 'btn btn-info']) ?>
- </p>
- <?= DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- //'id',
- 'name',
- 'description:ntext',
- 'created_at',
- 'updated_at',
- [
- 'label' => 'Created By',
- 'value' => RecordHelpers::getUserName($model->created_by)
- ],
- [
- 'label' => 'Updated By',
- 'value' => RecordHelpers::getUserName($model->updated_by)
- ],
- ],
- ]) ?>
- <?= Html::a('Create Task', '#', [
- 'id' => 'activity-index-link',
- 'class' => 'btn btn-success',
- 'data-toggle' => 'modal',
- 'data-target' => '#modal',
- 'data-url' => Url::to(['task/create?project_id='.$model->id]),
- 'data-pjax' => '0',
- ]); ?>
- <?php Pjax::begin() ?>
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'id' => 'task-grid',
- 'columns' => [
- ['class' => 'yii\grid\SerialColumn'],
- //'id',
- 'name',
- 'description:ntext',
- [
- 'attribute' => 'statusDescription',
- 'filter' => $searchModel->getStatusesList()
- ],
- [
- 'attribute' => 'ownerName',
- ],
- [
- 'attribute' => 'requesterName',
- ],
- // 'created_at',
- // 'updated_at',
- // 'created_by',
- // 'updated_by',
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{view}{update}{delete}',
- 'controller' => 'task',
- 'buttons' => [
- 'view' => function ($url, $model, $key) {
- return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', '#', [
- 'id' => 'activity-index-link',
- 'title' => Yii::t('app', 'View'),
- 'data-toggle' => 'modal',
- 'data-target' => '#modal',
- 'data-url' => Url::to(['task/view', 'id' => $model->id]),
- 'data-pjax' => '0',
- ]);
- },
- 'update' => function ($url, $model, $key) {
- return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '#', [
- 'id' => 'activity-index-link',
- 'title' => Yii::t('app', 'Update'),
- 'data-toggle' => 'modal',
- 'data-target' => '#modal',
- 'data-url' => Url::to(['task/update', 'id' => $model->id]),
- 'data-pjax' => '0',
- ]);
- },
- 'delete' => function ($url, $model, $key)
- {
- return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
- 'title' => Yii::t('yii', 'Delete'),
- 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
- 'data-method' => 'post',
- ]);
- },
- ]
- ],
- ],
- ]); ?>
- <?php Pjax::end() ?>
- <?php
- $this->registerJs(
- "$(document).on('click', '#activity-index-link', (function() {
- $.get(
- $(this).data('url'),
- function (data) {
- $('.modal-body').html(data);
- $('#modal').modal();
- }
- );
- }));"
- ); ?>
- <?php
- Modal::begin([
- 'id' => 'modal',
- 'header' => '<h4 class="modal-title">Complete</h4>',
- 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Cerrar</a>',
- ]);
- echo "<div class='well'></div>";
- Modal::end();
- ?>
- </div>
Add Comment
Please, Sign In to add comment