Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

163 lines
8.1KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. use common\models\Developpement;
  5. use common\models\DeveloppementPriorite;
  6. use common\models\User;
  7. use common\helpers\Url;
  8. /* @var $this yii\web\View */
  9. /* @var $dataProvider yii\data\ActiveDataProvider */
  10. $this->title = 'Développement';
  11. $this->params['breadcrumbs'][] = $this->title;
  12. ?>
  13. <div class="developpement-index">
  14. <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
  15. <div class="well">
  16. 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 />
  17. 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.
  18. </div>
  19. <?php
  20. foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
  21. echo '<div class="alert alert-' . $key . '">' . $message . '</div>';
  22. }
  23. ?>
  24. <ul id="tabs-statuts-developpements" class="nav nav-tabs" role="tablist">
  25. <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>
  26. <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>
  27. </ul>
  28. <?php
  29. $columns = [
  30. [
  31. 'header' => '#',
  32. 'value' => function($model) {
  33. return '#'.$model->id ;
  34. }
  35. ],
  36. [
  37. 'attribute' => 'type',
  38. 'header' => 'Type',
  39. 'format' => 'raw',
  40. 'value' => function($model) {
  41. if($model->type == Developpement::TYPE_EVOLUTION) {
  42. return '<span class="label label-success">Évolution</span>' ;
  43. }
  44. else {
  45. return '<span class="label label-danger">Anomalie</span>' ;
  46. }
  47. }
  48. ],
  49. [ 'attribute' => 'sujet',
  50. 'format' => 'raw',
  51. 'value' => function($model) {
  52. $html = '<strong>'.Html::encode($model->objet).'</strong>' ;
  53. if(strlen($model->description))
  54. $html .= '<br />'.nl2br(Html::encode($model->description)) ;
  55. return $html ;
  56. }],
  57. [ 'attribute' => 'estimation_temps',
  58. 'header' => 'Estimation',
  59. 'format' => 'raw',
  60. 'value' => function($model) {
  61. return intval($model->estimation_temps).' h' ;
  62. }],
  63. [ 'attribute' => 'avancement',
  64. 'format' => 'raw',
  65. 'value' => function($model) {
  66. if($model->avancement)
  67. return '<div class="progress">
  68. <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).'%;">
  69. <span class="sr-only">'.intval($model->avancement).'% effectué</span>
  70. </div>
  71. </div> ' ;
  72. else
  73. return '' ;
  74. }],
  75. [ 'attribute' => 'date_livraison',
  76. 'format' => 'raw',
  77. 'value' => function($model) {
  78. if(strlen($model->date_livraison))
  79. return date('d/m/Y',strtotime($model->date_livraison)) ;
  80. else
  81. return '' ;
  82. }],
  83. ] ;
  84. if(Yii::$app->user->identity->status == USER::STATUS_ADMIN
  85. || Yii::$app->user->identity->status == USER::STATUS_BOULANGER) {
  86. $columns[] = [
  87. 'header' => 'Priorité',
  88. 'format' => 'raw',
  89. 'value' => function($model) {
  90. $current_priorite = (isset($model->developpementPrioriteCurrentEtablissement)) ? $model->developpementPrioriteCurrentEtablissement->getStrPriorite() : 'Non' ;
  91. $style_bouton = (isset($model->developpementPrioriteCurrentEtablissement)) ? $model->developpementPrioriteCurrentEtablissement->getClassCssStyleBouton() : 'default' ;
  92. $html = '<div class="btn-group btn-group-priorite">
  93. <button type="button" class="btn btn-priorite btn-sm btn-'.$style_bouton.' dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  94. '.$current_priorite.' <span class="caret"></span>
  95. </button>
  96. <ul class="dropdown-menu">
  97. <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id]).'">Non</a></li>
  98. <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_BASSE]).'">Basse</a></li>
  99. <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_NORMALE]).'">Normale</a></li>
  100. <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/priorite','id_developpement'=>$model->id, 'priorite' => DeveloppementPriorite::PRIORITE_HAUTE]).'">Haute</a></li>
  101. </ul>
  102. </div><br />' ;
  103. if(isset($model->developpementPriorite) && count($model->developpementPriorite)) {
  104. foreach($model->developpementPriorite as $developpement_priorite) {
  105. if($developpement_priorite->id_etablissement != Yii::$app->user->identity->id_etablissement)
  106. $html .= '<div class="label label-priorite label-sm label-'.$developpement_priorite->getClassCssStyleBouton().'">'.Html::encode($developpement_priorite->etablissement->nom).'</div> ' ;
  107. }
  108. }
  109. return $html ;
  110. }
  111. ] ;
  112. }
  113. if(Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
  114. $columns[] = [
  115. 'class' => 'yii\grid\ActionColumn',
  116. 'template' => '{update}',
  117. 'headerOptions' => ['class' => 'actions'],
  118. 'buttons' => [
  119. 'update' => function ($url, $model) {
  120. return '<div class="btn-group">
  121. <a href="'.$url.'" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>
  122. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  123. <span class="caret"></span>
  124. <span class="sr-only">Toggle Dropdown</span>
  125. </button>
  126. <ul class="dropdown-menu">
  127. <li><a href="'.Yii::$app->urlManager->createUrl(['developpement/delete','id' => $model->id]).'" class=""><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li>
  128. </ul>
  129. </div>' ;
  130. },
  131. ],
  132. ] ;
  133. }
  134. ?>
  135. <?=
  136. GridView::widget([
  137. 'id' => 'tab-developpements',
  138. 'dataProvider' => $dataProvider,
  139. 'columns' => $columns
  140. ]);
  141. ?>
  142. </div>