diff --git a/.gitignore b/.gitignore
index c2226ea..c8f56dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
config/config.php
+config/conf.php
.idea
-tmp
+/public/uploads
+/tmp
+vendor
composer.lock
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 056115b..3bd2776 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
"require": {
"guzzlehttp/psr7": "^1.4",
"http-interop/response-sender": "^1.0",
- "zendframework/zend-expressive-fastroute": "^2.0",
+ "zendframework/zend-expressive-fastroute": "1.2.0",
"twig/twig": "^2.4",
"php-di/php-di": "^5.4",
"pagerfanta/pagerfanta": "^2.1",
@@ -28,8 +28,8 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.0",
- "phpunit/phpunit": "^6.2",
"robmorgan/phinx": "0.8.1",
+ "phpunit/phpunit": "~5.2",
"fzaninotto/faker": "^1.8"
}
}
diff --git a/config/conf.php b/config/conf.php
index 32e0b2d..b8c7df8 100644
--- a/config/conf.php
+++ b/config/conf.php
@@ -1,5 +1,7 @@
-
-
@@ -55,7 +53,6 @@
-
@@ -71,14 +68,10 @@
-
-
-
-
diff --git a/public/index.php b/public/index.php
index 3f31081..1ba2bf9 100644
--- a/public/index.php
+++ b/public/index.php
@@ -36,7 +36,7 @@ $app = (new \Framework\App( $chemin_new .'/config/config.php'))
$container = $app->getContainer();
// Pose problème
-$container->get(\Framework\Router::class)->get('/', \App\Gmarche\Actions\RegionIndexAction::class, 'home');
+//$container->get(\Framework\Router::class)->get('/', \App\Gmarche\Actions\RegionIndexAction::class, 'home');
$app->pipe(Whoops::class);
$app->pipe(TrailingSlashMiddleware::class);
diff --git a/public/uploads/products/panier.png b/public/uploads/products/panier.png
deleted file mode 100644
index 3601125..0000000
Binary files a/public/uploads/products/panier.png and /dev/null differ
diff --git a/public/uploads/products/panier_thumb.png b/public/uploads/products/panier_thumb.png
deleted file mode 100644
index f48fe0d..0000000
Binary files a/public/uploads/products/panier_thumb.png and /dev/null differ
diff --git a/src/Framework/Router.php b/src/Framework/Router.php
index 847b445..dfd6ce7 100644
--- a/src/Framework/Router.php
+++ b/src/Framework/Router.php
@@ -20,8 +20,8 @@ class Router
public function __construct(?string $cache = null)
{
$this->router = new FastRouteRouter(null, null, [
- FastRouteRouter::CONFIG_CACHE_ENABLED => !is_null($cache),
- FastRouteRouter::CONFIG_CACHE_FILE => $cache
+ // FastRouteRouter::CONFIG_CACHE_ENABLED => !is_null($cache),
+ // FastRouteRouter::CONFIG_CACHE_FILE => $cache
]);
}
@@ -72,7 +72,7 @@ class Router
* @param $callable
* @param string $prefixName
*/
- public function crud(string $prefixPath, $callable, string $prefixName)
+ /* public function crud(string $prefixPath, $callable, string $prefixName)
{
$this->get("$prefixPath", $callable, "$prefixName.index");
$this->get("$prefixPath/new", $callable, "$prefixName.create");
@@ -80,7 +80,7 @@ class Router
$this->get("$prefixPath/{id:\d+}", $callable, "$prefixName.edit");
$this->post("$prefixPath/{id:\d+}", $callable);
$this->delete("$prefixPath/{id:\d+}", $callable, "$prefixName.delete");
- }
+ }*/
diff --git a/src/Gmarche/Actions/AntenneShowAction.php b/src/Gmarche/Actions/AntenneShowAction.php
index f5ec230..f4fcf0d 100644
--- a/src/Gmarche/Actions/AntenneShowAction.php
+++ b/src/Gmarche/Actions/AntenneShowAction.php
@@ -7,6 +7,7 @@ use Framework\Actions\RouterAwareAction;
use Framework\Renderer\RendererInterface;
use Framework\Router;
use GuzzleHttp\Psr7\Response;
+use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
@@ -33,22 +34,25 @@ class AntenneShowAction
public function __construct(
RendererInterface $renderer,
RegionTable $regionTable,
- AntenneTable $antenneTable
+ AntenneTable $antenneTable,
+ ContainerInterface $container
) {
$this->renderer = $renderer;
$this->regionTable = $regionTable;
$this->antenneTable = $antenneTable;
+ $this->container = $container;
}
public function __invoke(Request $request)
{
$params = $request->getQueryParams();
+ $gmarchePrefix = $this->container->get('gmarche.prefix');
// On récupère l'id de la région cliquée
$region_id = $this->regionTable->findBy('slug', $request->getAttribute('slug'))->id;
$slug = $request->getAttribute('slug');
$page = $params['p'] ?? 1; // Si la page n'est pas définie, on l'initialise à 1
- $antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(10, $page);
+ $antennes = $this->antenneTable->findAllbyRegion($region_id)->paginate(25, $page);
$region=$this->regionTable->findBy('slug', $request->getAttribute('slug'));
//$antenne = 1;
@@ -58,6 +62,6 @@ class AntenneShowAction
'id' => $region->id
]);
}*/
- return $this->renderer->render('@gmarche/antenne', compact('slug', 'region', 'antennes', 'page'));
+ return $this->renderer->render('@gmarche/antenne', compact('slug', 'region', 'gmarchePrefix','antennes', 'page'));
}
}
diff --git a/src/Gmarche/GmarcheModule.php b/src/Gmarche/GmarcheModule.php
index dda3119..47e55da 100644
--- a/src/Gmarche/GmarcheModule.php
+++ b/src/Gmarche/GmarcheModule.php
@@ -17,11 +17,10 @@ class GmarcheModule extends Module
public function __construct(ContainerInterface $container)
{
- // $uri = $_SERVER['REQUEST_URI'];
$gmarchePrefix = $container->get('gmarche.prefix');
$container->get(RendererInterface::class)->addPath('gmarche', __DIR__ . '/views');
$router = $container->get(Router::class);
- $router->get( $gmarchePrefix, RegionIndexAction::class, 'gmarche.index');
- $router->get("$gmarchePrefix/{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne');
+ $router->get( '/france', RegionIndexAction::class, 'gmarche.index');
+ $router->get("/france/{slug:[a-z\-0-9]+}", AntenneShowAction::class, 'gmarche.antenne');
}
}
diff --git a/src/Gmarche/config.php b/src/Gmarche/config.php
index 8d1d0a3..a0473f6 100644
--- a/src/Gmarche/config.php
+++ b/src/Gmarche/config.php
@@ -5,5 +5,5 @@ use function \Di\object;
use function \Di\get;
return [
- 'gmarche.prefix' => '/gmarche'
+ 'gmarche.prefix' => '/france'
];
diff --git a/src/Gmarche/views/antenne.twig b/src/Gmarche/views/antenne.twig
index a74e593..5f9bf1e 100644
--- a/src/Gmarche/views/antenne.twig
+++ b/src/Gmarche/views/antenne.twig
@@ -32,7 +32,7 @@
{% for antenne in antennes %}
-
+
-
{{ antenne.name }}
diff --git a/src/Product/Actions/ProductIndexAction.php b/src/Product/Actions/ProductIndexAction.php
index d0899af..95c1ee8 100644
--- a/src/Product/Actions/ProductIndexAction.php
+++ b/src/Product/Actions/ProductIndexAction.php
@@ -6,6 +6,7 @@ use App\Gmarche\Table\RegionTable;
use App\Product\Table\ProductTable;
use Framework\Actions\RouterAwareAction;
use Framework\Renderer\RendererInterface;
+use Psr\Container\ContainerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
class ProductIndexAction
@@ -27,18 +28,20 @@ class ProductIndexAction
RendererInterface $renderer,
ProductTable $productTable,
AntenneTable $antenneTable,
- RegionTable $regionTable
+ RegionTable $regionTable,
+ ContainerInterface $container
) {
$this->renderer = $renderer;
$this->productTable = $productTable;
$this->antenneTable = $antenneTable;
$this->regionTable = $regionTable;
-
+ $this->container = $container;
}
public function __invoke(Request $request)
{
$params = $request->getQueryParams();
+ $gmarchePrefix = $this->container->get('gmarche.prefix');
$antenne_slug =$request->getAttribute('slug');
$region_slug =$request->getAttribute('region');
@@ -55,6 +58,6 @@ class ProductIndexAction
//echo "antenne_ici";
//var_dump($items);
//die();
- return $this->renderer->render($viewPath.'/index', compact('antenne_slug','region_name','region_slug','antenne_id','antenne_name','viewPath', 'items' ));
+ return $this->renderer->render($viewPath.'/index', compact('antenne_slug','gmarchePrefix','region_name','region_slug','antenne_id','antenne_name','viewPath', 'items' ));
}
}
diff --git a/src/Product/ProductModule.php b/src/Product/ProductModule.php
index d919f7c..b5b2886 100644
--- a/src/Product/ProductModule.php
+++ b/src/Product/ProductModule.php
@@ -5,11 +5,12 @@ use App\Admin\AdminTwigExtension;
use App\Product\Actions\ProductCrudAction;
use App\Product\Actions\ProductIndexAction;
use Framework\Auth\LoggedInMiddleware;
+use Framework\Middleware\CombinedMiddleware;
use Framework\Module;
use Framework\Renderer\RendererInterface;
use Framework\Renderer\TwigRenderer;
use Framework\Router;
-use Grpc\Server;
+//use Grpc\Server;
use GuzzleHttp\Psr7\ServerRequest;
use Psr\Container\ContainerInterface;
@@ -30,22 +31,11 @@ class ProductModule extends Module
$router = $container->get(Router::class);
//$router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/{antenne:[a-z\-0-9]+}", ProductIndexAction::class, 'product.index');
//$router->get("$gmarchePrefix/{region:[a-z\-]+}/{slug:[a-z\-]+}", ProductIndexAction::class, 'product.ville');
- $router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}/{antenne:[0-9]{1,}}", ProductIndexAction::class, 'product.ville');
+ $router->get("/france/{region:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}/produits", ProductIndexAction::class, 'product.ville');
+ // comb $router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}/produits", new CombinedMiddleware($container, [ProductIndexAction::class]), 'product.ville');
// $router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/{antenne:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}", ProductIndexAction::class, 'product.admin');
- //$router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/fuck/{antenne:[a-z\-0-9]+}", ProductIndexAction::class, 'product.index');
-
- // $route = $router->match(new ServerRequest('GET','/gmarche/ile-de-france/paris/1'));
- //$this->assertEquals(null, $route);
- //echo 'var dump route';
- //var_dump($route);
- //die();
-
-// $router->get("$gmarchePrefix/{region:[a-z\-0-9]+}/{slug:[a-z\-0-9]+}", ProductIndexAction::class, 'product.index');
- //$router->get("$gmarchePrefix/ile-de-france/paris", ProductIndexAction::class, 'product.index');
- //echo "
var_dump";
-//var_dump($router);
-//die();
+
// $router->crud("$gmarchePrefix/{region:[a-z\-]+}/{slug:[a-z\-0-9]+}/{antenne:[0-9]{1,}}",[LoggedInMiddleware::class, ProductCrudAction::class],'product.admin');
}
diff --git a/src/Product/views/admin/products/index.twig b/src/Product/views/admin/products/index.twig
index b39d9f1..f81e717 100644
--- a/src/Product/views/admin/products/index.twig
+++ b/src/Product/views/admin/products/index.twig
@@ -37,22 +37,95 @@
.breadcrumb {
font-size: 1rem;
}
+
+ .toggle_radio {
+ position: relative;
+ background: rgba(0,0,0,.1);
+ margin: -3px auto 4px 10px;
+ overflow: hidden;
+ padding: 0 !important;
+ border-radius: 50px;
+ height: 26px;
+ width: 215px;
+ }
+ .toggle_radio > * {
+ float: left;
+ }
+ .toggle_radio input[type=radio]{
+ display: none;
+ /*position: fixed;*/
+ }
+ .toggle_radio label{
+ /* font: 90%/1.618 "Source Sans Pro";*/
+ color: rgba(0,0,0,.9);
+ z-index: 0;
+ display: block;
+ width: 100px;
+ height: 20px;
+ margin: 3px 3px;
+ border-radius: 50px;
+ cursor: pointer;
+ z-index: 1;
+ /*background: rgba(0,0,0,.1);*/
+ text-align: center;
+ /*margin: 0 2px;*/
+ /*background: blue;*/ /*make it blue*/
+ }
+ .toggle_option_slider{
+ width: 100px;
+ height: 20px;
+ position: absolute;
+ top: 3px;
+ border-radius: 50px;
+ transition: all .4s ease;
+ }
+
+ #first_toggle:checked ~ .toggle_option_slider{
+ background: rgba(0,0,0,.3);
+ left: 3px;
+ }
+ #second_toggle:checked ~ .toggle_option_slider{
+ background: rgba(0,0,0,.3);
+ left: 109px;
+ }
+
-
-
G-Marché de : {{ antenne_name }}
-
+
{% if antenne_name == 'Paris' %}