feat: display new and pending feedbacks on admin dashboard
This commit is contained in:
@@ -3,10 +3,12 @@
|
|||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
use App\Entity\Application;
|
use App\Entity\Application;
|
||||||
|
use App\Entity\Feedback;
|
||||||
use App\Entity\Upload;
|
use App\Entity\Upload;
|
||||||
use App\Repository\ApplicationRepository;
|
use App\Repository\ApplicationRepository;
|
||||||
use App\Repository\AssignmentRepository;
|
use App\Repository\AssignmentRepository;
|
||||||
use App\Repository\AvailabilityRepository;
|
use App\Repository\AvailabilityRepository;
|
||||||
|
use App\Repository\FeedbackRepository;
|
||||||
use App\Repository\UploadRepository;
|
use App\Repository\UploadRepository;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -17,6 +19,7 @@ class IndexController extends AbstractController
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ApplicationRepository $applicationRepository,
|
private readonly ApplicationRepository $applicationRepository,
|
||||||
|
private readonly FeedbackRepository $feedbackRepository,
|
||||||
private readonly AssignmentRepository $assignmentRepository,
|
private readonly AssignmentRepository $assignmentRepository,
|
||||||
private readonly AvailabilityRepository $availabilityRepository,
|
private readonly AvailabilityRepository $availabilityRepository,
|
||||||
private readonly UploadRepository $uploadRepository
|
private readonly UploadRepository $uploadRepository
|
||||||
@@ -31,6 +34,9 @@ class IndexController extends AbstractController
|
|||||||
$newApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
$newApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_NEW);
|
||||||
$pendingApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
$pendingApplicationsCount = $this->applicationRepository->getCountByStatus(Application::STATUS_PENDING);
|
||||||
|
|
||||||
|
$feedbacks = $this->feedbackRepository->getNew();
|
||||||
|
$pendingFeedbacksCount = $this->feedbackRepository->getCountByStatus(Feedback::STATUS_NEW);
|
||||||
|
|
||||||
$assignments = $this->assignmentRepository->getNew();
|
$assignments = $this->assignmentRepository->getNew();
|
||||||
|
|
||||||
$availabilities = $this->availabilityRepository->getNew();
|
$availabilities = $this->availabilityRepository->getNew();
|
||||||
@@ -43,6 +49,8 @@ class IndexController extends AbstractController
|
|||||||
'applications' => $applications,
|
'applications' => $applications,
|
||||||
'newApplicationsCount' => $newApplicationsCount,
|
'newApplicationsCount' => $newApplicationsCount,
|
||||||
'pendingApplicationsCount' => $pendingApplicationsCount,
|
'pendingApplicationsCount' => $pendingApplicationsCount,
|
||||||
|
'feedbacks' => $feedbacks,
|
||||||
|
'pendingFeedbacksCount' => $pendingFeedbacksCount,
|
||||||
'assignments' => $assignments,
|
'assignments' => $assignments,
|
||||||
'availabilities' => $availabilities,
|
'availabilities' => $availabilities,
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
|
|||||||
@@ -21,21 +21,30 @@ class FeedbackRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Feedback::class);
|
parent::__construct($registry, Feedback::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(Feedback $entity, bool $flush = false): void
|
public function getNew(int $limit = 5): array
|
||||||
{
|
{
|
||||||
$this->getEntityManager()->persist($entity);
|
$qb = $this->createQueryBuilder('feedback');
|
||||||
|
|
||||||
if ($flush) {
|
return $qb
|
||||||
$this->getEntityManager()->flush();
|
->select('feedback', 'teamer')
|
||||||
}
|
->innerJoin('feedback.teamer', 'teamer')
|
||||||
|
->orderBy('feedback.createdAt', 'DESC')
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove(Feedback $entity, bool $flush = false): void
|
public function getCountByStatus(string $status): int
|
||||||
{
|
{
|
||||||
$this->getEntityManager()->remove($entity);
|
$qb = $this->createQueryBuilder('feedback');
|
||||||
|
|
||||||
if ($flush) {
|
return $qb
|
||||||
$this->getEntityManager()->flush();
|
->select($qb->expr()->count('feedback'))
|
||||||
}
|
->where($qb->expr()->eq('feedback.status', ':status'))
|
||||||
|
->setParameter('status', $status)
|
||||||
|
->getQuery()
|
||||||
|
->getSingleScalarResult()
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,5 +110,31 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
|
||||||
|
<h2 class="font-bold text-lg pb-2">
|
||||||
|
Neue Feedbacks
|
||||||
|
</h2>
|
||||||
|
<h3 class="font-bold pb-2">
|
||||||
|
{{ pendingFeedbacksCount }} freizugeben
|
||||||
|
</h3>
|
||||||
|
<ul class="divide-y divide-gray-200">
|
||||||
|
{% for feedback in feedbacks %}
|
||||||
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
|
<a href="#" class="flex items-center space-x-1 truncate">
|
||||||
|
{{ icon('feedback', 'w-4 h-4 shrink-0') }}
|
||||||
|
<span class="whitespace-nowrap">{{ feedback.teamer }}</span>
|
||||||
|
{{ _self.dot() }}
|
||||||
|
<span class="whitespace-nowrap">{{ feedback.destinationName }}</span>
|
||||||
|
{{ _self.dot() }}
|
||||||
|
<span class="whitespace-nowrap">{{ feedback.jobProfileName }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="py-2 first:pt-0 last:pb-0">
|
||||||
|
-
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user