Переглянути джерело

Activer/désactiver un point de vente

Possibilité d'activer/désactiver un point de vente pour chaque jour de la semaine au niveau du point de vente (valeur par défaut).
Possibilité d'activer/désactiver un point de vente au niveau de chaque production.
Répercution au niveau de l'affichage et de la validation du point de vente sur le frontend.
master
keun 7 роки тому
джерело
коміт
a2f7ceba78
13 змінених файлів з 633 додано та 149 видалено
  1. +73
    -7
      backend/controllers/CommandeController.php
  2. +23
    -7
      backend/views/commande/index.php
  3. +11
    -1
      backend/views/point-vente/_form.php
  4. +18
    -0
      backend/views/point-vente/index.php
  5. BIN
      backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc
  6. +146
    -117
      backend/web/css/screen.css
  7. +86
    -0
      backend/web/js/lechatdesnoisettes.js
  8. +27
    -0
      backend/web/sass/screen.scss
  9. +20
    -2
      common/models/PointVente.php
  10. +122
    -0
      common/models/ProductionPointVente.php
  11. +39
    -0
      console/migrations/m161222_100015_champs_point_vente_jours_livraison.php
  12. +52
    -9
      frontend/controllers/CommandeController.php
  13. +16
    -6
      frontend/web/js/lechatdesnoisettes.js

+ 73
- 7
backend/controllers/CommandeController.php Переглянути файл

@@ -21,6 +21,7 @@ use common\models\CommandeAuto ;
use common\models\CreditHistorique;
use common\models\UserEtablissement;
use yii\helpers\Html ;
use common\models\ProductionPointVente ;

class CommandeController extends BackendController {

@@ -239,11 +240,6 @@ class CommandeController extends BackendController {

$commandes = [];

// points de vente
$points_vente = PointVente::find()
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])
->all();

// users
$arr_users = [0 => '--'];
$users = User::find()->orderBy('prenom, nom ASC')->all();
@@ -266,6 +262,24 @@ class CommandeController extends BackendController {
$production->save();
}
}
// points de vente
if($production)
{
$points_vente = PointVente::find()
->joinWith(['productionPointVente'=> function($q) use ($production) {
$q->where(['id_production' => $production->id]) ;
} ])
->where([
'id_etablissement' => Yii::$app->user->identity->id_etablissement,
])
->all();
}
else {
$points_vente = PointVente::find()
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement,])
->all();
}

// produits
$produits = Produit::getAll() ;
@@ -338,6 +352,7 @@ class CommandeController extends BackendController {
}
$pv->data_select_commandes = $data_select_commandes ;
$pv->data_options_commandes = $data_options_commandes ;
}

// gestion produits selec
@@ -467,6 +482,28 @@ class CommandeController extends BackendController {
// commandes auto
$model_commande_auto = new CommandeAutoForm ;
// productions point vente
$production_point_vente = new ProductionPointVente ;
$productions_point_vente = [] ;
if($production)
{
$productions_point_vente = ProductionPointVente::find()
->with('pointVente')
->where(['id_production' => $production->id])
->all() ;
}
$arr_productions_point_vente = [] ;

foreach($productions_point_vente as $ppv)
{
$key = $ppv->id_production.'-'.$ppv->id_point_vente ;
if($ppv->livraison == 1)
$production_point_vente->productions_point_vente[] = $key ;
$arr_productions_point_vente[$key] = Html::encode($ppv->pointVente->nom) ;
}
$datas = [
'produits' => $produits,
'points_vente' => $points_vente,
@@ -485,6 +522,9 @@ class CommandeController extends BackendController {
'ca_potentiel' => $ca_potentiel,
'poids_total' => $poids_total,
'model_commande_auto' => $model_commande_auto,
'production_point_vente' => $production_point_vente,
'productions_point_vente' => $productions_point_vente,
'arr_productions_point_vente' => $arr_productions_point_vente
];

if ($return_data) {
@@ -772,16 +812,22 @@ class CommandeController extends BackendController {

public function actionChangeState($date, $actif)
{

// changement état
$production = Production::find()->where(['date' => $date, 'id_etablissement' => Yii::$app->user->identity->id_etablissement])->one();
$production->actif = $actif;
$production->save();
// add commandes automatiques
if($actif)
{
// add commandes automatiques
CommandeAuto::addAll($date) ;
// livraisons
ProductionPointVente::setAll($production->id, true) ;
}
else {
ProductionPointVente::setAll($production->id, false) ;
}
$this->redirect(['index', 'date' => $date]);
@@ -1097,6 +1143,26 @@ class CommandeController extends BackendController {
}
public function actionAjaxPointVenteLivraison($id_production, $id_point_vente, $bool_livraison)
{
$production_point_vente = ProductionPointVente::find()
->where([
'id_production' => $id_production,
'id_point_vente' => $id_point_vente,
])
->one() ;
if($production_point_vente)
{
$production_point_vente->livraison = $bool_livraison ;
$production_point_vente->save() ;
}
die() ;
}
public function actionStatutPaiement($id_commande)
{
$commande = Commande::find()

+ 23
- 7
backend/views/commande/index.php Переглянути файл

@@ -39,6 +39,7 @@ foreach ($produits as $p) {
<?php if ($date != ''): ?>
<div id="bloc-production">
<input type="hidden" id="date-production" value="<?= $date ?>" />
<input type="hidden" id="id-production" value="<?= $production->id ?>" />
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Production du <strong><?php echo date('d/m/Y', strtotime($date)); ?></strong></h3>
@@ -53,11 +54,23 @@ foreach ($produits as $p) {
<br />

<?php if ($production->actif): ?>
<strong>Livraison</strong><br />
<div class="btn-group" role="group">
<a class="btn btn-default<?php if ($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 1]); ?>">Activé</a>
<a class="btn btn-default<?php if (!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 0]); ?>">Désactivé</a>
</div>
<strong>Livraison</strong><br />
<div class="btn-group" role="group">
<a class="btn btn-default<?php if ($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 1]); ?>">Activé</a>
<a class="btn btn-default<?php if (!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 0]); ?>">Désactivé</a>
</div>
<?php if($production->livraison && count($arr_productions_point_vente)): ?>
<div id="productions-point-vente">
<strong>Points de vente : </strong>
<div class="checkbox-list">
<?= Html::activeCheckboxList(
$production_point_vente,
'productions_point_vente',
$arr_productions_point_vente ,
['encode' => false, 'class' => '']) ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
@@ -131,7 +144,7 @@ foreach ($produits as $p) {
$champs_horaires_point_vente = 'horaires_' . $arr_jour_semaine[$num_jour_semaine];
?>
<div class="panel panel-default">
<div class="panel panel-default" id="panel-commandes">
<div class="panel-heading">
<h3 class="panel-title">
Commandes
@@ -146,8 +159,11 @@ foreach ($produits as $p) {
<div class="panel-body">
<div class="col-md-12">
<div class="alert alert-danger" style="display:none;">Aucun point de vente activé</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<ul id="tabs-points-vente" class="nav nav-tabs" role="tablist">
<?php foreach($points_vente as $pv): ?>
<li role="presentation" class="<?php if($pv->point_fabrication): ?>active<?php endif; ?>">
<a href="#point-vente-<?= $pv->id ?>" id="btn-point-vente-<?= $pv->id ?>" aria-controls="point-vente-<?= $pv->id ?>" role="tab" data-toggle="tab"><?= Html::encode($pv->nom) ?> <span class="badge badge-<?php if(count($pv->commandes)): ?>success<?php else: ?>danger<?php endif; ?>"><?php echo count($pv->commandes); ?></span></a>

+ 11
- 1
backend/views/point-vente/_form.php Переглянути файл

@@ -27,9 +27,19 @@ use yii\helpers\ArrayHelper ;
->checkbox()
->hint('Cochez cette case si le client peut régler ses commandes via son compte Crédit Pain pour ce point de vente.') ?>

<div id="jours-livraison">
<h2>Jours de livraison</h2>
<?= $form->field($model, 'livraison_lundi')->checkbox() ?>
<?= $form->field($model, 'livraison_mardi')->checkbox() ?>
<?= $form->field($model, 'livraison_mercredi')->checkbox() ?>
<?= $form->field($model, 'livraison_jeudi')->checkbox() ?>
<?= $form->field($model, 'livraison_vendredi')->checkbox() ?>
<?= $form->field($model, 'livraison_samedi')->checkbox() ?>
<?= $form->field($model, 'livraison_dimanche')->checkbox() ?>
</div>
<div class="clr"></div>
<h2>Horaires</h2>
<div class="alert alert-info">Laisser vide si le point de vente est fermé</div>
<?= $form->field($model, 'horaires_lundi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_mardi')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'horaires_mercredi')->textarea(['rows' => 3]) ?>

+ 18
- 0
backend/views/point-vente/index.php Переглянути файл

@@ -33,6 +33,24 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'label' => 'Livraison',
'value' => function($model) {
$html = '' ;
if($model->livraison_lundi) $html .= 'lundi, ' ;
if($model->livraison_mardi) $html .= 'mardi, ' ;
if($model->livraison_mercredi) $html .= 'mercredi, ' ;
if($model->livraison_jeudi) $html .= 'jeudi, ' ;
if($model->livraison_vendredi) $html .= 'vendredi, ' ;
if($model->livraison_samedi) $html .= 'samedi, ' ;
if($model->livraison_dimanche) $html .= 'dimanche, ' ;
if(strlen($html))
return substr ($html, 0, strlen($html)-2) ;
else
return '' ;
}
],
[
'attribute' => 'acces_restreint',
'format' => 'raw',

BIN
backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc Переглянути файл


+ 146
- 117
backend/web/css/screen.css Переглянути файл

@@ -350,66 +350,86 @@ a:hover, a:focus, a:active {
background-color: #5cb85c;
border-color: #4cae4c;
}
/* line 315, ../sass/screen.scss */
/* line 307, ../sass/screen.scss */
#page-commande #bloc-production #productions-point-vente {
margin-top: 15px;
padding: 10px;
border: solid 1px #e0e0e0;
background-color: #F5F5F5;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
/* line 313, ../sass/screen.scss */
#page-commande #bloc-production #productions-point-vente label {
display: block;
font-weight: normal;
}
/* line 318, ../sass/screen.scss */
#page-commande #bloc-production #productions-point-vente .checkbox-list {
margin-left: 10px;
margin-top: 10px;
}
/* line 331, ../sass/screen.scss */
#page-commande #produits-production .overflow table {
width: 100%;
}
/* line 319, ../sass/screen.scss */
/* line 335, ../sass/screen.scss */
#page-commande #produits-production .overflow thead, #page-commande #produits-production .overflow tbody, #page-commande #produits-production .overflow tr, #page-commande #produits-production .overflow td, #page-commande #produits-production .overflow th {
display: block;
}
/* line 321, ../sass/screen.scss */
/* line 337, ../sass/screen.scss */
#page-commande #produits-production .overflow tr:after {
content: ' ';
display: block;
visibility: hidden;
clear: both;
}
/* line 328, ../sass/screen.scss */
/* line 344, ../sass/screen.scss */
#page-commande #produits-production .overflow thead th {
height: 30px;
/*text-align: left;*/
}
/* line 334, ../sass/screen.scss */
/* line 350, ../sass/screen.scss */
#page-commande #produits-production .overflow tbody {
height: 500px;
overflow-y: auto;
}
/* line 342, ../sass/screen.scss */
/* line 358, ../sass/screen.scss */
#page-commande #produits-production .overflow thead th {
width: 32%;
float: left;
}
/* line 347, ../sass/screen.scss */
/* line 363, ../sass/screen.scss */
#page-commande #produits-production .overflow tbody td {
width: 33%;
float: left;
}
/* line 352, ../sass/screen.scss */
/* line 368, ../sass/screen.scss */
#page-commande #produits-production .overflow .td-produit {
width: 60%;
}
/* line 355, ../sass/screen.scss */
/* line 371, ../sass/screen.scss */
#page-commande #produits-production .overflow .td-actif, #page-commande #produits-production .overflow .td-max {
width: 20%;
text-align: center;
}
/* line 361, ../sass/screen.scss */
/* line 377, ../sass/screen.scss */
#page-commande #produits-production .overflow thead .td-produit {
width: 57%;
}
/* line 367, ../sass/screen.scss */
/* line 383, ../sass/screen.scss */
#page-commande #produits-production input.quantite-max {
background-color: white;
border: 1px solid #e0e0e0;
text-align: center;
width: 50px;
}
/* line 375, ../sass/screen.scss */
/* line 391, ../sass/screen.scss */
#page-commande #produits-production td label {
font-weight: normal;
}
/* line 381, ../sass/screen.scss */
/* line 397, ../sass/screen.scss */
#page-commande #btn-export-commandes,
#page-commande #btn-commande-auto {
float: right;
@@ -418,30 +438,30 @@ a:hover, a:focus, a:active {
right: -7px;
padding: 2px 5px;
}
/* line 390, ../sass/screen.scss */
/* line 406, ../sass/screen.scss */
#page-commande #btn-export-commandes {
color: white;
margin-left: 10px;
padding: 1px 5px;
}
/* line 398, ../sass/screen.scss */
/* line 414, ../sass/screen.scss */
#page-commande #bloc-totaux .table-produits .depasse {
color: #b32815;
}
/* line 402, ../sass/screen.scss */
/* line 418, ../sass/screen.scss */
#page-commande #bloc-totaux .table-produits .total strong span {
font-weight: normal;
font-size: 13px;
}
/* line 411, ../sass/screen.scss */
/* line 427, ../sass/screen.scss */
#page-commande #commandes-points-vente .tab-pane {
padding-top: 20px;
}
/* line 418, ../sass/screen.scss */
/* line 434, ../sass/screen.scss */
#page-commande #commandes-points-vente .recap-pv.no-commande .recettes {
display: none;
}
/* line 422, ../sass/screen.scss */
/* line 438, ../sass/screen.scss */
#page-commande #commandes-points-vente .recap-pv .recettes {
float: right;
color: #BB8757;
@@ -454,11 +474,11 @@ a:hover, a:focus, a:active {
position: relative;
top: -3px;
}
/* line 436, ../sass/screen.scss */
/* line 452, ../sass/screen.scss */
#page-commande #commandes-points-vente .alert.commentaire {
display: none;
}
/* line 440, ../sass/screen.scss */
/* line 456, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes {
margin-top: 10px;
list-style-type: none;
@@ -470,16 +490,16 @@ a:hover, a:focus, a:active {
width: 100%;
overflow-y: scroll;
}
/* line 452, ../sass/screen.scss */
/* line 468, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes.no-commande {
display: none;
}
/* line 456, ../sass/screen.scss */
/* line 472, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li {
padding: 0;
margin: 0;
}
/* line 459, ../sass/screen.scss */
/* line 475, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a {
text-align: left;
-moz-border-radius: 0px;
@@ -489,22 +509,22 @@ a:hover, a:focus, a:active {
padding: 7px;
color: #333;
}
/* line 467, ../sass/screen.scss */
/* line 483, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a .montant {
float: right;
color: #BB8757;
font-weight: bold;
}
/* line 472, ../sass/screen.scss */
/* line 488, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a .montant.paye {
color: #5cb85c;
color: #519951;
}
/* line 478, ../sass/screen.scss */
/* line 494, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a .glyphicon-comment {
color: #BB8757;
}
/* line 482, ../sass/screen.scss */
/* line 498, ../sass/screen.scss */
#page-commande #commandes-points-vente ul.liste-commandes li a:hover, #page-commande #commandes-points-vente ul.liste-commandes li a:active, #page-commande #commandes-points-vente ul.liste-commandes li a.active {
text-decoration: none;
background-color: #FCF8E3;
@@ -515,82 +535,82 @@ a:hover, a:focus, a:active {
-webkit-transition: all 0.1s;
transition: all 0.1s;
}
/* line 496, ../sass/screen.scss */
/* line 512, ../sass/screen.scss */
#page-commande #commandes-points-vente .creer-commande,
#page-commande #commandes-points-vente .commandes-auto {
width: 100%;
margin-bottom: 10px;
}
/* line 502, ../sass/screen.scss */
/* line 518, ../sass/screen.scss */
#page-commande #commandes-points-vente .bloc-commande {
padding-top: 20px;
margin-top: 20px;
display: none;
}
/* line 508, ../sass/screen.scss */
/* line 524, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user {
display: none;
font-size: 19px;
margin-top: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/* line 514, ../sass/screen.scss */
/* line 530, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .btn-edit, #page-commande #commandes-points-vente .title-user .btn-remove,
#page-commande #commandes-points-vente .title-user .btn-cancel, #page-commande #commandes-points-vente .title-user .btn-save {
float: right;
position: relative;
top: -6px;
}
/* line 521, ../sass/screen.scss */
/* line 537, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .btn-edit, #page-commande #commandes-points-vente .title-user .btn-cancel {
margin-right: 10px;
}
/* line 525, ../sass/screen.scss */
/* line 541, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .buttons-save-cancel {
display: none;
}
/* line 529, ../sass/screen.scss */
/* line 545, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .choix-user {
display: none;
}
/* line 532, ../sass/screen.scss */
/* line 548, ../sass/screen.scss */
#page-commande #commandes-points-vente .title-user .choix-user .form-control {
width: 200px;
display: inline;
}
/* line 540, ../sass/screen.scss */
/* line 556, ../sass/screen.scss */
#page-commande #commandes-points-vente table.table-produits .td-commande {
text-align: center;
}
/* line 543, ../sass/screen.scss */
/* line 559, ../sass/screen.scss */
#page-commande #commandes-points-vente table.table-produits input.form-control {
text-align: center;
}
/* line 549, ../sass/screen.scss */
/* line 565, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-produit,
#page-commande #commandes-points-vente .th-produit {
width: 70%;
}
/* line 554, ../sass/screen.scss */
/* line 570, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-commande,
#page-commande #commandes-points-vente .th-commande {
width: 30%;
text-align: center;
}
/* line 560, ../sass/screen.scss */
/* line 576, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-produit {
text-transform: uppercase;
}
/* line 564, ../sass/screen.scss */
/* line 580, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-commande {
font-weight: bold;
}
/* line 568, ../sass/screen.scss */
/* line 584, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-total {
font-size: 18px;
text-align: center;
}
/* line 572, ../sass/screen.scss */
/* line 588, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-total span {
padding: 2px 10px;
background-color: #BB8757;
@@ -600,33 +620,33 @@ a:hover, a:focus, a:active {
-webkit-border-radius: 8px;
border-radius: 8px;
}
/* line 582, ../sass/screen.scss */
/* line 598, ../sass/screen.scss */
#page-commande #commandes-points-vente .td-paiement .buttons-credit {
float: right;
}
/* line 588, ../sass/screen.scss */
/* line 604, ../sass/screen.scss */
#page-commande #commandes-points-vente .panel-commande-automatique .field-commandeautoform-id_user,
#page-commande #commandes-points-vente .panel-commande-automatique .field-commandeautoform-id_etablissement {
display: none;
}
/* line 595, ../sass/screen.scss */
/* line 611, ../sass/screen.scss */
#page-commande #commandes-points-vente .panel-commande-automatique .jours .form-group {
float: left;
margin-right: 10px;
}
/* line 604, ../sass/screen.scss */
/* line 620, ../sass/screen.scss */
#page-commande #old-commandes {
display: none;
}
/* line 608, ../sass/screen.scss */
/* line 624, ../sass/screen.scss */
#page-commande .form-commandes-point-vente {
margin-top: 20px;
}
/* line 612, ../sass/screen.scss */
/* line 628, ../sass/screen.scss */
#page-commande .form-commandes-point-vente table {
border-bottom: solid 1px #e0e0e0;
}
/* line 616, ../sass/screen.scss */
/* line 632, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .title-point-vente {
background-color: #fff8e2;
border-left: solid 3px #BB8757;
@@ -634,76 +654,76 @@ a:hover, a:focus, a:active {
text-align: left;
padding: 10px;
}
/* line 624, ../sass/screen.scss */
/* line 640, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .title-totaux {
text-align: center;
}
/* line 628, ../sass/screen.scss */
/* line 644, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .border-left {
border-left: solid 1px #e0e0e0;
}
/* line 632, ../sass/screen.scss */
/* line 648, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .border-right {
border-right: solid 1px #e0e0e0;
}
/* line 636, ../sass/screen.scss */
/* line 652, ../sass/screen.scss */
#page-commande .form-commandes-point-vente input.quantite {
width: 30px;
background-color: white;
border: solid 1px #e0e0e0;
text-align: center;
}
/* line 644, ../sass/screen.scss */
/* line 660, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .td-produit {
text-align: center;
}
/* line 648, ../sass/screen.scss */
/* line 664, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .submit-pv {
float: right;
}
/* line 652, ../sass/screen.scss */
/* line 668, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .select-user {
background-color: #F9F9F9;
border: solid 1px #e0e0e0;
}
/* line 657, ../sass/screen.scss */
/* line 673, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .date-commande {
font-size: 12px;
}
/* line 661, ../sass/screen.scss */
/* line 677, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .datepicker, #page-commande .form-commandes-point-vente .text {
background-color: white;
border: solid 1px #e0e0e0;
margin-top: 3px;
width: 100px;
}
/* line 669, ../sass/screen.scss */
/* line 685, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.center {
text-align: center;
}
/* line 675, ../sass/screen.scss */
/* line 691, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .depasse {
color: #b32815;
}
/* line 679, ../sass/screen.scss */
/* line 695, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .total strong span {
font-weight: normal;
font-size: 13px;
}
/* line 684, ../sass/screen.scss */
/* line 700, ../sass/screen.scss */
#page-commande .form-commandes-point-vente .vrac {
display: none;
}
/* line 688, ../sass/screen.scss */
/* line 704, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.client {
text-align: left;
padding: 3px;
}
/* line 691, ../sass/screen.scss */
/* line 707, ../sass/screen.scss */
#page-commande .form-commandes-point-vente td.client .date-commande {
color: gray;
}
/* line 698, ../sass/screen.scss */
/* line 714, ../sass/screen.scss */
#page-commande .table-header-rotated {
border-top: 0px;
border-left: 0px;
@@ -711,15 +731,15 @@ a:hover, a:focus, a:active {
width: 100%;
width: auto;
}
/* line 705, ../sass/screen.scss */
/* line 721, ../sass/screen.scss */
#page-commande .table-header-rotated .total strong {
border-bottom: solid 1px gray;
}
/* line 710, ../sass/screen.scss */
/* line 726, ../sass/screen.scss */
#page-commande .table-header-rotated th.row-header {
width: auto;
}
/* line 714, ../sass/screen.scss */
/* line 730, ../sass/screen.scss */
#page-commande .table-header-rotated td {
width: 40px;
border-top: 1px solid #dddddd;
@@ -728,7 +748,7 @@ a:hover, a:focus, a:active {
vertical-align: middle;
text-align: center;
}
/* line 723, ../sass/screen.scss */
/* line 739, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 {
font-weight: normal;
height: 80px;
@@ -742,7 +762,7 @@ a:hover, a:focus, a:active {
line-height: 1;
border: 0px none;
}
/* line 737, ../sass/screen.scss */
/* line 753, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 > div {
background-color: #F5F5F5;
position: relative;
@@ -760,7 +780,7 @@ a:hover, a:focus, a:active {
border-right: 1px solid #dddddd;
border-top: 1px solid #dddddd;
}
/* line 754, ../sass/screen.scss */
/* line 770, ../sass/screen.scss */
#page-commande .table-header-rotated th.rotate-45 span {
-ms-transform: skew(45deg, 0deg) rotate(315deg);
-moz-transform: skew(45deg, 0deg) rotate(315deg);
@@ -778,51 +798,51 @@ a:hover, a:focus, a:active {
text-align: left;
}

/* line 775, ../sass/screen.scss */
/* line 791, ../sass/screen.scss */
#email-masse-form #ids-users {
line-height: 30px;
}
/* line 777, ../sass/screen.scss */
/* line 793, ../sass/screen.scss */
#email-masse-form #ids-users .label {
text-transform: capitalize;
}

/* line 785, ../sass/screen.scss */
/* line 801, ../sass/screen.scss */
.produit-create #jours-production .form-group, .produit-update #jours-production .form-group {
float: left;
margin-right: 15px;
}
/* line 789, ../sass/screen.scss */
/* line 805, ../sass/screen.scss */
.produit-create #jours-production .form-group label, .produit-update #jours-production .form-group label {
font-weight: normal;
}
/* line 794, ../sass/screen.scss */
/* line 810, ../sass/screen.scss */
.produit-create .field-produit-id_etablissement, .produit-update .field-produit-id_etablissement {
display: none;
}

/* line 799, ../sass/screen.scss */
/* line 815, ../sass/screen.scss */
.table-striped > tbody > tr:nth-of-type(2n) {
background-color: white;
}

/* line 804, ../sass/screen.scss */
/* line 820, ../sass/screen.scss */
.wrap .produit-index .td-photo {
max-width: 100px;
width: 100px;
}
/* line 808, ../sass/screen.scss */
/* line 824, ../sass/screen.scss */
.wrap .produit-index .photo-produit {
max-width: 100px;
}
/* line 812, ../sass/screen.scss */
/* line 828, ../sass/screen.scss */
.wrap .produit-index .ui-state-highlight {
height: 75px;
background-color: #F8F1DD;
}

/* communiquer */
/* line 820, ../sass/screen.scss */
/* line 836, ../sass/screen.scss */
.communiquer-mode-emploi {
border: solid 1px #e0e0e0;
padding: 10px;
@@ -832,18 +852,18 @@ a:hover, a:focus, a:active {
margin-bottom: 30px;
font-family: "myriadpro-regular";
}
/* line 828, ../sass/screen.scss */
/* line 844, ../sass/screen.scss */
.communiquer-mode-emploi .header .logo {
float: left;
width: 75px;
padding-right: 20px;
padding-top: 10px;
}
/* line 834, ../sass/screen.scss */
/* line 850, ../sass/screen.scss */
.communiquer-mode-emploi .header .logo img {
width: 75px;
}
/* line 840, ../sass/screen.scss */
/* line 856, ../sass/screen.scss */
.communiquer-mode-emploi .header h1 {
font-family: "comfortaaregular";
font-size: 40px;
@@ -851,7 +871,7 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
font-weight: normal;
}
/* line 848, ../sass/screen.scss */
/* line 864, ../sass/screen.scss */
.communiquer-mode-emploi .header h2 {
margin-top: 0px;
font-family: "myriadpro-regular";
@@ -861,7 +881,7 @@ a:hover, a:focus, a:active {
left: 2px;
font-weight: normal;
}
/* line 859, ../sass/screen.scss */
/* line 875, ../sass/screen.scss */
.communiquer-mode-emploi h3 {
font-family: "comfortaalight";
font-family: "myriadpro-regular";
@@ -871,45 +891,45 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
}

/* line 869, ../sass/screen.scss */
/* line 885, ../sass/screen.scss */
.communiquer-mode-emploi-encart {
width: 420px;
margin-top: 20px;
}
/* line 873, ../sass/screen.scss */
/* line 889, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header .logo {
width: 60px;
margin-right: 20px;
padding-top: 5px;
}
/* line 878, ../sass/screen.scss */
/* line 894, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header .logo img {
width: 60px;
}
/* line 884, ../sass/screen.scss */
/* line 900, ../sass/screen.scss */
.communiquer-mode-emploi-encart .header h1 {
margin-bottom: 3px;
}
/* line 893, ../sass/screen.scss */
/* line 909, ../sass/screen.scss */
.communiquer-mode-emploi-encart h3 {
margin-top: 15px;
margin-bottom: 15px;
}

/* line 899, ../sass/screen.scss */
/* line 915, ../sass/screen.scss */
.bloc-mode-emploi-pdf {
width: 49.9%;
float: left;
border-bottom: dotted 1px gray;
}

/* line 905, ../sass/screen.scss */
/* line 921, ../sass/screen.scss */
.bloc-mode-emploi-border {
border-right: dotted 1px gray;
border-bottom: dotted 1px gray;
}

/* line 910, ../sass/screen.scss */
/* line 926, ../sass/screen.scss */
.communiquer-mode-emploi-pdf {
border: 0px none;
-moz-border-radius: 0px;
@@ -918,111 +938,120 @@ a:hover, a:focus, a:active {
margin-bottom: 0px;
padding: 20px 0px 20px 30px;
}
/* line 918, ../sass/screen.scss */
/* line 934, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header .logo {
float: left;
width: 55px;
padding-right: 15px;
padding-top: 10px;
}
/* line 924, ../sass/screen.scss */
/* line 940, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header .logo img {
width: 55px;
}
/* line 928, ../sass/screen.scss */
/* line 944, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header h1 {
font-size: 32px;
}
/* line 931, ../sass/screen.scss */
/* line 947, ../sass/screen.scss */
.communiquer-mode-emploi-pdf .header h2 {
font-size: 16px;
}
/* line 936, ../sass/screen.scss */
/* line 952, ../sass/screen.scss */
.communiquer-mode-emploi-pdf h3 {
font-weight: normal;
}

/* line 941, ../sass/screen.scss */
/* line 957, ../sass/screen.scss */
.bloc-mode-emploi-bottom {
border-bottom: 0px none;
border-bottom: solid 1px white;
}

/* commandes auto */
/* line 951, ../sass/screen.scss */
/* line 967, ../sass/screen.scss */
.commandeauto-form #bloc-select-user {
padding-left: 0px;
}
/* line 955, ../sass/screen.scss */
/* line 971, ../sass/screen.scss */
.commandeauto-form #or-user {
font-size: 20px;
text-align: center;
}
/* line 958, ../sass/screen.scss */
/* line 974, ../sass/screen.scss */
.commandeauto-form #or-user span {
position: relative;
top: 24px;
}
/* line 964, ../sass/screen.scss */
/* line 980, ../sass/screen.scss */
.commandeauto-form .field-commandeautoform-id_etablissement {
display: none;
}
/* line 968, ../sass/screen.scss */
/* line 984, ../sass/screen.scss */
.commandeauto-form .jours .form-group {
float: left;
margin-right: 20px;
}
/* line 975, ../sass/screen.scss */
/* line 991, ../sass/screen.scss */
.commandeauto-form .produits .table {
width: 500px;
}
/* line 978, ../sass/screen.scss */
/* line 994, ../sass/screen.scss */
.commandeauto-form .produits .quantite {
text-align: center;
}

/* points de vente */
/* line 987, ../sass/screen.scss */
/* line 1003, ../sass/screen.scss */
.point-vente-form #pointvente-users {
display: none;
height: 500px;
overflow-y: scroll;
}
/* line 991, ../sass/screen.scss */
/* line 1007, ../sass/screen.scss */
.point-vente-form #pointvente-users label {
font-weight: normal;
display: block;
}
/* line 995, ../sass/screen.scss */
/* line 1011, ../sass/screen.scss */
.point-vente-form #pointvente-users .commentaire {
display: none;
margin-left: 17px;
width: 200px;
}
/* line 1019, ../sass/screen.scss */
.point-vente-form #jours-livraison .form-group {
float: left;
margin-right: 15px;
}
/* line 1023, ../sass/screen.scss */
.point-vente-form #jours-livraison .form-group label {
font-weight: normal;
}

/* utilisateurs */
/* line 1006, ../sass/screen.scss */
/* line 1033, ../sass/screen.scss */
.user-index .input-group {
width: 180px;
}
/* line 1009, ../sass/screen.scss */
/* line 1036, ../sass/screen.scss */
.user-index .input-group .input-credit {
text-align: center;
}

/* facturation */
/* line 1017, ../sass/screen.scss */
/* line 1044, ../sass/screen.scss */
#estimation-facture {
text-align: center;
margin-bottom: 30px;
padding-bottom: 20px;
background-color: #F9F9F9;
}
/* line 1023, ../sass/screen.scss */
/* line 1050, ../sass/screen.scss */
#estimation-facture h2 {
font-family: "myriadpro-it";
}
/* line 1027, ../sass/screen.scss */
/* line 1054, ../sass/screen.scss */
#estimation-facture .montant span {
font-size: 25px;
color: white;

+ 86
- 0
backend/web/js/lechatdesnoisettes.js Переглянути файл

@@ -7,10 +7,13 @@ $(document).ready(function() {
chat_ordre_produits() ;
chat_index_commandes_liste_produits() ;
chat_index_commandes_points_vente() ;
chat_index_commandes_points_vente_livraison() ;
chat_btn_plus_moins() ;
chat_commandeauto() ;
chat_points_vente_acces() ;
chat_tooltip() ;
chat_points_vente_jours_livraison() ;
chat_index_commandes_maj_points_vente() ;
// admin
chat_select_etablissement() ;
}) ;
@@ -24,6 +27,89 @@ function chat_nl2br(str, is_xhtml) {
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}

function chat_index_commandes_points_vente_livraison() {
$('#productionpointvente-productions_point_vente input[type=checkbox]').change(function() {
var nb = $('#productionpointvente-productions_point_vente input[type=checkbox]:checked').size() ;
if(nb == 0) {
$(this).prop('checked',true) ;
chat_alert('danger','Vous devez avoir au moins un point de vente activé') ;
}
else {
var val = $(this).val() ;
var arr_val = val.split('-') ;

var livraison = 0 ;
if($(this).prop('checked'))
livraison = 1 ;

$.get('index.php',{
r: 'commande/ajax-point-vente-livraison',
id_production: arr_val[0],
id_point_vente: arr_val[1],
bool_livraison: livraison
}, function(data) {
chat_alert('success','Point de vente modifié') ;
}) ;

chat_index_commandes_maj_points_vente() ;
}
}) ;
}


function chat_index_commandes_maj_points_vente() {
var nb = $('#productionpointvente-productions_point_vente input[type=checkbox]:checked').size() ;
if(nb == 0)
{
$('#panel-commandes #tabs-points-vente, #panel-commandes #commandes-points-vente').hide() ;
$('#panel-commandes .alert-danger').show();
}
else {
$('#panel-commandes #tabs-points-vente, #panel-commandes #commandes-points-vente').show() ;
$('#panel-commandes .alert-danger').hide();
}
var id_production = $('#id-production').val() ;
if(id_production) {
$('#tabs-points-vente li').each(function() {
var id_point_vente = $(this).find('a').attr('id').replace('btn-point-vente-','') ;
var nb_commandes = parseInt($(this).find('.badge-success').html()) ;
var checked = $('#productionpointvente-productions_point_vente input[value='+id_production+'-'+id_point_vente+']').prop('checked') ;
if(checked || nb_commandes > 0)
{
$(this).show() ;
}
else {
$(this).hide() ;
}
}) ;
$('#tabs-points-vente li:visible:first a').click() ;
}
}

function chat_points_vente_jours_livraison() {
$('#pointvente-point_fabrication').change(function() {
chat_points_vente_jours_livraison_event() ;
}) ;
chat_points_vente_jours_livraison_event();
}

function chat_points_vente_jours_livraison_event() {
if($('#pointvente-point_fabrication').prop('checked')) {
$('#jours-livraison').hide() ;
}
else {
$('#jours-livraison').fadeIn() ;
}
}

function chat_points_vente_acces() {
// affichage du bloc acces restreint
$('#pointvente-acces_restreint').change(function() {

+ 27
- 0
backend/web/sass/screen.scss Переглянути файл

@@ -304,6 +304,22 @@ a {
border-color: #4cae4c ;
}
#productions-point-vente {
margin-top: 15px ;
padding: 10px ;
border: solid 1px #e0e0e0 ;
background-color: #F5F5F5 ;
@include border-radius(5px) ;
label {
display: block ;
font-weight: normal ;
}
.checkbox-list {
margin-left: 10px ;
margin-top: 10px ;
}
}
}
#produits-production {
@@ -998,6 +1014,17 @@ a {
width: 200px ;
}
}
#jours-livraison {
.form-group {
float: left ;
margin-right: 15px ;
label {
font-weight: normal ;
}
}
}
}

/* utilisateurs */

+ 20
- 2
common/models/PointVente.php Переглянути файл

@@ -5,6 +5,7 @@ namespace common\models;
use Yii;
use yii\helpers\Html ;
use common\models\PointVenteUser ;
use common\models\ProductionPointVente ;

/**
* This is the model class for table "point_vente".
@@ -44,7 +45,7 @@ class PointVente extends \yii\db\ActiveRecord
[['acces_restreint'], 'boolean'],
[['nom'], 'string', 'max' => 255],
[['adresse','localite','horaires_lundi','horaires_mardi','horaires_mercredi','horaires_jeudi','horaires_vendredi','horaires_samedi','horaires_dimanche'], 'string'],
[['point_fabrication','vrac','pain', 'credit_pain'], 'boolean'],
[['point_fabrication','vrac','pain', 'credit_pain','livraison_lundi','livraison_mardi','livraison_mercredi','livraison_jeudi','livraison_vendredi','livraison_samedi','livraison_dimanche'], 'boolean'],
['point_fabrication', 'default','value'=>0],
['id_etablissement','integer'],
['id_etablissement','required'],
@@ -73,7 +74,14 @@ class PointVente extends \yii\db\ActiveRecord
'vrac' => 'Livraison de vrac',
'pain' => 'Livraison de pain',
'acces_restreint' => 'Accès restreint',
'credit_pain' => 'Activer le Crédit Pain'
'credit_pain' => 'Activer le Crédit Pain',
'livraison_lundi' => 'Lundi',
'livraison_mardi' => 'Mardi',
'livraison_mercredi' => 'Mercredi',
'livraison_jeudi' => 'Jeudi',
'livraison_vendredi' => 'Vendredi',
'livraison_samedi' => 'Samedi',
'livraison_dimanche' => 'Dimanche',
];
}
@@ -82,6 +90,11 @@ class PointVente extends \yii\db\ActiveRecord
return $this->hasMany(PointVenteUser::className(), ['id_point_vente'=>'id']) ;
}
public function getProductionPointVente()
{
return $this->hasMany(ProductionPointVente::className(), ['id_point_vente' => 'id']) ;
}
public function initCommandes($commandes) {
$this->commandes = [] ;
@@ -100,6 +113,11 @@ class PointVente extends \yii\db\ActiveRecord
}
}
public function getCommandes()
{
return $this->commandes ;
}
public function strListeVrac() {
$str = '' ;

+ 122
- 0
common/models/ProductionPointVente.php Переглянути файл

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

namespace common\models;

use Yii;
use common\models\PointVente ;
use common\models\Production ;

/**
* This is the model class for table "production_point_vente".
*
* @property integer $id_production
* @property integer $id_point_vente
* @property integer $livraison
*/
class ProductionPointVente extends \yii\db\ActiveRecord
{
var $productions_point_vente ;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'production_point_vente';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_production', 'id_point_vente'], 'required'],
[['id_production', 'id_point_vente', 'livraison'], 'integer'],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_production' => 'Id Production',
'id_point_vente' => 'Id Point Vente',
'livraison' => 'Livraison',
];
}
public function getProduction()
{
return $this->hasOne(Production::className(), ['id' => 'id_production']) ;
}
public function getPointVente()
{
return $this->hasOne(PointVente::className(), ['id' => 'id_point_vente']) ;
}
public static function setAll($id_production, $bool_livraison)
{
$count_productions_point_vente = self::find()->
where([
'id_production' => $id_production
])
->count() ;
if(!$count_productions_point_vente)
{
$points_vente = PointVente::find()
->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])
->all();
foreach($points_vente as $pv)
{
$production_pv = new ProductionPointVente() ;
$production_pv->id_production = $id_production ;
$production_pv->id_point_vente = $pv->id ;
$production_pv->save() ;
}
}
$production = Production::findOne($id_production) ;
if($production)
{
$jour = date('N', strtotime($production->date)) ;
$productions_point_vente = self::find()
->with(['production','pointVente'])
->where([
'id_production' => $id_production
])
->all() ;

foreach($productions_point_vente as $production_pv)
{
if($bool_livraison &&
( ($jour == 1 && $production_pv->pointVente->livraison_lundi) ||
($jour == 2 && $production_pv->pointVente->livraison_mardi) ||
($jour == 3 && $production_pv->pointVente->livraison_mercredi) ||
($jour == 4 && $production_pv->pointVente->livraison_jeudi) ||
($jour == 5 && $production_pv->pointVente->livraison_vendredi) ||
($jour == 6 && $production_pv->pointVente->livraison_samedi) ||
($jour == 7 && $production_pv->pointVente->livraison_dimanche)
))
{
$production_pv->livraison = 1 ;
}
else {
$production_pv->livraison = 0 ;
}

$production_pv->save() ;
}
}
}
}

+ 39
- 0
console/migrations/m161222_100015_champs_point_vente_jours_livraison.php Переглянути файл

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

use yii\db\Migration;
use yii\db\Schema;

class m161222_100015_champs_point_vente_jours_livraison extends Migration
{
public function up()
{
$this->addColumn('point_vente', 'livraison_lundi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_mardi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_mercredi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_jeudi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_vendredi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_samedi', Schema::TYPE_BOOLEAN) ;
$this->addColumn('point_vente', 'livraison_dimanche', Schema::TYPE_BOOLEAN) ;
$this->createTable('production_point_vente', [
'id_production' => Schema::TYPE_INTEGER.' NOT NULL',
'id_point_vente' => Schema::TYPE_INTEGER.' NOT NULL',
'livraison' => Schema::TYPE_BOOLEAN.' DEFAULT 0',
]);
$this->addPrimaryKey('production_point_vente_pk', 'production_point_vente', ['id_production', 'id_point_vente']);
}

public function down()
{
$this->dropColumn('point_vente', 'livraison_lundi') ;
$this->dropColumn('point_vente', 'livraison_mardi') ;
$this->dropColumn('point_vente', 'livraison_mercredi') ;
$this->dropColumn('point_vente', 'livraison_jeudi') ;
$this->dropColumn('point_vente', 'livraison_vendredi') ;
$this->dropColumn('point_vente', 'livraison_samedi') ;
$this->dropColumn('point_vente', 'livraison_dimanche') ;
$this->dropTable('production_point_vente') ;
}
}

+ 52
- 9
frontend/controllers/CommandeController.php Переглянути файл

@@ -17,6 +17,7 @@ use frontend\models\AddEtablissementForm;
use common\models\UserEtablissement;
use common\models\CreditHistorique ;
use yii\web\NotFoundHttpException ;
use common\models\ProductionPointVente ;

class CommandeController extends \yii\web\Controller {

@@ -39,13 +40,35 @@ class CommandeController extends \yii\web\Controller {
$production = Production::find()->where(['date' => $date])->one();

if ($production) {

$arr = [] ;
$produits_dispos = ProductionProduit::findProduits($production->id);

return json_encode([
'produits_dispos' => $produits_dispos,
'livraison' => (int) $production->livraison
]);
$arr['produits_dispos'] = $produits_dispos ;
$points_vente = PointVente::find()
->joinWith(['productionPointVente'=> function($q) use ($production) {
$q->where(['id_production' => $production->id]) ;
} ])
->where([
'id_etablissement' => Yii::$app->user->identity->id_etablissement,
])
->all();
$arr['points_vente'] = [] ;
foreach($points_vente as $pv)
{
if(isset($pv->productionPointVente) &&
isset($pv->productionPointVente[0]))
{
$arr['points_vente'][$pv->id] = $pv->productionPointVente[0]->livraison ;
}
else {
$arr['points_vente'][$pv->id] = false ;
}
}

return json_encode($arr);
}

return json_encode([]);
@@ -324,7 +347,27 @@ class CommandeController extends \yii\web\Controller {
}
}
if ($commande->validate() && count($produits) && !$err_nb_produits && !$err_date) {
// point de vente
$err_point_vente = false ;
if(isset($production) && $production)
{
$ppv = ProductionPointVente::find()
->where([
'id_production' => $production->id,
'id_point_vente' => $posts['Commande']['id_point_vente']
])
->one() ;
//print_r($ppv) ;
//die() ;
if(!$ppv || !$ppv->livraison)
{
$err_point_vente = true ;
}
}
if ($commande->validate() && count($produits) && !$err_nb_produits && !$err_date && !$err_point_vente) {
// gestion point de vente
$pv = PointVente::find()
@@ -407,9 +450,7 @@ class CommandeController extends \yii\web\Controller {
) ;
}
}

// redirection
$this->redirect(Yii::$app->urlManager->createUrl(['commande/index', 'commande_ok' => true, 'pate_deja_petrie' => $pate_deja_petrie]));
}
@@ -420,6 +461,8 @@ class CommandeController extends \yii\web\Controller {
Yii::$app->session->setFlash('error', "Vous ne pouvez pas commander plus de 3 produits");
if ($err_date)
Yii::$app->session->setFlash('error', "Vous ne pouvez pas commander pour cette date.");
if($err_point_vente)
Yii::$app->session->setFlash('error', "Point de vente invalide.");
}
}


+ 16
- 6
frontend/web/js/lechatdesnoisettes.js Переглянути файл

@@ -106,9 +106,9 @@ function chat_init_horaire_point_vente(date) {
$('#points-vente .horaires .jour').hide() ;
var selector_jour = '#points-vente .horaires .jour-'+date.getDay() ;
$(selector_jour).show() ;
// on cache les points de vente si la livraison n'est pas cochée
$('#points-vente .point-vente').show() ;
/*$('#points-vente .point-vente').show() ;
if($('#livraison').val() == 0) {
$('#points-vente .point-vente').hide() ;
$('#points-vente .point-vente').each(function() {
@@ -116,16 +116,16 @@ function chat_init_horaire_point_vente(date) {
$(this).show() ;
}
}) ;
}
}*/
// on cache les points de vente qui sont fermés
//$('#points-vente .point-vente').removeClass('disabled') ;
$(selector_jour).each(function() {
/*$(selector_jour).each(function() {
if($(this).html() == 'Fermé') {
//$(this).parent().parent().parent().addClass('disabled') ;
$(this).parent().parent().parent().hide() ;
}
}) ;
}) ;*/
}

function chat_systeme_commande() {
@@ -394,7 +394,17 @@ function chat_systeme_commande_produits_dispos(str_date, date) {
});
}
$('#livraison').val(data.livraison) ;
// init affichage points de vente
$.each(data.points_vente, function(key, livraison) {
console.log(key+' | '+livraison) ;
if(livraison) {
$('.point-vente-'+key).fadeIn() ;
}
else {
$('.point-vente-'+key).hide() ;
}
}) ;
chat_init_horaire_point_vente(date) ;
}, 'json') ;

Завантаження…
Відмінити
Зберегти