2020-11-25 16:05:21 +01:00
@ extends ( 'layout.app' )
@ section ( 'content' )
< div class = " container " >
< div class = " form-row " >
2021-04-18 20:31:07 +02:00
< h2 class = " @can('suscribeToTicket', $ticket )col-md-8 @else col-md-10 @endcan " >
2020-11-25 16:05:21 +01:00
< a href = " { { route('home') }} " class = " text-decoration-none " > ← </ a >
2021-04-18 20:31:07 +02:00
Ticket n° {{ $ticket -> id }} : {{ $ticket -> project -> name }} - {{ $ticket -> type -> label }}
@ cannot ( 'createMessage' , $ticket )
< span class = " badge badge-secondary " > {{ $ticket -> status -> label }} </ span >
@ endcan
2020-11-25 16:05:21 +01:00
</ h2 >
2021-04-18 20:31:07 +02:00
@ can ( 'suscribeToTicket' , $ticket )
< form action = " { { route('ticket.subscribe', $ticket->id ) }} " method = " POST " id = " form_abonnement " class = " col " >
2020-11-26 15:48:35 +01:00
@ 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 = " $ ('#form_abonnement').submit() " >
< label class = " custom-control-label " for = " subscription " > Suivre le ticket </ label >
</ div >
</ form >
2021-04-18 20:31:07 +02:00
@ endcan
@ can ( 'changeStatus' , $ticket )
< form action = " { { route('ticket.changeStatus', $ticket->id ) }} " method = " POST " id = " form_status " class = " col " >
2020-11-25 16:05:21 +01:00
@ csrf
< select class = " custom-select " name = " status " id = " status " onchange = " $ ('#form_status').submit(); " >
2021-04-18 20:31:07 +02:00
@ foreach ( TicketStatus :: toArray () as $ticketStatus )
< option value = " { { $ticketStatus->value }} " @ if ( $ticketStatus -> equals ( $ticket -> status )) selected @ endif > {{ $ticketStatus -> label }} </ option >
@ endforeach
2020-11-25 16:05:21 +01:00
</ select >
</ form >
2021-04-18 20:31:07 +02:00
@ endcan
2020-11-25 16:05:21 +01:00
</ div >
< hr >
< div >
@ if ( $errors -> any ())
< div class = " alert alert-danger " >
< ul >
@ foreach ( $errors -> all () as $error )
< li > {{ $error }} </ li >
@ endforeach
</ ul >
</ div >
@ endif
< h4 >
Suivi
2021-04-18 20:31:07 +02:00
@ can ( 'createMessage' , $ticket )
2020-11-25 16:05:21 +01:00
< button type = " button " class = " btn btn-sm btn-primary float-right " data - toggle = " modal " data - target = " #messageModal " >
Répondre
</ button >
< div class = " modal fade " id = " messageModal " tabindex = " -1 " aria - labelledby = " messageModalLabel " aria - hidden = " true " >
2021-04-18 20:31:07 +02:00
< div class = " modal-dialog modal-lg " >
2020-11-25 16:05:21 +01:00
< div class = " modal-content " >
2021-04-18 20:31:07 +02:00
< form action = " { { route('ticket.message.create', $ticket ) }} " method = " POST " enctype = " multipart/form-data " >
2020-11-25 16:05:21 +01:00
@ 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° {{ $ticket -> id }}
</ h5 >
< button type = " button " class = " close " data - dismiss = " modal " aria - label = " Close " >
< span aria - hidden = " true " >& times ; </ span >
</ button >
</ div >
< div class = " modal-body " >
< textarea name = " message " class = " form-control " rows = " 10 " ></ textarea >< br >
< input type = " file " name = " file_message " accept = " image/jpeg, image/png, image/jpg, .pdf " >
</ div >
< div class = " modal-footer " >
< button type = " reset " class = " btn btn-sm btn-danger " data - dismiss = " modal " > Fermer </ button >
< button type = " submit " class = " btn btn-sm btn-success " > Envoyer </ button >
</ div >
</ form >
</ div >
</ div >
</ div >
2021-04-18 20:31:07 +02:00
@ endcan
2020-11-25 16:05:21 +01:00
</ h4 >
@ foreach ( $messages as $message )
@ if ( $message -> user_id === null )
< div class = " offset-md-3 col-md-6 alert alert-secondary text-center " >
{ !! nl2br ( e ( $message -> message )) !! } - Le {{ \Carbon\Carbon :: parse ( $message -> created_at ) -> format ( 'd/m/Y à H:i' )}} < small class = " text-muted " > ( Message système ) </ small >
</ div >
@ elseif ( $message -> user_id === Auth :: user () -> id )
< div class = " offset-md-4 col-md-8 alert alert-primary text-right " >
{ !! nl2br ( e ( $message -> message )) !! } < br >
@ if ( $message -> file !== null )
2021-04-18 20:44:38 +02:00
< a data - fslightbox href = " { { asset( $message->file ) }} " target = " _blank " > Ouvrir la pièce jointe </ a >< br >
2020-11-25 16:05:21 +01:00
@ endif
< small class = " text-muted " > Le {{ \Carbon\Carbon :: parse ( $message -> created_at ) -> format ( 'd/m/Y à H:i' )}} par {{ $message -> user -> name }} </ small >
</ div >
@ else
< div class = " col-md-8 alert alert-success text-left " >
{ !! nl2br ( e ( $message -> message )) !! } < br >
@ if ( $message -> file !== null )
2021-04-18 20:44:38 +02:00
< a data - fslightbox href = " { { asset( $message->file ) }} " target = " _blank " > Ouvrir la pièce jointe </ a >< br >
2020-11-25 16:05:21 +01:00
@ endif
< small class = " text-muted " > Le {{ \Carbon\Carbon :: parse ( $message -> created_at ) -> format ( 'd/m/Y à H:i' )}} par {{ $message -> user -> name }} </ small >
</ div >
@ endif
@ endforeach
</ div >
< hr >
< div >
< h4 > Description </ h4 >
< p > { !! nl2br ( e ( $ticket -> text )) !! } </ p >
< small class = " text-muted " > Créer le {{ \Carbon\Carbon :: parse ( $ticket -> created_at ) -> format ( 'd/m/Y à H:i' ) }} </ small >
</ div >
2020-11-26 15:48:35 +01:00
@ if ( $ticket -> file !== null || $ticket -> file2 !== null )
2020-11-25 16:05:21 +01:00
< hr >
< div >
< h4 > Pièces jointes </ h4 >
< ul >
@ if ( $ticket -> file !== null )
< li >
Pièce jointe n°1 :
< a href = " { { asset( $ticket->file ) }} " target = " _blank " > Ouvrir la pièce jointe </ a >
</ li >
@ endif
@ if ( $ticket -> file2 !== null )
< li >
Pièce jointe n°2 :
< a href = " { { asset( $ticket->file2 ) }} " target = " _blank " > Ouvrir la pièce jointe </ a >
</ li >
@ endif
</ ul >
</ div >
2020-11-26 15:48:35 +01:00
@ endif
2020-11-25 16:05:21 +01:00
</ div >
@ endsection