update: user resurrections view

This commit is contained in:
Roardom
2023-04-07 05:46:55 +00:00
parent 014bf37ac3
commit 7620838f3c
4 changed files with 223 additions and 120 deletions
+1
View File
@@ -54,6 +54,7 @@
@import 'components/torrent-card';
@import 'components/user-active';
@import 'components/user-card';
@import 'components/user-resurrections';
@import 'components/user-tag';
@import 'components/user-torrents';
@import 'components/user-uploads';
@@ -0,0 +1,87 @@
.user-resurrections {
margin: 0 calc(-1 * max(0px, 10vw - 60px)); /* Inverses the magic numbers used in the main layout styles */
max-width: max-content;
align-self: center;
}
@media only screen and (min-width: 1600px) {
.user-resurrections {
margin: 0 calc(-1 * max(0px, 25vw - 300px)); /* Inverses the magic numbers used in the main layout styles */
}
}
@media only screen and (min-width: 2500px) {
.user-resurrections {
margin: 0 calc(-1 * max(0px, 45vw - 800px)); /* Inverses the magic numbers used in the main layout styles */
}
}
.user-resurrections__filters {
margin: 0 calc(-1 * max(0px, 45vw - 800px) + max(12px, 45vw - 600px));
}
@media only screen and (max-width: 767px) {
.user-resurrections__filters {
margin: 0 max(0, 45vw - 600px);
}
}
.user-resurrections__name-header,
.user-resurrections__size-header,
.user-resurrections__seeders-header,
.user-resurrections__leechers-header,
.user-resurrections__times-created-header,
.user-resurrections__completed-at-header,
.user-resurrections__current-seedtime-header,
.user-resurrections__seedtime-header,
.user-resurrections__rewarded-header,
.user-resurrections__actions-header {
cursor: pointer;
white-space: nowrap;
font-size: 11px;
}
.user-resurrections__name,
.user-resurrections__size,
.user-resurrections__seeders,
.user-resurrections__leechers,
.user-resurrections__times-header,
.user-resurrections__completed-header,
.user-resurrections__current-header,
.user-resurrections__seedtime,
.user-resurrections__actions {
font-size: 14px;
}
.user-resurrections__rewarded {
font-size: 11px;
}
.user-uploads__size-header,
.user-uploads__seeders-header,
.user-uploads__leechers-header,
.user-uploads__times-completed-header,
.user-uploads__size,
.user-uploads__seeders,
.user-uploads__leechers,
.user-uploads__times-completed {
text-align: right;
}
.user-resurrections__rewarded-header,
.user-resurrections__rewarded {
text-align: center;
}
.user-resurrections__name {
font-weight: bolder;
color: var(--text-color);
}
.user-resurrections__checkbox {
all: revert !important;
}
.user-resurrections__checkbox:indeterminate {
all: revert !important;
}
@@ -1,147 +1,160 @@
<div class="container-fluid">
<div class="block">
<div class="container well search mt-5">
<div class="form-horizontal form-condensed form-torrent-search form-bordered">
<div class="mx-0 mt-5 form-group fatten-me">
<label for="name"
class="mt-5 col-sm-1 label label-default fatten-me">{{ __('torrent.name') }}</label>
<div class="col-sm-9 fatten-me">
<label for="search"></label><input type="text" class="form-control userFilter"
trigger="keyup"
id="search" placeholder="{{ __('torrent.name') }}">
</div>
<div style="display: flex; flex-direction: column; gap: 1rem;">
<section class="panelV2 user-resurrections__filters">
<h2 class="panel__heading">{{ __('common.search') }}</h2>
<div class="panel__body">
<form class="form">
<div class="form__group">
<p class="form__group">
<input wire:model="name" class="form__text" placeholder="" autofocus="">
<label class="form__label form__label--floating">{{ __('torrent.name') }}</label>
</p>
</div>
<div class="mx-0 mt-5 form-group fatten-me">
<div class="mt-5 col-sm-1 label label-default fatten-me">
{{ __('torrent.filters') }}
</div>
<div class="col-sm-10">
<span class="badge-user">
<label style="user-select: none" class="inline" x-data="{ state: @entangle('rewarded'), ...ternaryCheckbox() }">
<input
type="checkbox"
class="user-torrents__checkbox"
x-init="updateTernaryCheckboxProperties($el, state)"
x-on:click="state = getNextTernaryCheckboxState(state); updateTernaryCheckboxProperties($el, state)"
x-bind:checked="state === 'include'"
>
{{ __('graveyard.rewarded') }}
</label>
</span>
</div>
</div>
</div>
<p class="form__group">
<label style="user-select: none" class="form__label" x-data="{ state: @entangle('rewarded'), ...ternaryCheckbox() }">
<input
type="checkbox"
class="user-resurrections__checkbox"
x-init="updateTernaryCheckboxProperties($el, state)"
x-on:click="state = getNextTernaryCheckboxState(state); updateTernaryCheckboxProperties($el, state)"
x-bind:checked="state === 'include'"
>
{{ __('graveyard.rewarded') }}
</label>
</p>
</form>
</div>
<span id="filterHeader"></span>
<div id="userFilter" userName="{{ $user->username }}" userId="{{ $user->id }}" view="resurrections">
<div class="table-responsive">
<table class="table table-condensed table-striped table-bordered">
<thead>
<th class="user-resurrections__name-header" wire:click="sortBy('name')" role="columnheader button">
{{ __('torrent.name') }}
@include('livewire.includes._sort-icon', ['field' => 'name'])
</th>
<th class="user-resurrections__size-header" wire:click="sortBy('size')" role="columnheader button">
{{ __('torrent.size') }}
@include('livewire.includes._sort-icon', ['field' => 'size'])
</th>
<th class="user-resurrections__seeders-header" wire:click="sortBy('seeders')" role="columnheader button">
{{ __('torrent.seeders') }}
@include('livewire.includes._sort-icon', ['field' => 'seeders'])
</th>
<th class="user-resurrections__leechers-header" wire:click="sortBy('leechers')" role="columnheader button">
{{ __('torrent.leechers') }}
@include('livewire.includes._sort-icon', ['field' => 'leechers'])
</th>
<th class="user-resurrections__times-completed-header" wire:click="sortBy('times_completed')" role="columnheader button">
{{ __('torrent.completed') }}
@include('livewire.includes._sort-icon', ['field' => 'times_completed'])
</th>
<th class="user-resurrections__created-at-header" wire:click="sortBy('created_at')" role="columnheader button">
{{ __('graveyard.resurrect-date') }}
@include('livewire.includes._sort-icon', ['field' => 'created_at'])
</th>
<th class="user-resurrections__current-seedtime-header">
{{ __('graveyard.current-seedtime') }}
</th>
<th class="user-resurrections__seedtime-header" wire:click="sortBy('seedtime')" role="columnheader button">
{{ __('graveyard.seedtime-goal') }}
@include('livewire.includes._sort-icon', ['field' => 'seedtime'])
</th>
<th class="user-resurrections__rewarded-header" wire:click="sortBy('rewarded')" role="columnheader button">
{{ __('graveyard.rewarded') }}
@include('livewire.includes._sort-icon', ['field' => 'rewarded'])
</th>
<th class="user-resurrections__cancel-header">
{{ __('common.cancel') }}
</th>
</thead>
<tbody>
</section>
<section class="panelV2">
<h2 class="panel__heading">{{ __('user.resurrections') }}</h2>
<div class="data-table">
<table class="data-table">
<thead>
<th class="user-resurrections__name-header" wire:click="sortBy('name')" role="columnheader button">
{{ __('torrent.name') }}
@include('livewire.includes._sort-icon', ['field' => 'name'])
</th>
<th class="user-resurrections__size-header" wire:click="sortBy('size')" role="columnheader button">
{{ __('torrent.size') }}
@include('livewire.includes._sort-icon', ['field' => 'size'])
</th>
<th class="user-resurrections__seeders-header" wire:click="sortBy('seeders')" role="columnheader button">
{{ __('torrent.seeders') }}
@include('livewire.includes._sort-icon', ['field' => 'seeders'])
</th>
<th class="user-resurrections__leechers-header" wire:click="sortBy('leechers')" role="columnheader button">
{{ __('torrent.leechers') }}
@include('livewire.includes._sort-icon', ['field' => 'leechers'])
</th>
<th class="user-resurrections__times-completed-header" wire:click="sortBy('times_completed')" role="columnheader button">
{{ __('torrent.completed') }}
@include('livewire.includes._sort-icon', ['field' => 'times_completed'])
</th>
<th class="user-resurrections__created-at-header" wire:click="sortBy('created_at')" role="columnheader button">
{{ __('graveyard.resurrect-date') }}
@include('livewire.includes._sort-icon', ['field' => 'created_at'])
</th>
<th class="user-resurrections__current-seedtime-header">
{{ __('graveyard.current-seedtime') }}
</th>
<th class="user-resurrections__seedtime-header" wire:click="sortBy('seedtime')" role="columnheader button">
{{ __('graveyard.seedtime-goal') }}
@include('livewire.includes._sort-icon', ['field' => 'seedtime'])
</th>
<th class="user-resurrections__rewarded-header" wire:click="sortBy('rewarded')" role="columnheader button">
{{ __('graveyard.rewarded') }}
@include('livewire.includes._sort-icon', ['field' => 'rewarded'])
</th>
<th class="user-resurrections__actions-header">
{{ __('common.actions') }}
</th>
</thead>
<tbody>
@foreach ($resurrections as $resurrection)
<tr>
<td>
<div class="torrent-file">
<div>
<a class="view-torrent"
href="{{ route('torrent', ['id' => $resurrection->torrent->id]) }}">
{{ $resurrection->torrent->name }}
</a>
</div>
</div>
<td class="user-resurrections__name">
<a href="{{ route('torrent', ['id' => $resurrection->torrent->id]) }}">
{{ $resurrection->torrent->name }}
</a>
</td>
<td>
<span class="badge-extra text-blue text-bold">
{{ $resurrection->torrent->getSize() }}</span>
<td class="user-resurrections__size">
{{ App\Helpers\StringHelper::formatBytes($resurrection->torrent->size) }}
</td>
<td>
<span class="badge-extra text-green text-bold">
{{ $resurrection->torrent->seeders }}</span>
<td class="user-resurrections__seeders">
<a href="{{ route('peers', ['id' => $resurrection->torrent->id]) }}">
<span class='text-green'>
{{ $resurrection->torrent->seeders }}
</span>
</a>
</td>
<td>
<span class="badge-extra text-red text-bold">
{{ $resurrection->torrent->leechers }}</span>
<td class="user-resurrections__leechers">
<a href="{{ route('peers', ['id' => $resurrection->torrent->id]) }}">
<span class='text-red'>
{{ $resurrection->torrent->leechers }}
</span>
</a>
</td>
<td>
<span class="badge-extra text-orange text-bold">
{{ $resurrection->torrent->times_completed }} {{ __('common.times') }}</span>
<td class="user-resurrections__times_completed">
<a href="{{ route('history', ['id' => $resurrection->torrent->id]) }}">
<span class='text-orange'>
{{ $resurrection->torrent->times_completed }}
</span>
</a>
</td>
<td>
<td class="user-resurrections__created-at">
{{ $resurrection->created_at->diffForHumans() }}
</td>
<td>
<td class="user-resurrections__current-seedtime">
@php $history = App\Models\History::select(['seedtime'])->where('user_id', '=',
$user->id)->where('torrent_id', '=', $resurrection->torrent_id)->first() @endphp
{{ empty($history) ? '0' : App\Helpers\StringHelper::timeElapsed($history->seedtime) }}
</td>
<td>
<td class="user-resurrections__seedtime">
{{ App\Helpers\StringHelper::timeElapsed($resurrection->seedtime) }}
</td>
<td>
@if ($resurrection->rewarded == 0)
<i class="{{ config('other.font-awesome') }} fa-times text-red"></i>
@else
<td class="user-resurrections__rewarded">
@if ($resurrection->rewarded)
<i class="{{ config('other.font-awesome') }} fa-check text-green"></i>
@else
<i class="{{ config('other.font-awesome') }} fa-times text-red"></i>
@endif
</td>
<td>
<form action="{{ route('graveyard.destroy', ['id' => $resurrection->id]) }}"
method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger" @if ($resurrection->rewarded ==
1) disabled @endif>
<i class="{{ config('other.font-awesome') }} fa-trash"></i>
</button>
</form>
<td class="user-resurrections__actions">
<menu class="data-table__actions">
<li class="data-table__action">
<form
action="{{ route('graveyard.destroy', ['id' => $resurrection->id]) }}"
method="POST"
x-data
>
@csrf
@method('DELETE')
<button
x-on:click.prevent="Swal.fire({
title: 'Are you sure?',
text: 'Are you sure you want to cancel this resurrection: {{ $resurrection->torrent->name }}?',
icon: 'warning',
showConfirmButton: true,
showCancelButton: true,
}).then((result) => {
if (result.isConfirmed) {
$root.submit();
}
})"
class="form__button form__button--text"
>
{{ __('common.cancel') }}
</button>
</form>
</li>
</menu>
</td>
</tr>
@endforeach
</tbody>
</table>
{{ $resurrections->links('partials.pagination') }}
</div>
</tbody>
</table>
</div>
</div>
{{ $resurrections->links('partials.pagination') }}
</section>
<script nonce="{{ HDVinnie\SecureHeaders\SecureHeaders::nonce('script') }}">
function ternaryCheckbox() {
return {
@@ -19,6 +19,8 @@
@include('user.buttons.user')
@endsection
@section('page', 'page__user-resurrections--index')
@section('content')
@livewire('user-resurrections', ['userId' => $user->id])
@endsection