Explorar el Código

feat: remove mock e adiciona com base em campo do backend

ebagabee hace 3 semanas
padre
commit
878b9bd6bc
Se han modificado 1 ficheros con 24 adiciones y 12 borrados
  1. 24 12
      src/pages/dashboard/DashboardPage.vue

+ 24 - 12
src/pages/dashboard/DashboardPage.vue

@@ -29,17 +29,11 @@
               class="column q-gutter-y-none"
               style="white-space: nowrap"
             >
-              <span class="text-body2 text-center">Ana Laura</span>
-              <span
-                v-if="$q.screen.gt.sm"
-                class="text-overline text-center"
-                style="line-height: 1rem; font-weight: 400"
-                >Gerente</span
-              >
+              <span class="text-body2 text-center">{{ user?.name }}</span>
             </div>
           </div>
 
-          <template v-if="$q.screen.gt.sm">
+          <template v-if="$q.screen.gt.sm && lastLoginFormatted">
             <q-separator
               vertical
               style="height: 36px; width: 2px; flex-shrink: 0"
@@ -53,9 +47,9 @@
               <span class="text-caption text-grey-6 text-primary text-center"
                 >Ultimo acesso</span
               >
-              <span class="text-caption text-primary text-center"
-                >16/02/2026, 14:16</span
-              >
+              <span class="text-caption text-primary text-center">{{
+                lastLoginFormatted
+              }}</span>
             </div>
           </template>
 
@@ -264,9 +258,10 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from "vue";
+import { computed, onMounted, ref, watch } from "vue";
 import { useQuasar } from "quasar";
 import { useI18n } from "vue-i18n";
+import { userStore } from "src/stores/user";
 import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
 import DashboardStatCard from "src/components/charts/DashboardStatCard.vue";
 import DashboardChartCard from "src/components/charts/DashboardChartCard.vue";
@@ -282,6 +277,23 @@ import TicketsAbertoDialog from "src/pages/dashboard/components/TicketsAbertoDia
 const { t } = useI18n();
 
 const $q = useQuasar();
+const store = userStore();
+
+const user = computed(() => store.user);
+
+const lastLoginFormatted = computed(() => {
+  const raw = store.user?.last_login_at;
+  if (!raw) return null;
+  const d = new Date(raw.replace(" ", "T") + "Z");
+  return new Intl.DateTimeFormat("pt-BR", {
+    day: "2-digit",
+    month: "2-digit",
+    year: "numeric",
+    hour: "2-digit",
+    minute: "2-digit",
+    timeZone: "America/Sao_Paulo",
+  }).format(d);
+});
 const isLoading = ref(true);
 
 const openAlunosDialog = () => {