Projekt

Obecné

Profil

Stáhnout (4.44 KB) Statistiky
| Větev: | Tag: | Revize:
1
@extends('layouts.app')
2

    
3
@section('title', 'Favorite artefacts')
4

    
5
@section('content')
6
    <div class="container">
7
        @if(isset($artefacts))
8
            @if(count($artefacts) >= 1)
9
                <div class="fav-cat-mybooks">
10
                    <h1>My books</h1>
11
                </div>
12
                @foreach($artefacts as $artefact)
13
                    <div class="artefacts-area mb-5">
14
                        <div class="card">
15
                        {{--<svg class="bd-placeholder-img card-img-top" width="100%" height="180" src="{{asset('images/artefacts/book_cover_01.jpg')}}" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Image cap"><title>{{$artefact[0]->name}}</title><rect width="100%" height="100%" fill="#868e96"></rect><text x="45%" y="50%" fill="#dee2e6" dy=".3em"></text></svg>--}}
16
                        <a href="{{ url('/artefact/' . $artefact->id) }}">
17
                            <img class="card-img-top" src="{{asset('images/artefacts/book_cover_01.jpg')}}" width="100%" height=auto>
18
                        </a>
19
                        <div class="container card-cus-bottom">
20
                            <div class="d-flex flex-row row-list">{{--<div class="flex-row row-list">--}}
21
                                <div class="p-1 flex-fill bd-highlight left_panel_info">{{--<div class="col-xs-2 float-left left_panel_info">--}}
22
                                    <h5 class="card-title ">{{$artefact->name}}</h5>
23
                                    <h6 class="card-title">{{$artefact->author}}</h6>
24
                                </div>
25
                                <div class="p-1 flex-fill bd-highlight float-right">{{--<div class="col-xs-2 float-right right_panel_info">--}}
26
                                    <div class="text-right right_panel_info">{{--<div class="float-right text-center">--}}
27
                                        <div class="float-left">
28
                                            <button id="info_butt_{{$artefact->id}}" type="button" class="btn btn-primary float-left button-image inter_info"></button>
29
                                        </div>
30
                                        <div class="fav-cat-likes-t float-right">
31
                                            <form method="POST" action="{{ url('/artefact/like/' . $artefact->id) }}">
32
                                                @csrf
33
                                                <button id="like_butt_{{$artefact->id}}" onclick="myFunction({{$artefact->id}}, 1)" type="submit" class="btn btn-primary button-image inter_like"></button>
34
                                            </form>
35
                                            <form method="POST" action="{{ url('/artefact/unlike/' . $artefact->id) }}">
36
                                                @csrf
37
                                                <button id="like_butt2_{{$artefact->id}}" onclick="myFunction({{$artefact->id}}, 0)" type="submit" class="btn btn-primary button-image inter_like_filled"></button>
38
                                            </form>
39
                                            <span class="likes_text">
40
                                                <h6>{{$artefact->likes}}</h6>
41
                                            </span>
42
                                        </div>
43
                                    </div>
44
                                </div>
45
                            </div>
46
                            </div>
47
                        </div>
48
                    </div>
49
                @endforeach
50
            @else
51
                <ul class="list-group">
52
                    <li class="list-group-item fav-cat-nofav">
53
                        <h3>No favorites were added!</h3>
54
                    </li>
55
                </ul>
56
            @endif
57
        @else
58
            <ul class="list-group">
59
                <li class="list-group-item">
60
                    <h3>Not found the USER in the database with number id {{$user->id}}!</h3>
61
                </li>
62
            </ul>
63
        @endif
64
	</div>
65
    <script>
66
        function myFunction(id, type)
67
        {
68
            if(type === 1)
69
            {
70
                $('#like_butt_' + id).css('display', "none");
71
                $('#like_butt2_' + id).css('display', "inline");
72
            }
73
            else
74
            {
75
                $('#like_butt_' + id).css('display', "inline");
76
                $('#like_butt2_' + id).css('display', "none");
77
            }
78
        }
79
    </script>
80
@endsection
    (1-1/1)