diff --git a/.idea/caisse_bliss.iml b/.idea/caisse_bliss.iml index 24643cc3..5947147d 100644 --- a/.idea/caisse_bliss.iml +++ b/.idea/caisse_bliss.iml @@ -5,6 +5,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/.idea/php.xml b/.idea/php.xml index 9f4bf038..0a7d7a22 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -214,6 +214,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index 4be5d133..1f98cf95 100755 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -169,6 +169,7 @@ angular $scope.refreshDeduplicateSellings(); } $scope.removeAll = function () { + console.log('$scope.categories', $scope.categories) $scope.categories.forEach(category => { if (category.products && category.products.length) { @@ -193,8 +194,8 @@ angular $scope.clearSellingComment = function () { console.log(' $scope.sellingComment', $scope.sellingComment); - // $scope.sellingComment = ''; - // document.querySelector('.client-now input').focus(); + $scope.sellingComment = ''; + document.querySelector('.client-now input').focus(); document.querySelector('.client-now input').select(); }; $scope.clearCurrentSelling = function () { diff --git a/composer.json b/composer.json index 083e9ed6..52595cf3 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", + "amphp/http-client": "^4.2.1", "api-platform/doctrine-orm": "^4.0", "api-platform/symfony": "^4.0", "doctrine/dbal": "^3", diff --git a/composer.lock b/composer.lock index bc43fad8..c13e16f0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,942 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d0236f64fc9e381cfc8b6c8c46ac667", + "content-hash": "43c5448c4e7e8d43f707726e77c8c6ed", "packages": [ + { + "name": "amphp/amp", + "version": "v2.6.4", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", + "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^7 | ^8 | ^9", + "react/promise": "^2", + "vimeo/psalm": "^3.12" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ], + "psr-4": { + "Amp\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "https://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v2.6.4" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T18:52:26+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.8.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Amp\\ByteStream\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "https://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "support": { + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-04-13T18:00:56+00:00" + }, + { + "name": "amphp/cache", + "version": "v1.5.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/cache.git", + "reference": "fe78cfae2fb8c92735629b8cd1893029c73c9b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/cache/zipball/fe78cfae2fb8c92735629b8cd1893029c73c9b63", + "reference": "fe78cfae2fb8c92735629b8cd1893029c73c9b63", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "amphp/serialization": "^1", + "amphp/sync": "^1.2", + "php": ">=7.1" + }, + "conflict": { + "amphp/file": "<0.2 || >=3" + }, + "require-dev": { + "amphp/file": "^1 || ^2", + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.1", + "phpunit/phpunit": "^6 | ^7 | ^8 | ^9", + "vimeo/psalm": "^4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Cache\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + } + ], + "description": "A promise-aware caching API for Amp.", + "homepage": "https://github.com/amphp/cache", + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/cache/issues", + "source": "https://github.com/amphp/cache/tree/v1.5.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:35:02+00:00" + }, + { + "name": "amphp/dns", + "version": "v1.2.4", + "source": { + "type": "git", + "url": "https://github.com/amphp/dns.git", + "reference": "4a13ffdc5e088593eb01860fc5002ebd9316d562" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/dns/zipball/4a13ffdc5e088593eb01860fc5002ebd9316d562", + "reference": "4a13ffdc5e088593eb01860fc5002ebd9316d562", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "amphp/byte-stream": "^1.1", + "amphp/cache": "^1.2", + "amphp/parser": "^1", + "amphp/windows-registry": "^0.3", + "daverandom/libdns": "^2.0.1", + "ext-filter": "*", + "ext-json": "*", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "phpunit/phpunit": "^6 || ^7 || ^8 || ^9" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Amp\\Dns\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Wright", + "email": "addr@daverandom.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + } + ], + "description": "Async DNS resolution for Amp.", + "homepage": "https://github.com/amphp/dns", + "keywords": [ + "amp", + "amphp", + "async", + "client", + "dns", + "resolve" + ], + "support": { + "issues": "https://github.com/amphp/dns/issues", + "source": "https://github.com/amphp/dns/tree/v1.2.4" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-12-08T15:06:32+00:00" + }, + { + "name": "amphp/hpack", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/hpack.git", + "reference": "4f293064b15682a2b178b1367ddf0b8b5feb0239" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/hpack/zipball/4f293064b15682a2b178b1367ddf0b8b5feb0239", + "reference": "4f293064b15682a2b178b1367ddf0b8b5feb0239", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "http2jp/hpack-test-case": "^1", + "nikic/php-fuzzer": "^0.0.10", + "phpunit/phpunit": "^7 | ^8 | ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\Http\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Bob Weinand" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + } + ], + "description": "HTTP/2 HPack implementation.", + "homepage": "https://github.com/amphp/hpack", + "keywords": [ + "headers", + "hpack", + "http-2" + ], + "support": { + "issues": "https://github.com/amphp/hpack/issues", + "source": "https://github.com/amphp/hpack/tree/v3.2.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:00:16+00:00" + }, + { + "name": "amphp/http", + "version": "v1.7.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/http.git", + "reference": "3a33e68a3b53f7279217238e89748cf0cb30b8a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/http/zipball/3a33e68a3b53f7279217238e89748cf0cb30b8a6", + "reference": "3a33e68a3b53f7279217238e89748cf0cb30b8a6", + "shasum": "" + }, + "require": { + "amphp/hpack": "^3", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "2.x-dev#3c24119d0377eed2093d5c0f0541478cb75ea72d", + "phpunit/phpunit": "^9 || ^8 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Http\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Basic HTTP primitives which can be shared by servers and clients.", + "support": { + "issues": "https://github.com/amphp/http/issues", + "source": "https://github.com/amphp/http/tree/v1.7.3" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-04-03T17:45:14+00:00" + }, + { + "name": "amphp/http-client", + "version": "v4.6.5", + "source": { + "type": "git", + "url": "https://github.com/amphp/http-client.git", + "reference": "6cac9e172a66a04df305acc8de02b6c40832b269" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/http-client/zipball/6cac9e172a66a04df305acc8de02b6c40832b269", + "reference": "6cac9e172a66a04df305acc8de02b6c40832b269", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.4", + "amphp/byte-stream": "^1.6", + "amphp/hpack": "^3", + "amphp/http": "^1.6", + "amphp/socket": "^1", + "amphp/sync": "^1.3", + "league/uri": "^6 | ^7", + "php": ">=7.2", + "psr/http-message": "^1 | ^2" + }, + "conflict": { + "amphp/file": "<0.2 || >=3" + }, + "require-dev": { + "amphp/file": "^0.2 || ^0.3 || ^1 || ^2", + "amphp/http-server": "^2", + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.1", + "amphp/react-adapter": "^2.1", + "clue/socks-react": "^1.0", + "ext-json": "*", + "kelunik/link-header-rfc5988": "^1.0", + "laminas/laminas-diactoros": "^2.3", + "phpunit/phpunit": "^7 || ^8 || ^9", + "vimeo/psalm": "^5" + }, + "suggest": { + "amphp/file": "Required for file request bodies and HTTP archive logging", + "ext-json": "Required for logging HTTP archives", + "ext-zlib": "Allows using compression for response bodies." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "files": [ + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\Http\\Client\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + } + ], + "description": "Asynchronous concurrent HTTP/2 and HTTP/1.1 client built on the Amp concurrency framework", + "homepage": "https://github.com/amphp/http-client", + "keywords": [ + "async", + "client", + "concurrent", + "http", + "non-blocking", + "rest" + ], + "support": { + "issues": "https://github.com/amphp/http-client/issues", + "source": "https://github.com/amphp/http-client/tree/v4.6.5" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-12-13T15:50:23+00:00" + }, + { + "name": "amphp/parser", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/parser.git", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Parser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A generator parser to make streaming parsers simple.", + "homepage": "https://github.com/amphp/parser", + "keywords": [ + "async", + "non-blocking", + "parser", + "stream" + ], + "support": { + "issues": "https://github.com/amphp/parser/issues", + "source": "https://github.com/amphp/parser/tree/v1.1.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:16:53+00:00" + }, + { + "name": "amphp/process", + "version": "v1.1.9", + "source": { + "type": "git", + "url": "https://github.com/amphp/process.git", + "reference": "55b837d4f1857b9bd7efb7bb859ae6b0e804f13f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/process/zipball/55b837d4f1857b9bd7efb7bb859ae6b0e804f13f", + "reference": "55b837d4f1857b9bd7efb7bb859ae6b0e804f13f", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "amphp/byte-stream": "^1.4", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "phpunit/phpunit": "^6" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Amp\\Process\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Asynchronous process manager.", + "homepage": "https://github.com/amphp/process", + "support": { + "issues": "https://github.com/amphp/process/issues", + "source": "https://github.com/amphp/process/tree/v1.1.9" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-12-13T17:38:25+00:00" + }, + { + "name": "amphp/serialization", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/serialization.git", + "reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/serialization/zipball/693e77b2fb0b266c3c7d622317f881de44ae94a1", + "reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "phpunit/phpunit": "^9 || ^8 || ^7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Serialization\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Serialization tools for IPC and data storage in PHP.", + "homepage": "https://github.com/amphp/serialization", + "keywords": [ + "async", + "asynchronous", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/amphp/serialization/issues", + "source": "https://github.com/amphp/serialization/tree/master" + }, + "time": "2020-03-25T21:39:07+00:00" + }, + { + "name": "amphp/socket", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/socket.git", + "reference": "b00528bd75548b7ae06a502358bb3ff8b106f5ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/socket/zipball/b00528bd75548b7ae06a502358bb3ff8b106f5ab", + "reference": "b00528bd75548b7ae06a502358bb3ff8b106f5ab", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "amphp/byte-stream": "^1.6", + "amphp/dns": "^1 || ^0.9", + "ext-openssl": "*", + "kelunik/certificate": "^1.1", + "league/uri-parser": "^1.4", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "phpunit/phpunit": "^6 || ^7 || ^8", + "vimeo/psalm": "^3.9@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php", + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Async socket connection / server tools for Amp.", + "homepage": "https://github.com/amphp/socket", + "keywords": [ + "amp", + "async", + "encryption", + "non-blocking", + "sockets", + "tcp", + "tls" + ], + "support": { + "issues": "https://github.com/amphp/socket/issues", + "source": "https://github.com/amphp/socket/tree/v1.2.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T18:12:22+00:00" + }, + { + "name": "amphp/sync", + "version": "v1.4.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/sync.git", + "reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/sync/zipball/85ab06764f4f36d63b1356b466df6111cf4b89cf", + "reference": "85ab06764f4f36d63b1356b466df6111cf4b89cf", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.2", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.1", + "phpunit/phpunit": "^9 || ^8 || ^7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/ConcurrentIterator/functions.php" + ], + "psr-4": { + "Amp\\Sync\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Mutex, Semaphore, and other synchronization tools for Amp.", + "homepage": "https://github.com/amphp/sync", + "keywords": [ + "async", + "asynchronous", + "mutex", + "semaphore", + "synchronization" + ], + "support": { + "issues": "https://github.com/amphp/sync/issues", + "source": "https://github.com/amphp/sync/tree/v1.4.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-10-25T18:29:10+00:00" + }, + { + "name": "amphp/windows-registry", + "version": "v0.3.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/windows-registry.git", + "reference": "0f56438b9197e224325e88f305346f0221df1f71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/windows-registry/zipball/0f56438b9197e224325e88f305346f0221df1f71", + "reference": "0f56438b9197e224325e88f305346f0221df1f71", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "amphp/byte-stream": "^1.4", + "amphp/process": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\WindowsRegistry\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Windows Registry Reader.", + "support": { + "issues": "https://github.com/amphp/windows-registry/issues", + "source": "https://github.com/amphp/windows-registry/tree/master" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2020-07-10T16:13:29+00:00" + }, { "name": "api-platform/doctrine-common", "version": "v4.0.17", @@ -1192,6 +2126,50 @@ ], "time": "2024-09-19T14:15:21+00:00" }, + { + "name": "daverandom/libdns", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/DaveRandom/LibDNS.git", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "Required for IDN support" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "LibDNS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DNS protocol implementation written in pure PHP", + "keywords": [ + "dns" + ], + "support": { + "issues": "https://github.com/DaveRandom/LibDNS/issues", + "source": "https://github.com/DaveRandom/LibDNS/tree/v2.1.0" + }, + "time": "2024-04-12T12:12:48+00:00" + }, { "name": "doctrine/cache", "version": "2.2.0", @@ -2564,6 +3542,308 @@ ], "time": "2024-12-27T00:36:43+00:00" }, + { + "name": "kelunik/certificate", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/kelunik/certificate.git", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kelunik/certificate/zipball/7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=7.0" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^6 | 7 | ^8 | ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kelunik\\Certificate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Access certificate details and transform between different formats.", + "keywords": [ + "DER", + "certificate", + "certificates", + "openssl", + "pem", + "x509" + ], + "support": { + "issues": "https://github.com/kelunik/certificate/issues", + "source": "https://github.com/kelunik/certificate/tree/v1.1.3" + }, + "time": "2023-02-03T21:26:53+00:00" + }, + { + "name": "league/uri", + "version": "7.5.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "81fb5145d2644324614cc532b28efd0215bda430" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430", + "reference": "81fb5145d2644324614cc532b28efd0215bda430", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.5", + "php": "^8.1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.5.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2024-12-08T08:40:02+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "7.5.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2024-12-08T08:18:47+00:00" + }, + { + "name": "league/uri-parser", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-parser.git", + "reference": "671548427e4c932352d9b9279fdfa345bf63fa00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-parser/zipball/671548427e4c932352d9b9279fdfa345bf63fa00", + "reference": "671548427e4c932352d9b9279fdfa345bf63fa00", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "phpstan/phpstan": "^0.9.2", + "phpstan/phpstan-phpunit": "^0.9.4", + "phpstan/phpstan-strict-rules": "^0.9.0", + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-intl": "Allow parsing RFC3987 compliant hosts", + "league/uri-schemes": "Allow validating and normalizing URI parsing results" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "League\\Uri\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "userland URI parser RFC 3986 compliant", + "homepage": "https://github.com/thephpleague/uri-parser", + "keywords": [ + "parse_url", + "parser", + "rfc3986", + "rfc3987", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/thephpleague/uri-parser/issues", + "source": "https://github.com/thephpleague/uri-parser/tree/master" + }, + "abandoned": "league/uri-interfaces", + "time": "2018-11-22T07:55:51+00:00" + }, { "name": "monolog/monolog", "version": "3.8.1", @@ -3151,6 +4431,114 @@ }, "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, { "name": "psr/link", "version": "2.0.1", diff --git a/config/packages/security.yaml b/config/packages/security.yaml index b367189e..82a2f235 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -34,6 +34,7 @@ security: - { path: ^/dashboard, roles: ROLE_USER } - { path: ^/docs, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI - { path: ^/authentication_token, roles: PUBLIC_ACCESS } + - { path: ^/, roles: PUBLIC_ACCESS } # - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès à la page de connexion # - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès anonyme à toutes les autres pages diff --git a/migrations/Version20250217160209.php b/migrations/Version20250217160209.php new file mode 100644 index 00000000..c40e1b2d --- /dev/null +++ b/migrations/Version20250217160209.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE festival ADD chiffre_affaire DOUBLE PRECISION DEFAULT NULL, ADD clients_count INT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE festival DROP chiffre_affaire, DROP clients_count'); + } +} diff --git a/migrations/Version20250217165029.php b/migrations/Version20250217165029.php new file mode 100644 index 00000000..f3ad14a6 --- /dev/null +++ b/migrations/Version20250217165029.php @@ -0,0 +1,41 @@ +addSql('ALTER TABLE group_of_products DROP FOREIGN KEY FK_2A99B370A76ED395'); + $this->addSql('DROP INDEX IDX_2A99B370A76ED395 ON group_of_products'); + $this->addSql('ALTER TABLE group_of_products CHANGE user_id owner_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE group_of_products ADD CONSTRAINT FK_2A99B3707E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)'); + $this->addSql('CREATE INDEX IDX_2A99B3707E3C61F9 ON group_of_products (owner_id)'); + $this->addSql('ALTER TABLE selling DROP date'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE selling ADD date VARCHAR(255) NOT NULL'); + $this->addSql('ALTER TABLE group_of_products DROP FOREIGN KEY FK_2A99B3707E3C61F9'); + $this->addSql('DROP INDEX IDX_2A99B3707E3C61F9 ON group_of_products'); + $this->addSql('ALTER TABLE group_of_products CHANGE owner_id user_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE group_of_products ADD CONSTRAINT FK_2A99B370A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); + $this->addSql('CREATE INDEX IDX_2A99B370A76ED395 ON group_of_products (user_id)'); + } +} diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 03a36ef8..df84f062 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -2,10 +2,14 @@ namespace App\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Response; +use App\Entity\Festival; +use App\Entity\Selling; +use App\Entity\GroupOfProducts; + use Symfony\Component\Routing\Attribute\Route; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; final class DefaultController extends AbstractController { @@ -16,6 +20,7 @@ final class DefaultController extends AbstractController 'controller_name' => 'DefaultController', ]); } + #[Route('/accueil', name: 'app_home')] public function accueil(): Response { @@ -23,6 +28,7 @@ final class DefaultController extends AbstractController 'controller_name' => 'DefaultController', ]); } + #[Route('/dashboard', name: 'dashboard')] public function dashboard(): Response { @@ -30,7 +36,7 @@ final class DefaultController extends AbstractController 'controller_name' => 'DefaultController', ]); } - + #[Route('/export_all', name: 'export_all')] public function export_all(): Response @@ -65,34 +71,34 @@ final class DefaultController extends AbstractController 'controller_name' => 'DefaultController', 'chiffreAffaires' => 10000, 'statisticsSoldProducts' => [ - [ - 'name' => 'mock 1', - 'count' => 10, - 'value' => 10, - ],[ - 'name' => 'mock 2', - 'count' => 1, - 'value' => 20, - ], + [ + 'name' => 'mock 1', + 'count' => 10, + 'value' => 10, + ], [ + 'name' => 'mock 2', + 'count' => 1, + 'value' => 20, + ], ], 'activeFestival' => [ - 'fondDeCaisseAvant' => 10, - 'chiffreAffaire' => 10, - 'clientsCount' => 10, - 'name' => 'demo festival mock dans default controller', + 'fondDeCaisseAvant' => 10, + 'chiffreAffaire' => 10, + 'clientsCount' => 10, + 'name' => 'demo festival mock dans default controller', ], 'allSellings' => 12, 'recentSellings' => [], 'recentSells' => [ - [ - 'id' => '1234', - 'date' => date_create('now'), - 'comment' => 'blah', - 'amount' => 52, - 'productsSold' => [ - 'name' => 'un truc de démo aussi làààà' - ], - ], + [ + 'id' => '1234', + 'date' => date_create('now'), + 'comment' => 'blah', + 'amount' => 52, + 'productsSold' => [ + 'name' => 'un truc de démo aussi làààà' + ], + ], ], 'activeSelling' => [], // 'sellingComment' => [], @@ -105,39 +111,113 @@ final class DefaultController extends AbstractController #[Route('/logged/get-my-products', name: 'get_my_products')] public function get_my_products(): JsonResponse { - // TODO: replace this with actual logic to get products of the logged user - // récupérer les produits de l'user connecté + // TODO: replace this with actual logic to get products of the logged user + // récupérer les produits de l'user connecté -$user = $this->getUser(); + $user = $this->getUser(); // $products = $this->getUser()->getProducts(); return $this->json([ 'categories' => $user->getGroupOfProducts(), 'products' => $user->getProducts(), // mock land - 'lastFestival' => ['id'=>1, - 'name'=>'le festival de mock', - 'dateCreation'=>'2025-02-16', - 'commentaire'=>'MOCK: hop le commentaire de festival', - 'chiffreAffaire'=>'1234', - 'fondDeCaisseAvant'=>'100', - 'fondDeCaisseAprès'=>'150', - 'sold'=>123 + 'lastFestival' => ['id' => 1, + 'name' => 'le festival de mock', + 'dateCreation' => '2025-02-16', + 'commentaire' => 'MOCK: hop le commentaire de festival', + 'chiffreAffaire' => '1234', + 'fondDeCaisseAvant' => '100', + 'fondDeCaisseAprès' => '150', + 'sold' => 123 ], 'history' => [], ]); } + #[Route('/logged/import', name: 'import')] public function import(): Response { - // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST + // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST return $this->render('logged/import.html.twig', []); } + #[Route('/logged/mass_create', name: 'mass_create')] public function mass_create(): Response { - // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST + // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST return $this->render('logged/import.html.twig', []); } + #[Route('/logged/add-selling', name: 'add_selling')] + public function add_selling(): JsonResponse + { + // créer un nouveau Selling et retourner une réponse +// +// $loggedUser = $this->getUser(); +// // Prendre les informations en POST et créer une vente avec. +// $request = Request::createFromGlobals(); +// $data = json_decode($request->getContent(), true); +// +// $dataOfNewSelling = $data['activeSelling']; +// +// $newSelling = new Selling(); +// +// // si l'utilisateur courant n'a pas de festival actuel, en créer un +// +// $currentFestival = $loggedUser->getCurrentFestival(); +// if (!$currentFestival) { +// +// $currentFestival = new Festival(); +// $currentFestival +// ->setName('festival auto créé') +// ->setClientsCount(1); +// } else { +// $currentFestival->setClientsCount($currentFestival->getClientsCount() + 1); +// } +// $currentFestival->addSelling($newSelling); +// +// // prendre les identifiants des produits en base et les ajouter aux produits de ce Selling +//// $dataOfNewSelling['activeSelling']['id']; +// +// +// // Récupérer l'EntityManager +// $entityManager = $this->getDoctrine()->getManager(); +// +// // Récupérer les produits à partir des identifiants +// foreach ($dataOfNewSelling['products']['id'] as $productId) { +// +// $product = $entityManager->getRepository(Product::class)->find($productId); +// +// if ($product) { +// $newSelling->addProduct($product); +// $product->addSelling($newSelling); +// $entityManager->persist($product); +// } +// } +// +// +// $newSelling +// ->setPaidByCustomer($dataOfNewSelling['paidByClient']) +// ->setCustomerInfo($dataOfNewSelling['comment']) +// ->setDate(new \DateTime($data['date'])) +// ->setOwner($loggedUser); +// +// $entityManager = $this->getDoctrine()->getManager(); +// $entityManager->persist($newSelling); +// +// $entityManager->flush(); +// $newSelling = new Selling(); +// $newSelling->setOwner($loggedUser); + + + $response = [ +// 'message' => 'yes', +// 'newChiffreAffaire' => $currentFestival->getChiffreAffaire(), +// 'clientsCount' => $currentFestival->getClientsCount(), +// 'activeFestival' => $currentFestival, + ]; + + // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST + return $this->json($response); + } } diff --git a/src/Controller/SellingController.php b/src/Controller/SellingController.php index bd4666e8..78087768 100644 --- a/src/Controller/SellingController.php +++ b/src/Controller/SellingController.php @@ -7,6 +7,7 @@ use App\Form\Selling1Type; use App\Repository\SellingRepository; 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; @@ -78,4 +79,6 @@ final class SellingController extends AbstractController return $this->redirectToRoute('app_selling_index', [], Response::HTTP_SEE_OTHER); } + + } diff --git a/src/Entity/Festival.php b/src/Entity/Festival.php index 09b6ad20..191e1d20 100644 --- a/src/Entity/Festival.php +++ b/src/Entity/Festival.php @@ -55,6 +55,12 @@ class Festival #[ORM\ManyToOne(inversedBy: 'festivals')] private ?SerieFestival $serieFestival = null; + #[ORM\Column(nullable: true)] + private ?float $chiffreAffaire = null; + + #[ORM\Column(nullable: true)] + private ?int $clientsCount = null; + public function __construct() { $this->users = new ArrayCollection(); @@ -233,4 +239,28 @@ class Festival return $this; } + + public function getChiffreAffaire(): ?float + { + return $this->chiffreAffaire; + } + + public function setChiffreAffaire(?float $chiffreAffaire): static + { + $this->chiffreAffaire = $chiffreAffaire; + + return $this; + } + + public function getClientsCount(): ?int + { + return $this->clientsCount; + } + + public function setClientsCount(?int $clientsCount): static + { + $this->clientsCount = $clientsCount; + + return $this; + } } diff --git a/src/Entity/GroupOfProducts.php b/src/Entity/GroupOfProducts.php index d0113c99..64076a01 100644 --- a/src/Entity/GroupOfProducts.php +++ b/src/Entity/GroupOfProducts.php @@ -2,12 +2,14 @@ namespace App\Entity; -use App\Repository\GroupOfProductsRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; + use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -use ApiPlatform\Metadata\ApiResource; +use \App\Entity\GroupOfProducts; +use \App\Entity\Product; +use \App\Entity\Selling; #[ApiResource(paginationEnabled: false)] #[ORM\Entity(repositoryClass: GroupOfProductsRepository::class)] @@ -24,7 +26,6 @@ class GroupOfProducts /** * @var Collection */ - // TODO apiresource return properties #[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')] private Collection $products; @@ -35,7 +36,8 @@ class GroupOfProducts private ?Collection $sellings = null; #[ORM\ManyToOne(inversedBy: 'groupOfProducts')] - private ?User $user = null; + private ?User $owner = null; + public function __construct() { @@ -72,10 +74,11 @@ class GroupOfProducts } return $productsDTO; } - public function getProducts(): ?object - { - return $this->products; - } + + public function getProducts(): ?object + { + return $this->products; + } public function setProducts(object $products): static { @@ -124,14 +127,14 @@ class GroupOfProducts return $this; } - public function getUser(): ?User + public function getOwner(): ?User { - return $this->user; + return $this->owner; } - public function setUser(?User $user): static + public function setOwner(?User $owner): static { - $this->user = $user; + $this->owner = $owner; return $this; } diff --git a/src/Entity/Selling.php b/src/Entity/Selling.php index 54c1b744..b9fe262a 100644 --- a/src/Entity/Selling.php +++ b/src/Entity/Selling.php @@ -2,12 +2,10 @@ namespace App\Entity; -use App\Repository\SellingRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Doctrine\DBAL\Types\Types; + use Doctrine\ORM\Mapping as ORM; -use ApiPlatform\Metadata\ApiResource; #[ApiResource(paginationEnabled: false)] #[ORM\Entity(repositoryClass: SellingRepository::class)] @@ -42,6 +40,16 @@ class Selling #[ORM\ManyToOne(inversedBy: 'sellings')] private ?Festival $festival = null; + #[ORM\Column(length: 255)] + private ?string $customer_info = null; + + #[ORM\Column] + private ?float $paidByCustomer = null; + + #[ORM\ManyToOne(inversedBy: 'sellings')] + private ?User $owner = null; + + public function __construct() { $this->groupOfProducts = new ArrayCollection(); @@ -155,4 +163,42 @@ class Selling return $this; } + + public function getCustomerInfo(): ?string + { + return $this->customer_info; + } + + public function setCustomerInfo(string $customer_info): static + { + $this->customer_info = $customer_info; + + return $this; + } + + public function getPaidByCustomer(): ?float + { + return $this->paidByCustomer; + } + + public function setPaidByCustomer(float $paidByCustomer): static + { + $this->paidByCustomer = $paidByCustomer; + + return $this; + } + + public function getOwner(): ?User + { + return $this->owner; + } + + public function setOwner(?User $owner): static + { + $this->owner = $owner; + + return $this; + } + + } diff --git a/src/Entity/User.php b/src/Entity/User.php index ea6de1e2..3881f3cf 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -11,6 +11,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use ApiPlatform\Metadata\ApiResource; +use \App\Entity\GroupOfProducts; +use \App\Entity\Product; +use \App\Entity\Selling; #[ApiResource(paginationEnabled: false)] #[ORM\Entity(repositoryClass: UserRepository::class)] @@ -65,11 +68,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\OneToMany(targetEntity: Product::class, mappedBy: 'user')] private Collection $products; - /** - * @var Collection - */ - #[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'user')] - private Collection $groupOfProducts; /** * @var Collection @@ -86,14 +84,27 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\OneToOne(cascade: ['persist', 'remove'])] private ?Festival $activeFestival = null; + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: GroupOfProducts::class, mappedBy: 'owner')] + private Collection $groupOfProducts; + + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: Selling::class, mappedBy: 'owner')] + private Collection $sellings; + public function __construct() { $this->expenses = new ArrayCollection(); $this->products = new ArrayCollection(); - $this->groupOfProducts = new ArrayCollection(); $this->festivals = new ArrayCollection(); $this->seriesFestival = new ArrayCollection(); + $this->groupOfProducts = new ArrayCollection(); + $this->sellings = new ArrayCollection(); } public function getId(): ?int @@ -259,36 +270,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } - /** - * @return Collection - */ - public function getGroupOfProducts(): Collection - { - return $this->groupOfProducts; - } - - public function addGroupOfProduct(GroupOfProducts $groupOfProduct): static - { - if (!$this->groupOfProducts->contains($groupOfProduct)) { - $this->groupOfProducts->add($groupOfProduct); - $groupOfProduct->setUser($this); - } - - return $this; - } - - public function removeGroupOfProduct(GroupOfProducts $groupOfProduct): static - { - if ($this->groupOfProducts->removeElement($groupOfProduct)) { - // set the owning side to null (unless already changed) - if ($groupOfProduct->getUser() === $this) { - $groupOfProduct->setUser(null); - } - } - - return $this; - } - /** * @return Collection */ @@ -387,4 +368,66 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + /** + * @return Collection + */ + public function getGroupOfProducts(): Collection + { + return $this->groupOfProducts; + } + + public function addGroupOfProduct(GroupOfProducts $groupOfProduct): static + { + if (!$this->groupOfProducts->contains($groupOfProduct)) { + $this->groupOfProducts->add($groupOfProduct); + $groupOfProduct->setOwner($this); + } + + return $this; + } + + public function removeGroupOfProduct(GroupOfProducts $groupOfProduct): static + { + if ($this->groupOfProducts->removeElement($groupOfProduct)) { + // set the owning side to null (unless already changed) + if ($groupOfProduct->getOwner() === $this) { + $groupOfProduct->setOwner(null); + } + } + + return $this; + } + + /** + * @return Collection + */ + public function getSellings(): Collection + { + return $this->sellings; + } + + public function addSelling(Selling $selling): static + { + if (!$this->sellings->contains($selling)) { + $this->sellings->add($selling); + $selling->setOwner($this); + } + + return $this; + } + + public function removeSelling(Selling $selling): static + { + if ($this->sellings->removeElement($selling)) { + // set the owning side to null (unless already changed) + if ($selling->getOwner() === $this) { + $selling->setOwner(null); + } + } + + return $this; + } + + }