From 6a429984d1d16bcc6edb24c4e7f5e57f4e83f19c Mon Sep 17 00:00:00 2001 From: Olivier PARPAILLON Date: Wed, 27 Nov 2024 13:31:25 +0100 Subject: [PATCH] better dashboard --- .idea/php.xml | 2 + .idea/sortir.iml | 3 +- composer.json | 3 +- composer.lock | 175 ++++++++++++++++++++++++++- config/bundles.php | 1 + src/Controller/ProfileController.php | 9 +- symfony.lock | 9 ++ templates/main/header.html.twig | 4 +- templates/profile/view.html.twig | 2 +- 9 files changed, 201 insertions(+), 7 deletions(-) diff --git a/.idea/php.xml b/.idea/php.xml index 855e17f..7bb38d3 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -148,6 +148,8 @@ + + diff --git a/.idea/sortir.iml b/.idea/sortir.iml index cf93744..fb09148 100644 --- a/.idea/sortir.iml +++ b/.idea/sortir.iml @@ -3,7 +3,6 @@ - @@ -141,6 +140,8 @@ + + diff --git a/composer.json b/composer.json index 57d57ff..e537aac 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,8 @@ "symfony/yaml": "6.4.*", "symfonycasts/verify-email-bundle": "^1.17", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "vich/uploader-bundle": "*" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 692f259..e135451 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e172d72b9dfb496cd9861e9141efa997", + "content-hash": "e11349ecdee967fa84856ce5d140b441", "packages": [ { "name": "composer/semver", @@ -1437,6 +1437,70 @@ "abandoned": true, "time": "2015-05-29T06:29:14+00:00" }, + { + "name": "jms/metadata", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/metadata.git", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "reference": "7ca240dcac0c655eb15933ee55736ccd2ea0d7a6", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "require-dev": { + "doctrine/cache": "^1.0", + "doctrine/coding-standard": "^8.0", + "mikey179/vfsstream": "^1.6.7", + "phpunit/phpunit": "^8.5|^9.0", + "psr/container": "^1.0|^2.0", + "symfony/cache": "^3.1|^4.0|^5.0", + "symfony/dependency-injection": "^3.1|^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Metadata\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "Class/method/property metadata management in PHP", + "keywords": [ + "annotations", + "metadata", + "xml", + "yaml" + ], + "support": { + "issues": "https://github.com/schmittjoh/metadata/issues", + "source": "https://github.com/schmittjoh/metadata/tree/2.8.0" + }, + "time": "2023-02-15T13:44:18+00:00" + }, { "name": "monolog/monolog", "version": "3.8.0", @@ -7765,6 +7829,115 @@ ], "time": "2024-11-17T15:59:19+00:00" }, + { + "name": "vich/uploader-bundle", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/dustin10/VichUploaderBundle.git", + "reference": "7925bea64df77991caacf8967f602efb268a3724" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/7925bea64df77991caacf8967f602efb268a3724", + "reference": "7925bea64df77991caacf8967f602efb268a3724", + "shasum": "" + }, + "require": { + "doctrine/persistence": "^3.0", + "ext-simplexml": "*", + "jms/metadata": "^2.4", + "php": "^8.1", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher-contracts": "^3.1", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/mime": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0", + "symfony/string": "^5.4 || ^6.0 || ^7.0" + }, + "conflict": { + "doctrine/annotations": "<1.12", + "league/flysystem": "<2.0" + }, + "require-dev": { + "dg/bypass-finals": "^1.8", + "doctrine/doctrine-bundle": "^2.7", + "doctrine/mongodb-odm": "^2.4", + "doctrine/orm": "^2.13", + "ext-sqlite3": "*", + "knplabs/knp-gaufrette-bundle": "dev-master", + "league/flysystem-bundle": "^2.4 || ^3.0", + "league/flysystem-memory": "^2.0 || ^3.0", + "matthiasnoback/symfony-dependency-injection-test": "^5.1", + "mikey179/vfsstream": "^1.6.11", + "phpunit/phpunit": "^9.6", + "symfony/asset": "^5.4 || ^6.0 || ^7.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0", + "symfony/form": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^7.0", + "symfony/security-csrf": "^5.4 || ^6.0 || ^7.0", + "symfony/translation": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "yoast/phpunit-polyfills": "^2.0" + }, + "suggest": { + "doctrine/annotations": "If you use doctrine/doctrine-bundle >2.7, this package is required to use annotations", + "doctrine/doctrine-bundle": "For integration with Doctrine", + "doctrine/mongodb-odm-bundle": "For integration with Doctrine ODM", + "doctrine/orm": "For integration with Doctrine ORM", + "doctrine/phpcr-odm": "For integration with Doctrine PHPCR", + "knplabs/knp-gaufrette-bundle": "For integration with Gaufrette", + "league/flysystem-bundle": "For integration with Flysystem", + "liip/imagine-bundle": "To generate image thumbnails", + "oneup/flysystem-bundle": "For integration with Flysystem", + "symfony/asset": "To generate better links", + "symfony/form": "To handle uploads in forms", + "symfony/yaml": "To use YAML mapping" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Vich\\UploaderBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dustin Dobervich", + "email": "ddobervich@gmail.com" + } + ], + "description": "Ease file uploads attached to entities", + "homepage": "https://github.com/dustin10/VichUploaderBundle", + "keywords": [ + "file uploads", + "upload" + ], + "support": { + "issues": "https://github.com/dustin10/VichUploaderBundle/issues", + "source": "https://github.com/dustin10/VichUploaderBundle/tree/v2.4.3" + }, + "time": "2024-11-18T06:29:52+00:00" + }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/config/bundles.php b/config/bundles.php index f9466c1..5440e3a 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -16,4 +16,5 @@ return [ SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle::class => ['all' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], Symfony\UX\Turbo\TurboBundle::class => ['all' => true], + Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true], ]; diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 1d88b23..5ecbe10 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -4,6 +4,7 @@ namespace App\Controller; use App\Entity\Participant; use App\Form\ProfileFormType; +use App\Repository\SortieRepository; use App\Service\FileUploader; use App\Form\RegistrationFormType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -18,9 +19,11 @@ class ProfileController extends AbstractController { private FileUploader $fileUploader; private ParticipantRepository $profileRepo; - public function __construct(FileUploader $fileUploader, ParticipantRepository $profileRepo) { + private SortieRepository $sortieRepo; + public function __construct(FileUploader $fileUploader, ParticipantRepository $profileRepo, SortieRepository $sortieRepo) { $this->fileUploader = $fileUploader; $this->profileRepo = $profileRepo; + $this->sortieRepo = $sortieRepo; } #[Route('/profile/{uuid}', name: 'profile_view', methods: ['GET'])] public function viewProfile(string $uuid, ParticipantRepository $profileRepo, TokenStorageInterface $tokenStorage): Response @@ -28,6 +31,8 @@ class ProfileController extends AbstractController $token = $tokenStorage->getToken(); $userConnect = $token?->getUser(); $currentProfile = $profileRepo->findOneBy(['idParticipant' => $uuid]); + $sortiesOrganisation = $this->sortieRepo->findUserOrganisation($userConnect); + $sortiesParticipation =$this->sortieRepo->findUserParticipation($userConnect); if ($userConnect->getIdParticipant() !== $currentProfile->getIdParticipant()) { $isActiveUser = false; } else { @@ -36,6 +41,8 @@ class ProfileController extends AbstractController return $this->render('profile/view.html.twig', [ 'profile' => $currentProfile, 'isActiveUser' => $isActiveUser, + 'sortiesOrganisation' => $sortiesOrganisation, + 'sortiesParticipation' => $sortiesParticipation ]); } diff --git a/symfony.lock b/symfony.lock index b711fb6..c00d57c 100644 --- a/symfony.lock +++ b/symfony.lock @@ -327,5 +327,14 @@ }, "twig/extra-bundle": { "version": "v3.15.0" + }, + "vich/uploader-bundle": { + "version": "2.4", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.13", + "ref": "1b3064c2f6b255c2bc2f56461aaeb76b11e07e36" + } } } diff --git a/templates/main/header.html.twig b/templates/main/header.html.twig index 8bd9e0b..6f0ed9b 100644 --- a/templates/main/header.html.twig +++ b/templates/main/header.html.twig @@ -46,15 +46,15 @@
{% if app.user %}