|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?php
-
-
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\models\Development;
- use common\models\DevelopmentPriority;
- use common\models\User;
- use common\helpers\Url;
-
- $this->setTitle('Développement') ;
- $this->addButton(['label' => '+', 'url' => ['development/create'], 'class' => 'btn btn-primary']) ;
- $this->addBreadcrumb($this->getTitle()) ;
-
- ?>
-
- <div class="development-index">
- <div class="well">
- Cette page liste les besoins recencés auprès des producteurs utilisant la plateforme. N'hésitez pas à me <a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['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>
-
- <ul id="tab-status-developments" class="nav nav-tabs" role="tablist">
- <li role="presentation" class="<?php if($status == Development::STATUS_OPEN): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['development/index','status' => Development::STATUS_OPEN]); ?>" id="" aria-controls="" role="tab">Ouvert</a></li>
- <li role="presentation" class="<?php if($status == Development::STATUS_CLOSED): ?>active<?php endif; ?>"><a href="<?= Yii::$app->urlManager->createUrl(['development/index','status' => Development::STATUS_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 == Development::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->subject).'</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->time_estimate).' h' ;
- }],
- [ 'attribute' => 'avancement',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->progress)
- return '<div class="progress">
- <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="'.intval($model->progress).'" aria-valuemin="0" aria-valuemax="100" style="width: '.intval($model->progress).'%;">
- <span class="sr-only">'.intval($model->progress).'% effectué</span>
- </div>
- </div> ' ;
- else
- return '' ;
- }],
- [ 'attribute' => 'date_delivery',
- 'format' => 'raw',
- 'value' => function($model) {
- if(strlen($model->date_delivery))
- return date('d/m/Y',strtotime($model->date_delivery)) ;
- else
- return '' ;
- }],
- ] ;
-
-
- if(User::hasAccessBackend()) {
-
- $columns[] = [
- 'header' => 'Priorité',
- 'format' => 'raw',
- 'value' => function($model) {
-
- $currentPriority = (isset($model->developmentPrioritYCurrentProducer)) ? $model->developmentPriorityCurrentProducer->getStrPriority() : 'Non' ;
- $styleButton = (isset($model->developmentPriorityCurrentProducer)) ? $model->developmentPriorityCurrentProducer->getClassCssStyleButton() : 'default' ;
-
- $html = '<div class="btn-group btn-group-priorite">
- <button type="button" class="btn btn-priorite btn-sm btn-'.$styleButton.' dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- '.$currentPriority.' <span class="caret"></span>
- </button>
- <ul class="dropdown-menu">
- <li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','idDevelopment' => $model->id]).'">Non</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','idDevelopment' => $model->id, 'priority' => DevelopmentPriority::PRIORITY_LOW]).'">Basse</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','idDevelopment' => $model->id, 'priority' => DevelopmentPriority::PRIORITY_NORMAL]).'">Normale</a></li>
- <li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','idDevelopment' => $model->id, 'priority' => DevelopmentPriority::PRIORITY_HIGH]).'">Haute</a></li>
- </ul>
- </div><br />' ;
-
- if(isset($model->developmentPriority) && count($model->developmentPriority)) {
- foreach($model->developmentPriority as $developmentPriority) {
- if($developmentPriority->id_producer != Producer::getId())
- $html .= '<div class="label label-priorite label-sm label-'.$developmentPriority->getClassCssStyleButton().'">'.Html::encode($developmentPriority->producer->name).'</div> ' ;
- }
- }
-
- return $html ;
- }
- ] ;
- }
-
- if(User::getCurrentStatus() == 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(['development/delete','id' => $model->id]).'" class=""><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li>
- </ul>
- </div>' ;
- },
- ],
- ] ;
- }
-
- ?>
-
- <?=
- GridView::widget([
- 'id' => 'tab-developments',
- 'dataProvider' => $dataProvider,
- 'columns' => $columns
- ]);
- ?>
- </div>
|