diff --git a/app/Http/Livewire/BookCase/HighscoreTable.php b/app/Http/Livewire/BookCase/HighscoreTable.php index 444714ef..bbb18bbb 100644 --- a/app/Http/Livewire/BookCase/HighscoreTable.php +++ b/app/Http/Livewire/BookCase/HighscoreTable.php @@ -10,6 +10,8 @@ use RalphJSmit\Laravel\SEO\Support\SEOData; class HighscoreTable extends Component { public Country $country; + public bool $viewingModal = false; + public ?User $modal = null; public function render() { @@ -28,4 +30,17 @@ class HighscoreTable extends Component ) ]); } + + public function openModal($id) + { + $this->modal = User::query() + ->with([ + 'orangePills', + 'reputations', + ]) + ->where('id', $id) + ->first(); + + $this->viewingModal = true; + } } diff --git a/app/Models/User.php b/app/Models/User.php index 956afe08..b5b56633 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -60,4 +60,9 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment { return $this->hasMany(OrangePill::class); } + + public function reputations() + { + return $this->morphMany('QCod\Gamify\Reputation', 'subject'); + } } diff --git a/resources/lang/de.json b/resources/lang/de.json index e87dbf68..ddb2b4a3 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -636,5 +636,8 @@ "This is the subtitle on the landing page.": "Das ist der Untertitel auf der Landing-Page des Dozenten.", "Subtitle": "Untertitel auf der Landing-Page", "Intro": "Intro auf der Landing-Page", - "This lecturer has not yet written an introduction.": "Dieser Dozent hat noch keine Einführung geschrieben." + "This lecturer has not yet written an introduction.": "Dieser Dozent hat noch keine Einführung geschrieben.", + "If your city is not listed, please create it first.": "Wenn deine Stadt nicht aufgeführt ist, erstelle sie bitte zuerst.", + "You get a point when you log in.": "Du bekommst einen Punkt, wenn du dich einloggst.", + "has": "hat" } diff --git a/resources/lang/en.json b/resources/lang/en.json index 4007bb5c..96f95e7f 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -629,5 +629,7 @@ "Subtitle": "", "Intro": "", "This lecturer has not yet written an introduction.": "", - "If your city is not listed, please create it first.": "" + "If your city is not listed, please create it first.": "", + "You get a point when you log in.": "", + "has": "" } diff --git a/resources/views/livewire/book-case/highscore-table.blade.php b/resources/views/livewire/book-case/highscore-table.blade.php index cb22fa74..a977354c 100644 --- a/resources/views/livewire/book-case/highscore-table.blade.php +++ b/resources/views/livewire/book-case/highscore-table.blade.php @@ -19,7 +19,9 @@ + + + @if($modal) +
+ {{ $modal->name }} +
+ @endif +
+ + + @if($modal) +
+ +
+
+
    +
  • +
    +

    +
    + + + {{ $modal->name }} {{ __('has') }} {{ $modal->reputations->where('name', 'LoggedIn')->sum('point') }} {{ __('logins') }} +
    +

    +

    {{ __('You get a point when you log in.') }}

    +
    +
  • +
+
+
+ +
    + @foreach($modal->orangePills as $orangePill) +
  • +
    + +
    +

    + 210 {{ __('points') }}

    +

    {{ $orangePill->date->asDate() }}

    +
  • + @endforeach +
+ +
+ @endif +
+ + + + @lang('Close') + + +
+ {{-- FOOTER --}}