WIP: Implement admin dashboard

This commit is contained in:
Björn Fromme committed 2023-10-22 17:05:43 +02:00
1 parent 38d6fafcb2
commit 91f0f76ccc
15 files changed
+280 -4

No files matched your search

+32
View File
@@ -72,4 +72,36 @@ class ApplicationRepository extends ServiceEntityRepository
->getResult()
;
}
public function getNew(int $limit = 5): array
{
$qb = $this->createQueryBuilder('application');
return $qb
->select('application', 'assignment', 'destination', 'job_profile', 'teamer')
->innerJoin('application.assignment', 'assignment')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->innerJoin('application.teamer', 'teamer')
->where($qb->expr()->neq('application.status', ':status'))
->orderBy('application.createdAt', 'DESC')
->setParameter('status', Application::STATUS_REJECTED)
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
public function getCountByStatus(string $status): ?int
{
$qb = $this->createQueryBuilder('application');
return $qb
->select($qb->expr()->count('application'))
->where($qb->expr()->eq('application.status', ':status'))
->setParameter('status', $status)
->getQuery()
->getSingleScalarResult()
;
}
}
+16
View File
@@ -121,4 +121,20 @@ class AssignmentRepository extends ServiceEntityRepository
return $options;
}
public function getNew(int $limit = 5): array
{
$qb = $this->createQueryBuilder('assignment');
return $qb
->select('assignment', 'destination', 'job_profile', 'owner')
->innerJoin('assignment.destination', 'destination')
->innerJoin('assignment.jobProfile', 'job_profile')
->innerJoin('assignment.owner', 'owner')
->orderBy('assignment.createdAt', 'DESC')
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
}
+13
View File
@@ -65,4 +65,17 @@ class AvailabilityRepository extends ServiceEntityRepository
->getResult()
;
}
public function getNew(int $limit = 5): array
{
$qb = $this->createQueryBuilder('availability');
return $qb
->where($qb->expr()->isNotNull('availability.owner'))
->orderBy('availability.createdAt', 'DESC')
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
}
+41
View File
@@ -6,6 +6,7 @@ use App\Entity\Upload;
use App\Repository\Traits\QueryHelperTrait;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\Persistence\ManagerRegistry;
/**
@@ -83,4 +84,44 @@ class UploadRepository extends ServiceEntityRepository
->getQuery()
;
}
public function getNew(int $limit = 5): array
{
$qb = $this->createQueryBuilder('upload');
return $qb
->select('upload', 'owner', 'teamer', 'disposition', 'assignment')
->innerJoin('upload.owner', 'owner')
->innerJoin('owner.teamer', 'teamer')
->leftJoin('upload.disposition', 'disposition')
->leftJoin('disposition.assignment', 'assignment')
->where($qb->expr()->andX(
$qb->expr()->in('upload.type', ':type'),
$qb->expr()->in('upload.status', ':status')
))
->orderBy('upload.createdAt', 'DESC')
->setParameter('type', [Upload::TYPE_CONTRACT, Upload::TYPE_INVOICE])
->setParameter('status', [Upload::STATUS_NEW, Upload::STATUS_PENDING])
->setMaxResults($limit)
->getQuery()
->getResult()
;
}
public function getCountByStatus(string $status): ?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.status', ':status')
))
->setParameter('type', [Upload::TYPE_CONTRACT, Upload::TYPE_INVOICE])
->setParameter('status', $status)
->getQuery()
->getSingleScalarResult()
;
}
}