From 54e64597e3563aa3f693ccd9f9d844c22ad21e15 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Fri, 26 Jan 2024 10:45:58 +0100 Subject: [PATCH] created partials --- .idea/dataSources.xml | 4 +- src/Enum/ErrorMessages.php | 2 +- src/Service/PrinterService.php | 5 +- templates/base.html.twig | 4 +- templates/frontend/index.html.twig | 201 +++++++++++++++--- .../frontend/partials/_createModal.html.twig | 35 +++ .../frontend/partials/_deleteModal.html.twig | 17 ++ .../frontend/partials/_editModal.html.twig | 34 +++ .../frontend/partials/_viewModal.html.twig | 25 +++ 9 files changed, 296 insertions(+), 31 deletions(-) create mode 100644 templates/frontend/partials/_createModal.html.twig create mode 100644 templates/frontend/partials/_deleteModal.html.twig create mode 100644 templates/frontend/partials/_editModal.html.twig create mode 100644 templates/frontend/partials/_viewModal.html.twig diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 64a9475..a97d305 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -1,13 +1,13 @@ - + mariadb true true DDEV generated data source org.mariadb.jdbc.Driver - jdbc:mariadb://127.0.0.1:32794/db?user=db&password=db + jdbc:mariadb://127.0.0.1:12526/db?user=db&password=db $ProjectFileDir$ diff --git a/src/Enum/ErrorMessages.php b/src/Enum/ErrorMessages.php index 8470652..93abe60 100644 --- a/src/Enum/ErrorMessages.php +++ b/src/Enum/ErrorMessages.php @@ -1,4 +1,4 @@ -serializer->deserialize($jsonString, Printer::class, 'json'); + $this->entityManager->persist($printer); $this->entityManager->flush(); @@ -40,9 +41,9 @@ class PrinterService $jsonArray = json_decode($json, true); $printer->setName($jsonArray['name'] ?? $printer->getName()); - $printer->setPrice($jsonArray['price'] ?? $printer->getPrice()); + $printer->setPrice((float)($jsonArray['price'] ?? $printer->getPrice())); $printer->setBuildVolume($jsonArray['build_volume'] ?? $printer->getBuildVolume()); - $printer->setMaxSpeed($jsonArray['max_speed'] ?? $printer->getMaxSpeed()); + $printer->setMaxSpeed((float)($jsonArray['max_speed'] ?? $printer->getMaxSpeed())); $this->entityManager->flush(); diff --git a/templates/base.html.twig b/templates/base.html.twig index 67598ac..a9e9d71 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -4,13 +4,15 @@ {% block title %}Welcome!{% endblock %} + + {% block stylesheets %} {% endblock %} {% block javascripts %} {% endblock %} - + {% block body %}{% endblock %} diff --git a/templates/frontend/index.html.twig b/templates/frontend/index.html.twig index d8ca910..7a90719 100644 --- a/templates/frontend/index.html.twig +++ b/templates/frontend/index.html.twig @@ -2,56 +2,207 @@ {% block javascripts %} {% endblock %} {% block body %} -

Printers

- - - - - - - - - - - +
+

Printers

+ +
NamePriceBuild VolumeMax SpeedActions
+ + + + + + + + + + - -
NamePriceBuild VolumeMax SpeedActions
- + {% include "frontend/partials/_deleteModal.html.twig" %} + {% include "frontend/partials/_viewModal.html.twig" %} + {% include "frontend/partials/_createModal.html.twig" %} + {% include "frontend/partials/_editModal.html.twig" %} {% endblock %} \ No newline at end of file diff --git a/templates/frontend/partials/_createModal.html.twig b/templates/frontend/partials/_createModal.html.twig new file mode 100644 index 0000000..a86cee4 --- /dev/null +++ b/templates/frontend/partials/_createModal.html.twig @@ -0,0 +1,35 @@ + + \ No newline at end of file diff --git a/templates/frontend/partials/_deleteModal.html.twig b/templates/frontend/partials/_deleteModal.html.twig new file mode 100644 index 0000000..baeed63 --- /dev/null +++ b/templates/frontend/partials/_deleteModal.html.twig @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/templates/frontend/partials/_editModal.html.twig b/templates/frontend/partials/_editModal.html.twig new file mode 100644 index 0000000..b565380 --- /dev/null +++ b/templates/frontend/partials/_editModal.html.twig @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/templates/frontend/partials/_viewModal.html.twig b/templates/frontend/partials/_viewModal.html.twig new file mode 100644 index 0000000..d049888 --- /dev/null +++ b/templates/frontend/partials/_viewModal.html.twig @@ -0,0 +1,25 @@ + \ No newline at end of file