Sort groups price configs by date to determine earliest in js
This commit is contained in:
@@ -34,8 +34,14 @@ class GroupsPriceController extends ActionController
|
|||||||
{
|
{
|
||||||
public function indexAction(Hotel $hotel)
|
public function indexAction(Hotel $hotel)
|
||||||
{
|
{
|
||||||
|
// Sort configs by date to properly determine earliest date in js component
|
||||||
|
$configs = $hotel->getGroupsPriceConfigs()->toArray();
|
||||||
|
uasort($configs, function ($a, $b) {
|
||||||
|
return $a->getDateFrom() > $b->getDateFrom();
|
||||||
|
});
|
||||||
|
|
||||||
$this->view->assign('hotel', $hotel);
|
$this->view->assign('hotel', $hotel);
|
||||||
$this->view->assign('configs', json_encode($hotel->getGroupsPriceConfigs()->toArray()));
|
$this->view->assign('configs', json_encode($configs));
|
||||||
$this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray()));
|
$this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray()));
|
||||||
$this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray()));
|
$this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ class ProductController extends ActionController
|
|||||||
}
|
}
|
||||||
// Use first hotel which should be the only one at this point
|
// Use first hotel which should be the only one at this point
|
||||||
if ($product->getHotels()->count() > 0) {
|
if ($product->getHotels()->count() > 0) {
|
||||||
$hotel = reset($product->getHotels()->toArray());
|
$hotels = $product->getHotels()->toArray();
|
||||||
|
$hotel = reset($hotels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user