|
- <?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>';
- }
- ?>
-
- <?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>
|