location_notes_tab.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * @var Location $location
  4. */
  5. $user = Core::$user;
  6. $action = sprintf("/account/locations/%d/add-note", $location->id);
  7. $notes = $location->getNotes();
  8. ?>
  9. <div class="tab-pane fade" id="notes" role="tabpanel" aria-labelledby="notes-tab">
  10. <form class="card mb-3" action="<?=htmlspecialchars($action)?>" method="post">
  11. <div class="card-header">
  12. <?=htmlspecialchars(__("Add Note"))?>
  13. </div>
  14. <div class="card-body">
  15. <label class="sr-only" for="note-content">
  16. <?=htmlspecialchars(__("Note"))?>
  17. </label>
  18. <textarea name="content" id="note-content" rows="4" class="form-control" placeholder="<?=htmlspecialchars(__("Type note"))?>"></textarea>
  19. </div>
  20. <div class="card-footer">
  21. <button class="btn btn-success" type="submit" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>">
  22. <?=htmlspecialchars(__("Add Note"))?>
  23. </button>
  24. </div>
  25. </form>
  26. <?php
  27. if(empty($notes)) {
  28. ?>
  29. <div class="alert alert-info">
  30. <i class="fa fa-fw fa-info-circle"></i>
  31. <?=htmlspecialchars(__("No notes have been added to this location."))?>
  32. </div>
  33. <?php
  34. }
  35. else {
  36. ?>
  37. <div class="list-group">
  38. <?php
  39. foreach($notes as $note) {
  40. $user = $note->getUser();
  41. $dt = $note->getDateTimeCreated();
  42. $dt->setTimezone(new DateTimeZone(TIMEZONE));
  43. ?>
  44. <div class="list-group-item">
  45. <div>
  46. <strong><?=htmlspecialchars($user->getDisplayName())?></strong>
  47. <span class="float-right text-muted"><?=htmlspecialchars($dt->format("d/m/Y H:i"))?></span>
  48. </div>
  49. <div>
  50. <?=$note->getContentHTML()?>
  51. </div>
  52. </div>
  53. <?php
  54. }
  55. ?>
  56. </div>
  57. <?php
  58. }
  59. ?>
  60. </div>