Fix weekday translation
This commit is contained in:
parent
c2aa74e1ce
commit
3c80fe8c4c
1 changed files with 9 additions and 6 deletions
|
|
@ -155,8 +155,11 @@ class Shop extends Model
|
|||
|
||||
$availCreneaux = [];
|
||||
|
||||
|
||||
/** @var \Carbon\CarbonInterface|null $day_to_consider Le jour pour lequel il faut obtenir les créneaux. */
|
||||
foreach ($period->days() as $day_to_consider) {
|
||||
// * Convert carbon weekday to FR
|
||||
$day_to_consider_week_day = $day_to_consider->weekday() ?: 7;
|
||||
// * Ignorer jours de fermeture.
|
||||
if ($noCollectDays->has($day_to_consider->format('d/m/Y'))) {
|
||||
continue;
|
||||
|
|
@ -164,7 +167,7 @@ class Shop extends Model
|
|||
|
||||
// * Délais de préparation minimal pour aujourd'hui.
|
||||
/** @var string $min_order_preparation A string like "hh:ii". Durée de préparation de commande */
|
||||
$min_order_preparation = $plage[$day_to_consider->weekday()]->min_order_preparation;
|
||||
$min_order_preparation = $plage[$day_to_consider_week_day]->min_order_preparation;
|
||||
/** @var \Carbon\CarbonInterval $min_order_preparation_carbon Heures minute de délais de préparation */
|
||||
$min_order_preparation_carbon = CarbonInterval::createFromFormat(
|
||||
'h:i',
|
||||
|
|
@ -172,22 +175,22 @@ class Shop extends Model
|
|||
);
|
||||
|
||||
/** @var integer|null $max_orders_per_interval . Nb de réservations maximum par créneau */
|
||||
$max_orders_per_interval = $plage[$day_to_consider->weekday()]->max_orders_per_interval;
|
||||
$max_orders_per_interval = $plage[$day_to_consider_week_day]->max_orders_per_interval;
|
||||
|
||||
/** @var \Carbon\CarbonInterval $baseInterval Durée d'un créneau */
|
||||
$baseInterval = CarbonInterval::createFromFormat('h:i', $plage[$day_to_consider->weekday()]->interval);
|
||||
$baseInterval = CarbonInterval::createFromFormat('h:i', $plage[$day_to_consider_week_day]->interval);
|
||||
|
||||
$availCreneaux[$day_to_consider->format('d/m/Y')] = [];
|
||||
|
||||
foreach (['morning', 'afternoon'] as $half_day_period) {
|
||||
if (!empty($plage[$day_to_consider->weekday()]->{"{$half_day_period}_start"})) {
|
||||
if (!empty($plage[$day_to_consider_week_day]->{"{$half_day_period}_start"})) {
|
||||
/** @var \Carbon\Carbon Début de la plage de demi journée */
|
||||
$start_half_day = Carbon::createFromTimeString(
|
||||
$plage[$day_to_consider->weekday()]->{"{$half_day_period}_start"}
|
||||
$plage[$day_to_consider_week_day]->{"{$half_day_period}_start"}
|
||||
);
|
||||
/** @var \Carbon\Carbon Fin de la plage de demi journée */
|
||||
$end_half_day = Carbon::createFromTimeString(
|
||||
$plage[$day_to_consider->weekday()]->{"{$half_day_period}_end"}
|
||||
$plage[$day_to_consider_week_day]->{"{$half_day_period}_end"}
|
||||
);
|
||||
|
||||
/** @var \Carbon\CarbonPeriod La période de demi journée a considérer */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue