Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
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.
 
 
 
 
 
 

121 lines
5.3 KiB

  1. <template>
  2. <div v-if="mobile && !toggled" class="sidebar-toggle">
  3. <svg @click="() => toggled = !toggled"
  4. width="1em" height="60" viewBox="0 0 16 16" class="bi bi-justify-left"
  5. fill="currentColor" xmlns="http://www.w3.org/2000/svg"> <path
  6. fill-rule="evenodd" d="M2 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0
  7. 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0
  8. 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0
  9. 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/> </svg>
  10. </div>
  11. <menu v-if="!mobile || toggled" class="sidebar">
  12. <svg v-if="mobile" @click="() => toggled = !toggled"
  13. width="1em" height="60" viewBox="0 0 16 16" class="bi bi-justify-left close"
  14. fill="currentColor" xmlns="http://www.w3.org/2000/svg"> <path
  15. fill-rule="evenodd" d="M2 12.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0
  16. 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0
  17. 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h11a.5.5 0
  18. 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/> </svg>
  19. <img v-if="avatar"
  20. :src="avatarUrl">
  21. <a href="#" :class="active == 1 ? 'active' : ''">
  22. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
  23. fill="currentColor" class="bi bi-house" viewBox="0 0 16 16"> <path
  24. fill-rule="evenodd" d="M2 13.5V7h1v6.5a.5.5 0 0 0 .5.5h9a.5.5 0 0 0
  25. .5-.5V7h1v6.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2
  26. 13.5zm11-11V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/> <path
  27. fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0
  28. 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
  29. </svg>
  30. <span>Home</span>
  31. </a>
  32. <a href="#new" :class="active == 2 ? 'active' : ''">
  33. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
  34. fill="currentColor" class="bi bi-journal-plus" viewBox="0 0 16 16"> <path
  35. fill-rule="evenodd" d="M8 5.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V10a.5.5
  36. 0 0 1-1 0V8.5H6a.5.5 0 0 1 0-1h1.5V6a.5.5 0 0 1 .5-.5z"/> <path d="M3 0h10a2 2 0
  37. 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0
  38. 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z"/> <path d="M1
  39. 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1
  40. 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0
  41. 0 1 0 1h-2a.5.5 0 0 1 0-1H1z"/> </svg>
  42. <span>New</span>
  43. </a>
  44. <a href="#estimates" :class="active == 3 ? 'active' : ''">
  45. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
  46. fill="currentColor" class="bi bi-journals" viewBox="0 0 16 16"> <path d="M5
  47. 0h8a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2 2 2 0 0 1-2 2H3a2 2 0 0 1-2-2h1a1 1 0 0 0 1
  48. 1h8a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1H1a2 2 0 0 1 2-2h8a2 2 0 0 1 2
  49. 2v9a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1H3a2 2 0 0 1 2-2z"/> <path
  50. d="M1 6v-.5a.5.5 0 0 1 1 0V6h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5
  51. 0 0 1 1 0V9h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 2.5v.5H.5a.5.5 0 0 0 0
  52. 1h2a.5.5 0 0 0 0-1H2v-.5a.5.5 0 0 0-1 0z"/> </svg>
  53. <span>Estimates</span>
  54. </a>
  55. <a href="#settings" :class="active == 4 ? 'active' : ''">
  56. <svg width="15px" height="15px" viewBox="0 0 15 15" fill="none"
  57. xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd"
  58. clip-rule="evenodd" d="M5.944 0.5L5.858 0.936707L5.52901 2.53467C5.00301 2.73554
  59. 4.526 3.02037 4.095 3.35815L2.487 2.8205L2.05501 2.68658L1.83101
  60. 3.07233L0.723999 4.9231L0.5 5.3089L0.828003 5.5957L2.07201 6.65399C2.02701
  61. 6.93081 1.96901 7.20461 1.96901 7.49542C1.96901 7.78623 2.02701 8.0601 2.07201
  62. 8.33691L0.828003 9.3952L0.5 9.68201L0.723999 10.0677L1.83101 11.9186L2.05501
  63. 12.3053L2.487 12.1704L4.095 11.6328C4.526 11.9705 5.00301 12.2553 5.52901
  64. 12.4562L5.858 14.0541L5.944 14.4909H9.05501L9.142 14.0541L9.47 12.4562C9.996
  65. 12.2553 10.473 11.9705 10.904 11.6328L12.512 12.1704L12.944 12.3053L13.169
  66. 11.9186L14.275 10.0677L14.5 9.68201L14.171 9.3952L12.927 8.33691C12.973 8.0601
  67. 13.03 7.78623 13.03 7.49542C13.03 7.20461 12.973 6.93081 12.927 6.65399L14.171
  68. 5.5957L14.5 5.3089L14.275 4.9231L13.169 3.07233L12.944 2.68658L12.512
  69. 2.8205L10.904 3.35815C10.473 3.02037 9.996 2.73554 9.47 2.53467L9.142
  70. 0.936707L9.05501 0.5H5.944Z" stroke="currentColor" stroke-linecap="square"
  71. stroke-linejoin="round"/> <path fill-rule="evenodd" clip-rule="evenodd"
  72. d="M9.49963 7.49542C9.49963 8.5987 8.60363 9.49414 7.49963 9.49414C6.39563
  73. 9.49414 5.49963 8.5987 5.49963 7.49542C5.49963 6.39214 6.39563 5.49677 7.49963
  74. 5.49677C8.60363 5.49677 9.49963 6.39214 9.49963 7.49542Z" stroke="currentColor"
  75. stroke-linecap="square" stroke-linejoin="round"/> </svg>
  76. <span>Settings</span>
  77. </a>
  78. <a href="#sign-out" :class="active == 5 ? 'active' : ''">
  79. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
  80. fill="currentColor" class="bi bi-door-closed" viewBox="0 0 16 16"> <path d="M3
  81. 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2zm1
  82. 13h8V2H4v13z"/> <path d="M9 9a1 1 0 1 0 2 0 1 1 0 0 0-2 0z"/> </svg>
  83. <span>Sign out</span>
  84. </a>
  85. </menu>
  86. </template>
  87. <script setup>
  88. import { ref, onMounted, computed } from "vue"
  89. const props = defineProps(['role', 'active', 'avatar'])
  90. const mobile = ref(false)
  91. const toggled = ref(false)
  92. let avatarUrl = computed(() => {
  93. return URL.createObjectURL(props.avatar)
  94. })
  95. function checkMobile() {
  96. if (window.innerWidth < 720) {
  97. mobile.value = true
  98. } else {
  99. mobile.value = false
  100. }
  101. }
  102. onMounted(() => {
  103. window.onresize = checkMobile
  104. checkMobile()
  105. })
  106. </script>