feat: hotel manager dashboard
This commit is contained in:
@@ -2,15 +2,52 @@
|
||||
|
||||
namespace App\Controller\HouseManager;
|
||||
|
||||
use App\BusProNet\DataProvider\HotelDataProvider;
|
||||
use App\BusProNet\Model\Hotel;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HotelDataProvider $hotelDataProvider,
|
||||
private readonly DispositionRepository $dispositionRepository
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/house-manager', name: 'app_house_manager_index')]
|
||||
#[IsGranted('ROLE_HOUSE_MANAGER')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('house_manager/index.html.twig');
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
$hotels = $this
|
||||
->hotelDataProvider
|
||||
->findByCode($user->getHotelCode())
|
||||
;
|
||||
|
||||
$hotelBusProIds = array_map(function (Hotel $hotel) {
|
||||
return $hotel->getBusProId();
|
||||
}, $hotels);
|
||||
|
||||
$newDispositions = $this
|
||||
->dispositionRepository
|
||||
->getNewByHotelBusProIds($hotelBusProIds)
|
||||
;
|
||||
|
||||
$pendingFeedbacks = $this
|
||||
->dispositionRepository
|
||||
->getPendingFeedbackByHotelBusProIds($hotelBusProIds)
|
||||
;
|
||||
|
||||
return $this->render('house_manager/index.html.twig', [
|
||||
'newDispositions' => $newDispositions,
|
||||
'pendingFeedbacks' => $pendingFeedbacks,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user