mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
Open modal to select acpw
This commit is contained in:
@@ -11,19 +11,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Form\FindAccompanyingPeriodWorkType;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
class AccompanyingPeriodWorkDuplicateController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, private readonly TranslatorInterface $translator, private readonly SerializerInterface $serializer) {}
|
||||
public function __construct(private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelperInterface $stringHelper) {}
|
||||
|
||||
/**
|
||||
* @ParamConverter("accompanyingPeriodWork", options={"id": "acpw_id"})
|
||||
@@ -35,10 +34,14 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController
|
||||
|
||||
$acpwList = $this->accompanyingPeriodWorkRepository->findByAccompanyingPeriod($accompanyingPeriod);
|
||||
|
||||
$acpwListArray = $this->serializer->normalize($acpwList, 'json', ['groups' => ['read']]);
|
||||
$acpwListJson = json_encode($acpwListArray);
|
||||
|
||||
dump($acpwListJson);
|
||||
$acpwArray = array_map(function ($acpw) {
|
||||
return [
|
||||
'id' => $acpw->getId(),
|
||||
'socialAction' => $this->stringHelper->localize($acpw->getSocialAction()->getTitle()),
|
||||
'start_date' => $acpw->getStartDate(),
|
||||
'end_date' => $acpw->getEndDate(),
|
||||
];
|
||||
}, $acpwList);
|
||||
|
||||
$this->denyAccessUnlessGranted(
|
||||
'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE',
|
||||
@@ -62,7 +65,7 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController
|
||||
|
||||
$direction = $form->get('direction')->getData();
|
||||
|
||||
if ('starting' === $direction) {
|
||||
/* if ('starting' === $direction) {
|
||||
$params = [
|
||||
'acpw1_id' => $acpw->getId(),
|
||||
'acpw2_id' => $acpw2->getId(),
|
||||
@@ -72,14 +75,14 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController
|
||||
'acpw1_id' => $acpw2->getId(),
|
||||
'acpw2_id' => $acpw->getId(),
|
||||
];
|
||||
}
|
||||
}*/
|
||||
|
||||
// return $this->redirectToRoute('chill_person_acpw_duplicate_confirm', $params);
|
||||
}
|
||||
|
||||
return $this->render('@ChillPerson/AccompanyingPeriodWorkDuplicate/assign_acpw_duplicate.html.twig', [
|
||||
'accompanyingCourse' => $acpw->getAccompanyingPeriod(),
|
||||
'acpwListJson' => $acpwListJson,
|
||||
'acpwList' => $acpwArray,
|
||||
'acpw' => $acpw,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
|
Reference in New Issue
Block a user