Merge branch 'develop' into trunk
This commit is contained in:
commit
1d2a50d4ae
5 changed files with 72 additions and 39 deletions
|
|
@ -20,6 +20,7 @@ use Exception;
|
|||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TicketController extends Controller
|
||||
|
|
@ -39,32 +40,53 @@ class TicketController extends Controller
|
|||
$tickets = $tickets->where('status', '<>', TicketStatus::archived());
|
||||
}
|
||||
|
||||
if ($request->sort_col and $request->sort_way) {
|
||||
switch ($request->sort_col) {
|
||||
if ($request->prs) {
|
||||
Session::remove('tickets.pr');
|
||||
}
|
||||
if ($request->sort_col) {
|
||||
Session::put('tickets.sort_col', $request->sort_col);
|
||||
Session::save();
|
||||
}
|
||||
if ($request->sort_way) {
|
||||
Session::put('tickets.sort_way', $request->sort_way);
|
||||
Session::save();
|
||||
}
|
||||
if ($request->pr) {
|
||||
Session::put('tickets.pr', $request->pr);
|
||||
Session::save();
|
||||
}
|
||||
if (Session::has('tickets.pr')) {
|
||||
$tickets = $tickets->where('project_id', Session::get('tickets.pr'));
|
||||
}
|
||||
|
||||
if (Session::has('tickets.sort_col') and Session::has('tickets.sort_way')) {
|
||||
switch (Session::get('tickets.sort_col')) {
|
||||
case 'id':
|
||||
$tickets = $tickets->orderBy('id', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('id', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
case 'project':
|
||||
$tickets = $tickets->orderBy('project_id', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('project_id', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
case 'created_at':
|
||||
$tickets = $tickets->orderBy('created_at', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('created_at', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
case 'created_by':
|
||||
$tickets = $tickets->orderBy('created_by', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('created_by', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
case 'type':
|
||||
$tickets = $tickets->orderBy('type', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('type', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
case 'status':
|
||||
$tickets = $tickets->orderBy('status', $request->sort_way);
|
||||
$tickets = $tickets->orderBy('status', Session::get('tickets.sort_way'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$tickets = $tickets->paginate();
|
||||
|
||||
return view('ticket.index', compact('tickets'));
|
||||
$projects = Project::select('id', 'name')->get();
|
||||
|
||||
return view('ticket.index', compact('tickets', 'projects'));
|
||||
}
|
||||
|
||||
public function show(Ticket $ticket)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Kernel extends HttpKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
|
|
@ -32,7 +33,6 @@ class Kernel extends HttpKernel
|
|||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class SortTickets extends FormRequest
|
|||
}
|
||||
}
|
||||
],
|
||||
'pr' => 'sometimes|int|exists:projects,id'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@if(!request('sort_way') or request('sort_col') !== $colname or (request('sort_way') === 'desc' and request('sort_col') === $colname))
|
||||
@if(!session('tickets.sort_way') or session('tickets.sort_col') !== $colname or (session('tickets.sort_way') === 'desc' and session('tickets.sort_col') === $colname))
|
||||
<a class="col_sort text-secondary lead asc" href="{{ route('ticket.index', ['sort_col' => $colname, 'sort_way' => 'asc']) }}"> ↓ </a>
|
||||
@endif
|
||||
@if(!request('sort_way') or request('sort_col') !== $colname or (request('sort_way') === 'asc' and request('sort_col') === $colname))
|
||||
@if(!session('tickets.sort_way') or session('tickets.sort_col') !== $colname or (session('tickets.sort_way') === 'asc' and session('tickets.sort_col') === $colname))
|
||||
<a class="col_sort text-secondary lead desc" href="{{ route('ticket.index', ['sort_col' => $colname, 'sort_way' => 'desc']) }}"> ↑ </a>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -12,36 +12,46 @@
|
|||
@else
|
||||
<a href="{{ route('ticket.index', ['status' => TicketStatus::archived()]) }}" class="float-right btn btn-sm btn-secondary mr-2">Tickets Archivés</a>
|
||||
@endif
|
||||
<div class="float-right mr-2">
|
||||
<select class="custom-select">
|
||||
<option value="-1" onclick="window.location='{{ route('ticket.index', ['prs' => '-1']) }}'">Tous</option>
|
||||
@foreach($projects as $project)
|
||||
<option value="{{$project->id}}" @if(intval(session('tickets.pr')) == $project->id)selected="selected" @endif onclick="window.location='{{ route('ticket.index', ['pr' => $project]) }}'">{{$project->name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</h2>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<th scope="col">
|
||||
#
|
||||
@include('modules.sorter', ['colname' => 'id'])
|
||||
</th>
|
||||
<th scope="col">
|
||||
Projet
|
||||
@include('modules.sorter', ['colname' => 'project'])
|
||||
</th>
|
||||
<th scope="col">
|
||||
Type
|
||||
@include('modules.sorter', ['colname' => 'type'])</th>
|
||||
<th scope="col">Fichier</th>
|
||||
<th scope="col">Fichier 2</th>
|
||||
<th scope="col">
|
||||
Date de création
|
||||
@include('modules.sorter', ['colname' => 'created_at'])</th>
|
||||
<th scope="col">
|
||||
Créé par
|
||||
@include('modules.sorter', ['colname' => 'created_by'])</th>
|
||||
<th scope="col">
|
||||
Statut
|
||||
@include('modules.sorter', ['colname' => 'status'])
|
||||
</th>
|
||||
<th scope="col">Contenu</th>
|
||||
@if (Auth::user()->role === 1)
|
||||
<th>Actions</th>
|
||||
@endif
|
||||
<tr>
|
||||
<th scope="col">
|
||||
#
|
||||
@include('modules.sorter', ['colname' => 'id'])
|
||||
</th>
|
||||
<th scope="col">
|
||||
Projet
|
||||
@include('modules.sorter', ['colname' => 'project'])
|
||||
</th>
|
||||
<th scope="col">
|
||||
Type
|
||||
@include('modules.sorter', ['colname' => 'type'])</th>
|
||||
<th scope="col">Fichier</th>
|
||||
<th scope="col">Fichier 2</th>
|
||||
<th scope="col">
|
||||
Date de création
|
||||
@include('modules.sorter', ['colname' => 'created_at'])</th>
|
||||
<th scope="col">
|
||||
Créé par
|
||||
@include('modules.sorter', ['colname' => 'created_by'])</th>
|
||||
<th scope="col">
|
||||
Statut
|
||||
@include('modules.sorter', ['colname' => 'status'])
|
||||
</th>
|
||||
<th scope="col">Contenu</th>
|
||||
@if (Auth::user()->role === 1)
|
||||
<th>Actions</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tickets as $ticket)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue