<h3 class="panel-title">Prise de commande</h3> | <h3 class="panel-title">Prise de commande</h3> | ||||
</div> | </div> | ||||
<div class="panel-body"> | <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') | <?= $form->field($model, 'order_infos') | ||||
->textarea(['rows' => 6]) | ->textarea(['rows' => 6]) |
[['tiller_provider_token', 'tiller_restaurant_token'], 'required', 'when' => function ($model) { | [['tiller_provider_token', 'tiller_restaurant_token'], 'required', 'when' => function ($model) { | ||||
return $model->tiller == true; | 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]], | ['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], | ||||
['code', function ($attribute, $params) { | ['code', function ($attribute, $params) { | ||||
$code = $this->$attribute; | $code = $this->$attribute; | ||||
'postcode' => 'Code postal', | 'postcode' => 'Code postal', | ||||
'city' => 'Ville', | 'city' => 'Ville', | ||||
'code' => 'Code', | 'code' => 'Code', | ||||
'order_deadline' => 'Heure limite de commande', | |||||
'order_delay' => 'Délai 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', | 'negative_balance' => 'Solde négatif', | ||||
'credit' => 'Crédit pain', | 'credit' => 'Crédit pain', | ||||
'active' => 'Actif', | 'active' => 'Actif', |
<?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') ; | |||||
} | |||||
} |