183 lines
9.5 KiB
PHP
183 lines
9.5 KiB
PHP
@extends('layout.app')
|
|
|
|
@section('content')
|
|
<div class="form-row row">
|
|
<h2 class="col">
|
|
<a href="{{ route('ticket.index') }}" class="text-decoration-none">←</a>
|
|
{{ __('Ticket n° :ticketId : :ticketSiteName - :ticketTypeLabel', [
|
|
'ticketId' => $ticket->id,
|
|
'ticketSiteName' => $ticket->site->name,
|
|
'ticketTypeLabel' => $ticket->type->label
|
|
]) }}
|
|
@if ($ticket->is_internal)🔒@endif
|
|
<span class="badge bg-info">{{ $ticket->status->label }}</span>
|
|
</h2>
|
|
<div class="col d-flex flex-row text-end">
|
|
@can('suscribeToTicket', $ticket)
|
|
<form action="{{ route('ticket.subscribe', $ticket->id) }}" method="POST" id="form_abonnement" class="col">
|
|
@csrf
|
|
<div class="custom-control custom-checkbox text-right p-2">
|
|
<input type="checkbox" name="subscription" class="custom-control-input" id="subscription" @if ($isSubscribed)checked @endif onchange="document.getElementById('form_abonnement').submit()">
|
|
<label class="custom-control-label" for="subscription">{{ __('Suivre le ticket') }}</label>
|
|
</div>
|
|
</form>
|
|
@endcan
|
|
@can('changeStatus', $ticket)
|
|
<form action="{{ route('ticket.changeStatus', $ticket->id) }}" method="POST" id="form_status" class="col">
|
|
@csrf
|
|
<select class="form-select" name="status" id="status" onchange="document.getElementById('form_status').submit();">
|
|
@foreach(TicketStatus::toArray() as $ticketStatus)
|
|
<option value="{{ $ticketStatus->value }}" @if($ticketStatus->equals($ticket->status))selected @endif>{{ $ticketStatus->label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</form>
|
|
@endcan
|
|
@if($ticket->status->equals(TicketStatus::archived()))
|
|
@can('reopen', $ticket)
|
|
<form action="{{ route('ticket.reopen', $ticket) }}" method="POST" id="form_status" class="col">
|
|
@csrf
|
|
<button class="btn btn-danger" type="submit">{{ __('Réouvrir le ticket') }}</button>
|
|
</form>
|
|
@endcan
|
|
@endif
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div>
|
|
<h4>
|
|
{{ __('Suivi') }}
|
|
@can('createMessage', $ticket)
|
|
<button type="button" class="btn btn-sm btn-primary float-end" data-bs-toggle="modal" data-bs-target="#messageModal">
|
|
{{ __('Répondre') }}
|
|
</button>
|
|
<div class="modal fade" id="messageModal" tabindex="-1" aria-labelledby="messageModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<form action="{{ route('ticket.message.create', $ticket) }}" method="POST" enctype="multipart/form-data">
|
|
@method('PUT')
|
|
@csrf
|
|
<input type="hidden" name="ticket_id" value="{{ $ticket->id }}">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="messageModalLabel">
|
|
{{ __('Répondre au ticket n°:ticketId', ['ticketId' => $ticket->id]) }}
|
|
</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{__('Fermer') }}"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col">
|
|
<textarea name="message" class="form-control" rows="10"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="row mt-4">
|
|
<div class="col">
|
|
<label for="formFile" class="form-label">{{ __('Joindre un fichier (jpg, png, pdf) 2Mo max') }}</label>
|
|
<input class="form-control" type="file" id="formFile" name="file_message" accept="image/jpeg, image/png, image/jpg, .pdf">
|
|
</div>
|
|
</div>
|
|
<div class="row mt-4">
|
|
<div class="col">
|
|
<div class="form-check">
|
|
<input name="subscribe" type="checkbox" class="form-check-input" id="subscribeResponse" autocomplete="off" @if ($isSubscribed)checked @endif value="1">
|
|
<label class="form-check-label" for="subscribeResponse">{{ __('Suivre le ticket') }}</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="reset" class="btn btn-sm btn-danger" data-bs-dismiss="modal">{{ __('Fermer') }}</button>
|
|
<button type="submit" class="btn btn-sm btn-success">{{ __('Envoyer') }}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endcan
|
|
</h4>
|
|
@foreach ($messages as $message)
|
|
@if ($message->user_id === null)
|
|
<div class="offset-md-3 col-md-6 alert alert-info text-center text-dark">
|
|
{!! nl2br(clean($message->message)) !!} - <span class="fw-bold text-light">Le {{ \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i')}}</span>
|
|
<small class="fw-bold">({{ __('Message système') }})</small>
|
|
</div>
|
|
@else
|
|
<div class="@if($message->user_id === Auth::user()->id)offset-md-4 alert-dark @else alert-light @endif col-md-8 alert">
|
|
{!! ToolboxHelper::plainToHtml($message->message) !!}
|
|
@if ($message->file !== null)
|
|
<br><a @if(ToolboxHelper::isImageFile($message->file))data-fslightbox="gallery" @endif href="{{ asset($message->file) }}" target="_blank">Ouvrir la pièce jointe</a><br>
|
|
@endif<br><br>
|
|
<small class="text-muted fw-bold">
|
|
{!! __('Créé le :date par <b>:userName</b>', [
|
|
'date' => \Carbon\Carbon::parse($message->created_at)->format('d/m/Y à H:i'),
|
|
'userName' => $message->user ? $message->user->name : __('Utilisateur supprimé')
|
|
]) !!}
|
|
</small>
|
|
@if($message->user_id === Auth::user()->id)
|
|
@can('updateMessage', $ticket, $message)
|
|
<button type="button" class="btn btn-sm btn-primary float-end" data-bs-toggle="modal" data-bs-target="#updateMessageModal{{$message->id}}">
|
|
{{ __('Modifier le message') }}
|
|
</button>
|
|
<div class="modal fade" id="updateMessageModal{{$message->id}}" tabindex="-1" aria-labelledby="updateMessageModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<form action="{{ route('ticket.message.update', ['ticket'=>$ticket, 'message'=>$message]) }}" method="POST" enctype="multipart/form-data">
|
|
@method('PUT')
|
|
@csrf
|
|
<input type="hidden" name="ticket_id" value="{{ $ticket->id }}">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="messageModalLabel">
|
|
{{ __('Modification du message n°:messageid', ['messageid' => $message->id]) }}
|
|
</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{__('Fermer') }}"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col">
|
|
<textarea name="message" class="form-control" rows="10">{{ $message->message }}</textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="reset" class="btn btn-sm btn-danger" data-bs-dismiss="modal">{{ __('Fermer') }}</button>
|
|
<button type="submit" class="btn btn-sm btn-success">{{ __('Envoyer') }}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endcan
|
|
@endif
|
|
</div>
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
<hr>
|
|
<div>
|
|
<h4>{{__('Description') }}</h4>
|
|
<p>{!! clean(ToolboxHelper::plainToHtml($ticket->text)) !!}</p>
|
|
<small class="text-muted">{!! __('Créé le :date par <b>:userName</b>', [
|
|
'date' => \Carbon\Carbon::parse($ticket->created_at)->format('d/m/Y à H:i'),
|
|
'userName' => $ticket->user ? $ticket->user->name : __('Utilisateur supprimé')
|
|
]) !!}</small>
|
|
</div>
|
|
@if (!is_null($ticket->file) or !is_null($ticket->file2))
|
|
<hr>
|
|
<div>
|
|
<h4>{{ __('Pièces jointes') }}</h4>
|
|
<ul>
|
|
@if (!is_null($ticket->file))
|
|
<li>
|
|
{{ __('Pièce jointe n°1') }} :
|
|
<a @if(ToolboxHelper::isImageFile($ticket->file))data-fslightbox="gallery" @endif href="{{ asset($ticket->file) }}" target="_blank">{{ __('Ouvrir la pièce jointe') }}</a>
|
|
</li>
|
|
@endif
|
|
@if (!is_null($ticket->file2))
|
|
<li>
|
|
{{ __('Pièce jointe n°2') }} :
|
|
<a @if(ToolboxHelper::isImageFile($ticket->file2))data-fslightbox="gallery" @endif href="{{ asset($ticket->file2) }}" target="_blank">{{ __('Ouvrir la pièce jointe') }}</a>
|
|
</li>
|
|
@endif
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
@endsection
|