feat: drop the upcoming bookings list from the dashboard
This commit is contained in:
1 parent
3d67942c62
commit
0be3c2ccde
2 files changed
+2
-42
No files matched your search
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace App\Controller\Dashboard;
|
namespace App\Controller\Dashboard;
|
||||||
|
|
||||||
use App\Controller\Traits\CurrentUserTrait;
|
use App\Controller\Traits\CurrentUserTrait;
|
||||||
use App\Entity\Booking;
|
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Enum\ResourceType;
|
use App\Enum\ResourceType;
|
||||||
use App\Repository\BookingRepository;
|
use App\Repository\BookingRepository;
|
||||||
@@ -15,7 +14,8 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The landing screen: one tile per bookable kind, plus what this person has coming up.
|
* The landing screen: one tile per bookable kind, plus tiles for the bookings list and, for an
|
||||||
|
* administrator, the admin screens.
|
||||||
*
|
*
|
||||||
* It replaces the sidebar navigation, so it is also the only route to the booking boards and the
|
* It replaces the sidebar navigation, so it is also the only route to the booking boards and the
|
||||||
* bookings list -- which is why the tiles are generated from ResourceType rather than written
|
* bookings list -- which is why the tiles are generated from ResourceType rather than written
|
||||||
@@ -39,7 +39,6 @@ final class IndexController extends AbstractController
|
|||||||
|
|
||||||
return $this->render('dashboard/index.html.twig', [
|
return $this->render('dashboard/index.html.twig', [
|
||||||
'tiles' => $this->tiles($user, $today),
|
'tiles' => $this->tiles($user, $today),
|
||||||
'upcoming' => $this->upcoming($user, $today),
|
|
||||||
'today' => $today,
|
'today' => $today,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -83,14 +82,4 @@ final class IndexController extends AbstractController
|
|||||||
|
|
||||||
return $tiles;
|
return $tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return list<Booking>
|
|
||||||
*/
|
|
||||||
private function upcoming(User $user, \DateTimeImmutable $from, int $limit = 5): array
|
|
||||||
{
|
|
||||||
$bookings = $this->bookings->findForUserInRange($user, $from, $from->modify('+1 year'));
|
|
||||||
|
|
||||||
return \array_slice($bookings, 0, $limit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -76,33 +76,4 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="pt-10">Als Nächstes</h2>
|
|
||||||
|
|
||||||
{% if upcoming is empty %}
|
|
||||||
<p class="text-sm text-gray-500">Nichts gebucht.</p>
|
|
||||||
{% else %}
|
|
||||||
<ul class="divide-y divide-gray-200 border-y border-gray-200">
|
|
||||||
{% for booking in upcoming %}
|
|
||||||
<li class="flex items-center justify-between gap-4 py-3">
|
|
||||||
<div>
|
|
||||||
<div class="font-semibold">
|
|
||||||
{{ booking.date|format_datetime(pattern: 'EEEE, d. MMMM') }}
|
|
||||||
<span class="font-normal text-gray-500">· {{ booking.timeRange }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-sm text-gray-500">
|
|
||||||
{{ booking.resource.type.label }} · {{ booking.resource.label }}
|
|
||||||
{% if booking.partOfSeries %}
|
|
||||||
<span class="badge bg-gray-100 text-gray-600 ml-1">Serie</span>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a class="text-sm underline shrink-0"
|
|
||||||
href="{{ path('app_board', { type: booking.resource.type.value, date: booking.date|date('Y-m-d') }) }}">
|
|
||||||
Im Plan
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in new issue
Block a user