93 lines
5 KiB
PHP
93 lines
5 KiB
PHP
@extends('layout.app')
|
|
|
|
@section('tickets', 'active')
|
|
|
|
@section('content')
|
|
<div class="container content">
|
|
@auth
|
|
<h2>Gestion des tickets<a href="{{ route('create-ticket') }}" class="float-right btn btn-sm btn-primary">Créer un ticket</a></h2>
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<th scope="col">#</th>
|
|
<th scope="col">Projet</th>
|
|
<th scope="col">Type</th>
|
|
<th scope="col">Description</th>
|
|
<th scope="col">Fichier</th>
|
|
<th scope="col">Date de création</th>
|
|
<th scope="col">Créer par</th>
|
|
<th scope="col">Status</th>
|
|
<th></th>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($tickets as $ticket)
|
|
@if (Auth::user()->project_id === $ticket->project->id || Auth::user()->role === 1)
|
|
<tr>
|
|
<th scope="row">
|
|
{{-- Modal du ticket --}}
|
|
<!-- Button trigger modal -->
|
|
<button type="button" class="btn btn-sm btn-outline-secondary" data-toggle="modal" data-target="#ticket{{ $ticket->id }}Modal">
|
|
{{ $ticket->id }}
|
|
</button>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="ticket{{ $ticket->id }}Modal" tabindex="-1" aria-labelledby="ticket{{ $ticket->id }}ModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="ticket{{ $ticket->id }}ModalLabel">
|
|
{{ $ticket->project->name }} - Ticket N°{{ $ticket->id }} - {{ $ticket->type === 0 ? "Bug" : "Évolution" }}
|
|
</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>{!! nl2br(e($ticket->text)) !!}</p>
|
|
@if ($ticket->file !== null)
|
|
<hr>
|
|
<img src="{{ asset('fichiers/' . Str::slug($ticket->project->name) . '/' . $ticket->id . '/' . $ticket->file) }}" style="max-width: 100%;">
|
|
<br>
|
|
<a href="{{ asset('fichiers/' . Str::slug($ticket->project->name) . '/' . $ticket->id . '/' . $ticket->file) }}" target="_blank">Ouvrir dans un nouvel onglet</a>
|
|
@endif
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-sm btn-primary" data-dismiss="modal">Fermer</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</th>
|
|
<td>{{ $ticket->project->name }}</td>
|
|
<td>
|
|
@if ($ticket->type === 0)
|
|
<span class="badge badge-danger">Bug</span>
|
|
@else
|
|
<span class="badge badge-success">Évolution</span>
|
|
@endif
|
|
</td>
|
|
<td>{{ \Illuminate\Support\Str::limit($ticket->text, 40, '...') }}</td>
|
|
<td>
|
|
@if ($ticket->file !== null)
|
|
<a href="{{ asset('fichiers/' . Str::slug($ticket->project->name) . '/' . $ticket->id . '/' . $ticket->file) }}"
|
|
class="btn btn-sm btn-outline-secondary" target="_blank">Fichier</a>
|
|
@endif
|
|
</td>
|
|
<td>{{ Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i') }}</td>
|
|
<td>{{ $ticket->user->name }}</td>
|
|
<td>{{ $status[$ticket->status] }}</td>
|
|
<td>
|
|
@if ($ticket->created_by === Auth::user()->id || Auth::user()->role === 1)
|
|
<a href="{{ route('edit-ticket', $ticket->id) }}" class="btn btn-sm btn-outline-primary">Modifier</a>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@else
|
|
<h2>Bienvenue sur le support LDC WEB.</h2>
|
|
<p>Pour consulter vos tickets, merci de vous connecter : <a href="{{ route('login') }}">Connexion</a></p>
|
|
@endauth
|
|
</div>
|
|
@endsection
|