oha
This commit is contained in:
parent
b4ae1f9007
commit
51fb951b2b
2 changed files with 24 additions and 4 deletions
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace App\Controller;
|
||||
|
||||
use App\Repository\DrinkTypeRepository;
|
||||
use App\Service\DrinkType\FilterLowStockDrinks;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
@ -12,10 +13,15 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||
#[Route(path: '/', name: 'app_index')]
|
||||
final class Index extends AbstractController
|
||||
{
|
||||
public function __invoke(DrinkTypeRepository $drinkTypeRepository): Response
|
||||
{
|
||||
public function __invoke(
|
||||
DrinkTypeRepository $drinkTypeRepository,
|
||||
FilterLowStockDrinks $filterLowStockDrinks
|
||||
): Response {
|
||||
$wanted = $drinkTypeRepository->findWanted();
|
||||
$lowStock = $filterLowStockDrinks($wanted);
|
||||
return $this->render('index.html.twig', [
|
||||
'drinkTypes' => $drinkTypeRepository->findWanted(),
|
||||
'drinkTypes' => $lowStock,
|
||||
'lowStock' => $lowStock,
|
||||
]);
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,21 @@
|
|||
{% block body %}
|
||||
<div class="container">
|
||||
<h1>Drink Inventory</h1>
|
||||
{% if lowStock != [] %}
|
||||
<div class="card">
|
||||
<div class="card-header bg-danger">
|
||||
<h5 class="card-title">LOW STOCK ALERT</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
{% for drinkType in lowStock %}
|
||||
<li>{{ drinkType.name }} ({{ drinkType.currentStock }} / {{ drinkType.wantedStock }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Drink Inventory Overview</h5>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue