From 503efc6f2585d62f9a9e5487e2e4af663a1f378b Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Tue, 7 Feb 2023 23:25:59 +0100 Subject: [PATCH] add cookie consent, change search for product_type empty --- .../Controllers/Shop/SearchController.php | 8 +- app/Models/Shop/Article.php | 8 +- config/apexcharts.php | 89 +++++++++++++++++++ resources/views/Shop/Search/results.blade.php | 1 + resources/views/Shop/layout/layout.blade.php | 1 + 5 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 config/apexcharts.php diff --git a/app/Http/Controllers/Shop/SearchController.php b/app/Http/Controllers/Shop/SearchController.php index 01be573c..80e082d7 100644 --- a/app/Http/Controllers/Shop/SearchController.php +++ b/app/Http/Controllers/Shop/SearchController.php @@ -11,13 +11,17 @@ class SearchController extends Controller { public function search(Request $request) { + $data = $request->input(); + $data['product_type'] = 'botanic'; $articles = Searches::getResults($request->input()); $data = [ 'articles' => $articles, 'articles_count' => $articles ? count($articles) : 0, - 'search' => $request->input(), - 'product_type' => $request->input('product_type'), + 'search' => $data, + 'product_type' => $data['product_type'], ]; + // dump($data); + // exit; return view('Shop.Search.results', $data); } } diff --git a/app/Models/Shop/Article.php b/app/Models/Shop/Article.php index 236de1ef..aafd9f70 100644 --- a/app/Models/Shop/Article.php +++ b/app/Models/Shop/Article.php @@ -89,22 +89,22 @@ class Article extends Model implements HasMedia public function scopeByAutocomplete($query, $str) { - return $query->where($this->table . '.name', 'LIKE', "%${str}%"); + return $query->where($this->table . '.name', 'LIKE', '%' . $str .'%'); } public function scopeSearch($query, $str) { - return $query->where($this->table . '.name', 'LIKE', "%${str}%"); + return $query->where($this->table . '.name', 'LIKE', '%' . $str .'%'); } public function scopeByArticleNature($query, $id) { - return $query->where($this->table . '.article_nature_id', $id); + return $id ? $query->where($this->table . '.article_nature_id', $id) : $query; } public function scopeByArticleNatures($query, $ids) { - return $query->whereIn($this->table . '.article_nature_id', $ids); + return $ids ? $query->whereIn($this->table . '.article_nature_id', $ids) : $query; } public function scopeByCategories($query, $categories_id) diff --git a/config/apexcharts.php b/config/apexcharts.php new file mode 100644 index 00000000..c2a9158d --- /dev/null +++ b/config/apexcharts.php @@ -0,0 +1,89 @@ + [ + 'chart' => [ + 'type' => 'line', + 'height' => 500, + 'width' => null, + 'toolbar' => [ + 'show' => false, + ], + 'stacked' => false, + 'zoom' => [ + 'enabled' => true, + ], + 'fontFamily' => 'Nunito', + 'foreColor' => '#373d3f', + ], + + 'plotOptions' => [ + 'bar' => [ + 'horizontal' => false, + ], + ], + + 'colors' => [ + '#008FFB', '#00E396', '#feb019', '#ff455f', '#775dd0', '#80effe', + '#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '#00a9f4', '#2ccdc9', '#5e72e4' + ], + + 'series' => [], + + 'dataLabels' => [ + 'enabled' => false + ], + + 'labels' => [], + + 'title' => [ + 'text' => [] + ], + + 'subtitle' => [ + 'text' => 'undefined', + 'align' => 'left', + ], + + 'xaxis' => [ + 'categories' => [], + ], + + 'grid' => [ + 'show' => true + ], + + 'markers' => [ + 'size' => 4, + 'colors' => [ + '#008FFB', '#00E396', '#feb019', '#ff455f', '#775dd0', '#80effe', + '#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '#00a9f4', '#2ccdc9', '#5e72e4' + ], + 'strokeColors' => "#fff", + 'strokeWidth' => 2, + 'hover' => [ + 'size' => 7, + ], + ], + + 'stroke' => [ + 'show' => true, + 'width' => 4, + 'colors' => [ + '#008FFB', '#00E396', '#feb019', '#ff455f', '#775dd0', '#80effe', + '#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '#00a9f4', '#2ccdc9', '#5e72e4' + ] + ], + ], + +]; diff --git a/resources/views/Shop/Search/results.blade.php b/resources/views/Shop/Search/results.blade.php index a9a626bd..b5e94878 100644 --- a/resources/views/Shop/Search/results.blade.php +++ b/resources/views/Shop/Search/results.blade.php @@ -6,6 +6,7 @@ @include('Shop.Tags.partials.filter') {{ $articles_count ?? 0 }} Résultats + @if ($display_by_rows ?? false) @include('Shop.Shelves.partials.category_articles_rows') @else diff --git a/resources/views/Shop/layout/layout.blade.php b/resources/views/Shop/layout/layout.blade.php index 3d29495c..114b263a 100644 --- a/resources/views/Shop/layout/layout.blade.php +++ b/resources/views/Shop/layout/layout.blade.php @@ -34,6 +34,7 @@ @include("Shop.layout.partials.footer") + @include('cookie-consent::index')