Procházet zdrojové kódy

Délais de commande : affichage des bons délais de commande

refactoring
Guillaume před 4 roky
rodič
revize
d464827113
5 změnil soubory, kde provedl 115 přidání a 17 odebrání
  1. +48
    -0
      common/models/Producer.php
  2. +7
    -5
      producer/views/layouts/main.php
  3. +51
    -9
      producer/views/order/order.php
  4. +2
    -2
      producer/web/css/screen.css
  5. +7
    -1
      producer/web/sass/order/_order.scss

+ 48
- 0
common/models/Producer.php Zobrazit soubor

@@ -440,6 +440,54 @@ class Producer extends ActiveRecordCommon
return $userProducer;
}

public function getSpecificDelays()
{
$array = [] ;
$daysArray = [
'monday','tuesday','wednesday','thursday','friday','saturday','sunday'
] ;


foreach($daysArray as $day) {
$fieldDelay = 'order_delay_'.$day ;
$fieldDeadline = 'order_deadline_'.$day ;

$delay = $this->order_delay ;
$deadline = $this->order_deadline ;
if($this->$fieldDelay) {
$delay = $this->$fieldDelay ;
}
if($this->$fieldDeadline) {
$deadline = $this->$fieldDeadline ;
}

$array[$day] = [
'order_delay' => $delay,
'order_deadline' => $deadline,
] ;
}

return $array ;
}

public function hasSpecificDelays()
{
$daysArray = [
'monday','tuesday','wednesday','thursday','friday','saturday','sunday'
] ;

foreach($daysArray as $day) {
$fieldDelay = 'order_delay_'.$day ;
$fieldDeadline = 'order_deadline_'.$day ;

if($this->$fieldDelay || $this->$fieldDeadline) {
return true ;
}
}

return false ;
}

/**
* Retourne le chemin vers le fichier contenant la clé secrète d'API de Payplug
*

+ 7
- 5
producer/views/layouts/main.php Zobrazit soubor

@@ -234,11 +234,13 @@ if (!Yii::$app->user->isGuest) {
</div>
<?php endif; ?>
<div id="infos-producer">
<span data-toggle="tooltip" data-placement="bottom" title="Heure limite de commande">
<span class="glyphicon glyphicon-time"></span> Commande avant
<strong><?php echo Html::encode($producer->order_deadline) ?> h</strong></span>,
<span data-toggle="tooltip" data-placement="bottom"
title="Exemple : commande le lundi pour le <?php if ($producer->order_delay == 1): ?>mardi<?php elseif ($producer->order_delay == 2): ?>mercredi<?php elseif ($producer->order_delay == 3): ?>jeudi<?php elseif ($producer->order_delay == 4): ?>vendredi<?php elseif ($producer->order_delay == 5): ?>samedi<?php elseif ($producer->order_delay == 6): ?>dimanche<?php elseif ($producer->order_delay == 7): ?>lundi d'après<?php endif; ?>"><strong><?= Html::encode($producer->order_delay) ?> jour<?php if ($producer->order_delay > 1): ?>s<?php endif; ?></strong> à l'avance</span>
<?php if(!$producer->hasSpecificDelays()): ?>
<span data-toggle="tooltip" data-placement="bottom" title="Heure limite de commande">
<span class="glyphicon glyphicon-time"></span> Commande avant
<strong><?php echo Html::encode($producer->order_deadline) ?> h</strong></span>,
<span data-toggle="tooltip" data-placement="bottom"
title="Exemple : commande le lundi pour le <?php if ($producer->order_delay == 1): ?>mardi<?php elseif ($producer->order_delay == 2): ?>mercredi<?php elseif ($producer->order_delay == 3): ?>jeudi<?php elseif ($producer->order_delay == 4): ?>vendredi<?php elseif ($producer->order_delay == 5): ?>samedi<?php elseif ($producer->order_delay == 6): ?>dimanche<?php elseif ($producer->order_delay == 7): ?>lundi d'après<?php endif; ?>"><strong><?= Html::encode($producer->order_delay) ?> jour<?php if ($producer->order_delay > 1): ?>s<?php endif; ?></strong> à l'avance</span>
<?php endif; ?>

<?php if (!Yii::$app->user->isGuest): ?>
<span class="favorite">

+ 51
- 9
producer/views/order/order.php Zobrazit soubor

@@ -281,15 +281,57 @@ $this->setTitle('Commander') ;
</transition>
</div>
</div>
<div id="infos" v-if="producer != null && producer.order_infos != null && producer.order_infos.length">
<div class="panel panel-default">
<div class="panel-heading">
Informations
</div>
<div class="panel-body">
{{ producer.order_infos }}
</div>

<div id="infos" v-if="producer != null && producer.order_infos != null && producer.order_infos.length">
<div class="panel panel-default">
<div class="panel-heading">
Informations
</div>
<div class="panel-body">
{{ producer.order_infos }}
</div>
</div>
</div>
</div>

<?php
$producer = GlobalParam::getCurrentProducer() ;
if($producer->hasSpecificDelays()): ?>
<div id="specific-delays" class="panel panel-default">
<div class="panel-heading">
Délais de commande spécifiques
</div>
<div class="panel-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Jour</th>
<th>Délai</th>
</tr>
</thead>
<?php foreach($producer->getSpecificDelays() as $day => $delay): ?>
<tr>
<td>
<?php
switch($day) {
case 'monday': echo 'Lundi' ; break;
case 'tuesday': echo 'Mardi' ; break;
case 'wednesday': echo 'Mercredi' ; break;
case 'thursday': echo 'Jeudi' ; break;
case 'friday': echo 'Vendredi' ; break;
case 'saturday': echo 'Samedi' ; break;
case 'sunday': echo 'Dimanche' ; break;
}
?>
</td>
<td>
<span><?= $delay['order_delay'] ?> jour<?= ($delay['order_delay'] > 1) ? 's' : '' ?></span> à l'avance,
avant <span><?= $delay['order_deadline'] ?>h</span>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
</div>

+ 2
- 2
producer/web/css/screen.css Zobrazit soubor

@@ -1523,11 +1523,11 @@ termes.
.order-order #main #app-order-order #content-step-payment .comment {
margin-bottom: 20px;
}
/* line 267, ../sass/order/_order.scss */
/* line 273, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos {
margin-top: 30px;
}
/* line 269, ../sass/order/_order.scss */
/* line 275, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos .panel-body {
padding-top: 0px;
white-space: pre-line;

+ 7
- 1
producer/web/sass/order/_order.scss Zobrazit soubor

@@ -263,7 +263,13 @@
margin-bottom: 20px ;
}
}

#specific-delays {
strong {
//text-decoration: underline ;
}
}

#infos {
margin-top: 30px ;
.panel-body {

Načítá se…
Zrušit
Uložit