DashboardHeaderBar.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. <!-- BADGE -->
  32. <q-badge
  33. v-if="unreadNotifications > 0"
  34. floating
  35. rounded
  36. color="pink"
  37. class="notification-badge"
  38. >
  39. {{ unreadNotifications }}
  40. </q-badge>
  41. </q-btn>
  42. </div>
  43. </div>
  44. </template>
  45. <script setup>
  46. import LogoDiariaColorida from 'src/assets/logo_diaria_colorido_sem_texto.svg'
  47. import { computed } from 'vue'
  48. import { useRouter } from 'vue-router'
  49. const router = useRouter()
  50. const props = defineProps({
  51. data: {
  52. type: Object,
  53. default: () => null
  54. },
  55. notifications: {
  56. type: Array,
  57. default: () => []
  58. }
  59. })
  60. //vai para dashboard as notificações tem que ser mocada no backend
  61. const unreadNotifications = computed(() => {
  62. return props.notifications.filter((notification) => !notification.read).length
  63. })
  64. const goToNotifications = () => {
  65. router.push({
  66. name: 'NotificationsPage',
  67. query: {
  68. notifications: JSON.stringify(props.notifications)
  69. }
  70. })
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .dashboard-header {
  75. padding-top: calc(env(safe-area-inset-top) + 8px);
  76. width: 100%;
  77. box-sizing: border-box;
  78. }
  79. .dashboard-logo {
  80. width: 32px;
  81. height: 32px;
  82. }
  83. .dashboard-metric-value {
  84. font-family: "Inter", sans-serif;
  85. font-size: 11px;
  86. font-weight: 700;
  87. color: #3a3a4a;
  88. line-height: 1;
  89. }
  90. .dashboard-metric-meta {
  91. font-family: "Inter", sans-serif;
  92. font-size: 10px;
  93. font-weight: 400;
  94. color: #999;
  95. line-height: 1;
  96. }
  97. .notification-badge {
  98. min-width: 16px;
  99. height: 16px;
  100. font-size: 10px;
  101. font-weight: 700;
  102. }
  103. </style>