Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Apr 11, 2022
1 parent a16a486 commit 23af0dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
8 changes: 5 additions & 3 deletions classes/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,18 @@ public function orderDateTime()
return make_carbon($dateTime);
}

public function scheduleTimeslot()
public function scheduleTimeslot($orderType = null)
{
$orderType = $this->orderType();
if (is_null($orderType))
$orderType = $this->orderType();

if (array_key_exists($orderType, $this->scheduleCache))
return $this->scheduleCache[$orderType];

$leadMinutes = $this->model->getOption($orderType.'_add_lead_time')
? $this->orderLeadTime() : 0;

$result = $this->getOrderType()->getSchedule()->getTimeslot(
$result = $this->getOrderType($orderType)->getSchedule()->getTimeslot(
$this->orderTimeInterval(), null, $leadMinutes
);

Expand Down
9 changes: 2 additions & 7 deletions components/LocalList.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,8 @@ protected function filterQueryResult($collection, $searchDeliveryAreas = FALSE)

protected function buildPageUrl()
{
$url = page_url().'?';
if ($searchTerm = $this->getSearchTerm())
$url .= $this->property('searchParamName').'='.$searchTerm.'&';

if ($sortBy = $this->getSortBy())
$url .= $this->property('sortByParamName').'='.$sortBy.'&';
$query = array_except(request()->query(), [$this->property('orderTypeParamName')]);

return $url;
return page_url().'?'.http_build_query($query).'&';
}
}
7 changes: 4 additions & 3 deletions components/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,16 @@ public function createMenuItemObject($menuItem)

$mealtimes = optional($menuItem->mealtimes)->where('mealtime_status', 1);
$object->hasMealtime = count($mealtimes);
$object->mealtimeIsNotAvailable = !$menuItem->isAvailable(Location::orderDateTime());
$object->mealtimeIsAvailable = $menuItem->isAvailable(Location::orderDateTime());
$object->mealtimeIsNotAvailable = !$object->mealtimeIsAvailable;

$object->mealtimeTitles = [];
foreach ($mealtimes ?? [] as $mealtime) {
$object->mealtimeTitles[] = sprintf(
lang('igniter.local::default.text_mealtime'),
$mealtime->mealtime_name,
$mealtime->start_time,
$mealtime->end_time
now()->setTimeFromTimeString($mealtime->start_time)->isoFormat(lang('system::lang.moment.time_format')),
now()->setTimeFromTimeString($mealtime->end_time)->isoFormat(lang('system::lang.moment.time_format'))
);
}

Expand Down
2 changes: 1 addition & 1 deletion language/en/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
'label_hide_min_order_amount' => 'Hide Min. Order Amount',
'label_lang' => 'Language Line',
'label_status' => 'Status',
'label_search_query' => 'Enter your address or postcode to order',
'label_search_query' => 'Enter delivery address',
'label_menu_search' => 'Search menu items.',
'label_redirect' => 'Page to redirect to when no location is selected',
'label_menu_page' => 'Menus Page',
Expand Down

0 comments on commit 23af0dd

Please sign in to comment.