diff --git a/.env b/.env index 4b1083a..d75a5b7 100644 --- a/.env +++ b/.env @@ -47,4 +47,8 @@ MAILER_URL=null://localhost:465 MAILER_URL=gmail://anis.fetoui@esprit.tn:uomjgxvcysigrmmu@localhost #MAILER_URL=smtp://localhost:465?encryption=ssl&auth_mode=login&username=anis.fetoui@esprit.tn&password=uomjgxvcysigrmmu -###< symfony/swiftmailer-bundle ### \ No newline at end of file +###< symfony/swiftmailer-bundle ### +###> victor-prdh/recaptcha-bundle ### +GOOGLE_RECAPTCHA_SITE_KEY="6LfToh0pAAAAAJ-MhVLxWGvc2J00ETMYKQm7ouYS" +GOOGLE_RECAPTCHA_SECRET_KEY="6LfToh0pAAAAAPbXF-u6uF-MKGHmKGjUEMb7dCBD" +###< victor-prdh/recaptcha-bundle ### diff --git a/composer.json b/composer.json index 4facde9..3dfb54c 100644 --- a/composer.json +++ b/composer.json @@ -7,10 +7,13 @@ "php": ">=7.2.5", "ext-ctype": "*", "ext-iconv": "*", + "bacon/bacon-qr-code": "^2.0", "doctrine/annotations": "^2.0", "doctrine/doctrine-bundle": "^2.10", "doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/orm": "^2.16", + "endroid/qr-code": "^5.0", + "endroid/qr-code-bundle": "^5.0", "knplabs/knp-paginator-bundle": "^5.9", "phpdocumentor/reflection-docblock": "^5.3", "phpoffice/phpspreadsheet": "1.29.0", @@ -44,14 +47,16 @@ "symfony/web-link": "5.4.*", "symfony/yaml": "5.4.*", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "victor-prdh/recaptcha-bundle": "^1.7" }, "config": { "allow-plugins": { "composer/package-versions-deprecated": true, "php-http/discovery": true, "symfony/flex": true, - "symfony/runtime": true + "symfony/runtime": true, + "endroid/installer": true }, "optimize-autoloader": true, "preferred-install": { diff --git a/composer.lock b/composer.lock index 39fdf95..224cfad 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,112 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "095d2003ddd43a47fd35d3e0354d17be", + "content-hash": "a7ba81f6ed96d9545b33bcf840e346bd", "packages": [ + { + "name": "bacon/bacon-qr-code", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/Bacon/BaconQrCode.git", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22", + "shasum": "" + }, + "require": { + "dasprid/enum": "^1.0.3", + "ext-iconv": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phly/keep-a-changelog": "^2.1", + "phpunit/phpunit": "^7 | ^8 | ^9", + "spatie/phpunit-snapshot-assertions": "^4.2.9", + "squizlabs/php_codesniffer": "^3.4" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "type": "library", + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "BaconQrCode is a QR code generator for PHP.", + "homepage": "https://github.com/Bacon/BaconQrCode", + "support": { + "issues": "https://github.com/Bacon/BaconQrCode/issues", + "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8" + }, + "time": "2022-12-07T17:46:57+00:00" + }, + { + "name": "dasprid/enum", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/DASPRiD/Enum.git", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6faf451159fb8ba4126b925ed2d78acfce0dc016", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016", + "shasum": "" + }, + "require": { + "php": ">=7.1 <9.0" + }, + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "PHP 7.1 enum implementation", + "keywords": [ + "enum", + "map" + ], + "support": { + "issues": "https://github.com/DASPRiD/Enum/issues", + "source": "https://github.com/DASPRiD/Enum/tree/1.0.5" + }, + "time": "2023-08-25T16:18:39+00:00" + }, { "name": "doctrine/annotations", "version": "2.0.1", @@ -1473,6 +1577,212 @@ ], "time": "2023-06-01T07:04:22+00:00" }, + { + "name": "endroid/installer", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/endroid/installer.git", + "reference": "308051404c8370b9641cd61d86a464f2c6938265" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/installer/zipball/308051404c8370b9641cd61d86a464f2c6938265", + "reference": "308051404c8370b9641cd61d86a464f2c6938265", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^8.1" + }, + "require-dev": { + "composer/composer": "^2.0", + "endroid/quality": "dev-main" + }, + "suggest": { + "roave/security-advisories": "Avoids installation of package versions with vulnerabilities" + }, + "type": "composer-plugin", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "class": "Endroid\\Installer\\Installer" + }, + "autoload": { + "psr-4": { + "Endroid\\Installer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Composer plugin for installing configuration files", + "support": { + "issues": "https://github.com/endroid/installer/issues", + "source": "https://github.com/endroid/installer/tree/1.4.5" + }, + "funding": [ + { + "url": "https://github.com/endroid", + "type": "github" + } + ], + "time": "2023-11-07T12:11:36+00:00" + }, + { + "name": "endroid/qr-code", + "version": "5.0.2", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code.git", + "reference": "e58d34fa0b86a62696144baba9d80ee98845f957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code/zipball/e58d34fa0b86a62696144baba9d80ee98845f957", + "reference": "e58d34fa0b86a62696144baba9d80ee98845f957", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0.5", + "php": "^8.1" + }, + "conflict": { + "khanamiryan/qrcode-detector-decoder": "^1.0.6" + }, + "require-dev": { + "endroid/quality": "dev-master", + "ext-gd": "*", + "khanamiryan/qrcode-detector-decoder": "^1.0.4||^2.0.2", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "ext-gd": "Enables you to write PNG images", + "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator", + "roave/security-advisories": "Makes sure package versions with known security issues are not installed", + "setasign/fpdf": "Enables you to use the PDF writer" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Endroid\\QrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code", + "homepage": "https://github.com/endroid/qr-code", + "keywords": [ + "code", + "endroid", + "php", + "qr", + "qrcode" + ], + "support": { + "issues": "https://github.com/endroid/qr-code/issues", + "source": "https://github.com/endroid/qr-code/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/endroid", + "type": "github" + } + ], + "time": "2023-10-04T22:55:54+00:00" + }, + { + "name": "endroid/qr-code-bundle", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/endroid/qr-code-bundle.git", + "reference": "9a4e171a44aee363dcaf8def4ddfd999331439fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/endroid/qr-code-bundle/zipball/9a4e171a44aee363dcaf8def4ddfd999331439fa", + "reference": "9a4e171a44aee363dcaf8def4ddfd999331439fa", + "shasum": "" + }, + "require": { + "endroid/installer": "^1.2.2", + "endroid/qr-code": "^5.0", + "php": "^8.1", + "symfony/framework-bundle": "^5.4||^6.4||^7.0", + "symfony/twig-bundle": "^5.4||^6.4||^7.0", + "symfony/yaml": "^5.4||^6.4||^7.0" + }, + "require-dev": { + "endroid/quality": "dev-master" + }, + "suggest": { + "roave/security-advisories": "Avoids installation of package versions with vulnerabilities" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Endroid\\QrCodeBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeroen van den Enden", + "email": "info@endroid.nl" + } + ], + "description": "Endroid QR Code Bundle", + "homepage": "https://github.com/endroid/qr-code-bundle", + "keywords": [ + "bundle", + "code", + "endroid", + "php", + "qr", + "symfony" + ], + "support": { + "issues": "https://github.com/endroid/qr-code-bundle/issues", + "source": "https://github.com/endroid/qr-code-bundle/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/endroid", + "type": "github" + } + ], + "time": "2023-11-07T09:05:08+00:00" + }, { "name": "ezyang/htmlpurifier", "version": "v4.17.0", @@ -1534,6 +1844,58 @@ }, "time": "2023-11-17T15:01:25+00:00" }, + { + "name": "google/recaptcha", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "d59a801e98a4e9174814a6d71bbc268dff1202df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/d59a801e98a4e9174814a6d71bbc268dff1202df", + "reference": "d59a801e98a4e9174814a6d71bbc268dff1202df", + "shasum": "" + }, + "require": { + "php": ">=8" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.14", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "support": { + "forum": "https://groups.google.com/forum/#!forum/recaptcha", + "issues": "https://github.com/google/recaptcha/issues", + "source": "https://github.com/google/recaptcha" + }, + "time": "2023-02-18T17:41:46+00:00" + }, { "name": "knplabs/knp-components", "version": "v3.6.0", @@ -8026,6 +8388,51 @@ ], "time": "2023-10-31T07:58:33+00:00" }, + { + "name": "symfony/twig-pack", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-pack.git", + "reference": "08a73e833e07921c464336deb7630f93e85ef930" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-pack/zipball/08a73e833e07921c464336deb7630f93e85ef930", + "reference": "08a73e833e07921c464336deb7630f93e85ef930", + "shasum": "" + }, + "require": { + "symfony/twig-bundle": "*", + "twig/extra-bundle": "^2.12|^3.0", + "twig/twig": "^2.12|^3.0" + }, + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A Twig pack for Symfony projects", + "support": { + "issues": "https://github.com/symfony/twig-pack/issues", + "source": "https://github.com/symfony/twig-pack/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-19T08:46:41+00:00" + }, { "name": "symfony/validator", "version": "v5.4.31", @@ -8609,6 +9016,57 @@ ], "time": "2023-11-21T18:54:41+00:00" }, + { + "name": "victor-prdh/recaptcha-bundle", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/victor-prdh/recaptcha-bundle.git", + "reference": "e967f9ada4a4688fd62a953185175cd0f2a0fd99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/victor-prdh/recaptcha-bundle/zipball/e967f9ada4a4688fd62a953185175cd0f2a0fd99", + "reference": "e967f9ada4a4688fd62a953185175cd0f2a0fd99", + "shasum": "" + }, + "require": { + "google/recaptcha": "^1.2", + "php": ">=7.2.5", + "symfony/form": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/twig-pack": "^1.0", + "symfony/validator": "^5.4|^6.0" + }, + "type": "symfony-bundle", + "extra": { + "symfony": { + "allow-contrib": "true" + } + }, + "autoload": { + "psr-4": { + "VictorPrdh\\RecaptchaBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Victor Prudhomme", + "email": "contact@victor-prdh.com" + } + ], + "description": "Use Google Recaptcha v2/v3 as form type with Symfony 5.4+", + "support": { + "issues": "https://github.com/victor-prdh/recaptcha-bundle/issues", + "source": "https://github.com/victor-prdh/recaptcha-bundle/tree/1.7.1" + }, + "time": "2023-09-10T20:33:24+00:00" + }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/config/bundles.php b/config/bundles.php index ff567ef..481a225 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -14,4 +14,6 @@ Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true], + Endroid\QrCodeBundle\EndroidQrCodeBundle::class => ['all' => true], + VictorPrdh\RecaptchaBundle\RecaptchaBundle::class => ['all' => true], ]; diff --git a/config/packages/endroid_qr_code.yaml b/config/packages/endroid_qr_code.yaml new file mode 100644 index 0000000..706647e --- /dev/null +++ b/config/packages/endroid_qr_code.yaml @@ -0,0 +1,9 @@ +endroid_qr_code: + default: + writer: Endroid\QrCode\Writer\PngWriter + size: 300 + margin: 10 + encoding: "UTF-8" + errorCorrectionLevel: "low" + roundBlockSizeMode: "margin" + validateResult: false diff --git a/config/packages/recaptcha.yaml b/config/packages/recaptcha.yaml new file mode 100644 index 0000000..44641e7 --- /dev/null +++ b/config/packages/recaptcha.yaml @@ -0,0 +1,3 @@ +recaptcha: + google_site_key: '%env(GOOGLE_RECAPTCHA_SITE_KEY)%' + google_secret_key: '%env(GOOGLE_RECAPTCHA_SECRET_KEY)%' diff --git a/config/routes/endroid_qr_code.yaml b/config/routes/endroid_qr_code.yaml new file mode 100644 index 0000000..ceab54e --- /dev/null +++ b/config/routes/endroid_qr_code.yaml @@ -0,0 +1,3 @@ +endroid_qr_code: + resource: "@EndroidQrCodeBundle/Resources/config/routes.yaml" + prefix: /qr-code diff --git a/public/assets/css/styleaziz.css b/public/assets/css/styleaziz.css index c4fff67..5fc3cd5 100644 --- a/public/assets/css/styleaziz.css +++ b/public/assets/css/styleaziz.css @@ -139,6 +139,14 @@ flex-direction: column; color: rgb(182, 174, 174); margin-left: 70px; +} +.navact a{ + font-size: 15px; + color: rgb(182, 174, 174); + margin-left: 560px; + margin-top: 10px; + color: rgb(207, 74, 74); + } .navact .first{ diff --git a/public/assets/css/styleticket.css b/public/assets/css/styleticket.css new file mode 100644 index 0000000..e61f8ac --- /dev/null +++ b/public/assets/css/styleticket.css @@ -0,0 +1,141 @@ +.content { + +background-color: whitesmoke; + height:100%; + display: flex; + flex-direction: row; +} +.tickettable{ +background-color: #007bff; +height :200px; +width: 50%; +} +.inscription_list{ + height:10px; +} +/* Apply basic styles to the table */ +.table2 { + width: 50%; + border-collapse: collapse; + margin-top: 20px; /* Adjust as needed */ +} + +/* Style the table header */ +.table2 th { + + padding: 10px; + text-align: left; + color: #2b2525; + +} + +/* Style the table rows */ +.table2 td { + padding: 10px; + border: 1px solid #ddd; /* Border color */ +} + +/* Style alternating rows for better readability */ + +/* Style links inside table cells */ +.table2 a { + text-decoration: none; + color: #007bff; /* Blue color for links, adjust as needed */ +} + +/* Add hover effect to links */ +.table2 a:hover { + text-decoration: underline; +} + +/* Style the "you have no inscription right now" message */ +.table2 tbody tr:nth-last-child(2), +.table2 tbody tr:last-child { + font-style: italic; + color: rgb(31, 28, 28); /* Gray color for the message */ +} + +/* Adjust styling for the "go back to the home page and make one" message */ +.table2 tbody tr:last-child { + font-weight: bold; + color: rgb(31, 28, 28); /* Darker color for emphasis */ +} + + + +.qrcode #qrCodeImage{ + height: 100px; + width: 100px; + margin-left: 10px; +} +.ticket{ + border-radius: 4px; + + width: 600px; + margin-left: 50px; + height: 200px; + display: flex; + position: relative; + flex-direction: row; + justify-content: flex-end; + gap: 280px; + background:url(../images/welcome-hero/Ticket.png)no-repeat; + + background-position:center; + background-size:cover; + background-color: #8D2649; + z-index: 1; +} +.ticket img{ + max-height: 100px; /* Set the maximum desired height */ + max-width: 120px; /* Set the maximum desired width */ + width: auto; /* Allow the width to adjust proportionally */ + height: auto; + object-fit: fill; +} + +.ticket .nomactivte{ + + + margin-top: 170px; + +} +.ticket .nomactivte h4 { + color: #ddd; + font-size: 15px; + font-style: italic; +} +.content-ticket{ + margin-top: 100px; + display: flex; + flex-direction: row; + gap:100px; +} +.leftside{ + + margin-left: 20px; +} +.leftside p { + font-size: 17px; +} +.leftside h1 { + font-size: 19px; + color: #8D2649; +} +.leftside #note{ + color: #FF3131; + +} +.btndownload{ + margin-top: 20px; + border-radius: 7px; + color: azure; + width: 120px; + height: 40px; + background-color: #8D2649; +} +.btndownload:hover{ + + background-color: #5e1f34; + +} \ No newline at end of file diff --git a/public/assets/images/welcome-hero/Ticket.png b/public/assets/images/welcome-hero/Ticket.png new file mode 100644 index 0000000..a58a9e3 Binary files /dev/null and b/public/assets/images/welcome-hero/Ticket.png differ diff --git a/public/uploads/images/655f8f01b1144.jpg b/public/uploads/images/655f8f01b1144.jpg new file mode 100644 index 0000000..46822ed Binary files /dev/null and b/public/uploads/images/655f8f01b1144.jpg differ diff --git a/public/uploads/images/655f8f4a2d60f.jpg b/public/uploads/images/655f8f4a2d60f.jpg new file mode 100644 index 0000000..46822ed Binary files /dev/null and b/public/uploads/images/655f8f4a2d60f.jpg differ diff --git a/src/Controller/ActivitesController.php b/src/Controller/ActivitesController.php index d2c0005..e62df72 100644 --- a/src/Controller/ActivitesController.php +++ b/src/Controller/ActivitesController.php @@ -13,6 +13,17 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +use Endroid\QrCode\QrCode; +use Endroid\QrCode\Writer\PngWriter; +use Endroid\QrCode\Color\Color; +use Endroid\QrCode\Encoding\Encoding; +use Endroid\QrCode\ErrorCorrectionLevel; + +use Endroid\QrCode\Label\Label; +use Endroid\QrCode\Logo\Logo; +use Endroid\QrCode\RoundBlockSizeMode; + +use Endroid\QrCode\Writer\ValidationException; #[Route('/activites')] class ActivitesController extends AbstractController @@ -84,19 +95,23 @@ public function new(Request $request, EntityManagerInterface $entityManager): Re #[Route('/{idAct}', name: 'app_activites_show', methods: ['GET', 'POST'])] public function show(Activites $activite , Request $request, EntityManagerInterface $entityManager,$idAct): Response { + $isFormSubmitted = false; $inscription = new Inscription(); $inscription->setNbrTickes(1); $prix = $activite->getPrixAct(); $form = $this->createForm(InscriptionType::class, $inscription); $form->handleRequest($request); + $userId=0; if ($form->isSubmitted() && $form->isValid()) { - $inscription -> setActiviteId($idAct); + $inscription->setActivite($activite); $inscription -> setUserId(0); $inscription -> setFraitAbonnement(20.00); dump($inscription); $entityManager->persist($inscription); $entityManager->flush(); + + $this->addFlash('success', 'Reservation made successfully'); return $this->redirectToRoute('app_activites_show', ['idAct' => $idAct], Response::HTTP_SEE_OTHER); @@ -107,9 +122,41 @@ public function show(Activites $activite , Request $request, EntityManagerInterf 'form' => $form, 'id'=>$idAct, 'prixactivite'=>$prix, + 'userid'=> $userId, + + ]); + } + + + #[Route('/ticket/{userId}', name: 'ticket', methods: ['GET', 'POST'])] + public function showTicket(InscriptionRepository $inscriptionRepository,ActivitesRepository $activitesRepository , $userId): Response + { + $inscriptions = $inscriptionRepository->findByUserId($userId); + return $this->render('inscription/ticket.html.twig', [ + 'inscription' => $inscriptions, + ]); } - + #[Route('/load-ticket-content/{inscriptionId}', name: 'load-ticket-content', methods: ['GET'])] +public function loadTicketContent(InscriptionRepository $inscriptionRepository, $inscriptionId): Response +{ $writer = new PngWriter(); + + $inscription = $inscriptionRepository->find($inscriptionId); + $ticketData = $inscription->getTicketData(); + $qrCode = new QrCode($ticketData); + //$qrCode = new QrCode("heelo world"); + + + $pngResult = $writer->write($qrCode); + + $qrCodeImage = base64_encode($pngResult->getString()); + + + return $this->render('inscription/ticket_content.html.twig', [ + 'inscription' => $inscription, + 'qrCodeImage' => $qrCodeImage, + ]); +} @@ -147,8 +194,6 @@ public function delete(Request $request, Activites $activite, EntityManagerInter - - } diff --git a/src/Controller/ReclamationsController.php b/src/Controller/ReclamationsController.php index 93b0d41..d058ccb 100644 --- a/src/Controller/ReclamationsController.php +++ b/src/Controller/ReclamationsController.php @@ -10,6 +10,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\HttpFoundation\JsonResponse; #[Route('/reclamations')] @@ -34,7 +35,7 @@ public function new(Request $request, EntityManagerInterface $entityManager): Re $entityManager->persist($reclamation); $entityManager->flush(); - return $this->redirectToRoute('app_reclamations_index', [], Response::HTTP_SEE_OTHER); + return $this->redirectToRoute('app_reclamations_new', [], Response::HTTP_SEE_OTHER); } return $this->renderForm('reclamations/new.html.twig', [ @@ -43,12 +44,23 @@ public function new(Request $request, EntityManagerInterface $entityManager): Re ]); } - #[Route('/{idr}', name: 'app_reclamations_show', methods: ['GET'])] + #[Route('show/{idr}', name: 'app_reclamations_show', methods: ['GET', 'POST'])] public function show(Reclamations $reclamation): Response { return $this->render('reclamations/show.html.twig', [ 'reclamation' => $reclamation, ]); + + } + + #[Route('/details/{idr}', name: 'app_reclamations_details', methods: ['GET'])] + public function details(string $idr, ReclamationRepository $reclamationRepository): Response + { + $reclamation = $reclamationRepository->find($idr); + + return $this->render('reclamations/details.html.twig', [ + 'reclamation' => $reclamation, + ]); } #[Route('/{idr}/edit', name: 'app_reclamations_edit', methods: ['GET', 'POST'])] @@ -79,4 +91,30 @@ public function delete(Request $request, Reclamations $reclamation, EntityManage return $this->redirectToRoute('app_reclamations_index', [], Response::HTTP_SEE_OTHER); } + + #[Route('/reclamations/search', name: 'app_reclamations_search')] +public function searchPage(): Response +{ + return $this->render('reclamations/search.html.twig'); +} + +#[Route('/search', name: 'ajax_search', methods: ['GET'])] +public function search(Request $request, ReclamationRepository $reclamationRepository): JsonResponse +{ + $searchString = $request->query->get('q'); + $reclamations = $reclamationRepository->findReclamationsByString($searchString); + + $reclamationDetails = []; + foreach ($reclamations as $reclamation) { + $reclamationDetails[] = [ + 'idr' => $reclamation->getIdr(), + 'details' => $reclamation->getDetails(), + // Ajoutez d'autres détails de réclamation si nécessaires + ]; + } + + return new JsonResponse(['reclamations' => $reclamationDetails]); +} + + } diff --git a/src/Entity/Activites.php b/src/Entity/Activites.php index 050d99a..13ea7be 100644 --- a/src/Entity/Activites.php +++ b/src/Entity/Activites.php @@ -11,7 +11,8 @@ class Activites { #[ORM\Id] #[ORM\GeneratedValue] - #[ORM\Column] + #[ORM\Column(type: 'integer')] + private ?int $idAct; #[Assert\NotBlank(message: "Le nom ne peut pas être vide" )] @@ -75,6 +76,7 @@ class Activites private ?int $idUser; + #[ORM\OneToOne] #[ORM\JoinColumn(nullable: false, name: "id_user", referencedColumnName: "id_user")] private ?Utilisateur $user=null; @@ -204,17 +206,7 @@ public function setPeriode(string $periode): static return $this; } - public function getIdUser(): ?int - { - return $this->idUser; - } - public function setIdUser(int $idUser): static - { - $this->idUser = $idUser; - - return $this; - } public function getUser(): ?Utilisateur { return $this->user; @@ -226,5 +218,5 @@ public function setUser(?Utilisateur $user): static return $this; } - + } diff --git a/src/Entity/Inscription.php b/src/Entity/Inscription.php index 942fabe..711a35b 100644 --- a/src/Entity/Inscription.php +++ b/src/Entity/Inscription.php @@ -37,12 +37,17 @@ class Inscription private ?float $fraitAbonnement; #[ORM\Column] - private ?int $activiteId; + private ?int $activite_id; - #[ORM\Column] + #[ORM\Column(type: 'integer')] private ?int $userId; + #[ORM\OneToOne] + #[ORM\JoinColumn(nullable: false, name: "activite_id", referencedColumnName: "id_act")] + private ?Activites $activite=null; + + public function __construct() @@ -104,27 +109,48 @@ public function setFraitAbonnement(float $fraitAbonnement): static return $this; } - public function getActiviteId(): ?int + + + public function getUserId(): ?int { - return $this->activiteId; + return $this->userId; } - public function setActiviteId(int $activiteId): static + public function setUserId(int $userId): static { - $this->activiteId = $activiteId; + $this->userId = $userId; return $this; } - public function getUserId(): ?int + + public function getActivite(): ?Activites { - return $this->userId; + return $this->activite; + } + + public function setActivite(?Activites $activite): static + { + $this->activite = $activite; + + return $this; } - public function setUserId(int $userId): static + + + public function getTicketData(): string { - $this->userId = $userId; + + $data = 'Inscription ID: ' . $this->Id_ins . ', Price: ' . $this->fraitAbonnement . ',activity:' . $this->activite->getNomAct() + + . ',availablity:' . $this->activite->getDuree(). ',activity:' . $this->activite->getAdresse() + ; - return $this; + + + return $data; } + } + + diff --git a/src/Form/InscriptionType.php b/src/Form/InscriptionType.php index 7895da0..6e2b38d 100644 --- a/src/Form/InscriptionType.php +++ b/src/Form/InscriptionType.php @@ -14,8 +14,8 @@ class InscriptionType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('nbrTickes', IntegerType::class) // Update this - + ->add('nbrTickes', IntegerType::class) // Update this + ; } diff --git a/src/Form/ReclamationsType.php b/src/Form/ReclamationsType.php index 06f107a..d4697ed 100644 --- a/src/Form/ReclamationsType.php +++ b/src/Form/ReclamationsType.php @@ -23,7 +23,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('utilisateur', null, [ 'choice_label' => 'mail' ]) - ->add('daterec', null) + ->add('daterec', null ) ->add('typerec', ChoiceType::class, [ 'choices' => [ 'Réclamation liée à une activité' => 3, @@ -32,23 +32,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ], 'placeholder' => 'Sélectionnez le type de réclamation', // Optionnel : affiche un texte vide par défaut 'attr' => ['id' => 'reclamations_typerec'], - /* 'constraints' => [ - new Assert\NotBlank(), - ], */ + ]) - ->add('refobject'/* , IntegerType::class, [ - 'constraints' => [ - new Assert\NotBlank(), - new Assert\Type(['type' => 'numeric', 'message' => 'Ce champ doit être un nombre.']), - ], - - ] */) - ->add('details', TextareaType::class/* , [ - 'constraints' => [ - new Assert\NotBlank(), - ], - ] */); + ->add('refobject') + ->add('details', TextareaType::class); ; } diff --git a/src/Form/RegisterType.php b/src/Form/RegisterType.php index 88aef38..caefdbb 100644 --- a/src/Form/RegisterType.php +++ b/src/Form/RegisterType.php @@ -11,6 +11,7 @@ use Symfony\Component\Validator\Constraints\File; use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; +use VictorPrdh\RecaptchaBundle\Form\ReCaptchaType; class RegisterType extends AbstractType { @@ -58,6 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]) + ->add("captcha", ReCaptchaType::class) ; } diff --git a/src/Form/UserrType.php b/src/Form/UserrType.php index b5e56dd..db66b44 100644 --- a/src/Form/UserrType.php +++ b/src/Form/UserrType.php @@ -12,6 +12,7 @@ use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; + class UserrType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void @@ -59,6 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]) ->add('etat') + ; } diff --git a/src/Repository/InscriptionRepository.php b/src/Repository/InscriptionRepository.php index 486103a..68c78c4 100644 --- a/src/Repository/InscriptionRepository.php +++ b/src/Repository/InscriptionRepository.php @@ -45,4 +45,13 @@ public function __construct(ManagerRegistry $registry) // ->getOneOrNullResult() // ; // } + +public function findByUserId($user_id) +{ + return $this->createQueryBuilder('i') + ->andWhere('i.userId = :user_id') + ->setParameter('user_id', $user_id) + ->getQuery() + ->getResult(); +} } diff --git a/src/Repository/ReclamationRepository.php b/src/Repository/ReclamationRepository.php index 04473bb..f27f783 100644 --- a/src/Repository/ReclamationRepository.php +++ b/src/Repository/ReclamationRepository.php @@ -45,4 +45,14 @@ public function __construct(ManagerRegistry $registry) // ->getOneOrNullResult() // ; // } + + +public function findReclamationsByString($searchString) +{ + return $this->createQueryBuilder('r') + ->where('r.details LIKE :search') + ->setParameter('search', '%' . $searchString . '%') + ->getQuery() + ->getResult(); +} } diff --git a/symfony.lock b/symfony.lock index ab9795a..b88368f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -38,6 +38,18 @@ "./migrations/.gitignore" ] }, + "endroid/qr-code-bundle": { + "version": "5.0.1" + }, + "google/recaptcha": { + "version": "1.3", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.1", + "ref": "e5a4aa21f2e98d7440ae9aab6b56e307f99dd084" + } + }, "knplabs/knp-paginator-bundle": { "version": "v5.9.0" }, @@ -287,5 +299,17 @@ }, "twig/extra-bundle": { "version": "v3.7.1" + }, + "victor-prdh/recaptcha-bundle": { + "version": "1.7", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.5", + "ref": "f604d862b3ce4434d131a0e9b3a2eb7bb1784aff" + }, + "files": [ + "./config/packages/recaptcha.yaml" + ] } } diff --git a/templates/activites/backoffice.html.twig b/templates/activites/backoffice.html.twig index f98cb1e..7c2f071 100644 --- a/templates/activites/backoffice.html.twig +++ b/templates/activites/backoffice.html.twig @@ -36,7 +36,7 @@ {% for activite in activites %} {{ activite.idAct }} - {{ activite.idUser }} + {{ activite.user.getIdUser }} {{ activite.nomAct }} {{ activite.description }} {{ activite.organisateur }} diff --git a/templates/activites/show.html.twig b/templates/activites/show.html.twig index 2cb2938..c42bc45 100644 --- a/templates/activites/show.html.twig +++ b/templates/activites/show.html.twig @@ -7,12 +7,17 @@ {% endblock %} + {% block container %}
@@ -78,4 +83,5 @@
{{ include('inscription/_form.html.twig') }}
-
{% endblock %}{% block explore %}{% endblock %}{% block card %}{% endblock %} +{% set successMessages = app.flashes('success') %}{% if successMessages is not empty %}{% endif %}{% endblock %}{% block explore %}{% endblock %}{% block card %}{% endblock %} diff --git a/templates/base.html.twig b/templates/base.html.twig index a179188..aadd3e5 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -61,16 +61,16 @@ + + + +

You are using an outdated browser. Please upgrade your browser to improve your experience and security.

+
@@ -174,7 +175,7 @@ {% block container %}
- +

best place to find and explore
@@ -220,7 +221,7 @@ {% endblock %}
- +
{% block explore %}
diff --git a/templates/channel/index.html.twig b/templates/channel/index.html.twig index 8075af2..7c21da0 100644 --- a/templates/channel/index.html.twig +++ b/templates/channel/index.html.twig @@ -2,10 +2,10 @@ {% block title %}{% endblock %} -<<<<<<Channelindex

=======

Channeldediscussion

>> {% block container %} +

Channeldediscussion

-{% block container %}>>>>> d00afe88a7cd55eb234c89439a559dc1b84f43e3 +{% block container %} diff --git a/templates/evenement/index.html.twig b/templates/evenement/index.html.twig index f6ce9f7..6c0f5d9 100644 --- a/templates/evenement/index.html.twig +++ b/templates/evenement/index.html.twig @@ -46,4 +46,58 @@
Create new + +{% block title %}Evenement index{% endblock %} + +{% block container %} +

Evenement

+ + + + + + + + + + + + + + + + + + {% for evenement in evenements %} + + + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
NomEventDescriptDateEventHeureEventLieuEventNbParticipantsImageOrganisateuractions
{{ evenement.nomEvent }}{{ evenement.descript }}{{ evenement.dateEvent ? evenement.dateEvent|date('Y-m-d H:i:s') : '' }}{{ evenement.heureEvent }}{{ evenement.lieuEvent }}{{ evenement.nbParticipants }} + {% if evenement.image %} + event image + {% else %} + No Image Available + {% endif %} + {{ evenement.organisateur }} + show + edit +
no records found
+ + Create new + {% endblock %} diff --git a/templates/inscription/_form.html.twig b/templates/inscription/_form.html.twig index 464857b..cb2323f 100644 --- a/templates/inscription/_form.html.twig +++ b/templates/inscription/_form.html.twig @@ -5,10 +5,8 @@ {{ form_label(form.nbrTickes) }} {{ form_widget(form.nbrTickes, {'attr': {'class': 'form-control'}}) }} {{ form_errors(form.nbrTickes) }} - - - - {{ form_end(form) }} + -
+ + {{ form_end(form) }}
diff --git a/templates/inscription/ticket.html.twig b/templates/inscription/ticket.html.twig new file mode 100644 index 0000000..f381b0b --- /dev/null +++ b/templates/inscription/ticket.html.twig @@ -0,0 +1,57 @@ +{% extends 'base.html.twig' %} +{% block title %}{% endblock %} +{% block css %} + {{ parent() }} + + +{% endblock %} +{% block container %} + +
+
+ + +
+ + + + + + + + + + + + + + + {% for i in inscription %} + + + + + + + + + + + + + {% else %} + you have no inscription right now + go back to the home page and make one + {% endfor %} + +
idActivityDatetimePersonnesPriceactionaction
{{ i.Idins }}{{ i.activite.getnomAct }}{{ i.dateIns ? i.dateIns|date('Y-m-d') : '' }}{{ i.heureIns ? i.heureIns|date('H:i') : '' }}{{ i.nbrTickes }}{{ i.fraitAbonnement }} + show and download my ticket + + + + download ticket +
+
+
+ +
{% endblock %}{% block explore %}{% endblock %}{% block card %}{% endblock %} diff --git a/templates/inscription/ticket_content.html.twig b/templates/inscription/ticket_content.html.twig new file mode 100644 index 0000000..d806640 --- /dev/null +++ b/templates/inscription/ticket_content.html.twig @@ -0,0 +1,62 @@ +{% extends 'base.html.twig' %} +{% block title %}{% endblock %} +{% block css %} + {{ parent() }} + + +{% endblock %} +{% block container %} +
+
+

Your Event Ticket

+

Event: + {{ inscription.activite.getNomAct|upper}}

+

Date: + {{ inscription.activite.getPeriode }}

+ + +

Please present this ticket at the event entrance.

+

Keep this ticket in a safe place and do not share it with others.

+

You can download you ticket Now.

+ + +
+
+
+

ticket for + {{inscription.activite.getnomAct }}

+
+ + +
+
+ + + + + +{% endblock %} +{% block explore %}{% endblock %} +{% block card %}{% endblock %} diff --git a/templates/reclamations/_form.html.twig b/templates/reclamations/_form.html.twig index 5738166..eb867a2 100644 --- a/templates/reclamations/_form.html.twig +++ b/templates/reclamations/_form.html.twig @@ -1,29 +1,79 @@ + + + +
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }} +
-{{ form_row(form.utilisateur) }} +{{ form_row(form.utilisateur ,{'attr': {'class': 'text'}}) }} {{ form_errors(form.utilisateur) }} -{{ form_row(form.daterec) }} +{{ form_row(form.daterec,{'attr': {'class': 'date-wrapper'}}) }} {{ form_errors(form.daterec) }} -{{ form_row(form.typerec) }} +{{ form_row(form.typerec,{'attr': {'class': 'text'}}) }} {{ form_errors(form.typerec) }} -{{ form_row(form.refobject) }} +{{ form_row(form.refobject,{'attr': {'class': 'text'}}) }} {{ form_errors(form.refobject) }} -{{ form_row(form.details) }} +{{ form_row(form.details,{'attr': {'class': 'text'}}) }} {{ form_errors(form.details) }} +
{{ form_end(form) }} +
\ No newline at end of file diff --git a/templates/reclamations/details.html.twig b/templates/reclamations/details.html.twig new file mode 100644 index 0000000..cb34b3e --- /dev/null +++ b/templates/reclamations/details.html.twig @@ -0,0 +1,46 @@ + + + + + + + + + + Dashboard - XperienceZone + + + +

Reclamations

+ + + + + + + + + + + + + + + + + + + + + + + + +
Idr{{ reclamation.idr }}
Daterec{{ reclamation.daterec ? reclamation.daterec|date('Y-m-d') : '' }}
Typerec{{ reclamation.typerec }}
Refobject{{ reclamation.refobject }}
Details{{ reclamation.details }}
+ back to list + + edit + + {{ include('reclamations/_delete_form.html.twig') }} + + diff --git a/templates/reclamations/edit.html.twig b/templates/reclamations/edit.html.twig index f582c68..5b43b49 100644 --- a/templates/reclamations/edit.html.twig +++ b/templates/reclamations/edit.html.twig @@ -7,7 +7,7 @@ {{ include('reclamations/_form.html.twig', {'button_label': 'Update'}) }} - back to list + back to list {{ include('reclamations/_delete_form.html.twig') }} {% endblock %} diff --git a/templates/reclamations/index.html.twig b/templates/reclamations/index.html.twig index 7a9ddfd..765b7b5 100644 --- a/templates/reclamations/index.html.twig +++ b/templates/reclamations/index.html.twig @@ -17,6 +17,7 @@ + {% for reclamation in reclamations %} {{ reclamation.idr }} @@ -26,7 +27,8 @@ {{ reclamation.details }} show - edit + edit + {% else %} @@ -37,6 +39,6 @@ - - traitement + traitement + Search {% endblock %} diff --git a/templates/reclamations/new.html.twig b/templates/reclamations/new.html.twig index b87dc2d..3661af7 100644 --- a/templates/reclamations/new.html.twig +++ b/templates/reclamations/new.html.twig @@ -2,18 +2,43 @@ {% block title %}New Reclamations{% endblock %} + + {% block container %} -
-

Create new Reclamation

-
-
+ + +
+
+
+

Submit a complaint

+
+ +
+ {{ include('reclamations/_form.html.twig') }}
-
+ -
- Back to list + +
{% endblock %} diff --git a/templates/reclamations/search.html.twig b/templates/reclamations/search.html.twig new file mode 100644 index 0000000..c99bf6f --- /dev/null +++ b/templates/reclamations/search.html.twig @@ -0,0 +1,86 @@ +{% extends 'utilisateur/base.html.twig' %} + +{% block title %}Search{% endblock %} + +{% block container %} + + +

Search Reclamations

+ +
+ +
+ +
+
+ + +{% endblock %} diff --git a/templates/reclamations/show.html.twig b/templates/reclamations/show.html.twig index edbb4df..3d54244 100644 --- a/templates/reclamations/show.html.twig +++ b/templates/reclamations/show.html.twig @@ -30,9 +30,9 @@ - back to list + back to list - edit + edit {{ include('reclamations/_delete_form.html.twig') }} {% endblock %} diff --git a/templates/registration/form.html.twig b/templates/registration/form.html.twig index 02f044b..52f01c5 100644 --- a/templates/registration/form.html.twig +++ b/templates/registration/form.html.twig @@ -30,6 +30,9 @@ {{ form_errors(form.sexe) }} +

+ {{ form_widget(form.captcha) }} + {{ form_errors(form.captcha) }}
Login