DashboardHeaderBar.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
  2. <template>
  3. <div class="dashboard-header shadow-card bg-white row items-center no-wrap q-px-md q-pb-sm">
  4. <div class="col column q-gutter-y-xs">
  5. <div class="row items-center q-gutter-x-xs">
  6. <q-icon name="mdi-star" color="warning" size="14px" />
  7. <span class="dashboard-metric-value">{{ data?.rating != null ? Number(data.rating).toFixed(1).replace('.', ',') : '-' }}</span>
  8. <span class="dashboard-metric-meta">({{ data?.total_ratings ?? 0 }})</span>
  9. </div>
  10. <div class="row items-center q-gutter-x-xs">
  11. <q-icon name="mdi-broom" color="secondary" size="14px" />
  12. <span class="dashboard-metric-value">{{ data?.total_services ?? 0 }}</span>
  13. </div>
  14. </div>
  15. <div class="col-auto row justify-center">
  16. <img :src="LogoDiariaColorida" alt="Diária" class="dashboard-logo" />
  17. </div>
  18. <div class="col row justify-end items-center">
  19. <q-btn
  20. flat
  21. round
  22. dense
  23. color="grey-7"
  24. size="sm"
  25. @click="goToNotifications"
  26. >
  27. <q-icon
  28. name="mdi-bell-outline"
  29. size="20px"
  30. />
  31. <q-badge
  32. v-if="unreadNotifications > 0"
  33. floating
  34. rounded
  35. color="pink"
  36. class="notification-badge"
  37. >
  38. {{ unreadNotifications }}
  39. </q-badge>
  40. </q-btn>
  41. </div>
  42. </div>
  43. </template>
  44. <script setup>
  45. import { computed } from 'vue'
  46. import { useRouter } from 'vue-router'
  47. import LogoDiariaColorida from 'src/assets/logo_diaria_colorido_sem_texto.svg'
  48. const router = useRouter()
  49. const props = defineProps({
  50. data: {
  51. type: Object,
  52. default: () => null
  53. },
  54. notifications: {
  55. type: Array,
  56. default: () => []
  57. }
  58. })
  59. const unreadNotifications = computed(() => {
  60. return props.notifications.filter((notification) => !notification.read).length
  61. })
  62. const goToNotifications = () => {
  63. router.push({
  64. name: 'NotificationsPage',
  65. query: {
  66. notifications: JSON.stringify(props.notifications)
  67. }
  68. })
  69. }
  70. </script>
  71. <style scoped lang="scss">
  72. .dashboard-header {
  73. padding-top: calc(env(safe-area-inset-top) + 8px);
  74. width: 100%;
  75. box-sizing: border-box;
  76. }
  77. .dashboard-logo {
  78. width: 32px;
  79. height: 32px;
  80. }
  81. .dashboard-metric-value {
  82. font-family: "Inter", sans-serif;
  83. font-size: 11px;
  84. font-weight: 700;
  85. color: #3a3a4a;
  86. line-height: 1;
  87. }
  88. .dashboard-metric-meta {
  89. font-family: "Inter", sans-serif;
  90. font-size: 10px;
  91. font-weight: 400;
  92. color: #999;
  93. line-height: 1;
  94. }
  95. .notification-badge {
  96. min-width: 16px;
  97. height: 16px;
  98. font-size: 10px;
  99. font-weight: 700;
  100. }
  101. </style>