feat: dedicated dashboard widgets for contracts and invoices

This commit is contained in:
Björn Fromme
2025-01-15 16:17:55 +01:00
parent 6af42e5703
commit b62cf18ede
5 changed files with 194 additions and 97 deletions
+6 -7
View File
@@ -147,7 +147,7 @@ class UploadRepository extends ServiceEntityRepository
return $qb->getQuery();
}
public function getNew(int $limit = 5): array
public function getNewByType(string $type): array
{
$qb = $this->createQueryBuilder('upload');
@@ -158,29 +158,28 @@ class UploadRepository extends ServiceEntityRepository
->leftJoin('upload.disposition', 'disposition')
->leftJoin('disposition.assignment', 'assignment')
->where($qb->expr()->andX(
$qb->expr()->in('upload.type', ':type'),
$qb->expr()->eq('upload.type', ':type'),
$qb->expr()->in('upload.status', ':status')
))
->orderBy('upload.createdAt', 'DESC')
->setParameter('type', [Upload::TYPE_CONTRACT, Upload::TYPE_INVOICE])
->setParameter('type', $type)
->setParameter('status', [Upload::STATUS_NEW, Upload::STATUS_PENDING])
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
public function getCountByStatus(string $status): ?int
public function getCountByStatusAndType(string $status, string $type): ?int
{
$qb = $this->createQueryBuilder('upload');
return $qb
->select($qb->expr()->count('upload'))
->where($qb->expr()->andX(
$qb->expr()->in('upload.type', ':type'),
$qb->expr()->eq('upload.type', ':type'),
$qb->expr()->eq('upload.status', ':status')
))
->setParameter('type', [Upload::TYPE_CONTRACT, Upload::TYPE_INVOICE])
->setParameter('type', $type)
->setParameter('status', $status)
->getQuery()
->getSingleScalarResult()