소스 검색

Délais de commande : ajout des champs supplémentaires + évolution du formulaire des paramètres producteur

refactoring
Guillaume 4 년 전
부모
커밋
f5fef6694c
3개의 변경된 파일144개의 추가작업 그리고 37개의 파일을 삭제
  1. +79
    -34
      backend/views/producer/update.php
  2. +22
    -3
      common/models/Producer.php
  3. +43
    -0
      console/migrations/m200206_102436_champs_delais_commande_par_jour_semaine.php

+ 79
- 34
backend/views/producer/update.php 파일 보기

@@ -109,40 +109,85 @@ $this->addBreadcrumb($this->getTitle()) ;
<h3 class="panel-title">Prise de commande</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'order_delay')
->dropDownList([
1 => '1 jour',
2 => '2 jours',
3 => '3 jours',
4 => '4 jours',
5 => '5 jours',
6 => '6 jours',
7 => '7 jours',
], [])
->hint('Si <strong>1 jour</strong> est sélectionné, le client pourra commander jusqu\'à la veille de la production.<br />'
. 'Si <strong>2 jours</strong> est sélectionné, le client pourra commander jusqu\'à l\'avant-veille de la production, etc.') ; ?>
<?= $form->field($model, 'order_deadline')
->dropDownList([
24 => 'Minuit',
23 => '23h',
22 => '22h',
21 => '21h',
20 => '20h',
19 => '19h',
18 => '18h',
17 => '17h',
16 => '16h',
15 => '15h',
14 => '14h',
13 => '13h',
12 => '12h',
11 => '11h',
10 => '10h',
9 => '9h',
8 => '8h',
], [])
->hint('Heure limite jusqu\'à laquelle les clients peuvent commander pour satisfaire le délai de commande.<br />'
. 'Par exemple, si <strong>2 jours</strong> est sélectionné dans le délai de commande, le client devra commander l\'avant-veille de la production avant l\'heure précisée ici.') ; ?>

<?php

$delaysArray = [
1 => '1 jour',
2 => '2 jours',
3 => '3 jours',
4 => '4 jours',
5 => '5 jours',
6 => '6 jours',
7 => '7 jours',
] ;

$deadlinesArray = [
24 => 'Minuit',
23 => '23h',
22 => '22h',
21 => '21h',
20 => '20h',
19 => '19h',
18 => '18h',
17 => '17h',
16 => '16h',
15 => '15h',
14 => '14h',
13 => '13h',
12 => '12h',
11 => '11h',
10 => '10h',
9 => '9h',
8 => '8h',
] ;

$daysArray = [
'monday' => 'Lundi',
'tuesday' => 'Mardi',
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche'
] ;
?>

<div class="row">
<div class="col-md-2">
<strong>Par défaut</strong>
</div>
<div class="col-md-5">
<?= $form->field($model, 'order_delay')
->dropDownList($delaysArray, ['prompt' => '--'])
->hint('Si <strong>1 jour</strong> est sélectionné, le client pourra commander jusqu\'à la veille de la production.<br />'
. 'Si <strong>2 jours</strong> est sélectionné, le client pourra commander jusqu\'à l\'avant-veille de la production, etc.') ; ?>
</div>
<div class="col-md-5">
<?= $form->field($model, 'order_deadline')
->dropDownList($deadlinesArray, ['prompt' => '--'])
->hint('Heure limite jusqu\'à laquelle les clients peuvent commander pour satisfaire le délai de commande.<br />'
. 'Par exemple, si <strong>2 jours</strong> est sélectionné dans le délai de commande, le client devra commander l\'avant-veille de la production avant l\'heure précisée ici.') ; ?>
</div>
</div>
<?php foreach($daysArray as $day => $labelDay): ?>
<div class="row">
<div class="col-md-2">
<strong><?= $labelDay ?></strong>
</div>
<div class="col-md-5">
<?= $form->field($model, 'order_delay_'.$day, [
'template' => '{input}',
])->dropDownList($delaysArray, ['prompt' => '--'])->label(''); ?>
</div>
<div class="col-md-5">
<?= $form->field($model, 'order_deadline_'.$day, [
'template' => '{input}',
])->dropDownList($deadlinesArray, ['prompt' => '--'])->label(''); ?>
</div>
</div>
<?php endforeach; ?>

<?= $form->field($model, 'order_infos')
->textarea(['rows' => 6])

+ 22
- 3
common/models/Producer.php 파일 보기

@@ -106,8 +106,13 @@ class Producer extends ActiveRecordCommon
[['tiller_provider_token', 'tiller_restaurant_token'], 'required', 'when' => function ($model) {
return $model->tiller == true;
}],
[['order_deadline', 'order_delay', 'id_tax_rate_default', 'document_quotation_duration'], 'integer'],
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]],
[['order_delay', 'order_deadline', 'order_delay_monday', 'order_deadline_monday', 'order_delay_tuesday', 'order_deadline_tuesday',
'order_delay_wednesday', 'order_deadline_wednesday', 'order_delay_thursday', 'order_deadline_thursday', 'order_delay_friday',
'order_deadline_friday', 'order_delay_saturday', 'order_deadline_saturday', 'order_delay_sunday', 'order_deadline_sunday',
'id_tax_rate_default', 'document_quotation_duration'], 'integer'],
[['order_deadline', 'order_deadline_monday', 'order_deadline_tuesday', 'order_deadline_wednesday',
'order_deadline_thursday', 'order_deadline_friday', 'order_deadline_saturday',
'order_deadline_sunday', ], 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]],
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]],
['code', function ($attribute, $params) {
$code = $this->$attribute;
@@ -145,8 +150,22 @@ class Producer extends ActiveRecordCommon
'postcode' => 'Code postal',
'city' => 'Ville',
'code' => 'Code',
'order_deadline' => 'Heure limite de commande',
'order_delay' => 'Délai de commande',
'order_deadline' => 'Heure limite de commande',
'order_delay_monday' => 'Délai de commande (lundi)',
'order_deadline_monday' => 'Heure limite de commande (lundi)',
'order_delay_tuesday' => 'Délai de commande (mardi)',
'order_deadline_tuesday' => 'Heure limite de commande (mardi)',
'order_delay_wednesday' => 'Délai de commande (mercredi)',
'order_deadline_wednesday' => 'Heure limite de commande (mercredi)',
'order_delay_thursday' => 'Délai de commande (jeudi)',
'order_deadline_thursday' => 'Heure limite de commande (jeudi)',
'order_delay_friday' => 'Délai de commande (vendredi)',
'order_deadline_friday' => 'Heure limite de commande (vendredi)',
'order_delay_saturday' => 'Délai de commande (samedi)',
'order_deadline_saturday' => 'Heure limite de commande (samedi)',
'order_delay_sunday' => 'Délai de commande (dimanche)',
'order_deadline_sunday' => 'Heure limite de commande (dimanche)',
'negative_balance' => 'Solde négatif',
'credit' => 'Crédit pain',
'active' => 'Actif',

+ 43
- 0
console/migrations/m200206_102436_champs_delais_commande_par_jour_semaine.php 파일 보기

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

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

class m200206_102436_champs_delais_commande_par_jour_semaine extends Migration
{
public function safeUp()
{
$this->addColumn('producer', 'order_delay_monday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_monday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_tuesday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_tuesday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_wednesday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_wednesday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_thursday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_thursday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_friday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_friday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_saturday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_saturday', Schema::TYPE_FLOAT) ;
$this->addColumn('producer', 'order_delay_sunday', Schema::TYPE_INTEGER) ;
$this->addColumn('producer', 'order_deadline_sunday', Schema::TYPE_FLOAT) ;
}

public function safeDown()
{
$this->dropColumn('producer', 'order_delay_monday') ;
$this->dropColumn('producer', 'order_deadline_monday') ;
$this->dropColumn('producer', 'order_delay_tuesday') ;
$this->dropColumn('producer', 'order_deadline_tuesday') ;
$this->dropColumn('producer', 'order_delay_wednesday') ;
$this->dropColumn('producer', 'order_deadline_wednesday') ;
$this->dropColumn('producer', 'order_delay_thursday') ;
$this->dropColumn('producer', 'order_deadline_thursday') ;
$this->dropColumn('producer', 'order_delay_friday') ;
$this->dropColumn('producer', 'order_deadline_friday') ;
$this->dropColumn('producer', 'order_delay_saturday') ;
$this->dropColumn('producer', 'order_deadline_saturday') ;
$this->dropColumn('producer', 'order_delay_sunday') ;
$this->dropColumn('producer', 'order_deadline_sunday') ;
}
}

Loading…
취소
저장