<?php
namespace App\Controller;
use App\Repository\Company\CompanyRepository;
use App\Security\SecurityWrapper;
use App\Utils\Payment\Payment;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @IsGranted("IS_AUTHENTICATED_FULLY")
*/
class FeedController extends AbstractController
{
protected $companyRepository;
/**
* @var Payment
*/
protected $paymentService;
public function __construct(CompanyRepository $companyRepository, Payment $paymentService )
{
$this->companyRepository = $companyRepository;
$this->paymentService = $paymentService;
}
/**
* @Route("/feed", name="feed")
*/
public function index()
{
$company = $this->companyRepository->findByOwner($this->getUser()->getSlug());
// if(empty($this->getUser()->getDepartment()) OR empty($this->getUser()->getSections())){
// return $this->redirectToRoute('company.request.panding-department');
// }elseif(empty($this->getUser()->getAccountVerification()->getAccountVerified())){
// return $this->redirectToRoute('auth.checking');
// }elseif(!empty($company) && empty($company->getAccountVerification()->getAccountVerified())){
// return $this->redirectToRoute('company.checking.email',["slug" => $company->getSlug()]);
// }
if(empty($this->getUser()->getDepartment()) OR empty($this->getUser()->getSections())){
return $this->redirectToRoute('company.request.panding-department');
}elseif(!empty($company) && empty($company->getAccountVerification()->getAccountVerified())){
return $this->redirectToRoute('company.checking.email',["slug" => $company->getSlug()]);
}
// elseif(empty($this->getUser()->getProject())){
// return $this->redirectToRoute('auth.checking.check-project',["slug" => $this->getUser()->getSlug()]);
// }
$summaryCDF = $this->paymentService->summaryContributionsCDFByCompany();
$summaryUSD = $this->paymentService->summaryContributionsUSDByCompany();
return $this->render('feed/index.html.twig', [
'controller_name' => 'FeedController',
'summaryCDF' => $summaryCDF,
'summaryUSD' => $summaryUSD,
//
'app_cash_path' => $this->getParameter("app_cash_path"),
'app_accounting_path' => $this->getParameter("app_accounting_path"),
'app_baadhi_path' => $this->getParameter("app_baadhi_path"),
]);
}
}