Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup appeal sorting, improve appeal list styling #241

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
68 changes: 41 additions & 27 deletions app/Http/Controllers/AppealController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,41 +141,55 @@ public function appeallist()
});
}

$appealtypes = ['assigned'=>'Assigned to me','unassigned'=>'All unreserved open appeals','reserved'=>'Open reserved appeals'];
if($isDeveloper) { $appealtypes['developer']='Developer access appeals'; }
$appealtypes = [
'assigned'=>'Assigned to me',
'unassigned'=>'All unreserved open appeals',
'reserved'=>'Open reserved appeals'
];

if ($isDeveloper) {
$appealtypes['developer'] = 'Developer access appeals';
}

$developerStatuses = [Appeal::STATUS_VERIFY, Appeal::STATUS_NOTFOUND];
$basicStatuses = [Appeal::STATUS_ACCEPT, Appeal::STATUS_DECLINE, Appeal::STATUS_EXPIRE, Appeal::STATUS_VERIFY, Appeal::STATUS_NOTFOUND, Appeal::STATUS_INVALID, Appeal::STATUS_CHECKUSER];

$appeals[$appealtypes['assigned']] = Appeal::whereIn('wiki', $wikis)->where(function ($query) use ($basicStatuses) {
$query->whereNotIn('status', $basicStatuses)
->where('handlingadmin',Auth::id());
})->orWhere(function ($query) use ($isCUAnyWiki) {
if ($isCUAnyWiki) {
$query->where('status',Appeal::STATUS_CHECKUSER);
}
})
$appeals[$appealtypes['assigned']] = Appeal::with('handlingAdminObject')
->whereIn('wiki', $wikis)
->where(function ($query) use ($basicStatuses) {
$query->whereNotIn('status', $basicStatuses)
->where('handlingadmin', Auth::id());
})
->when($isCUAnyWiki, function ($query) {
$query->orWhere('status',Appeal::STATUS_CHECKUSER);
})
->get();
$appeals[$appealtypes['unassigned']] = Appeal::whereIn('wiki', $wikis)

$appeals[$appealtypes['unassigned']] = Appeal::with('handlingAdminObject')
->whereIn('wiki', $wikis)
->whereNotIn('status', $basicStatuses)
->where(function ($query) {
$query->where('handlingadmin','!=',Auth::id())
->orWhereNull('handlingadmin');
})->get();
$appeals[$appealtypes['reserved']] = Appeal::whereIn('wiki', $wikis)
->whereNull('handlingadmin')
->get();

$appeals[$appealtypes['reserved']] = Appeal::with('handlingAdminObject')
->whereIn('wiki', $wikis)
->whereNotIn('status', $basicStatuses)
->where(function ($query) use ($isCUAnyWiki) {
if ($isCUAnyWiki) {
$query->where('handlingadmin','!=',Auth::id());
}
else {
$query->where('handlingadmin','!=',Auth::id())
->orWhere('status',Appeal::STATUS_CHECKUSER);
}
})->get();
if($isDeveloper) {
$appeals[$appealtypes['developer']] = Appeal::whereIn('status',$developerStatuses)
->when($isCUAnyWiki,
function (Builder $query) {
$query->where('handlingadmin','!=', Auth::id());
},
function (Builder $query) {
$query->where(function (Builder $query) {
$query->where('handlingadmin','!=', Auth::id())
->orWhere('status',Appeal::STATUS_CHECKUSER);
});
})
->get();

if ($isDeveloper) {
$appeals[$appealtypes['developer']] = Appeal::with('handlingAdminObject')
->whereIn('status', $developerStatuses)
->get();
}

return view('appeals.appeallist', ['appeals' => $appeals, 'appealtypes' => $appealtypes, 'tooladmin' => $isTooladmin, 'noWikis' => $wikis->isEmpty()]);
Expand Down
2 changes: 1 addition & 1 deletion public/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=290317198df363e18bf9",
"/css/app.css": "/css/app.css?id=2ee96407c918b84019d0"
"/css/app.css": "/css/app.css?id=5d561a814c2150e9983e"
}
8 changes: 8 additions & 0 deletions resources/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ $enable-shadows: true;

@import '~bootstrap/scss/bootstrap';

.table-dark-warning {
background: #854D0E;
}

.table-dark-primary {
background: #004085;
}

.table td {
vertical-align: middle;
}
1 change: 0 additions & 1 deletion resources/views/appeals/appeallist.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
@component('components.appeal-table', ['appeals' => $appeals[$type]])
@endcomponent
</div>
</div>
@endforeach

@endsection
6 changes: 3 additions & 3 deletions resources/views/components/appeal-table.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="table table-bordered table-dark">
<table class="table table-dark">
<thead>
<tr>
<th scope="col">ID #</th>
Expand All @@ -12,9 +12,9 @@
<tbody>
@foreach($appeals as $appeal)
@if($appeal->status === "ADMIN")
<tr class="bg-primary">
<tr class="table-dark-primary">
@elseif($appeal->status === "CHECKUSER")
<tr class="bg-warning" style="color: #212529!important;">
<tr class="table-dark-warning">
@else
<tr>
@endif
Expand Down