commit fb354d59ad3c7749bd9ff22ce6cd34ba3e8aa871
Author: rizir01 <themurrayms@seznam.cz>
Date:   Fri May 1 14:12:08 2020 +0200

    Issue #7957 @3h
    
    Issue #7957 @3h
    
    Opraveni prekryti tlacitek. Opraveni rozdeleni tlacitek po 6 do novych "rows". Odstraneni tlacitka "Enter" a pridani po stisknuti na konkretni kategorii zobrazeni vsech artefaktu prirazenych do konkretni kategorie.

diff --git a/app/ArtefactCategory.php b/app/ArtefactCategory.php
new file mode 100644
index 0000000..d69aaab
--- /dev/null
+++ b/app/ArtefactCategory.php
@@ -0,0 +1,22 @@
+<?php
+
+
+namespace App;
+
+
+use Illuminate\Database\Eloquent\Model;
+
+class ArtefactCategory extends Model
+{
+    // Table Name
+    protected $table = 'artefact_category';
+    // Primary Key
+    public $primaryKey = 'artefact_id';
+
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public $timestamps = false;
+}
diff --git a/app/ArtefactUser.php b/app/ArtefactUser.php
new file mode 100644
index 0000000..4514152
--- /dev/null
+++ b/app/ArtefactUser.php
@@ -0,0 +1,20 @@
+<?php
+
+
+namespace App;
+
+
+class ArtefactUser extends Model
+{
+    // Table Name
+    protected $table = 'artefact_user';
+    // Primary Key
+    public $primaryKey = 'artefact_id';
+
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public $timestamps = false;
+}
diff --git a/app/Http/Controllers/ArtefactController.php b/app/Http/Controllers/ArtefactController.php
index 867d976..74b0fdd 100644
--- a/app/Http/Controllers/ArtefactController.php
+++ b/app/Http/Controllers/ArtefactController.php
@@ -3,6 +3,8 @@
 namespace App\Http\Controllers;
 
 use App\Artefact;
+use App\ArtefactCategory;
+use App\Category;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 
@@ -25,6 +27,30 @@ class ArtefactController extends Controller
         return view('artefact.default', ['artefacts' => $artefacts]);
     }
 
+    /**
+     * Returns view of artefacts related to the chosen category
+     *
+     * @param $id       id of the category
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     */
+    public function showCategory($id)
+    {
+        $cateogryArtefacts = ArtefactCategory::where('category_id', $id)->get();
+        if(count($cateogryArtefacts) > 0)
+        {
+            $artefacts = array();
+            foreach($cateogryArtefacts as $ar)
+            {
+                array_push($artefacts, Artefact::where('id', $ar->artefact_id)->get());
+            }
+            return view('artefact.category', ['artefacts' => $artefacts]);
+        }
+        else
+        {
+            return view('artefact.category', ['artefacts' => array()]);
+        }
+    }
+
     /**
      * Returns view of single artefact given by its id.
      *
diff --git a/resources/sass/_custom.scss b/resources/sass/_custom.scss
index 5abafaa..64ea5c0 100644
--- a/resources/sass/_custom.scss
+++ b/resources/sass/_custom.scss
@@ -395,6 +395,12 @@ body {
         }
     }
 
+    //CATEGORIES - ROW BLOCK
+    .cat-col-md-2
+    {
+        margin: 2%;
+    }
+
     //CATEGORIES - TILES
     .btn.btn-dark.cat-tile
     {
@@ -414,9 +420,8 @@ body {
         word-wrap: break-word;
 
         //SPACING
-        margin: 10pt 32pt;
         height: 40mm;
-        width: 86%;
+        width: 100%;
 
         &:active, &:focus
         {
@@ -428,15 +433,11 @@ body {
         }
     }
 
-    //CATEGORIES - enter button
-    .btn.button-square.cat-enter-butt
+    //CATEGORY/{id} -h2 title NO ARTEFACTS
+    .category-h2
     {
-        position: fixed;
-        bottom: 8%;
-        right: 40%;
-        display: none;
+        color: $theme-color-four;
     }
-
 }
 
 .arrow{
@@ -522,7 +523,6 @@ body {
     {
         font-size: 23pt;
         padding-top: 50pt;
-        margin-left: 36pt;
         white-space: nowrap;
 
     }
diff --git a/resources/views/artefact/category.blade.php b/resources/views/artefact/category.blade.php
new file mode 100644
index 0000000..714e3a0
--- /dev/null
+++ b/resources/views/artefact/category.blade.php
@@ -0,0 +1,54 @@
+@extends('layouts.app')
+
+@section('title', 'Artefacts')
+
+@section('breadcrumb')
+    <li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
+    <li class="breadcrumb-item active" aria-current="page">Artefacts</li>
+@endsection
+
+
+@section('content')
+    <div class="container">
+        <div class="jumbotron mt-5">
+            <div class="text-center">
+                <h1>Artefact list</h1>
+                <p>
+                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+                    Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
+                    Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
+                    Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
+                    Morbi scelerisque luctus velit.
+                    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+                </p>
+            </div>
+        </div>
+
+        @if (count($artefacts) === 0)
+            <div class="text-center category-h2">
+                <h2>Currently no artefacts available.</h2>
+            </div>
+        @else
+            @foreach($artefacts as $artefact)
+                <div class="artefacts-area mb-5">
+                    <div class="card">
+                        <svg class="bd-placeholder-img card-img-top" width="100%" height="180" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Image cap"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"></rect><text x="45%" y="50%" fill="#dee2e6" dy=".3em">Artefact image</text></svg>
+                        <div class="card-body">
+                            <h5 class="card-title"><a href="{{ url('/artefact/' . $artefact[0]->id) }}">{{$artefact[0]->name}}</a> - {{$artefact[0]->author}}</h5>
+                            <h6 class="card-subtitle mb-2 text-muted">{{$artefact[0]->year}}, {{$artefact[0]->pages}} pages</h6>
+                            <p class="card-text">
+                                Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+                                Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
+                                Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
+                                Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
+                                Morbi scelerisque luctus velit.
+                                Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
+                            </p>
+                        </div>
+                    </div>
+                </div>
+            @endforeach
+        @endif
+    </div>
+
+@endsection
diff --git a/resources/views/categories/index.blade.php b/resources/views/categories/index.blade.php
index 84de344..2f9fd51 100644
--- a/resources/views/categories/index.blade.php
+++ b/resources/views/categories/index.blade.php
@@ -7,43 +7,25 @@
         {{--<p><?php dd($categories); ?></p>--}}
         <div class="cat-main-div" onclick="resetEnter()">
             <div class="head-title text-center">
-                <h1>choose a few topics</h1>
+                <h1>choose a topic</h1>
             </div>
-            <div class="row">
-                {{--@for($k = 1; $k <= count($categories);$k++)--}}
-                @for($k = 0; $k < $count;$k++)
-                    <div class="col-md-2">
-                        <button class="btn btn-dark cat-tile" onclick="showEnterButton({{$categoryNames[$k]->id}})">
-                            {{$categoryNames[$k]->nameCZ}}
-                        </button>
+            {{--@for($k = 1; $k <= count($categories);$k++)--}}
+            @for($k = 0; $k < $count;$k++)
+                @if($k % 6 == 0)
+                    <div class="row">
+                @endif
+                    <div class="col-md-2 cat-col-md-2">
+                        <a href="{{ url('/category/' . $categoryNames[$k]->id) }}">
+                            <button class="btn btn-dark cat-tile">
+                                {{$categoryNames[$k]->nameCZ}}
+                            </button>
+                        </a>
                     </div>
-                @endfor
-            </div>
-            <div class="carousel-button">
-                <a class="btn button-square cat-enter-butt" role="button">enter</a>
-            </div>
+                @if($k % 6 == 5 || $k + 1 == $count)
+                    </div>
+                @endif
+            @endfor
         </div>
-        <script>
-            var catId = -1;
-            var show = 0;
-
-            function showEnterButton(id)
-            {
-                catId = id;
-                show = 1;
-                $(".cat-enter-butt").css('display', "inline");
-            }
-
-            function resetEnter()
-            {
-                if(show == 0)
-                {
-                    catId = -1;
-                    $(".cat-enter-butt").css('display', "none");
-                }
-                show = 0;
-            }
-        </script>
     @else
         <ul class="list-group">
             <li class="list-group-item">
diff --git a/routes/web.php b/routes/web.php
index 994b0dc..0a1d100 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -17,11 +17,13 @@ Route::get('/', 'PagesController@index');
 
 Route::get('/artefact', 'ArtefactController@default');
 Route::get('/artefact/{id}', 'ArtefactController@view');
+Route::get('/category/{id}', 'ArtefactController@showCategory');
 Route::resource('/detail', 'DetailsController', array('only' => array('index', 'show')));
 Route::resource('/categories', 'CategoriesController', array('only' => array('index')));
-Route::resource('/favartefacts', 'FavoriteArtefactsController', array('only' => array('index', 'show')));
+Route::resource('/favartefacts', 'FavoriteArtefactsController', array('only' => array('index', 'show', 'store')));
 Route::get('/favmetadata', 'FavoriteMetadataController@index');
 
+
 Auth::routes();
 
 Route::get('/home', 'HomeController@index')->name('home');
