<?php

namespace Modules\Additional\Specifique\Client160\Modules\Fournisseur\Controller;

use Helpers\Ariane\Ariane;
use Helpers\Trad\Trad;
use Modules\Additional\Specifique\Client160\Modules\Fournisseur\Service\QualityReviewService;
use Skeleton\Controller\Controller;

class QualityReviewController extends Controller
{
    private QualityReviewService $service;
    // private QualityReview $repository;

    public function init(): void
    {
        $this->service = new QualityReviewService($this->pdo);
        // $this->repository = new QualityReview($this->pdo);
    }

    public function indexAction(): string
    {
        
        $post   = $this->request->getParsedBody();
        $trad = $this->getTranslationService();

        $data = (array)$this->service->getListNonConf($post);

        Ariane::generate(0, $trad->t('Avis qualité'), $post);

        $paginator = new \Helpers\Pagination\Paginator();
        $infopagination = $paginator->generate($data, 0, $post, $this->renderer);

        return $this->renderer->render('@Specifique160.Fournisseur/index', [
            'menuActive'        => 'Fournisseur',
            'menuLeft'          => 'QualityReview',
            'post'              => $post,
            'dataList'          => $data,
            'infoPagination'    => $infopagination,
        ]);
    }
}
