✨ feat(ValidateAdvertController): Valide les publicités et envoie un événement.
🐛 fix(ShareController): Corrige la condition d'environnement pour l'URL de base. ✨ feat(share.twig): Affiche l'URL de partage avec la base correcte.
This commit is contained in:
@@ -4,16 +4,32 @@ namespace App\Controller\Artemis\Intranet;
|
||||
|
||||
use App\Entity\AvisPaymentState;
|
||||
use App\Repository\AvisPaymentStateRepository;
|
||||
use App\Service\Customer\Billing\CreateAvisEventSend;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class ValidateAdvertController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/artemis/intranet/validateAdvert', name: 'artemis_intranet_validateAdvert', methods: ['GET', 'POST'])]
|
||||
public function validateAdvert(AvisPaymentStateRepository $avisPaymentStateRepository)
|
||||
public function validateAdvert(EntityManagerInterface $entityManager,EventDispatcherInterface $eventDispatcher,AvisPaymentStateRepository $avisPaymentStateRepository,Request $request)
|
||||
{
|
||||
/** @var AvisPaymentState[] $list */
|
||||
$list = $avisPaymentStateRepository->findBy(['isValidated'=>false]);
|
||||
if($request->query->has('id')){
|
||||
$avisPaymentState = $avisPaymentStateRepository->find($request->query->get('id'));
|
||||
$avisPaymentState->setIsValidated(true);
|
||||
$avisPaymentState->setIsFirstSend(true);
|
||||
$entityManager->persist($avisPaymentState);
|
||||
$entityManager->flush();
|
||||
|
||||
$evDevis = new CreateAvisEventSend($avisPaymentState->getAvisPayment());
|
||||
$eventDispatcher->dispatch($evDevis);
|
||||
|
||||
return $this->redirectToRoute('artemis_intranet_validateAdvert');
|
||||
}
|
||||
|
||||
return $this->render('artemis/intranet/validateAdvert.twig', [
|
||||
"listing" => $list
|
||||
|
||||
@@ -27,7 +27,7 @@ class ShareController extends AbstractController
|
||||
#[Route('/artemis/tools/share', name: 'artemis_tools_share', methods: ['GET', 'POST'])]
|
||||
public function toolsShare(TempFileRepository $tempFileRepository,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if($_ENV['APP_ENV'] !== 'DEV') {
|
||||
if($_ENV['APP_ENV'] != "dev") {
|
||||
$baseUrl = "https://partage.siteconseil.fr";
|
||||
} else {
|
||||
$baseUrl = "http://esyweb.local";
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<div class="mt-2 text-center">
|
||||
<p class="text-sm text-gray-500 dark:text-gray-400 mb-4">Scannez pour accéder au fichier</p>
|
||||
<img src="{{ path('artemis_tools_share_qrcode', {'id': file.id}) }}" alt="QR Code du fichier {{ file.name }}" class="zc mx-auto border dark:border-gray-700 p-2 w-40 h-40 object-contain">
|
||||
<p class="mt-3 text-xs text-gray-400 dark:text-gray-500 truncate">{{ url('share', {'id': file.id}) }}</p>
|
||||
<p class="mt-3 text-xs text-gray-400 dark:text-gray-500 truncate">{{ baseUrl }}{{ path('share', {'id': file.id}) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user