From 09ab27a6d19883317f2fc185b57b971b8c780069 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 10 Feb 2018 01:59:26 +0100 Subject: Major improvements. (website) --- site/app/Http/Controllers/IndexController.php | 30 +- site/app/Http/Controllers/OfferController.php | 26 ++ site/app/Http/Controllers/WhiskyController.php | 18 -- site/app/Libraries/TemplateFunction.php | 26 ++ site/config/app.php | 2 + site/public/css/blog.css | 2 + site/public/css/custom.css | 38 +++ site/public/css/sticky-footer-navbar.css | 13 +- site/resources/views/index.blade.php | 422 ++++--------------------- site/resources/views/layouts/base.blade.php | 9 +- site/resources/views/offer.blade.php | 117 +++++++ site/resources/views/snippets/footer.blade.php | 24 ++ site/resources/views/snippets/navbar.blade.php | 29 +- site/routes/web.php | 6 +- 14 files changed, 359 insertions(+), 403 deletions(-) create mode 100644 site/app/Http/Controllers/OfferController.php delete mode 100644 site/app/Http/Controllers/WhiskyController.php create mode 100644 site/app/Libraries/TemplateFunction.php create mode 100644 site/resources/views/offer.blade.php create mode 100644 site/resources/views/snippets/footer.blade.php (limited to 'site') diff --git a/site/app/Http/Controllers/IndexController.php b/site/app/Http/Controllers/IndexController.php index 745a023..c0056d9 100644 --- a/site/app/Http/Controllers/IndexController.php +++ b/site/app/Http/Controllers/IndexController.php @@ -14,8 +14,34 @@ class IndexController extends Controller { */ public function showPage(Request $request) { - //$data = DB::table('angebote')->orderBy('quotient', 'DESC')->limit(100)->get(); - $data = DB::table('angebote')->orderBy('quotient', 'DESC')->limit(100)->simplePaginate(20); + + $views = array("whisky", "wodka", "gin", "rum", "misc"); + $query = ""; + + foreach($views as $view) { + if ($query != "") { + $query .= " UNION "; + } + $query .= "(SELECT name, image_url, spirit_type, spirit_type AS url, spirit_type AS angebotsname, original_price, discounted_price, procent, '' AS linktext FROM ". $view ."_view WHERE original_price > 19.98 ORDER BY procent DESC LIMIT 1)"; + } + + // removes the last union + #$query .= substr($query, -1, strlen(" UNION ")); + #echo "
";
+	    #var_dump($query); exit;
+
+	    /*
+	    $dbh = DB::connection('mysql')->getPdo();
+	    $stmt = $dbh->prepare($query);
+	    $stmt->execute();
+
+	    $data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
+	     */
+
+
+	    #var_dump($query); exit;
+	    $data = DB::select($query);
+		#$data = DB::table('whisky_view')->orderBy('procent', 'DESC')->limit(100)->simplePaginate(20);
 
         return view('index', ['data' => $data]);
     }
diff --git a/site/app/Http/Controllers/OfferController.php b/site/app/Http/Controllers/OfferController.php
new file mode 100644
index 0000000..99108cd
--- /dev/null
+++ b/site/app/Http/Controllers/OfferController.php
@@ -0,0 +1,26 @@
+getName();
+	$data = DB::table($view_name . '_view')->orderBy('procent', 'DESC')->limit(100)->simplePaginate(20);
+
+	if ( "misc" == $view_name ) {
+		$view_name = "Andere Angebote";
+	}
+
+        return view('offer', ['data' => $data, 'spirit_type' => $view_name]);
+    }
+} 
diff --git a/site/app/Http/Controllers/WhiskyController.php b/site/app/Http/Controllers/WhiskyController.php
deleted file mode 100644
index 620bfc7..0000000
--- a/site/app/Http/Controllers/WhiskyController.php
+++ /dev/null
@@ -1,18 +0,0 @@
- Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
 
+        'TF' => App\Libraries\TemplateFunction::class,
+
     ],
 
 ];
diff --git a/site/public/css/blog.css b/site/public/css/blog.css
index 8f6d6a2..9d105dc 100644
--- a/site/public/css/blog.css
+++ b/site/public/css/blog.css
@@ -120,6 +120,7 @@ h1, h2, h3, h4, h5, h6 {
 /*
  * Footer
  */
+/*
 .blog-footer {
   padding: 2.5rem 0;
   color: #999;
@@ -130,3 +131,4 @@ h1, h2, h3, h4, h5, h6 {
 .blog-footer p:last-child {
   margin-bottom: 0;
 }
+*/
diff --git a/site/public/css/custom.css b/site/public/css/custom.css
index f3c99e1..417d4dd 100644
--- a/site/public/css/custom.css
+++ b/site/public/css/custom.css
@@ -1,4 +1,42 @@
+.custom-flex-child {
+	min-width: 0;
+}
+.h3-truncate {
+	min-width: 0;
+}
+.custom-flex-child > .h3-truncate > .hide-overflow{
+	overflow: hidden;
+	text-overflow: ellipsis !important;
+}
+.custom-flex-child > .hide-overflow{
+	overflow: hidden;
+	text-overflow: ellipsis !important;
+}
 .hide-overflow{
 	overflow: hidden;
 	text-overflow: ellipsis !important;
 }
+.footer-col {
+	padding-right: 20px;
+	padding-left: 20px;
+}
+.bg-dark-opacity {
+}
+.w-55 {
+	width: 55% !important;
+}
+.h-40 {
+	height: 40% !important;
+}
+.h-45 {
+	height: 45% !important;
+}
+.text-small {
+	font-size: 80%;
+}
+.mt-10 {
+	margin-top: 10px;
+}
+.mt-20 {
+	margin-top: 20px;
+}
diff --git a/site/public/css/sticky-footer-navbar.css b/site/public/css/sticky-footer-navbar.css
index 07fd56a..bca2eae 100644
--- a/site/public/css/sticky-footer-navbar.css
+++ b/site/public/css/sticky-footer-navbar.css
@@ -6,14 +6,14 @@ html {
 }
 body {
   /* Margin bottom by footer height */
-  margin-bottom: 60px;
+  margin-bottom: 200px;
 }
 .footer {
   position: absolute;
   bottom: 0;
   width: 100%;
   /* Set the fixed height of the footer here */
-  height: 60px;
+  height: 200px;
   line-height: 60px; /* Vertically center the text there */
   background-color: #f5f5f5;
 }
@@ -23,15 +23,14 @@ body {
 -------------------------------------------------- */
 /* Not required for template or sticky footer method. */
 
+/*
+*/
 body > .container {
-  padding: 60px 15px 0;
+  padding: 30px 15px 0;
 }
 
 .footer > .container {
+  margin-top: 10px;
   padding-right: 15px;
   padding-left: 15px;
 }
-
-code {
-  font-size: 80%;
-}
diff --git a/site/resources/views/index.blade.php b/site/resources/views/index.blade.php
index 57c2c42..448c069 100644
--- a/site/resources/views/index.blade.php
+++ b/site/resources/views/index.blade.php
@@ -10,10 +10,23 @@
         
       
 
+
 spirit_type ) {
+		$offer->url = "misc";
+		$offer->angebotsname = "anderen Angeboten";
+		$offer->linktext = "Weitere günstige Angebote entdecken.";
+	} else {
+		$offer->url = lcfirst($offer->url) ;
+		$offer->angebotsname = $offer->angebotsname . "angeboten";
+		$offer->linktext = "Den günstigsten ". $offer->spirit_type ." finden.";
+	}
 
 	if ( $count % 2 == 0) {
 ?>
@@ -21,26 +34,39 @@ foreach( $data as $whisky) {
 name) > 60 ) {
-	#	$whisky->name = substr($whisky->name, 0, 60) . "...";
-	}
-
 ?>
-	
+ + + + +
+
+ {{ $offer->name }} + + {{ $offer->name }} +
+
- -{{ $data->links() }} - - - +@endsection - -
+@section('scripts') + @endsection - diff --git a/site/resources/views/layouts/base.blade.php b/site/resources/views/layouts/base.blade.php index 81f11f2..c487461 100644 --- a/site/resources/views/layouts/base.blade.php +++ b/site/resources/views/layouts/base.blade.php @@ -22,13 +22,12 @@ @yield('content')
- + + @include('snippets.footer') + + @yield('scripts') diff --git a/site/resources/views/offer.blade.php b/site/resources/views/offer.blade.php new file mode 100644 index 0000000..f17c39e --- /dev/null +++ b/site/resources/views/offer.blade.php @@ -0,0 +1,117 @@ +@extends('layouts.base') + +@section('content') +
+
+
+

{{ ucfirst($spirit_type) }}

+ +

Zurück zur Übersicht...

+
+
+ + + +
+ +
+
+ + +
+
+

{{ $offer->procent}}%

+
+
+
+ {{ $offer->spirit_type }} + {{ $offer->shop }} +
+ +

+ {{ $offer->name }} +

+ +

{{ TF::fF($offer->original_price) . "€" }} {{ TF::fF($offer->discounted_price) . "€" }} + {{ TF::fF($offer->base_price ) }}€/L +

+
+ {{ TF::fF($offer->volume) . " Liter" }}{{ TF::fF($offer->abv) . "%" }} Alk. +
+ Jetzt bestellen +

+ Versand: {{ TF::fF($offer->shipping_costs) }}€ Gratis ab {{ $offer->free_shipping }} +

+
+
+ {{ $offer->name }} + + + {{ $offer->name }} +
+
+

{{ $offer->procent}}%

+
+
+
+ {{ $offer->spirit_type }} + {{ $offer->shop }} +
+

+ {{ $offer->name }} +

+ +
+ {{ TF::fF($offer->volume) . " Liter" }}{{ TF::fF($offer->abv) . "%" }} Alk. +
+ +

{{ TF::fF($offer->original_price) . "€" }} {{ TF::fF($offer->discounted_price) . "€" }} + {{ TF::fF($offer->base_price ) }}€/L +

+ Jetzt bestellen +
+
+
+
+ + + +
+ + +
+ + +{{ $data->links() }} + + + + + +@endsection + diff --git a/site/resources/views/snippets/footer.blade.php b/site/resources/views/snippets/footer.blade.php new file mode 100644 index 0000000..80ea21e --- /dev/null +++ b/site/resources/views/snippets/footer.blade.php @@ -0,0 +1,24 @@ + + diff --git a/site/resources/views/snippets/navbar.blade.php b/site/resources/views/snippets/navbar.blade.php index e61a348..379dfeb 100644 --- a/site/resources/views/snippets/navbar.blade.php +++ b/site/resources/views/snippets/navbar.blade.php @@ -1,25 +1,34 @@
-