diff --git a/.idea/HegreEtConfort.iml b/.idea/HegreEtConfort.iml index 709c049..9f30260 100644 --- a/.idea/HegreEtConfort.iml +++ b/.idea/HegreEtConfort.iml @@ -139,5 +139,6 @@ + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index f782d7a..d95fc33 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,11 +1,11 @@ - + postgresql true org.postgresql.Driver - jdbc:postgresql://localhost:5433/HegreEtConfort + jdbc:postgresql://localhost:5432/hegreetconfort $ProjectFileDir$ diff --git a/src/Controller/InterventionController.php b/src/Controller/InterventionController.php index 7a1d1fd..8f9e352 100644 --- a/src/Controller/InterventionController.php +++ b/src/Controller/InterventionController.php @@ -7,6 +7,7 @@ use App\Form\InterventionType; use App\Repository\InterventionRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; @@ -106,4 +107,25 @@ final class InterventionController extends AbstractController return $this->redirectToRoute('app_intervention_index', [], Response::HTTP_SEE_OTHER); } + + + + #[Route('/api/interventions', name: 'api_interventions')] + public function apiInterventions(InterventionRepository $repo): JsonResponse + { + $interventions = $repo->findAll(); + + $events = []; + + foreach ($interventions as $intervention) { + $events[] = [ + 'id' => $intervention->getId(), + 'title' => $intervention->getWording(), // ou getTitre() selon ton entité + 'start' => $intervention->getDate()->format('Y-m-d\TH:i:s'), + // ajoute 'end' si tu veux une durée + ]; + } + + return $this->json($events); + } } diff --git a/src/Entity/Intervention.php b/src/Entity/Intervention.php index b014c3c..4ced921 100644 --- a/src/Entity/Intervention.php +++ b/src/Entity/Intervention.php @@ -1,4 +1,175 @@ stocks = new ArrayCollection(); +// } +////>>>>>>> 4fc91211f0d814453d2ed97caf6a1d94d709058e +// +// public function getId(): ?int +// { +// return $this->id; +// } +// +// public function getWording(): ?string +// { +// return $this->Wording; +// } +// +// public function setWording(string $Wording): static +// { +// $this->Wording = $Wording; +// return $this; +// } +// +// public function getTimestamp(): ?\DateTimeInterface +// { +// return $this->Timestamp; +// } +// +// public function setTimestamp(\DateTimeInterface $Timestamp): static +// { +// $this->Timestamp = $Timestamp; +// return $this; +// } +// +// public function getDescription(): ?string +// { +// return $this->Description; +// } +// +// public function setDescription(string $Description): static +// { +// $this->Description = $Description; +// return $this; +// } +// +// public function getAddress(): ?string +// { +// return $this->Address; +// } +// +// public function setAddress(string $Address): static +// { +// $this->Address = $Address; +// return $this; +// } +// +// public function getStatus(): ?string +// { +// return $this->Status; +// } +// +// public function setStatus(string $Status): static +// { +// $this->Status = $Status; +// return $this; +// } +// +// public function getUser(): ?Utilisateur +// { +// return $this->user; +// } +// +// public function setUser(?Utilisateur $user): static +// { +// $this->user = $user; +// return $this; +// } +// +// public function getFault(): ?Fault +// { +// return $this->fault; +// } +// +// public function setFault(?Fault $fault): static +// { +// $this->fault = $fault; +// return $this; +// } +// +// public function getVehicle(): ?Vehicle +// { +// return $this->vehicle; +// } +// +// public function setVehicle(?Vehicle $vehicle): static +// { +// $this->vehicle = $vehicle; +// return $this; +// } +// +// public function getStocks(): Collection +// { +// return $this->stocks; +// } +// +// public function addStock(Stock $stock): static +// { +// if (!$this->stocks->contains($stock)) { +// $this->stocks[] = $stock; +// } +// return $this; +// } +// +// public function removeStock(Stock $stock): static +// { +// $this->stocks->removeElement($stock); +// return $this; +// } +//} + namespace App\Entity; @@ -31,11 +202,6 @@ class Intervention #[ORM\Column(length: 255)] private ?string $Status = null; -<<<<<<< HEAD -// #[ORM\ManyToOne(targetEntity: Vehicule::class)] -// private ?Vehicule $vehicule = null; - -======= #[ORM\ManyToOne(inversedBy: 'interventions')] #[ORM\JoinColumn(nullable: false)] private ?Utilisateur $user = null; @@ -51,11 +217,14 @@ class Intervention #[ORM\JoinTable(name: "intervention_stock")] private Collection $stocks; + // Ajout de la propriété StartDate + #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] + private ?\DateTimeInterface $startDate = null; + public function __construct() { $this->stocks = new ArrayCollection(); } ->>>>>>> 4fc91211f0d814453d2ed97caf6a1d94d709058e public function getId(): ?int { @@ -168,4 +337,23 @@ class Intervention $this->stocks->removeElement($stock); return $this; } + + // Ajout de la méthode getStartDate + public function getStartDate(): ?\DateTimeInterface + { + return $this->startDate; + } + + public function setStartDate(\DateTimeInterface $startDate): static + { + $this->startDate = $startDate; + return $this; + } + + // Ajout de la méthode getTitle() + public function getTitle(): ?string + { + return $this->Wording; + } } + diff --git a/templates/calendrier/index.html.twig b/templates/calendrier/index.html.twig index e240022..a4fa396 100644 --- a/templates/calendrier/index.html.twig +++ b/templates/calendrier/index.html.twig @@ -5,19 +5,38 @@ {% block body %}

📅 Calendrier des interventions

+ ➕ Ajouter une intervention +
+ + + +{#
#} + +{# #} {% endblock %} diff --git a/templates/intervention/index.html.twig b/templates/intervention/index.html.twig index 0a7b4b4..cef392d 100644 --- a/templates/intervention/index.html.twig +++ b/templates/intervention/index.html.twig @@ -50,4 +50,8 @@ Créer une nouvelle intervention + + {% endblock %} diff --git a/templates/intervention/new.html.twig b/templates/intervention/new.html.twig index b76a014..7a7bcdf 100644 --- a/templates/intervention/new.html.twig +++ b/templates/intervention/new.html.twig @@ -5,9 +5,7 @@ {% block body %}

➕ Créer une nouvelle intervention

- {{ include('intervention/_form.html.twig') }} - -<<<<<<< HEAD +{#<<<<<<< HEAD#}
{# #} @@ -59,14 +57,15 @@ {# #} {{ include('intervention/_form.html.twig') }} - - Retour à la liste
-======= +{#=======#} + {% endblock %} ->>>>>>> 4fc91211f0d814453d2ed97caf6a1d94d709058e +{#>>>>>>> 4fc91211f0d814453d2ed97caf6a1d94d709058e#}