feat: add admin views, a booking horizon and confirmation modals
Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
8caf618950
commit
1a3640b15c
27 files changed
+1269
-62
No files matched your search
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\BookingSeries;
|
||||
use App\Entity\ResourceType;
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
@@ -24,15 +25,38 @@ class BookingSeriesRepository extends ServiceEntityRepository
|
||||
*/
|
||||
public function findActiveForUser(User $user, \DateTimeImmutable $on): array
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->addSelect('r')
|
||||
return $this->findActive($on, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every series still running on the given day, optionally narrowed to one person or one kind
|
||||
* of resource. The admin list is the caller that needs it across everybody.
|
||||
*
|
||||
* The user is eager-selected because the admin list names the holder of every row -- without
|
||||
* it the page fires a query per series.
|
||||
*
|
||||
* @return list<BookingSeries>
|
||||
*/
|
||||
public function findActive(\DateTimeImmutable $on, ?User $user = null, ?ResourceType $type = null): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('s')
|
||||
->addSelect('u', 'r', 'g')
|
||||
->join('s.user', 'u')
|
||||
->join('s.resource', 'r')
|
||||
->andWhere('s.user = :user')
|
||||
->leftJoin('r.group', 'g')
|
||||
->andWhere('s.endDate >= :on')
|
||||
->setParameter('user', $user)
|
||||
->setParameter('on', $on->setTime(0, 0))
|
||||
->orderBy('s.startDate', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
->addOrderBy('u.name', 'ASC');
|
||||
|
||||
if (null !== $user) {
|
||||
$qb->andWhere('s.user = :user')->setParameter('user', $user);
|
||||
}
|
||||
|
||||
if (null !== $type) {
|
||||
$qb->andWhere('r.type = :type')->setParameter('type', $type);
|
||||
}
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user