|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\models\Developpement;
- use common\models\DeveloppementPriorite;
- use common\models\User;
- use common\helpers\Url;
-
- /* @var $this yii\web\View */
- /* @var $dataProvider yii\data\ActiveDataProvider */
-
- $this->title = 'Développement';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="developpement-index">
-
- <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
-
- <div class="well">
- Cette page liste les besoins recencés auprès des producteurs utilisant la plateforme. N'hésitez pas à me <a href="<?= Url::frontend('site/contact') ?>">contacter</a> pour la faire évoluer. Les remontées de bugs sont également bienvenues.<br />
- Afin d'orienter de manière pertinente le développement de la plateforme, je vous invite à définir la priorité des évolutions qui vous intéressent.
- </div>
-
- <?php
- foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
- echo '<div class="alert alert-' . $key . '">' . $message . '</div>';
- }
- ?>
-
- <ul id="tabs-statuts-developpements" class="nav nav-tabs" role="tablist">
- <li role="presentation" class="<?php if($statut == Developpement::STATUT_OPEN): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['developpement/index','statut' => Developpement::STATUT_OPEN]); ?>" id="" aria-controls="" role="tab">Ouvert</a></li>
- <li role="presentation" class="<?php if($statut == Developpement::STATUT_CLOSED): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['developpement/index','statut' => Developpement::STATUT_CLOSED]); ?>" id="" aria-controls="" role="tab">Fermé</a></li>
- </ul>
-
- <?php
-
- $columns = [
- [
- 'header' => '#',
- 'value' => function($model) {
- return '#'.$model->id ;
- }
- ],
- [
- 'attribute' => 'type',
- 'header' => 'Type',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->type == Developpement::TYPE_EVOLUTION) {
- return '<span class="label label-success">Évolution</span>' ;
- }
- else {
- return '<span class="label label-danger">Anomalie</span>' ;
- }
- }
- ],
- [ 'attribute' => 'sujet',
- 'format' => 'raw',
- 'value' => function($model) {
- $html = '<strong>'.Html::encode($model->objet).'</strong>' ;
- if(strlen($model->description))
- $html .= '<br />'.nl2br(Html::encode($model->description)) ;
- return $html ;
- }],
- [ 'attribute' => 'estimation_temps',
- 'header' => 'Estimation',
- 'format' => 'raw',
- 'value' => function($model) {
- return intval($model->estimation_temps).' h' ;
- }],
- [ 'attribute' => 'avancement',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->avancement)
- return '<div class="progress">
- <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="'.intval($model->avancement).'" aria-valuemin="0" aria-valuemax="100" style="width: '.intval($model->avancement).'%;">
- <span class="sr-only">'.intval($model->avancement).'% effectué</span>
- </div>
- </div> ' ;
- else
- return '' ;
- }],
- [ 'attribute' => 'date_livraison',
- 'format' => 'raw',
- 'value' => function($model) {
- if(strlen($model->date_livraison))
- return date('d/m/Y',strtotime($model->date_livraison)) ;
- else
- return '' ;
- }],
- ] ;
-
-
- if(Yii::$app->user->identity->status == USER::STATUS_ADMIN
- || Yii::$app->user->identity->status == USER::STATUS_BOULANGER) {
-
- $columns[] = [
- 'header' => 'Priorité',
- 'format' => 'raw',
- 'value' => function($model) {
-
-
- $current_priorite = (isset($model->developpementPrioriteCurrentEtablissement)) ? $model->developpementPrioriteCurrentEtablissement->getStrPriorite() : 'Non' ;
- $style_bouton = (isset($model->developpementPrioriteCurrentEtablissement)) ? $model->developpementPrioriteCurrentEtablissement->getClassCssStyleBouton() : 'default' ;
-
- $html = '<div class="btn-group btn-group-priorite">
- <button type="button" class="btn btn-priorite btn-sm btn-'.$style_bouton.' dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- '.$current_priorite.' <span class="caret"></span>
- </button>
- <ul class="dropdown-menu">
- <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id]).'">Non</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_BASSE]).'">Basse</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_NORMALE]).'">Normale</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_HAUTE]).'">Haute</a></li>
- </ul>
- </div><br />' ;
-
- if(isset($model->developpementPriorite) && count($model->developpementPriorite)) {
- foreach($model->developpementPriorite as $developpement_priorite) {
- if($developpement_priorite->id_etablissement != Yii::$app->user->identity->id_etablissement)
- $html .= '<div class="label label-priorite label-sm label-'.$developpement_priorite->getClassCssStyleBouton().'">'.Html::encode($developpement_priorite->etablissement->nom).'</div> ' ;
- }
- }
-
- return $html ;
- }
- ] ;
- }
-
- if(Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
- $columns[] = [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{update}',
- 'headerOptions' => ['class' => 'actions'],
- 'buttons' => [
- 'update' => function ($url, $model) {
- return '<div class="btn-group">
- <a href="'.$url.'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- <span class="caret"></span>
- <span class="sr-only">Toggle Dropdown</span>
- </button>
- <ul class="dropdown-menu">
- <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/delete','id' => $model->id]).'" class=""><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li>
- </ul>
- </div>' ;
- },
- ],
- ] ;
- }
-
- ?>
-
- <?=
- GridView::widget([
- 'id' => 'tab-developpements',
- 'dataProvider' => $dataProvider,
- 'columns' => $columns
- ]);
- ?>
- </div>
|