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.

100 lines
4.2KB

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