瀏覽代碼

Merge branch 'section_developpement'

# Conflicts:
#	common/models/Developpement.php
#	common/models/DeveloppementPriorite.php
#	console/migrations/m171226_200642_tables_developpement.php
prodstable
keun 7 年之前
父節點
當前提交
f0de0a5464
共有 13 個文件被更改,包括 694 次插入156 次删除
  1. +161
    -0
      backend/controllers/DeveloppementController.php
  2. +42
    -0
      backend/views/developpement/_form.php
  3. +21
    -0
      backend/views/developpement/create.php
  4. +157
    -0
      backend/views/developpement/index.php
  5. +21
    -0
      backend/views/developpement/update.php
  6. +157
    -142
      backend/views/layouts/main.php
  7. 二進制
      backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc
  8. +19
    -0
      backend/web/css/screen.css
  9. +22
    -0
      backend/web/sass/screen.scss
  10. +32
    -6
      common/models/Developpement.php
  11. +39
    -5
      common/models/DeveloppementPriorite.php
  12. +6
    -3
      console/migrations/m171226_200642_tables_developpement.php
  13. +17
    -0
      console/migrations/m171227_090138_champs_priorite_developpement.php

+ 161
- 0
backend/controllers/DeveloppementController.php 查看文件

@@ -0,0 +1,161 @@
<?php

namespace backend\controllers;

use Yii;
use common\models\User;
use common\models\Developpement;
use common\models\DeveloppementPriorite;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;

/**
* DeveloppementController implements the CRUD actions for Developpement model.
*/
class DeveloppementController extends Controller {

/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER;
}
]
],
],
];
}

/**
* Lists all Developpement models.
* @return mixed
*/
public function actionIndex() {
$dataProvider = new ActiveDataProvider([
'query' => Developpement::find()->with(['developpementPriorite','developpementPrioriteCurrentEtablissement']),
]);

return $this->render('index', [
'dataProvider' => $dataProvider,
]);
}

/**
* Creates a new Developpement model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate() {
$model = new Developpement();
if ($model->load(Yii::$app->request->post())) {
$model->date = date('Y-m-d H:i:s') ;
$model->setDateLivraison() ;
if($model->save()) {
Yii::$app->getSession()->setFlash('success','Développement ajouté') ;
return $this->redirect(['index']);
}
} else {
return $this->render('create', [
'model' => $model,
]);
}
}

/**
* Updates an existing Developpement model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = $this->findModel($id);

if ($model->load(Yii::$app->request->post())) {
$model->setDateLivraison() ;
if($model->save()) {
Yii::$app->getSession()->setFlash('success','Développement modifié') ;
return $this->redirect(['index']);
}
} else {
return $this->render('update', [
'model' => $model,
]);
}
}

/**
* Deletes an existing Developpement model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel($id)->delete();
Yii::$app->getSession()->setFlash('success','Développement supprimé') ;
return $this->redirect(['index']);
}

public function actionPriorite($id_developpement, $priorite = null) {
$developpement_priorite = DeveloppementPriorite::find()
->where(['id_developpement' => $id_developpement, 'id_etablissement' => Yii::$app->user->identity->id_etablissement])
->one() ;
if(in_array($priorite,
[DeveloppementPriorite::PRIORITE_HAUTE,
DeveloppementPriorite::PRIORITE_NORMALE,
DeveloppementPriorite::PRIORITE_BASSE])) {
if($developpement_priorite) {
$developpement_priorite->priorite = $priorite ;
$developpement_priorite->id_etablissement = Yii::$app->user->identity->id_etablissement ;
}
else {
$developpement_priorite = new DeveloppementPriorite ;
$developpement_priorite->id_developpement = $id_developpement ;
$developpement_priorite->priorite = $priorite ;
$developpement_priorite->id_etablissement = Yii::$app->user->identity->id_etablissement ;
}
$developpement_priorite->save() ;
}
else {
if($developpement_priorite) {
$developpement_priorite->delete() ;
}
}
$this->redirect(['index']) ;
}
/**
* Finds the Developpement model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Developpement the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id) {
if (($model = Developpement::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

+ 42
- 0
backend/views/developpement/_form.php 查看文件

@@ -0,0 +1,42 @@
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Developpement ;

/* @var $this yii\web\View */
/* @var $model common\models\Developpement */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="developpement-form">

<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'type')->dropDownList([
Developpement::TYPE_EVOLUTION => 'Évolution',
Developpement::TYPE_BUG => 'Anomalie',
]) ?>
<?= $form->field($model, 'statut')->dropDownList([
Developpement::STATUT_OPEN => 'Ouvert',
Developpement::STATUT_CLOSED => 'Fermé',
]) ?>
<?= $form->field($model, 'objet')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>

<?= $form->field($model, 'estimation_temps')->textInput() ?>

<?= $form->field($model, 'avancement')->textInput() ?>
<?= $form->field($model, 'date_livraison')->textInput() ?>

<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>

</div>

+ 21
- 0
backend/views/developpement/create.php 查看文件

@@ -0,0 +1,21 @@
<?php

use yii\helpers\Html;


/* @var $this yii\web\View */
/* @var $model common\models\Developpement */

$this->title = 'Ajouter un développement';
$this->params['breadcrumbs'][] = ['label' => 'Développement', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="developpement-create">

<h1><?= Html::encode($this->title) ?></h1>

<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 157
- 0
backend/views/developpement/index.php 查看文件

@@ -0,0 +1,157 @@
<?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 />'.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>

+ 21
- 0
backend/views/developpement/update.php 查看文件

@@ -0,0 +1,21 @@
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model common\models\Developpement */

$this->title = 'Modifier un développement';
$this->params['breadcrumbs'][] = ['label' => 'Développement', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => '#'.$model->id, 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="developpement-update">

<h1><?= Html::encode($this->title) ?></h1>

<?= $this->render('_form', [
'model' => $model,
]) ?>

</div>

+ 157
- 142
backend/views/layouts/main.php 查看文件

@@ -1,14 +1,15 @@
<?php

use backend\assets\AppAsset;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\models\Etablissement ;
use common\models\User ;
use common\models\Etablissement;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper ;
use common\helpers\Url ;
use yii\helpers\ArrayHelper;
use common\helpers\Url;

/* @var $this \yii\web\View */
/* @var $content string */
@@ -18,37 +19,37 @@ AppAsset::register($this);
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon3.png" />
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?> - La boîte à pain</title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon3.png" />
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?> - La boîte à pain</title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => '<img class="logo" src="'.Yii::$app->urlManager->getBaseUrl().'/img/laboulange3.png" />',
'brandLabel' => '<img class="logo" src="' . Yii::$app->urlManager->getBaseUrl() . '/img/laboulange3.png" />',
'brandUrl' => Yii::$app->homeUrl,
'innerContainerOptions' => ['class'=>'container-fluid'],
'innerContainerOptions' => ['class' => 'container-fluid'],
'options' => [
'class' => 'navbar-inverse navbar-fixed-top nav-header',
],
]);
$menuItems = [
[
'label' => '<span class="glyphicon glyphicon-home"></span> Tableau de bord',
'url' => ['/site/index'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-home"></span> Tableau de bord',
'url' => ['/site/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/commande/index'],
'visible'=> !Yii::$app->user->isGuest,
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/commande/index'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
@@ -63,80 +64,83 @@ AppAsset::register($this);
]
],
[
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/produit/index'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/produit/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-vente/index'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-vente/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-user"></span> Clients',
'url' => ['/user/index'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-user"></span> Clients',
'url' => ['/user/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-plus"></span>',
'url' => ['/etablissement/update'],
'visible'=> !Yii::$app->user->isGuest,
'url' => ['/etablissement/update'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/etablissement/update'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/etablissement/update'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communiquer/index'],
'visible'=> !Yii::$app->user->isGuest
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communiquer/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['/etablissement/facturation'],
'visible'=> !Yii::$app->user->isGuest,
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques',
'url' => ['/stats/index'],
'visible'=> !Yii::$app->user->isGuest,
]
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
'url' => ['/developpement/index'],
'visible' => !Yii::$app->user->isGuest
],
],
]
];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
} else {
if(Yii::$app->user->identity->status == USER::STATUS_ADMIN)
{

if (Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
'url' => '#',
'items' => [
[
'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
'url' => ['etablissement-admin/index'],
'visible'=> !Yii::$app->user->isGuest,
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['etablissement-admin/facturation'],
'visible'=> !Yii::$app->user->isGuest,
'visible' => !Yii::$app->user->isGuest,
],
]
] ;
];
}
$menuItems[] = [
'label' => '<span class="glyphicon glyphicon-off"></span>',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post','title' => 'Déconnexion']
'linkOptions' => ['data-method' => 'post', 'title' => 'Déconnexion']
];
$menuItems[] = [
'label' => '<span class="retour-site">Retour sur le site</span>',
'url' => Url::frontend(),
@@ -148,93 +152,104 @@ AppAsset::register($this);
'encodeLabels' => false
]);
NavBar::end();
?>

<div class="container-fluid container-body">
<?php if(YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
<div id="env-dev"><?php if(YII_ENV == 'dev'): ?>Dév.<?php elseif(YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?>
<?php if(!Yii::$app->user->isGuest): ?>
<div class="nom-boulange">
<?php if(Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()) ; ?></span>
<?php elseif(Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-etablissement']) ; ?>
<?= Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
return $model->nom ;
})) ; ?>
<?php ActiveForm::end(); ?>
<?php endif; ?>
<?php
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
if(!$etablissement->actif):
?>
<span class="label label-danger" data-toggle="tooltip" data-placement="bottom" data-original-title="Activez votre établissement quand vous le souhaitez afin de la rendre visible à vos clients.">
<?= Html::a('Hors-ligne',['etablissement/update']); ?>
</span>
?>

<div class="container-fluid container-body">
<?php if (YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
<div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?>
<?php if (!Yii::$app->user->isGuest): ?>
<div class="nom-boulange">
<?php if (Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()); ?></span>
<?php elseif (Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-etablissement']); ?>
<?=
Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
return $model->nom;
}));
?>
<?php ActiveForm::end(); ?>
<?php endif; ?>

<?php
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement);
if (!$etablissement->actif):
?>
<span class="label label-danger" data-toggle="tooltip" data-placement="bottom" data-original-title="Activez votre établissement quand vous le souhaitez afin de la rendre visible à vos clients.">
<?= Html::a('Hors-ligne', ['etablissement/update']); ?>
</span>
<?php endif; ?>

<div class="clr"></div>

<?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
<?php if ($etat_paiement_etablissement == 'essai'): ?>
<span id="etat-paiement-etablissement">Période d'essai gratuite
<span class="strong"><?php echo Yii::$app->user->identity->periodeEssai(); ?> jours</span> <a class="btn btn-success" href="<?php echo Yii::$app->urlManager->createUrl(['paiement/index']) ?>">S'abonner</a>
</span>
<?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
<span id="etat-paiement-etablissement">
<span class="strong">
<?php if ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
<?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
<?php endif; ?>
</span>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
<?php if($etat_paiement_etablissement == 'essai'): ?>
<span id="etat-paiement-etablissement">Période d'essai gratuite
<span class="strong"><?php echo Yii::$app->user->identity->periodeEssai(); ?> jours</span> <a class="btn btn-success" href="<?php echo Yii::$app->urlManager->createUrl(['paiement/index']) ?>">S'abonner</a>
</span>
<?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
<span id="etat-paiement-etablissement">
<span class="strong">
<?php if($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
<?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
<?php endif; ?>
</span>
</span>

<?php if (YII_ENV == 'demo'): ?>
<div id="block-demo">
<div class="container-fluid">
<span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
</div>
</div>
<?php endif; ?>

<?=
Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
])
?>
<?= $content ?>
</div>
<?php endif; ?>
<?php if(YII_ENV == 'demo'): ?>
<div id="block-demo">
<div class="container-fluid">
<span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
</div>
</div>
<?php endif; ?>
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= $content ?>
</div>
</div>

<div id="alerts-fixed"></div>
<footer class="footer">
<div class="container-fluid">
<p class="pull-left">
<a href="<?php echo Url::frontend('site/contact') ; ?>">Contact</a> &bull;
<a href="<?php echo Url::frontend('site/mentions') ; ?>">Mentions légales</a> &bull;
<a href="<?php echo Url::frontend('site/cgv') ; ?>">CGS</a>
</p>
<p class="pull-right"><?= Yii::powered() ?></p>
</div>
</footer>

<?php $this->endBody() ?>
<!-- analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>

<div id="alerts-fixed"></div>

<footer class="footer">
<div class="container-fluid">
<p class="pull-left">
<a href="<?php echo Url::frontend('site/contact'); ?>">Contact</a> &bull;
<a href="<?php echo Url::frontend('site/mentions'); ?>">Mentions légales</a> &bull;
<a href="<?php echo Url::frontend('site/cgv'); ?>">CGS</a>
</p>
<p class="pull-right"><?= Yii::powered() ?></p>
</div>
</footer>

<?php $this->endBody() ?>

<!-- analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-86917043-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
<?php $this->endPage() ?>

二進制
backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc 查看文件


+ 19
- 0
backend/web/css/screen.css 查看文件

@@ -1212,3 +1212,22 @@ a:hover, a:focus, a:active {
padding: 10px;
text-align: center;
}

/* line 1230, ../sass/screen.scss */
.developpement-index #tab-developpements .btn-group-priorite {
width: 100%;
margin-bottom: 5px;
}
/* line 1234, ../sass/screen.scss */
.developpement-index #tab-developpements .btn-group-priorite .btn-priorite {
display: block;
float: none;
width: 100%;
}
/* line 1241, ../sass/screen.scss */
.developpement-index #tab-developpements .label-priorite {
display: block;
width: 100%;
margin-bottom: 2px;
padding: 5px 8px;
}

+ 22
- 0
backend/web/sass/screen.scss 查看文件

@@ -1223,4 +1223,26 @@ a {
padding: 10px ;
text-align: center ;
}
}

.developpement-index {
#tab-developpements {
.btn-group-priorite {
width: 100% ;
margin-bottom: 5px ;

.btn-priorite {
display: block ;
float: none ;
width: 100% ;
}
}
.label-priorite {
display: block ;
width: 100% ;
margin-bottom: 2px ;
padding: 5px 8px ;
}
}
}

+ 32
- 6
common/models/Developpement.php 查看文件

@@ -1,8 +1,9 @@
<?php

namespace app\models;
namespace common\models;

use Yii;
use common\models\DeveloppementPriorite ;

/**
* This is the model class for table "developpement".
@@ -17,6 +18,12 @@ use Yii;
*/
class Developpement extends \yii\db\ActiveRecord {

const STATUT_OPEN = 'open' ;
const STATUT_CLOSED = 'closed' ;
const TYPE_EVOLUTION = 'evolution' ;
const TYPE_BUG = 'bug' ;
/**
* @inheritdoc
*/
@@ -29,14 +36,22 @@ class Developpement extends \yii\db\ActiveRecord {
*/
public function rules() {
return [
[['id', 'objet', 'date'], 'required'],
[['objet', 'date'], 'required'],
[['id', 'avancement'], 'integer'],
[['description'], 'string'],
[['date'], 'safe'],
[['date','date_livraison'], 'safe'],
[['estimation_temps'], 'number'],
[['objet', 'statut'], 'string', 'max' => 255],
[['objet', 'statut','type'], 'string', 'max' => 255],
];
}
public function getDeveloppementPriorite() {
return $this->hasMany(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->with('etablissement') ;
}
public function getDeveloppementPrioriteCurrentEtablissement() {
return $this->hasOne(DeveloppementPriorite::className(), ['id_developpement' => 'id'])->where(['id_etablissement'=>Yii::$app->user->identity->id_etablissement])->with('etablissement') ;
}

/**
* @inheritdoc
@@ -44,13 +59,24 @@ class Developpement extends \yii\db\ActiveRecord {
public function attributeLabels() {
return [
'id' => 'ID',
'objet' => 'Objet',
'objet' => 'Sujet',
'description' => 'Description',
'date' => 'Date',
'avancement' => 'Avancement',
'statut' => 'Statut',
'estimation_temps' => 'Estimation temps',
'type' => 'Type',
'date_livraison' => 'Date de livraison'
];
}

public function setDateLivraison($date = '') {
if(strlen($date))
$this->date_livraison = $date ;
if(strlen($this->date_livraison))
$this->date_livraison = date('Y-m-d',strtotime($this->date_livraison)) ;
}
}

+ 39
- 5
common/models/DeveloppementPriorite.php 查看文件

@@ -1,8 +1,9 @@
<?php

namespace app\models;
namespace common\models;

use Yii;
use common\models\Etablissement ;

/**
* This is the model class for table "developpement_priorite".
@@ -12,6 +13,10 @@ use Yii;
*/
class DeveloppementPriorite extends \yii\db\ActiveRecord {

const PRIORITE_HAUTE = 'haute' ;
const PRIORITE_NORMALE = 'normale' ;
const PRIORITE_BASSE = 'basse' ;
/**
* @inheritdoc
*/
@@ -24,19 +29,48 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord {
*/
public function rules() {
return [
[['id_user', 'id_developpement'], 'required'],
[['id_user', 'id_developpement'], 'integer'],
[['id_etablissement', 'id_developpement'], 'required'],
[['id_etablissement', 'id_developpement'], 'integer'],
[['priorite'], 'string'],
];
}
public function getEtablissement() {
return $this->hasOne(Etablissement::className(), ['id' => 'id_etablissement']) ;
}

/**
* @inheritdoc
*/
public function attributeLabels() {
return [
'id_user' => 'Id User',
'id_developpement' => 'Id Developpement',
'id_etablissement' => 'Établissement',
'id_developpement' => 'Développement',
'priorite' => 'Priorité'
];
}
public function getStrPriorite()
{
switch($this->priorite)
{
case self::PRIORITE_BASSE : return 'Basse' ; break ;
case self::PRIORITE_NORMALE : return 'Normale' ; break ;
case self::PRIORITE_HAUTE : return 'Haute' ; break ;
default: return 'Non définie' ; break ;
}
}
public function getClassCssStyleBouton() {
$style_bouton = 'default' ;
if($this->priorite == DeveloppementPriorite::PRIORITE_BASSE)
$style_bouton = 'info' ;
elseif($this->priorite == DeveloppementPriorite::PRIORITE_NORMALE)
$style_bouton = 'warning' ;
elseif($this->priorite == DeveloppementPriorite::PRIORITE_HAUTE)
$style_bouton = 'danger' ;
return $style_bouton ;
}

}

+ 6
- 3
console/migrations/m171226_200642_tables_developpement.php 查看文件

@@ -7,18 +7,21 @@ class m171226_200642_tables_developpement extends Migration {

public function up() {
$this->createTable('developpement', [
'id' => Schema::TYPE_INTEGER . ' NOT NULL',
'id' => 'pk',
'objet' => Schema::TYPE_STRING . ' NOT NULL',
'description' => Schema::TYPE_TEXT,
'date' => Schema::TYPE_DATE . ' NOT NULL',
'date' => Schema::TYPE_DATETIME . ' NOT NULL',
'avancement' => Schema::TYPE_INTEGER . ' DEFAULT 0',
'statut' => Schema::TYPE_STRING . ' DEFAULT \'open\'',
'type' => Schema::TYPE_STRING . ' DEFAULT \'evolution\'',
'estimation_temps' => Schema::TYPE_FLOAT,
'date_livraison' => Schema::TYPE_DATE
]);

$this->createTable('developpement_priorite', [
'id_user' => Schema::TYPE_INTEGER . ' NOT NULL',
'id_etablissement' => Schema::TYPE_INTEGER . ' NOT NULL',
'id_developpement' => Schema::TYPE_INTEGER . ' NOT NULL',
'PRIMARY KEY (`id_user`, `id_developpement`)'
]);
}


+ 17
- 0
console/migrations/m171227_090138_champs_priorite_developpement.php 查看文件

@@ -0,0 +1,17 @@
<?php

use yii\db\Migration;
use yii\db\Schema;
use common\models\DeveloppementPriorite ;

class m171227_090138_champs_priorite_developpement extends Migration {

public function up() {
$this->addColumn('developpement_priorite','priorite',Schema::TYPE_STRING.' DEFAULT \''.DeveloppementPriorite::PRIORITE_NORMALE.'\'');
}

public function down() {
$this->dropColumn('developpement_priorite','priorite');
}
}

Loading…
取消
儲存