-
Notifications
You must be signed in to change notification settings - Fork 131
/
show.blade.php
126 lines (125 loc) · 6.17 KB
/
show.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@extends('layouts.app')
@php
/**
* @var \App\Models\Chapter $chapter
* @var \App\Models\Chapter $previousChapter
* @var \App\Models\Chapter $nextChapter
* @var \App\Models\Exercise $exercise
* @var \App\Models\User $authUser
* @var bool $isCompletedChapter
*/
@endphp
@section('description'){{ __('chapter.chapter') }} {{ getChapterName($chapter->path) }} {{ __('chapter.show.description') }}@endsection
@section('content')
{{ Breadcrumbs::render('chapter', $chapter) }}
<div class="row justify-content-center">
<div class="sticky-top col-md-12 d-flex justify-content-between">
@if($previousChapter->exists)
<a class="me-auto"
href="{{ route('chapters.show', $previousChapter) }}">@lang('chapter.show.previous_chapter')</a>
@endif
@if($nextChapter->exists)
<a class="ms-auto"
href="{{ route('chapters.show', $nextChapter) }}">@lang('chapter.show.next_chapter')</a>
@endif
</div>
<div class="col-md-8">
<small>
@if ($chapter->parent)
<a href="{{ route('chapters.show', $chapter->parent) }}">
{{ $chapter->parent->path }}. {{ getChapterName($chapter->parent->path) }}
</a>
@endif
</small>
<h1 class="h2">
{{ $chapter->path }}. {{ getChapterName($chapter->path) }}
<small>
<a class="text-muted"
target="_blank"
href="{{ getChapterOriginLink($chapter) }}"
data-bs-toggle="tooltip"
data-placement="right"
title="{{ __('layout.common.origin') }}">
<i class="fas fa-external-link-alt"></i>
</a>
</small>
</h1>
<ul>
@foreach ($chapter->children as $child)
<li>
<h2 class="h5">
<a href="{{ route('chapters.show', $child) }}">
{{ $child->path }}. {{ getChapterName($child->path) }}
</a>
</h2>
</li>
@endforeach
</ul>
@if ($chapter->exercises->isNotEmpty())
<p>{{ __('chapter.show.exercises_list') }}:</p>
<ul>
@foreach ($chapter->exercises as $exercise)
<li><a href="{{ route('exercises.show', $exercise) }}">{{ $exercise->path }}
. {{ getExerciseTitle($exercise) }}</a></li>
@endforeach
</ul>
@endif
@if($chapter->can_read)
@auth
{{ BsForm::open(route('users.chapters.store', [$authUser])) }}
@foreach($authUser->chapters as $userChapter)
{{ Form::hidden('chapters_id[]', $userChapter->id) }}
@endforeach
{{ Form::hidden('chapters_id[]', $chapter->id) }}
<div class="form-group">
{{ Form::button(($isCompletedChapter ? '<i class="fas fa-check"></i> ' : '')
. __(sprintf('chapter.show.%s', $isCompletedChapter ? 'already_completed' : 'mark_read')),
['type' => 'submit', 'class' => 'btn btn-success', 'disabled' => $isCompletedChapter]) }}
</div>
@if ($isCompletedChapter)
<a href="{{ route('users.chapters.destroy', [$authUser, $chapter]) }}"
class="text-decoration-none"
data-bs-toggle="tooltip"
data-placement="bottom"
data-confirm="{{ __('chapter.remove_completed_chapter', ['chapter_path' => $chapter->path]) }}"
data-method="delete">
<span class="ps-2">{{ __('layout.common.cancel') }}</span>
</a>
@endif
{{ BsForm::close() }}
@endauth
@if ($chapter->users->isNotEmpty())
<br/>
<button type="button" class="btn btn-primary" data-bs-toggle="modal"
data-bs-target="#modalCart">{{ __('chapter.show.who_completed') }}</button>
<div class="modal fade" id="modalCart" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">{{ __('chapter.show.completed_by') }}</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body">
<ul>
@foreach ($chapter->users as $user)
<li><a href="{{ route('users.show', $user) }}">{{ $user->name }}</a></li>
@endforeach
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-primary"
data-bs-dismiss="modal">{{ __('layout.common.close') }}</button>
</div>
</div>
</div>
</div>
@else
<p class="mt-3">{{ __('chapter.show.nobody_completed') }}</p>
@endif
@endif
@comments(['model' => $chapter])
</div>
</div>
@endsection