@@ -29,6 +29,7 @@ Import::using('yii\db\*'); | |||
Import::using('yii\behaviors\*'); | |||
Import::using('yii\helpers\*'); | |||
Import::using('yii\web\NotFoundHttpException'); | |||
Import::using('yii\grid\*'); | |||
// models | |||
Import::using('common\models\*'); |
@@ -174,46 +174,33 @@ class CommandeController extends ProducerBaseController { | |||
'credit' => $credit | |||
]; | |||
} | |||
/** | |||
* Affiche l'historique des commandes de l'utilisateur | |||
* | |||
* @return ProducerView | |||
*/ | |||
public function actionHistorique() { | |||
$model_form_etablissement = new AddEtablissementForm(); | |||
if ($model_form_etablissement->load(Yii::$app->request->post()) && $model_form_etablissement->validate()) { | |||
$model_form_etablissement->add(); | |||
$model_form_etablissement->code = ''; | |||
} | |||
// liste des etablissements | |||
$etablissements = Yii::$app->user->identity->getEtablissementsFavoris(); | |||
// liste des établissement disponibles | |||
$arr_etablissements = Etablissement::getEtablissementsPopulateDropdown(); | |||
$data_etablissements_dispos = $arr_etablissements['data']; | |||
$options_etablissements_dispos = $arr_etablissements['options']; | |||
// liste des commandes | |||
$commandes = Commande::find() | |||
$data_provider_commandes = new ActiveDataProvider([ | |||
'query' => Commande::find() | |||
->with('commandeProduits', 'pointVente', 'creditHistorique') | |||
->joinWith('production', 'production.etablissement') | |||
->where(['id_user' => Yii::$app->user->id]) | |||
//->andWhere('production.date < '.) | |||
->orderBy('production.date DESC') | |||
->limit(40) | |||
->all(); | |||
// initilisation commandes | |||
foreach ($commandes as $c) | |||
$c->init(); | |||
->where([ | |||
'id_user' => Yii::$app->user->id, | |||
'production.id_etablissement' => $this->getProducer()->id | |||
]) | |||
->orderBy('production.date DESC'), | |||
'pagination' => [ | |||
'pageSize' => 10, | |||
], | |||
]); | |||
return $this->render('historique', [ | |||
'commandes' => $commandes, | |||
'commande_ok' => Yii::$app->getRequest()->get('commande_ok', false), | |||
'annule_ok' => Yii::$app->getRequest()->get('annule_ok', false), | |||
'pate_deja_petrie' => Yii::$app->getRequest()->get('pate_deja_petrie', false), | |||
'etablissements' => $etablissements, | |||
'model_form_etablissement' => $model_form_etablissement, | |||
'data_etablissements_dispos' => $data_etablissements_dispos, | |||
'options_etablissements_dispos' => $options_etablissements_dispos, | |||
'data_provider_commandes' => $data_provider_commandes, | |||
'commande_ok' => Yii::$app->getRequest()->get('commande_ok', false), | |||
'annule_ok' => Yii::$app->getRequest()->get('annule_ok', false), | |||
]); | |||
} | |||
@@ -19,95 +19,70 @@ $this->setTitle('Historique de mes commandes') ; | |||
<div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div> | |||
<?php endif; ?> | |||
<div id="liste-boulangeries"> | |||
<?= | |||
$this->render('_liste_etablissements.php',[ | |||
'etablissements' => $etablissements, | |||
'context' => 'index' | |||
]) ; | |||
?> | |||
<div class="col-md-6" id="bloc-add-etablissement"> | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title"><span class="glyphicon glyphicon-plus"></span> Ajouter un producteur</h3> | |||
</div> | |||
<div class="panel-body"> | |||
<?php $form = ActiveForm::begin(['id' => 'form-add-boulanger','enableClientValidation'=> false]); ?> | |||
<?= $form->field($model_form_etablissement, 'id_etablissement') | |||
->label('') | |||
->dropDownList($data_etablissements_dispos, | |||
['prompt' => '--', | |||
'encode' => false, | |||
'options' => $options_etablissements_dispos | |||
]) ; ?> | |||
<div id="bloc-code-acces"> | |||
<?= $form->field($model_form_etablissement, 'code',[ | |||
'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>', | |||
]) | |||
->label('Code') | |||
->hint('Renseignez-vous auprès de votre producteur pour qu\'il vous fournisse le code d\'accès') ; ?> | |||
</div> | |||
<?= Html::submitButton('<span class="glyphicon glyphicon-plus"></span> Valider', ['class' => 'btn btn-default', 'name' => 'add-etablissement-button']) ?> | |||
<?php ActiveForm::end(); ?> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="clr"></div> | |||
</div> | |||
<h2 class="first">Historique</h2> | |||
<?php if(count($commandes)): ?> | |||
<p>Retrouvez ici vos dernières commandes.</p> | |||
<table id="historique-commandes" class="table table-striped table-bordered"> | |||
<thead> | |||
<tr> | |||
<th>Producteur</th> | |||
<th>Date livraison</th> | |||
<th>Résumé</th> | |||
<th>Lieu</th> | |||
<th class="montant">Montant</th> | |||
<th class="statut"></th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<?php foreach($commandes as $c): ?> | |||
<tr> | |||
<td><?= Html::encode($c->production->etablissement->nom) ?></td> | |||
<td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td> | |||
<td class="resume"><?= $c->getResumePanier() ; ?></td> | |||
<td><?= $c->getResumePointVente(); ?></td> | |||
<td class="montant"><?= $c->getResumeMontant(); ?></td> | |||
<td class="statut"> | |||
<?php if($c->getEtat() == Commande::ETAT_LIVREE): ?> | |||
Livrée | |||
<?php elseif($c->getEtat() == Commande::ETAT_PREPARATION): ?> | |||
En préparation | |||
<?php elseif($c->getEtat() == Commande::ETAT_MODIFIABLE): ?> | |||
<div class="btn-group"> | |||
<a href="<?php echo Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->id]) ; ?>" 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-expanded="false"> | |||
<span class="caret"></span> | |||
<span class="sr-only">Toggle Dropdown</span> | |||
</button> | |||
<ul class="dropdown-menu" role="menu"> | |||
<li><a href="<?php echo Yii::$app->urlManager->createUrl(['commande/annuler','id'=>$c->id]) ; ?>"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li> | |||
</ul> | |||
</div> | |||
<?php endif; ?> | |||
</td> | |||
</tr> | |||
<?php endforeach; ?> | |||
</tbody> | |||
</table> | |||
<?php else: ?> | |||
<div class="alert alert-info">Vous n'avez pas encore passé de commandes</div> | |||
<?php endif; ?> | |||
<?= | |||
</div> | |||
GridView::widget([ | |||
'dataProvider' => $data_provider_commandes, | |||
'summary' => '', | |||
'beforeRow' => function($model) { | |||
$model->init() ; | |||
}, | |||
'columns' => [ | |||
[ | |||
'attribute' => 'production.date', | |||
'label' => 'Date de livraison', | |||
'value' => function($model) { | |||
return date('d/m/Y', strtotime($model->production->date)) ; | |||
} | |||
], | |||
[ | |||
'label' => 'Résumé', | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
return $model->getResumePanier(); | |||
} | |||
], | |||
[ | |||
'label' => 'Point de vente', | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
return $model->getResumePointVente(); | |||
} | |||
], | |||
[ | |||
'label' => 'Montant', | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
return $model->getResumeMontant(); | |||
} | |||
], | |||
[ | |||
'label' => 'Statut', | |||
'format' => 'raw', | |||
'value' => function($c) { | |||
if($c->getEtat() == Commande::ETAT_LIVREE) { | |||
return 'Livrée' ; | |||
} | |||
elseif($c->getEtat() == Commande::ETAT_PREPARATION) { | |||
return 'En préparation' ; | |||
} | |||
elseif($c->getEtat() == Commande::ETAT_MODIFIABLE) { | |||
return '<div class="btn-group"> | |||
<a href="'.Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->id]).'" 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-expanded="false"> | |||
<span class="caret"></span> | |||
<span class="sr-only">Toggle Dropdown</span> | |||
</button> | |||
<ul class="dropdown-menu" role="menu"> | |||
<li><a href="'.Yii::$app->urlManager->createUrl(['commande/annuler','id'=>$c->id]).'"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li> | |||
</ul> | |||
</div>' ; | |||
} | |||
} | |||
], | |||
] | |||
]); | |||
?> |
@@ -112,29 +112,51 @@ body { | |||
color: #8a6d3b; | |||
} | |||
/* line 54, ../sass/_layout.scss */ | |||
/* line 57, ../sass/_layout.scss */ | |||
ul.pagination li.active a { | |||
background-color: #BB8757; | |||
border: solid 1px #BB8757; | |||
} | |||
/* line 61, ../sass/_layout.scss */ | |||
ul.pagination li.active a:hover { | |||
background-color: #F8F1DD; | |||
border: solid 1px #F8F1DD; | |||
color: #BB8757; | |||
} | |||
/* line 68, ../sass/_layout.scss */ | |||
ul.pagination li a { | |||
color: #BB8757; | |||
} | |||
/* line 71, ../sass/_layout.scss */ | |||
ul.pagination li a:hover, ul.pagination li a:focus, ul.pagination li a:active { | |||
background-color: #F8F1DD; | |||
border: solid 1px #F8F1DD; | |||
color: #BB8757; | |||
} | |||
/* line 80, ../sass/_layout.scss */ | |||
#header-bap { | |||
background-color: #F8F1DD; | |||
padding-top: 7px; | |||
padding-bottom: 7px; | |||
} | |||
/* line 59, ../sass/_layout.scss */ | |||
/* line 85, ../sass/_layout.scss */ | |||
#header-bap .container { | |||
padding-left: 0px; | |||
padding-right: 0px; | |||
} | |||
/* line 64, ../sass/_layout.scss */ | |||
/* line 90, ../sass/_layout.scss */ | |||
#header-bap #logo { | |||
color: black; | |||
text-decoration: none; | |||
position: relative; | |||
top: 3px; | |||
} | |||
/* line 70, ../sass/_layout.scss */ | |||
/* line 96, ../sass/_layout.scss */ | |||
#header-bap #logo img { | |||
width: 25px; | |||
} | |||
/* line 73, ../sass/_layout.scss */ | |||
/* line 99, ../sass/_layout.scss */ | |||
#header-bap #logo .text { | |||
font-size: 17px; | |||
font-family: "comfortaalight"; | |||
@@ -142,38 +164,38 @@ body { | |||
bottom: 6px; | |||
left: 3px; | |||
} | |||
/* line 82, ../sass/_layout.scss */ | |||
/* line 108, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap { | |||
float: right; | |||
} | |||
/* line 85, ../sass/_layout.scss */ | |||
/* line 111, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap li { | |||
float: right; | |||
} | |||
/* line 87, ../sass/_layout.scss */ | |||
/* line 113, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap li a { | |||
color: black; | |||
font-size: 15px; | |||
color: #BB8757; | |||
} | |||
/* line 92, ../sass/_layout.scss */ | |||
/* line 118, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap li a:hover, #header-bap ul#nav-bap li a:focus { | |||
color: #333; | |||
color: #BB8757; | |||
background: none; | |||
} | |||
/* line 99, ../sass/_layout.scss */ | |||
/* line 125, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap li ul { | |||
background-color: #F8F1DD; | |||
border-top: solid 2px #BB8757; | |||
} | |||
/* line 103, ../sass/_layout.scss */ | |||
/* line 129, ../sass/_layout.scss */ | |||
#header-bap ul#nav-bap li ul li a { | |||
text-transform: uppercase; | |||
font-size: 13px; | |||
} | |||
/* line 113, ../sass/_layout.scss */ | |||
/* line 139, ../sass/_layout.scss */ | |||
#header { | |||
background-color: #BB8757; | |||
text-align: center; | |||
@@ -181,16 +203,16 @@ body { | |||
padding-bottom: 70px; | |||
border-bottom: solid 1px #e0e0e0; | |||
} | |||
/* line 120, ../sass/_layout.scss */ | |||
/* line 146, ../sass/_layout.scss */ | |||
#header .container { | |||
position: relative; | |||
padding: 0px; | |||
} | |||
/* line 125, ../sass/_layout.scss */ | |||
/* line 151, ../sass/_layout.scss */ | |||
#header h1, #header h2 { | |||
color: white; | |||
} | |||
/* line 129, ../sass/_layout.scss */ | |||
/* line 155, ../sass/_layout.scss */ | |||
#header h1 { | |||
text-transform: uppercase; | |||
font-family: "myriadpro-regular"; | |||
@@ -198,13 +220,13 @@ body { | |||
padding-bottom: 20px; | |||
font-weight: bold; | |||
} | |||
/* line 137, ../sass/_layout.scss */ | |||
/* line 163, ../sass/_layout.scss */ | |||
#header h2 { | |||
font-family: "myriadpro-it"; | |||
font-size: 18px; | |||
padding-bottom: 15px; | |||
} | |||
/* line 143, ../sass/_layout.scss */ | |||
/* line 169, ../sass/_layout.scss */ | |||
#header #credit { | |||
position: absolute; | |||
top: 0px; | |||
@@ -214,16 +236,16 @@ body { | |||
border-bottom: solid 1px white; | |||
padding: 7px 0px; | |||
} | |||
/* line 152, ../sass/_layout.scss */ | |||
/* line 178, ../sass/_layout.scss */ | |||
#header #credit span { | |||
font-family: "myriadpro-light"; | |||
} | |||
/* line 158, ../sass/_layout.scss */ | |||
/* line 184, ../sass/_layout.scss */ | |||
#main { | |||
background-color: #F8F1DD; | |||
} | |||
/* line 161, ../sass/_layout.scss */ | |||
/* line 187, ../sass/_layout.scss */ | |||
#main #main-nav { | |||
width: 100%; | |||
position: relative; | |||
@@ -231,14 +253,14 @@ body { | |||
background-color: white; | |||
border-bottom: solid 1px #e0e0e0; | |||
} | |||
/* line 170, ../sass/_layout.scss */ | |||
/* line 196, ../sass/_layout.scss */ | |||
#main #main-nav ul li a { | |||
color: #BB8757; | |||
text-transform: uppercase; | |||
font-family: "myriadpro-regular"; | |||
border-right: solid 1px #e0e0e0; | |||
} | |||
/* line 177, ../sass/_layout.scss */ | |||
/* line 203, ../sass/_layout.scss */ | |||
#main #main-nav ul li a:hover, #main #main-nav ul li.active a { | |||
background: none; | |||
border-bottom: solid 1px #BB8757; | |||
@@ -246,18 +268,18 @@ body { | |||
-webkit-border-radius: 0px; | |||
border-radius: 0px; | |||
} | |||
/* line 184, ../sass/_layout.scss */ | |||
/* line 210, ../sass/_layout.scss */ | |||
#main #main-nav ul li#btn-administration { | |||
background-color: #F8F1DD; | |||
float: right; | |||
} | |||
/* line 191, ../sass/_layout.scss */ | |||
/* line 217, ../sass/_layout.scss */ | |||
#main #main-nav #user { | |||
color: #BB8757; | |||
float: right; | |||
padding: 10px; | |||
} | |||
/* line 198, ../sass/_layout.scss */ | |||
/* line 224, ../sass/_layout.scss */ | |||
#main #page-title { | |||
padding-left: 15px; | |||
padding-right: 15px; | |||
@@ -270,7 +292,7 @@ body { | |||
top: -10px; | |||
text-align: center; | |||
} | |||
/* line 211, ../sass/_layout.scss */ | |||
/* line 237, ../sass/_layout.scss */ | |||
#main .container { | |||
padding: 0px; | |||
background-color: white; | |||
@@ -278,30 +300,30 @@ body { | |||
border-left: solid 1px #e0e0e0; | |||
border-right: solid 1px #e0e0e0; | |||
} | |||
/* line 219, ../sass/_layout.scss */ | |||
/* line 245, ../sass/_layout.scss */ | |||
#main #content { | |||
padding-bottom: 20px; | |||
padding: 0px 20px 20px 20px; | |||
} | |||
/* line 223, ../sass/_layout.scss */ | |||
/* line 249, ../sass/_layout.scss */ | |||
#main #content h1, #main #content h2, #main #content h3, #main #content h4, #main #content h5, #main #content h6 { | |||
font-family: "myriadpro-regular"; | |||
margin-top: 30px; | |||
margin-bottom: 20px; | |||
} | |||
/* line 228, ../sass/_layout.scss */ | |||
/* line 254, ../sass/_layout.scss */ | |||
#main #content h1.first, #main #content h2.first, #main #content h3.first, #main #content h4.first, #main #content h5.first, #main #content h6.first { | |||
margin-top: 0px; | |||
} | |||
/* line 233, ../sass/_layout.scss */ | |||
/* line 259, ../sass/_layout.scss */ | |||
#main #content h1 { | |||
font-size: 30px; | |||
} | |||
/* line 237, ../sass/_layout.scss */ | |||
/* line 263, ../sass/_layout.scss */ | |||
#main #content h2 { | |||
font-size: 25px; | |||
} | |||
/* line 242, ../sass/_layout.scss */ | |||
/* line 268, ../sass/_layout.scss */ | |||
#main #content h3 { | |||
font-family: "myriadpro-light"; | |||
text-transform: uppercase; | |||
@@ -310,35 +332,35 @@ body { | |||
color: white; | |||
text-align: center; | |||
} | |||
/* line 249, ../sass/_layout.scss */ | |||
/* line 275, ../sass/_layout.scss */ | |||
#main #content h3 span { | |||
background-color: #BB8757; | |||
padding: 10px 20px; | |||
padding-top: 14px; | |||
} | |||
/* line 256, ../sass/_layout.scss */ | |||
/* line 282, ../sass/_layout.scss */ | |||
#main #content h4 { | |||
font-size: 20px; | |||
} | |||
/* line 260, ../sass/_layout.scss */ | |||
/* line 286, ../sass/_layout.scss */ | |||
#main #content h5 { | |||
font-size: 18px; | |||
} | |||
/* line 264, ../sass/_layout.scss */ | |||
/* line 290, ../sass/_layout.scss */ | |||
#main #content h6 { | |||
font-size: 16px; | |||
} | |||
/* line 270, ../sass/_layout.scss */ | |||
/* line 296, ../sass/_layout.scss */ | |||
#footer { | |||
background-color: #BB8757; | |||
height: 100px; | |||
} | |||
/* line 274, ../sass/_layout.scss */ | |||
/* line 300, ../sass/_layout.scss */ | |||
#footer .container { | |||
padding: 0px; | |||
} | |||
/* line 276, ../sass/_layout.scss */ | |||
/* line 302, ../sass/_layout.scss */ | |||
#footer .container .overflow { | |||
height: 30px; | |||
background-color: white; | |||
@@ -346,12 +368,12 @@ body { | |||
border-right: solid 1px #e0e0e0; | |||
border-bottom: solid 1px #e0e0e0; | |||
} | |||
/* line 284, ../sass/_layout.scss */ | |||
/* line 310, ../sass/_layout.scss */ | |||
#footer .container .content { | |||
padding-top: 20px; | |||
color: white; | |||
} | |||
/* line 288, ../sass/_layout.scss */ | |||
/* line 314, ../sass/_layout.scss */ | |||
#footer .container .content a { | |||
color: white; | |||
text-decoration: underline; |
@@ -51,6 +51,32 @@ body { | |||
} | |||
} | |||
ul.pagination { | |||
li { | |||
&.active { | |||
a { | |||
background-color: $color1 ; | |||
border: solid 1px $color1 ; | |||
&:hover { | |||
background-color: $color2 ; | |||
border: solid 1px $color2 ; | |||
color: $color1 ; | |||
} | |||
} | |||
} | |||
a { | |||
color: $color1 ; | |||
&:hover, &:focus, &:active { | |||
background-color: $color2 ; | |||
border: solid 1px $color2 ; | |||
color: $color1 ; | |||
} | |||
} | |||
} | |||
} | |||
#header-bap { | |||
background-color: $color2 ; | |||
padding-top: 7px ; |