|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <?php
-
- use yii\widgets\ActiveForm;
-
- ?>
- <div class="commande-form">
-
- <?php
- $form = ActiveForm::begin([
- 'enableClientScript' => false
- ]);
- ?>
-
- <?php
- if(count($jours_production) <= 1) :
- ?>
- <div class="alert alert-warning">Aucun jour de production n'a été programmé par le producteur.</div>
- <?php endif; ?>
-
-
- <?php if($id_etablissement && count($jours_production) > 1): ?>
-
- <div id="step-choix-date" class="col-md-6">
- <?= $form->field($model, 'id_production')->label('')->hiddenInput(); ?>
-
- <?php if (isset($model->id)): ?>
- <div class="date-commande"><span><?php echo date('d/m/Y', strtotime($production->date)); ?></span></div>
- <?= Html::hiddenInput('id_commande', $model->id,['id'=>'id-commande']); ?>
- <?= Html::hiddenInput('montant_paye', $model->getMontantPaye(),['id'=>'montant-paye']); ?>
- <?php endif; ?>
-
- <div id="datepicker-production" <?php if (isset($model->id)): ?>style="display:none"<?php endif; ?>>
- </div>
-
- <?php if (!isset($model->id)): ?>
- <br />
- <?php endif; ?>
-
- <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, 'id_etablissement' => $c->production->id_etablissement]) . '"></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>
- <div class="col-md-6">
- <?php if(strlen($etablissement->infos_commande)): ?>
- <div id="infos-commande">
- <?= nl2br(Html::encode($etablissement->infos_commande)) ?>
- </div>
- <?php endif; ?>
- </div>
-
-
- <div class="clr"></div>
-
- <div id="depots">
- <h3 id="step-choix-depot"><span>Points de vente</span></h3>
- <?=
- $form->field($model, 'id_point_vente')
- ->label('')
- ->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
-
- foreach ($points_vente as $pv) {
-
- $commentaire = '' ;
- if(isset($pv->pointVenteUser) && is_array($pv->pointVenteUser) && count($pv->pointVenteUser))
- {
- foreach($pv->pointVenteUser as $pvu)
- {
- if($pvu->id_user == Yii::$app->user->identity->id && strlen($pvu->commentaire))
- {
- $commentaire = '<div class="commentaire"><span>'.Html::encode($pvu->commentaire).'</span></div>' ;
- }
- }
- }
-
- $html_code = '' ;
- $data_code = '0' ;
- $code = '' ;
- if(strlen($pv->code))
- {
- if(!isset($model->id_point_vente) || $model->id_point_vente != $pv->id)
- {
- $html_code .= '<span class="glyphicon glyphicon-lock"></span> ' ;
- $data_code = '1' ;
- }
- else {
- $code = $pv->code ;
- }
- }
-
- echo '<li class="bloc point-vente point-vente-' . $pv->id . '" data-code="'.$data_code.'" data-vrac="' . (int) $pv->vrac . '" data-pain="' . (int) $pv->pain . '" data-credit-pain="'.(int) $pv->credit_pain.'"><div class="contenu">' .
- '<span style="display:none;" class="id">' . $pv->id . '</span>' .
- '<div class="nom">' .$html_code. Html::encode($pv->nom) . '</div>' .
- '<div class="adresse">à ' . Html::encode($pv->localite) . '</div>' .
- $commentaire .
- '<input type="hidden" name="code_point_vente_'.$pv->id.'" value="'.$code.'" />'.
- '</div></li>';
-
- }
- ?>
- </ul>
-
- <div class="clr"></div>
-
- <div id="step-infos-pv">
- <?php
- foreach ($points_vente as $pv) {
- echo '<div class="alert alert-warning infos-pv infos-pv-'.$pv->id.'"><h4>Infos : <span>'.Html::encode($pv->nom).'</span></h4>' .
- '<div class="jour jour-1">' . $pv->strInfos('lundi') . '</div>' .
- '<div class="jour jour-2">' . $pv->strInfos('mardi') . '</div>' .
- '<div class="jour jour-3">' . $pv->strInfos('mercredi') . '</div>' .
- '<div class="jour jour-4">' . $pv->strInfos('jeudi') . '</div>' .
- '<div class="jour jour-5">' . $pv->strInfos('vendredi') . '</div>' .
- '<div class="jour jour-6">' . $pv->strInfos('samedi') . '</div>' .
- '<div class="jour jour-0">' . $pv->strInfos('dimanche') . '</div>' .
- '</div>' ;
- }
- ?>
- </div>
-
- <div class="clr"></div>
- </div>
-
- <div id="produits">
-
- <h3 id="step-choix-produits"><span>Produits</span></h3>
-
- <?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">
- <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="th-photo">Photo</th>
- <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): ?>
- <?php
- $quantite = 0;
- if (isset($produits_selec[$p->id]))
- $quantite = $produits_selec[$p->id];
- ?>
-
- <tr class="produit-<?php echo $p->id; ?>" data-no-limit="<?php if(!$p->quantite_max): ?>1<?php else: ?>0<?php endif; ?>" data-quantite-max="<?= $quantite ?>" <?php if (count($produits_dispos) && !$produits_dispos[$p->id]['actif']): ?>style="display:none;"<?php endif; ?>>
- <td class="td-photo">
- <?php if (strlen($p->photo) && file_exists(dirname(__FILE__).'/../../web/uploads/' . $p->photo)): ?><a href="<?= Yii::$app->urlManager->getBaseUrl() . '/uploads/' . $p->photo ?>" data-lightbox="produit-<?php echo $p->id; ?>"><img class="photo img-rounded" src="<?= Yii::$app->urlManager->getBaseUrl() . '/uploads/' . $p->photo ?>" alt="Photo <?= Html::encode($p->nom); ?>" /></a><?php endif; ?>
- </td>
- <td class="produit">
- <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" <?php if (isset($produits_dispos[$p->id]) && $produits_dispos[$p->id]['quantite_restante'] == 0 && $quantite == 0): ?>style="display:none;"<?php endif; ?>>
- <span class="input-group-btn">
- <button type="button" class="btn btn-default move-quantity moins">-</button>
- </span>
- <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>
-
- <?php if($id_etablissement): ?>
- <?php
- $etablissement = Etablissement::findOne($id_etablissement);
- ?>
- <div id="bar-fixed" class="<?php if($etablissement->credit_pain): ?>credit-pain<?php else: ?>no-credit-pain<?php endif; ?>">
- <div class="container">
- <?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; ?>
- <span id="total-commande-bottom"><span></span> €</span>
- <?= Html::submitButton('<span class="glyphicon glyphicon-comment"></span> Commentaire', ['class' => 'btn btn-default btn-commentaire', 'data-placement' => 'top', 'data-toggle' => 'tooltip', 'data-original-title' => 'Ajouter un commentaire']) ?>
-
- <?php
- if($etablissement->credit_pain):
-
- $lien_credit_pain = '<a class="info-credit-pain" href="'.Yii::$app->urlManager->createUrl(['site/creditpain']) .'" data-toggle="tooltip" data-placement="bottom" title="En savoir plus sur le Crédit Pain"><span class="glyphicon glyphicon-info-sign"></span></a>' ; ;
- ?>
- <div id="checkbox-credit-pain" >
- <?php if($credit || $model->getMontantPaye()): ?>
- <?= Html::checkbox('credit_pain', true, ['label' => 'Utiliser mon compte Crédit Pain <span class="the-credit" data-toggle="tooltip" data-placement="top" data-original-title="Vous avez actuellement '.number_format($credit,2).' € sur votre compte Crédit Pain">'.number_format($credit,2).' €</span><br /><span class="info"></span>']) ?>
- <?= Html::hiddenInput('montant_credit_pain', $credit, ['id' => 'montant-credit-pain']) ?>
- <?= Html::hiddenInput('str_montant_credit_pain', number_format($credit,2).' €', ['id' => 'str-montant-credit-pain']) ?>
- <?php else: ?>
- <div id="info-credit-vide">
- Votre compte Crédit Pain est vide <?= $lien_credit_pain ?>
- </div>
- <?php endif; ?>
- <div id="credit-pain-disabled">Le Crédit Pain est désactivé<br /> pour ce point de vente <?= $lien_credit_pain ?></div>
- </div>
- <div class="clr"></div>
- <?php endif; ?>
-
- <?= $form->field($model, 'commentaire')->textarea(['rows' => 3, 'placeholder' => 'Un commentaire ?'])->label(''); ?>
- <div id="bloc-valider-commande">
- <?= Html::submitButton('<span class="glyphicon glyphicon-ok"></span> Valider ma commande', ['class' => 'btn btn-primary valider-commande']) ?>
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <?php
- // id_etablissement
- endif; ?>
-
- <?php ActiveForm::end(); ?>
-
-
- <!-- modal code point de vente -->
- <div class="modal fade" id="modal-code" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
- <div class="modal-dialog modal-lg" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h4 class="modal-title" id="myModalLabel">Code d'accès</h4>
- </div>
- <div class="modal-body">
- <div class="alert alert-warning">
- Ce point de vente nécessite un code d'accès.
- </div>
- <form action="index.php?r=commande/verif-code" method="post">
- <input type="hidden" value="" name="id_point_vente" id="id-point-vente" />
- <div class="form-group field-code required">
- <label class="control-label" for="code">Code d'accès :</label>
- <input type="password" class="form-control" id="code" name="code" />
- <p class="help-block help-block-error" style="display:none;">Code incorrect</p>
- </div>
- <div class="form-group">
- <button type="submit" class="btn btn-primary">Valider</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
-
-
- </div><!-- commande-form -->
|