feat: dedicated dashboard widgets for contracts and invoices
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user