Bladeren bron

Intégrer le système multi-boulangerie à la page de commande

master
keun 8 jaren geleden
bovenliggende
commit
c85d29802e
14 gewijzigde bestanden met toevoegingen van 278 en 315 verwijderingen
  1. +1
    -0
      backend/controllers/CommandeController.php
  2. +1
    -1
      backend/controllers/PointVenteController.php
  3. +1
    -1
      backend/controllers/ProduitController.php
  4. +1
    -1
      backend/controllers/UserController.php
  5. +1
    -1
      common/models/Commande.php
  6. +6
    -0
      common/models/Production.php
  7. +17
    -34
      frontend/controllers/CommandeController.php
  8. +189
    -222
      frontend/views/commande/_form.php
  9. +3
    -1
      frontend/views/commande/create.php
  10. +4
    -4
      frontend/views/commande/index.php
  11. +3
    -1
      frontend/views/commande/update.php
  12. BIN
      frontend/web/.sass-cache/e1a48ee3204d3a535cdbe440c2995954a615ac19/_systeme_commandes.scssc
  13. +48
    -47
      frontend/web/css/screen.css
  14. +3
    -2
      frontend/web/sass/_systeme_commandes.scss

+ 1
- 0
backend/controllers/CommandeController.php Bestand weergeven

@@ -155,6 +155,7 @@ class CommandeController extends \yii\web\Controller {
$production = new Production;
$production->date = $date;
$production->livraison = 1;
$production->id_etablissement = Yii::$app->user->identity->id_etablissement ;
$production->save();
}
}

+ 1
- 1
backend/controllers/PointVenteController.php Bestand weergeven

@@ -49,7 +49,7 @@ class PointVenteController extends Controller
{
$dataProvider = new ActiveDataProvider([
'query' => PointVente::find()->where(['id_etablissement'=>Yii::$app->user->identity->id])
'query' => PointVente::find()->where(['id_etablissement'=>Yii::$app->user->identity->id_etablissement])
]);

return $this->render('index', [

+ 1
- 1
backend/controllers/ProduitController.php Bestand weergeven

@@ -60,7 +60,7 @@ class ProduitController extends Controller
$dataProvider = new ActiveDataProvider([
'query' => Produit::find()
->where('(vrac IS NULL OR vrac = 0)')
->andWhere(['id_etablissement'=>Yii::$app->user->identity->id])
->andWhere(['id_etablissement'=>Yii::$app->user->identity->id_etablissement])
->orderBy('order ASC'),
'pagination' => [
'pageSize' => 1000,

+ 1
- 1
backend/controllers/UserController.php Bestand weergeven

@@ -54,7 +54,7 @@ class UserController extends Controller
->select('*')
->from('user, user_etablissement')
->where('user.id = user_etablissement.id_user')
->andWhere('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id)
->andWhere('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id_etablissement)
]);

return $this->render('index', [

+ 1
- 1
common/models/Commande.php Bestand weergeven

@@ -79,7 +79,7 @@ class Commande extends \yii\db\ActiveRecord
}
public function getProduction() {
return $this->hasOne(Production::className(), ['id'=>'id_production']) ;
return $this->hasOne(Production::className(), ['id'=>'id_production'])->with('etablissement') ;
}
public function getPointVente() {

+ 6
- 0
common/models/Production.php Bestand weergeven

@@ -20,6 +20,10 @@ class Production extends \yii\db\ActiveRecord
{
return 'production';
}
public function getEtablissement() {
return $this->hasOne(Etablissement::className(), ['id'=>'id_etablissement']) ;
}

/**
* @inheritdoc
@@ -44,4 +48,6 @@ class Production extends \yii\db\ActiveRecord
'actif' => 'Actif',
];
}
}

+ 17
- 34
frontend/controllers/CommandeController.php Bestand weergeven

@@ -51,12 +51,15 @@ class CommandeController extends \yii\web\Controller {

public static function initForm($commande = null) {

// etablissements
$etablissements = Yii::$app->user->identity->getEtablissementsFavoris() ;
$id_etablissement = Yii::$app->request->get('id_etablissement', 0) ;
// points de vente
$points_vente = PointVente::find()->all();
$points_vente = PointVente::find()
->where(['id_etablissement'=>$id_etablissement])
->all();
$arr_points_vente = $points_vente;
/* $arr_points_vente = array(''=>'--') ;
foreach($points_vente as $pv)
$arr_points_vente[$pv->id] = $pv->nom.' ('.$pv->localite.')' ; */

// jours de production;
if (date('H') >= 20) {
@@ -68,6 +71,7 @@ class CommandeController extends \yii\web\Controller {
$jours_production = Production::find()
->where(['actif' => 1])
->andWhere('date > :date')
->andWhere(['id_etablissement'=>$id_etablissement])
->addParams([':date' => $date])
->all();

@@ -104,31 +108,15 @@ class CommandeController extends \yii\web\Controller {

$produits_dispos = [];
$production = null;
if (!is_null($commande)) {
if (!is_null($commande) && $commande->id_production) {
$produits_dispos = ProductionProduit::findProduits($commande->id_production);
$production = Production::find()->where(['id' => $commande->id_production])->one();
}



// commandes déjà réalisées
/* if(!is_null($commande)) {
$commandes = Commande::find()
->where(['id_user'=> Yii::$app->user->identity->id])
->andWhere('date > :date')
->andWhere('id != '.$commande->id)
->addParams([':date'=>date('Y-m-d')])
->all() ;
}
else { */
$commandes = Commande::find()
->where(['id_user' => Yii::$app->user->identity->id])
//->andWhere('date > :date')
//->addParams([':date'=>date('Y-m-d 00:00:00')])
->all();
//}


return [
'points_vente' => $arr_points_vente,
'jours_production' => $arr_jours_production,
@@ -137,7 +125,9 @@ class CommandeController extends \yii\web\Controller {
'produits_dispos' => $produits_dispos,
'production' => $production,
'commandes_en_cours' => $commandes,
'produits_vrac' => $produits_vrac
'produits_vrac' => $produits_vrac,
'etablissements' => $etablissements,
'id_etablissement' => $id_etablissement,
];
}

@@ -177,7 +167,7 @@ class CommandeController extends \yii\web\Controller {
// liste des commandes
$commandes = Commande::find()
->with('commandeProduits', 'pointVente')
->joinWith('production')
->joinWith('production','production.etablissement')
->where(['id_user' => Yii::$app->user->id])
//->andWhere('production.date < '.)
->orderBy('production.date DESC')
@@ -225,11 +215,11 @@ class CommandeController extends \yii\web\Controller {
$commande->id_user = Yii::$app->user->id;
$commande->date = date('Y-m-d H:i:s');
}
$this->gestionForm($commande);
}

return $this->render('create', array_merge(self::initForm(), [
return $this->render('create', array_merge(self::initForm($commande), [
'model' => $commande,
]));
}
@@ -282,18 +272,11 @@ class CommandeController extends \yii\web\Controller {
$date = date('Y-m-d');
}

//die($production->date.' '.$date) ;

if ($production->date < $date) {
$err_date = true;
}

// pate déjà pétrie ou non
/* if(date('Y-m-d', strtotime(date('Y-m-d')) + 60*60*24*3) > $production->date && date('H', strtotime(date('Y-m-d')) + 60*60*24*3) < 20) {
$pate_deja_petrie = true ;
} */
}
if ($commande->validate() && count($produits) && !$err_nb_produits && !$err_date) {
// sauvegarde de la commande
$commande->save();

+ 189
- 222
frontend/views/commande/_form.php Bestand weergeven

@@ -9,228 +9,195 @@ use yii\widgets\ActiveForm;
?>
<div class="commande-form">

<?php $form = ActiveForm::begin([
'enableClientScript' => false
]);
?>
<?= $form->field($model, 'id_production')->label('Pour quelle date ?')->hiddenInput() ; ?>
<?php if(isset($model->id)): ?>
<h2><?php echo date('d/m/Y',strtotime($production->date)); ?></h2>
<?php endif;?>
<div id="datepicker-production" <?php if(isset($model->id)): ?>style="display:none"<?php endif; ?>>
<div id="infos-importantes" class="alert alert-warning">
<strong>Jours de fournées :</strong>
<ul>
<li>Mercredi</li>
<li>Jeudi</li>
<li>Vendredi</li>
<li>Samedi</li>
<li>Dimanche</li>
</ul>
</div>
</div>
<br />
<div id="dates" style="display:none;">
<?php
foreach($jours_production as $id_production => $j) {
if($j != '--') {
echo '<div><span class="date">'.$j.'</span><span class="id_production">'.$id_production.'</span></div>' ;
}
}
?>
</div>
<div class="clr"></div>
<div id="commandes-en-cours" style="display:none;">
<?php foreach($commandes_en_cours as $c): ?>
<?php echo '<div class="commande" data-idproduction="'.$c->id_production.'" data-id="'.$c->id.'" data-href="'.Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id]).'"></div>' ;?>
<?php endforeach; ?>
</div>
<div id="has-commande-en-cours" style="display:none;" class="alert alert-danger">Vous avez déjà une commande en cours pour cette date. <a href="#">Cliquez ici</a> pour la modifier.</div>
<div class="clr"></div>
<?= $form->field($model, 'id_point_vente')
->label('Où souhaitez-vous récupérer votre commande ?')
->hiddenInput() ;
//->dropDownList($points_vente) ; ?>
<div id="info-horaire-retrait-commande" class="alert alert-warning">Les commandes sont disponibles à partir de 11h au plus tard dans les points de vente. Merci de me laisser un commentaire si vous souhaitez récupérer votre commande en début de matinée.</div>
<input type="hidden" id="livraison" value="<?php if(!is_null($production) && $production->livraison): ?>1<?php else: ?>0<?php endif; ?>" />
<ul id="points-vente">
<?php
//$points_vente = PointVente::find()->all() ;
foreach($points_vente as $pv) {
//print_r($pv) ;
echo '<li class="point-vente point-vente-'.$pv->id.'" data-vrac="'.(int)$pv->vrac.'" data-pain="'.(int)$pv->pain.'"><div class="contenu">'.
'<span style="display:none;" class="id">'.$pv->id.'</span>'.
'<div class="nom">'.Html::encode($pv->nom).'</div>'.
'<div class="adresse">à '.Html::encode($pv->localite).'</div>'.
'<div class="horaires">'.
'<div class="jour jour-1">'.(strlen($pv->horaires_lundi) ? nl2br(Html::encode($pv->horaires_lundi)) : 'Fermé').'</div>'.
'<div class="jour jour-2">'.(strlen($pv->horaires_mardi) ? nl2br(Html::encode($pv->horaires_mardi)) : 'Fermé').'</div>'.
'<div class="jour jour-3">'.(strlen($pv->horaires_mercredi) ? nl2br(Html::encode($pv->horaires_mercredi)) : 'Fermé').'</div>'.
'<div class="jour jour-4">'.(strlen($pv->horaires_jeudi) ? nl2br(Html::encode($pv->horaires_jeudi)) : 'Fermé').'</div>'.
'<div class="jour jour-5">'.(strlen($pv->horaires_vendredi) ? nl2br(Html::encode($pv->horaires_vendredi)) : 'Fermé').'</div>'.
'<div class="jour jour-6">'.(strlen($pv->horaires_samedi) ? nl2br(Html::encode($pv->horaires_samedi)) : 'Fermé').'</div>'.
'<div class="jour jour-0">'.(strlen($pv->horaires_dimanche) ? nl2br(Html::encode($pv->horaires_dimanche)) : 'Fermé').'</div>'.
'</div>'.
'</div></li>' ;
}
?>
</ul>
<div class="clr"></div>
<div id="produits">
<strong id="label-produits">Quels produits désirez-vous ?</strong>
<?php // confiance ?>
<input type="hidden" id="confiance" value="<?php echo (int) Yii::$app->user->identity->confiance ;?>" />
<?php if(!Yii::$app->user->identity->confiance): ?>
<div id="mess-limit-quantity" class="alert alert-warning"><strong>Attention,</strong> vous ne pouvez commander que 3 produits.</div>
<?php endif;?>
<?php // erreur ?>
<?php if(Yii::$app->session->getFlash('error')): ?>
<div class="alert alert-danger"><div class="icon"></div><?= Yii::$app->session->getFlash('error'); ?></div>
<?php endif; ?>
<div id="pain">
<h2>Pain</h2>
<div class="alert alert-warning indisponible">Pain indisponible pour ce point de vente</div>
<table class="table table-bordered" id="table-produits">
<thead>
<tr>
<th class="produit">Produit</th>
<th class="prix-unit">Prix unitaire</th>
<th class="colonne-quantite">Quantité</th>
<th class="total">Total</th>
</tr>
</thead>
<tbody>
<?php foreach($produits as $p): ?>
<tr class="produit-<?php echo $p->id; ?>" <?php if(count($produits_dispos) && !$produits_dispos[$p->id]['actif']): ?>style="display:none;"<?php endif;?>>
<td class="produit">
<?php if(strlen($p->photo)): ?><br /><a href="<?= Yii::$app->urlManager->getBaseUrl().'/uploads/'.$p->photo ?>" data-lightbox="produit-<?php echo $p->id; ?>"><img class="photo img-rounded img-thumbnail" src="<?= Yii::$app->urlManager->getBaseUrl().'/uploads/'.$p->photo ?>" alt="Photo <?= Html::encode($p->nom); ?>" /></a><?php endif; ?>
<?php if(strlen($p->illustration)): ?><img class="illu" src="<?= Yii::$app->urlManager->getBaseUrl().'/uploads/'.$p->illustration ?>" alt="illustration <?= Html::encode($p->nom); ?>" /><?php endif; ?>
<span class="nom"><?= Html::encode($p->nom); ?></span> - <span class="description"><?= Html::encode($p->getDescription()); ?></span><br />
<span class="recette"><?= Html::encode($p->recette); ?></span>
</td>
<td class="prix-unit"><span class="prix"><?= number_format($p->prix, 2) ; ?></span> €</td>
<td class="colonne-quantite">
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity moins">-</button>
</span>
<?php $quantite = 0 ;
if(isset($produits_selec[$p->id]))
$quantite = $produits_selec[$p->id] ;
?>
<input type="text" value="<?php if(isset($produits_selec[$p->id])): echo $produits_selec[$p->id] ; else:?>0<?php endif;?>" readonly name="Produit[produit_<?php echo $p->id ; ?>]" class="quantity form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity plus">+</button>
</span>
</div>
<div class="quantite-restante">Reste <span class="nb"><?php if(isset($produits_dispos[$p->id])): echo $produits_dispos[$p->id]['quantite_restante'] + $quantite ; endif;?></span> <?php echo Html::encode(strtolower($p->nom)); ?>(s)</div>
<div class="epuise">Épuisé</div>
</td>
<td class="total"><strong></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<!-- <td><strong><span id="total-commande">0</span> €</strong></td> -->
<td id="total-commande"><strong></strong></td>
</tr>
</tfoot>
</table>
</div>
<div id="vrac">
<h2>Vrac</h2>
<div class="alert alert-warning indisponible">Vrac indisponible pour ce point de vente</div>
<table class="table table-bordered" id="table-produits-vrac">
<thead>
<tr>
<th>Produit</th>
<th class="prix-unit">Prix au kg</th>
<th class="colonne-quantite">Quantité (en g)</th>
<th class="total">Total</th>
</tr>
</thead>
<tbody>
<?php foreach($produits_vrac as $p): ?>
<tr class="vrac produit-<?php echo $p->id; ?>" <?php if(count($produits_dispos) && !$produits_dispos[$p->id]['actif']): ?>style="display:none;"<?php endif;?>>
<td class="produit">
<?php if(strlen($p->photo)): ?><br /><a href="<?= Yii::$app->urlManager->getBaseUrl().'/uploads/'.$p->photo ?>" data-lightbox="produit-<?php echo $p->id; ?>"><img class="photo img-rounded img-thumbnail" src="<?= Yii::$app->urlManager->getBaseUrl().'/uploads/'.$p->photo ?>" alt="Photo <?= Html::encode($p->nom); ?>" /></a><?php endif; ?>
<span class="nom"><?= Html::encode($p->nom); ?></span><br />
<span class="recette"><?= Html::encode($p->description); ?></span>
</td>
<td class="prix-unit"><span class="prix"><?= number_format($p->prix, 2) ; ?></span> €</td>
<td class="colonne-quantite">
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity moins">-</button>
</span>
<?php $quantite = 0 ;
if(isset($produits_selec[$p->id]))
$quantite = $produits_selec[$p->id] ;
?>
<input type="text" value="<?php if(isset($produits_selec[$p->id])): echo $produits_selec[$p->id] ; else:?>0<?php endif;?>" readonly name="Produit[produit_<?php echo $p->id ; ?>]" class="quantity form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity plus">+</button>
</span>
</div>
<div class="epuise">Épuisé</div>
</td>
<td class="total"><strong></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<!-- <td><strong><span id="total-commande">0</span> €</strong></td> -->
<td id="total-commande-vrac"><strong></strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
<h2>Boulangerie</h2>
<?php if(count($etablissements)): ?>
<?php //if(!$id_etablissement): ?>
<div class="alert alert-info">Choisissez la boulangerie dans laquelle vous souhaitez passer commande.</div>
<?php //endif; ?>
<div class="blocs">
<?php foreach($etablissements as $e): ?>
<a class="bloc <?php if($e['id'] == $id_etablissement): ?>selected<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['commande/create', 'id_etablissement' => $e['id']]) ?>">
<span class="nom"><?= Html::encode($e['nom']) ?></span><br />
<span class="adresse">à <?= Html::encode($e['ville']) ?></span>
</a>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Veuiller <a href="<?= Yii::$app->urlManager->createUrl(['commande/index']) ; ?>">ajouter une boulangerie</a> à votre tableau de bord avant de passer commande.</div>
<?php endif; ?>
<div id="bar-fixed">
<div class="container">
<a href="<?php echo Yii::$app->urlManager->createUrl('commande/index') ?>" class="btn btn-default btn-retour">Retour</a>
<?php if(isset($model->id)): ?>
<a href="<?php echo Yii::$app->urlManager->createUrl(['commande/annuler','id'=> $model->id]) ; ?>" class="btn btn-danger annuler-commande">Annuler ma commande</a>
<?php endif; ?>
<?= Html::submitButton('Valider ma commande', ['class' => 'btn btn-primary valider-commande']) ?>
<?= Html::submitButton('<span class="glyphicon glyphicon-comment"></span>', ['class' => 'btn btn-default btn-commentaire', 'data-placement'=>'top', 'data-toggle'=>'tooltip', 'data-original-title'=>'Ajouter un commentaire']) ?>
<span id="total-commande-bottom"><span></span> €</span>
<div class="clr"></div>
<?= $form->field($model, 'commentaire')->textarea(['rows'=>3,'placeholder'=>'Un commentaire ?'])->label('') ; ?>
</div>
</div>
<?php
$form = ActiveForm::begin([
'enableClientScript' => false
]);
?>
<?php if($id_etablissement): ?>
<?php ActiveForm::end(); ?>
<h2>Pour quelle date ?</h2>

<?= $form->field($model, 'id_production')->label('')->hiddenInput(); ?>

<?php if (isset($model->id)): ?>
<h2><?php echo date('d/m/Y', strtotime($production->date)); ?></h2>
<?php endif; ?>

<div id="datepicker-production" <?php if (isset($model->id)): ?>style="display:none"<?php endif; ?>>
</div>
<br />
<div id="dates" style="display:none;">
<?php
foreach ($jours_production as $id_production => $j) {
if ($j != '--') {
echo '<div><span class="date">' . $j . '</span><span class="id_production">' . $id_production . '</span></div>';
}
}
?>
</div>

<div class="clr"></div>
<div id="commandes-en-cours" style="display:none;">
<?php foreach ($commandes_en_cours as $c): ?>
<?php echo '<div class="commande" data-idproduction="' . $c->id_production . '" data-id="' . $c->id . '" data-href="' . Yii::$app->urlManager->createUrl(['commande/update', 'id' => $c->id]) . '"></div>'; ?>
<?php endforeach; ?>
</div>
<div id="has-commande-en-cours" style="display:none;" class="alert alert-danger">Vous avez déjà une commande en cours pour cette date. <a href="#">Cliquez ici</a> pour la modifier.</div>

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

<!--<h2>Où souhaitez-vous récupérer votre commande ?</h2>-->
<?=
$form->field($model, 'id_point_vente')
->label('Où souhaitez-vous récupérer votre commande ?')
->hiddenInput();
//->dropDownList($points_vente) ;
?>

<input type="hidden" id="livraison" value="<?php if (!is_null($production) && $production->livraison): ?>1<?php else: ?>0<?php endif; ?>" />

<ul id="points-vente" class="blocs">
<?php
//$points_vente = PointVente::find()->all() ;
foreach ($points_vente as $pv) {
//print_r($pv) ;
echo '<li class="bloc point-vente point-vente-' . $pv->id . '" data-vrac="' . (int) $pv->vrac . '" data-pain="' . (int) $pv->pain . '"><div class="contenu">' .
'<span style="display:none;" class="id">' . $pv->id . '</span>' .
'<div class="nom">' . Html::encode($pv->nom) . '</div>' .
'<div class="adresse">à ' . Html::encode($pv->localite) . '</div>' .
'<div class="horaires">' .
'<div class="jour jour-1">' . (strlen($pv->horaires_lundi) ? nl2br(Html::encode($pv->horaires_lundi)) : 'Fermé') . '</div>' .
'<div class="jour jour-2">' . (strlen($pv->horaires_mardi) ? nl2br(Html::encode($pv->horaires_mardi)) : 'Fermé') . '</div>' .
'<div class="jour jour-3">' . (strlen($pv->horaires_mercredi) ? nl2br(Html::encode($pv->horaires_mercredi)) : 'Fermé') . '</div>' .
'<div class="jour jour-4">' . (strlen($pv->horaires_jeudi) ? nl2br(Html::encode($pv->horaires_jeudi)) : 'Fermé') . '</div>' .
'<div class="jour jour-5">' . (strlen($pv->horaires_vendredi) ? nl2br(Html::encode($pv->horaires_vendredi)) : 'Fermé') . '</div>' .
'<div class="jour jour-6">' . (strlen($pv->horaires_samedi) ? nl2br(Html::encode($pv->horaires_samedi)) : 'Fermé') . '</div>' .
'<div class="jour jour-0">' . (strlen($pv->horaires_dimanche) ? nl2br(Html::encode($pv->horaires_dimanche)) : 'Fermé') . '</div>' .
'</div>' .
'</div></li>';
}
?>
</ul>
<div class="clr"></div>

<div id="produits">
<strong id="label-produits">Quels produits désirez-vous ?</strong>

<?php // confiance ?>
<input type="hidden" id="confiance" value="<?php echo (int) Yii::$app->user->identity->confiance; ?>" />
<?php if (!Yii::$app->user->identity->confiance): ?>
<div id="mess-limit-quantity" class="alert alert-warning"><strong>Attention,</strong> vous ne pouvez commander que 3 produits.</div>
<?php endif; ?>

<?php // erreur ?>
<?php if (Yii::$app->session->getFlash('error')): ?>
<div class="alert alert-danger"><div class="icon"></div><?= Yii::$app->session->getFlash('error'); ?></div>
<?php endif; ?>

<div id="pain">
<h2>Pain</h2>
<div class="alert alert-warning indisponible">Pain indisponible pour ce point de vente</div>
<table class="table table-bordered" id="table-produits">
<thead>
<tr>
<th class="produit">Produit</th>
<th class="prix-unit">Prix unitaire</th>
<th class="colonne-quantite">Quantité</th>
<th class="total">Total</th>
</tr>
</thead>
<tbody>
<?php foreach ($produits as $p): ?>
<tr class="produit-<?php echo $p->id; ?>" <?php if (count($produits_dispos) && !$produits_dispos[$p->id]['actif']): ?>style="display:none;"<?php endif; ?>>
<td class="produit">
<?php if (strlen($p->photo)): ?><br /><a href="<?= Yii::$app->urlManager->getBaseUrl() . '/uploads/' . $p->photo ?>" data-lightbox="produit-<?php echo $p->id; ?>"><img class="photo img-rounded img-thumbnail" src="<?= Yii::$app->urlManager->getBaseUrl() . '/uploads/' . $p->photo ?>" alt="Photo <?= Html::encode($p->nom); ?>" /></a><?php endif; ?>
<?php if (strlen($p->illustration)): ?><img class="illu" src="<?= Yii::$app->urlManager->getBaseUrl() . '/uploads/' . $p->illustration ?>" alt="illustration <?= Html::encode($p->nom); ?>" /><?php endif; ?>
<span class="nom"><?= Html::encode($p->nom); ?></span> - <span class="description"><?= Html::encode($p->getDescription()); ?></span><br />
<span class="recette"><?= Html::encode($p->recette); ?></span>
</td>
<td class="prix-unit"><span class="prix"><?= number_format($p->prix, 2); ?></span> €</td>
<td class="colonne-quantite">
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity moins">-</button>
</span>
<?php
$quantite = 0;
if (isset($produits_selec[$p->id]))
$quantite = $produits_selec[$p->id];
?>
<input type="text" value="<?php if (isset($produits_selec[$p->id])): echo $produits_selec[$p->id];
else: ?>0<?php endif; ?>" readonly name="Produit[produit_<?php echo $p->id; ?>]" class="quantity form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-default move-quantity plus">+</button>
</span>
</div>

<div class="quantite-restante">Reste <span class="nb"><?php if (isset($produits_dispos[$p->id])): echo $produits_dispos[$p->id]['quantite_restante'] + $quantite;
endif; ?></span> <?php echo Html::encode(strtolower($p->nom)); ?>(s)</div>
<div class="epuise">Épuisé</div>
</td>
<td class="total"><strong></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<!-- <td><strong><span id="total-commande">0</span> €</strong></td> -->
<td id="total-commande"><strong></strong></td>
</tr>
</tfoot>
</table>
</div>

</div>

<div id="bar-fixed">
<div class="container">
<a href="<?php echo Yii::$app->urlManager->createUrl('commande/index') ?>" class="btn btn-default btn-retour">Retour</a>
<?php if (isset($model->id)): ?>
<a href="<?php echo Yii::$app->urlManager->createUrl(['commande/annuler', 'id' => $model->id]); ?>" class="btn btn-danger annuler-commande">Annuler ma commande</a>
<?php endif; ?>

<?= Html::submitButton('Valider ma commande', ['class' => 'btn btn-primary valider-commande']) ?>
<?= Html::submitButton('<span class="glyphicon glyphicon-comment"></span>', ['class' => 'btn btn-default btn-commentaire', 'data-placement' => 'top', 'data-toggle' => 'tooltip', 'data-original-title' => 'Ajouter un commentaire']) ?>

<span id="total-commande-bottom"><span></span> €</span>
<div class="clr"></div>
<?= $form->field($model, 'commentaire')->textarea(['rows' => 3, 'placeholder' => 'Un commentaire ?'])->label(''); ?>
</div>
</div>

<?php
// id_etablissement
endif; ?>
<?php ActiveForm::end(); ?>

</div><!-- commande-form -->

+ 3
- 1
frontend/views/commande/create.php Bestand weergeven

@@ -23,7 +23,9 @@ $this->title = 'Passer une commande';
'produits_dispos' => $produits_dispos,
'production' => $production,
'commandes_en_cours' => $commandes_en_cours,
'produits_vrac' => $produits_vrac
'produits_vrac' => $produits_vrac,
'etablissements' => $etablissements,
'id_etablissement' => $id_etablissement,
]) ?>

</div>

+ 4
- 4
frontend/views/commande/index.php Bestand weergeven

@@ -76,7 +76,7 @@ $this->title = 'Commande' ;
<table id="historique-commandes" class="table table-striped table-bordered">
<thead>
<tr>
<!-- <th>Date commande</th> -->
<th>Boulangerie</th>
<th>Date livraison</th>
<th>Résumé</th>
<th>Lieu</th>
@@ -87,8 +87,8 @@ $this->title = 'Commande' ;
<tbody>
<?php foreach($commandes as $c): ?>
<tr>
<!-- <td><?php echo date('d/m/Y',strtotime($c->date)); ?></td> -->
<td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
<td><?= Html::encode($c->production->etablissement->nom) ?></td>
<td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
<td class="resume"><?php
$count = count($c->commandeProduits);
$i = 0;
@@ -117,7 +117,7 @@ $this->title = 'Commande' ;
<?php else: ?>
<!-- <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id]) ; ?>" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>-->
<div class="btn-group">
<a href="<?php echo Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id]) ; ?>" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>
<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>

+ 3
- 1
frontend/views/commande/update.php Bestand weergeven

@@ -28,7 +28,9 @@ $this->title = 'Modifier une commande';
'produits_dispos' => $produits_dispos,
'production' => $production,
'commandes_en_cours' => $commandes_en_cours,
'produits_vrac' => $produits_vrac
'produits_vrac' => $produits_vrac,
'etablissements' => $etablissements,
'id_etablissement' => $id_etablissement,
]) ?>
<?php endif; ?>

BIN
frontend/web/.sass-cache/e1a48ee3204d3a535cdbe440c2995954a615ac19/_systeme_commandes.scssc Bestand weergeven


+ 48
- 47
frontend/web/css/screen.css Bestand weergeven

@@ -568,13 +568,14 @@ h2 {
margin-bottom: 0px;
}
/* line 160, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente {
.commande-form .blocs {
list-style-type: none;
margin: 0px;
padding: 0px;
}
/* line 165, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente {
.commande-form .blocs .bloc {
text-decoration: none;
width: 268px;
height: 130px;
float: left;
@@ -586,107 +587,107 @@ h2 {
background-color: #f9f9f9;
border: 1px solid #d8d8d8;
}
/* line 178, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente .nom {
/* line 179, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc .nom {
font-family: "comfortaalight";
font-size: 20px;
}
/* line 184, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente .adresse {
/* line 185, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc .adresse {
color: gray;
font-size: 13px;
line-height: 16px;
}
/* line 190, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente .horaires {
/* line 191, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc .horaires {
margin-top: 7px;
}
/* line 192, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente .horaires .jour {
/* line 193, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc .horaires .jour {
font-weight: bold;
display: none;
}
/* line 198, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente.selected {
/* line 199, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc.selected {
border-left: solid 5px black;
-moz-box-shadow: 0px 0px 5px #d8d8d8;
-webkit-box-shadow: 0px 0px 5px #d8d8d8;
box-shadow: 0px 0px 5px #d8d8d8;
}
/* line 202, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente.selected .contenu {
/* line 203, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc.selected .contenu {
position: relative;
left: -4px;
}
/* line 208, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente:hover {
/* line 209, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc:hover {
-moz-box-shadow: 0px 0px 5px #d8d8d8;
-webkit-box-shadow: 0px 0px 5px #d8d8d8;
box-shadow: 0px 0px 5px #d8d8d8;
}
/* line 213, ../sass/_systeme_commandes.scss */
.commande-form ul#points-vente .point-vente.disabled {
/* line 214, ../sass/_systeme_commandes.scss */
.commande-form .blocs .bloc.disabled {
display: none;
}
/* line 220, ../sass/_systeme_commandes.scss */
/* line 221, ../sass/_systeme_commandes.scss */
.commande-form #produits {
margin-top: 15px;
}
/* line 223, ../sass/_systeme_commandes.scss */
/* line 224, ../sass/_systeme_commandes.scss */
.commande-form #produits #label-produits {
display: block;
margin-bottom: 5px;
}
/* line 228, ../sass/_systeme_commandes.scss */
/* line 229, ../sass/_systeme_commandes.scss */
.commande-form #produits .table {
margin-top: 7px;
}
/* line 231, ../sass/_systeme_commandes.scss */
/* line 232, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .illu {
float: left;
height: auto;
width: 70px;
margin-right: 15px;
}
/* line 238, ../sass/_systeme_commandes.scss */
/* line 239, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .photo {
float: right;
margin-left: 10px;
width: 200px;
}
/* line 244, ../sass/_systeme_commandes.scss */
/* line 245, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .nom {
font-family: "comfortaalight";
font-weight: bold;
text-transform: uppercase;
font-size: 18px;
}
/* line 251, ../sass/_systeme_commandes.scss */
/* line 252, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .description {
font-style: italic;
}
/* line 255, ../sass/_systeme_commandes.scss */
/* line 256, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .recette {
font-size: 12px;
}
/* line 259, ../sass/_systeme_commandes.scss */
/* line 260, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .input-group {
width: 133px;
}
/* line 261, ../sass/_systeme_commandes.scss */
/* line 262, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .input-group .quantity {
text-align: center;
}
/* line 266, ../sass/_systeme_commandes.scss */
/* line 267, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .colonne-quantite, .commande-form #produits .table .prix-unit, .commande-form #produits .table .total {
width: 150px;
text-align: center;
}
/* line 271, ../sass/_systeme_commandes.scss */
/* line 272, ../sass/_systeme_commandes.scss */
.commande-form #produits .table td#total-commande, .commande-form #produits .table td#total-commande-vrac, .commande-form #produits .table td.total {
text-align: center;
}
/* line 275, ../sass/_systeme_commandes.scss */
/* line 276, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .epuise {
display: none;
text-transform: uppercase;
@@ -695,32 +696,32 @@ h2 {
font-size: 16px;
text-align: center;
}
/* line 284, ../sass/_systeme_commandes.scss */
/* line 285, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .quantite-restante {
font-size: 12px;
margin-top: 8px;
}
/* line 288, ../sass/_systeme_commandes.scss */
/* line 289, ../sass/_systeme_commandes.scss */
.commande-form #produits .table .quantite-restante .nb {
font-weight: bold;
}
/* line 293, ../sass/_systeme_commandes.scss */
/* line 294, ../sass/_systeme_commandes.scss */
.commande-form #produits .table td.produit, .commande-form #produits .table th.produit {
width: 70%;
}
/* line 297, ../sass/_systeme_commandes.scss */
/* line 298, ../sass/_systeme_commandes.scss */
.commande-form #produits .table td.prix-unit, .commande-form #produits .table th.prix-unit {
width: 10%;
}
/* line 301, ../sass/_systeme_commandes.scss */
/* line 302, ../sass/_systeme_commandes.scss */
.commande-form #produits .table td.colonne-quantite, .commande-form #produits .table th.colonne-quantite {
width: 10%;
}
/* line 305, ../sass/_systeme_commandes.scss */
/* line 306, ../sass/_systeme_commandes.scss */
.commande-form #produits .table td.total, .commande-form #produits .table th.total {
width: 10%;
}
/* line 311, ../sass/_systeme_commandes.scss */
/* line 312, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed {
position: fixed;
bottom: 0px;
@@ -737,7 +738,7 @@ h2 {
background-color: #F9F9F9;
text-align: center;
}
/* line 325, ../sass/_systeme_commandes.scss */
/* line 326, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed #total-commande-bottom {
background-color: white;
-moz-border-radius: 20px;
@@ -746,37 +747,37 @@ h2 {
padding: 5px 25px;
border: solid 1px #e0e0e0;
}
/* line 332, ../sass/_systeme_commandes.scss */
/* line 333, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed .valider-commande, .commande-form #bar-fixed .btn-commentaire {
float: right;
}
/* line 336, ../sass/_systeme_commandes.scss */
/* line 337, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed .btn-commentaire {
margin-right: 10px;
}
/* line 340, ../sass/_systeme_commandes.scss */
/* line 341, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed .btn-retour, .commande-form #bar-fixed .annuler-commande {
float: left;
margin-right: 5px;
}
/* line 345, ../sass/_systeme_commandes.scss */
/* line 346, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed .annuler-commande {
color: #b92c28;
background-color: white;
}
/* line 350, ../sass/_systeme_commandes.scss */
/* line 351, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed #total-commande-bottom {
display: none;
font-weight: bold;
font-family: "comfortaalight";
font-size: 24px;
}
/* line 357, ../sass/_systeme_commandes.scss */
/* line 358, ../sass/_systeme_commandes.scss */
.commande-form #bar-fixed .field-commande-commentaire {
display: none;
}

/* line 365, ../sass/_systeme_commandes.scss */
/* line 366, ../sass/_systeme_commandes.scss */
.ui-datepicker .ui-widget-header {
background: none;
background-color: gray;
@@ -784,7 +785,7 @@ h2 {
color: black;
font-weight: normal;
}
/* line 373, ../sass/_systeme_commandes.scss */
/* line 374, ../sass/_systeme_commandes.scss */
.ui-datepicker .ui-datepicker-current-day a,
.ui-datepicker a.ui-state-hover {
background: none;

+ 3
- 2
frontend/web/sass/_systeme_commandes.scss Bestand weergeven

@@ -157,12 +157,13 @@ h2 {
}
}
ul#points-vente {
.blocs {
list-style-type: none ;
margin: 0px ;
padding: 0px ;
.point-vente {
.bloc {
text-decoration: none ;
width: 268px ;
height: 130px ;
float: left ;

Laden…
Annuleren
Opslaan