You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
3.6KB

  1. <?php
  2. use common\logic\Ticket\Ticket\Wrapper\TicketManager;
  3. use common\logic\User\User\Wrapper\UserManager;
  4. use yii\helpers\Html;
  5. use yii\widgets\ActiveForm;
  6. $ticketManager = TicketManager::getInstance();
  7. $userManager = UserManager::getInstance();
  8. $this->setTitle('Voir un ticket');
  9. $this->addBreadcrumb(['label' => 'Support', 'url' => ['index']]);
  10. $this->addBreadcrumb('Voir un ticket');
  11. ?>
  12. <div class="ticket-view">
  13. <div class="box box-solid">
  14. <div class="box-body">
  15. <table class="table">
  16. <tbody>
  17. <tr>
  18. <td><strong>Sujet</strong></td>
  19. <td><?= Html::encode($ticket->subject); ?></td>
  20. </tr>
  21. <tr>
  22. <td><strong>Ouverture</strong></td>
  23. <td><?= $ticketManager->getTicketDateCreatedAtFormat($ticket); ?></td>
  24. </tr>
  25. <tr>
  26. <td><strong>Statut</strong></td>
  27. <td><?= $ticketManager->getTicketStatusLabelAsHtml($ticket); ?></td>
  28. </tr>
  29. </tbody>
  30. </table>
  31. </div>
  32. </div>
  33. <ul class="timeline">
  34. <?php foreach($ticket->ticketMessages as $key => $ticketMessage): ?>
  35. <li>
  36. <?php if ($key === array_key_last($ticket->ticketMessages)): ?>
  37. <a name="bottom"></a>
  38. <?php endif; ?>
  39. <a name="<?= $ticketMessage->id ?>"></a>
  40. <i class="fa fa-user <?= $userManager->isAdmin($ticketMessage->user) ? 'bg-orange' : 'bg-aqua'; ?>"></i>
  41. <div class="timeline-item">
  42. <span class="time"><i class="fa fa-clock-o"></i> <?= date('d/m/Y à H:i', strtotime($ticketMessage->created_at)) ?></span>
  43. <h3 class="timeline-header"><?= Html::encode($userManager->getUsername($ticketMessage->user)); ?></h3>
  44. <div class="timeline-body">
  45. <?= nl2br($ticketMessage->message); ?>
  46. </div>
  47. </div>
  48. </li>
  49. <?php endforeach; ?>
  50. </ul>
  51. <div class="box box-success">
  52. <div class="box-header">
  53. <h3 class="box-title"><i class="fa fa-comments"></i> Répondre</h3>
  54. </div>
  55. <div class="box-body">
  56. <?php $form = ActiveForm::begin(); ?>
  57. <?= $form->field($ticketMessageResponse, 'message')->textarea(['rows' => 6]); ?>
  58. <div class="form-group">
  59. <?= Html::submitButton('Répondre', ['class' => 'btn btn-success btn-sm']) ?>
  60. </div>
  61. <?php ActiveForm::end(); ?>
  62. </div>
  63. </div>
  64. <div class="box <?= $ticketManager->isTicketOpen($ticket) ? 'box-danger' : 'box-success'; ?>">
  65. <div class="box-header">
  66. <h3 class="box-title">
  67. <?php if($ticketManager->isTicketOpen($ticket)): ?>
  68. <i class="fa fa-folder"></i> Cliquez ici si vous souhaitez fermer le ticket
  69. <?php else: ?>
  70. <i class="fa fa-folder-open"></i> Cliquez ici si vous souhaitez rouvrir le ticket
  71. <?php endif; ?>
  72. </h3>
  73. </div>
  74. <div class="box-body">
  75. <?php if($ticketManager->isTicketOpen($ticket)): ?>
  76. <?= Html::a('Fermer le ticket', ['close', 'id' => $ticket->id], ['class' => 'btn btn-danger btn-sm']) ?>
  77. <?php else: ?>
  78. <?= Html::a('Rouvrir le ticket', ['open', 'id' => $ticket->id], ['class' => 'btn btn-success btn-sm']) ?>
  79. <?php endif; ?>
  80. </div>
  81. </div>
  82. </div>