Browse Source

Adaptations backend/development

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
435dcdc038
5 changed files with 12 additions and 12 deletions
  1. +2
    -2
      backend/controllers/DevelopmentController.php
  2. +1
    -1
      backend/views/development/_form.php
  3. +6
    -6
      backend/views/development/index.php
  4. +2
    -2
      common/models/Development.php
  5. +1
    -1
      common/models/DevelopmentPriority.php

+ 2
- 2
backend/controllers/DevelopmentController.php View File

* *
* @return mixed * @return mixed
*/ */
public function actionIndex($status = Development::STATUT_OPEN)
public function actionIndex($status = Development::STATUS_OPEN)
{ {
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => Development::find() 'query' => Development::find()
DevelopmentPriority::PRIORITY_LOW])) { DevelopmentPriority::PRIORITY_LOW])) {


if ($develpmentPriority) { if ($develpmentPriority) {
$develpmentPriority->priority = $priorite;
$develpmentPriority->priority = $priority;
$develpmentPriority->id_producer = Producer::getId(); $develpmentPriority->id_producer = Producer::getId();
} else { } else {
$develpmentPriority = new DevelopmentPriority; $develpmentPriority = new DevelopmentPriority;

+ 1
- 1
backend/views/development/_form.php View File

Development::TYPE_BUG => 'Anomalie', Development::TYPE_BUG => 'Anomalie',
]) ?> ]) ?>
<?= $form->field($model, 'statut')->dropDownList([
<?= $form->field($model, 'status')->dropDownList([
Development::STATUS_OPEN => 'Ouvert', Development::STATUS_OPEN => 'Ouvert',
Development::STATUS_CLOSED => 'Fermé', Development::STATUS_CLOSED => 'Fermé',
]) ?> ]) ?>

+ 6
- 6
backend/views/development/index.php View File

'header' => 'Type', 'header' => 'Type',
'format' => 'raw', 'format' => 'raw',
'value' => function($model) { 'value' => function($model) {
if($model->type == Develoement::TYPE_EVOLUTION) {
if($model->type == Development::TYPE_EVOLUTION) {
return '<span class="label label-success">Évolution</span>' ; return '<span class="label label-success">Évolution</span>' ;
} }
else { else {
'.$currentPriority.' <span class="caret"></span> '.$currentPriority.' <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','id_development' => $model->id]).'">Non</a></li>
<li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','id_development' => $model->id, 'priorite' => DevelopmentPriority::PRIORITY_LOW]).'">Basse</a></li>
<li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','id_development' => $model->id, 'priorite' => DevelopmentPriority::PRIORITY_NORMAL]).'">Normale</a></li>
<li><a href="'.Yii::$app->urlManager->createUrl(['development/priority','id_development' => $model->id, 'priorite' => DevelopmentPriority::PRIORITY_HIGH]).'">Haute</a></li>
<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> </ul>
</div><br />' ; </div><br />' ;
if(isset($model->developmentPriority) && count($model->developmentPriority)) { if(isset($model->developmentPriority) && count($model->developmentPriority)) {
foreach($model->developmentPriority as $developmentPriority) { foreach($model->developmentPriority as $developmentPriority) {
if($developmentPriority->id_producer != Producer::getId()) if($developmentPriority->id_producer != Producer::getId())
$html .= '<div class="label label-priorite label-sm label-'.$developmentPriority->getClassCssStyleButton().'">'.Html::encode($developmentPriority->etablissement->name).'</div> ' ;
$html .= '<div class="label label-priorite label-sm label-'.$developmentPriority->getClassCssStyleButton().'">'.Html::encode($developmentPriority->producer->name).'</div> ' ;
} }
} }

+ 2
- 2
common/models/Development.php View File

[['id', 'progress'], 'integer'], [['id', 'progress'], 'integer'],
[['description'], 'string'], [['description'], 'string'],
[['date', 'date_delivery'], 'safe'], [['date', 'date_delivery'], 'safe'],
[['tie_estimate'], 'number'],
[['objet', 'status', 'type'], 'string', 'max' => 255],
[['time_estimate'], 'number'],
[['subject', 'status', 'type'], 'string', 'max' => 255],
]; ];
} }



+ 1
- 1
common/models/DevelopmentPriority.php View File

* Relations * Relations
*/ */


public function getProducert()
public function getProducer()
{ {
return $this->hasOne(Producer::className(), ['id' => 'id_producer']); return $this->hasOne(Producer::className(), ['id' => 'id_producer']);
} }

Loading…
Cancel
Save