ソースを参照

fix: :bug: fix(correções) Foi realizada correções na dashboard do sistema e tambem alteraçãoes na tradução

Foi realizzada correções na dashboard para serviços pedendetes onde foi alterado para mostra a data e a hora do serviço, tambem foi ajustado o serviços do dia onde após o prestador colocar o codigo ira mostra a barra do serviço em andamento para o cliente logo apos acaba o horario do serviço ira mostra a opção de avaliar para o cliente

origin:bug-interno
kayo henrique 2 日 前
コミット
8fe2c43b13

+ 70 - 0
src/components/dashboard/DashboardPendingSchedules.vue

@@ -103,6 +103,24 @@
               />
             </div>
 
+            <div class="schedule-info">
+  <div class="schedule-info-item">
+    <q-icon
+      name="mdi-calendar-outline"
+      size="14px"
+    />
+    <span>{{ displayDate(item) }}</span>
+  </div>
+
+  <div class="schedule-info-item">
+    <q-icon
+      name="mdi-clock-outline"
+      size="14px"
+    />
+    <span>{{ displayScheduleTime(item) }}</span>
+  </div>
+</div>
+
             <div class="card-footer row items-center no-wrap">
               <q-btn
                 v-if="type !== 'servicePackage'"
@@ -233,6 +251,34 @@ const displayTime = (item) => {
     : timeAgo;
 };
 
+const displayDate = (item) => {
+  const schedule = isServicePackage.value
+    ? item.schedules?.[0]
+    : item;
+
+  if (!schedule?.date) return "—";
+
+  const date = new Date(schedule.date);
+
+  return date.toLocaleDateString("pt-BR", {
+    day: "2-digit",
+    month: "2-digit",
+    year: "numeric",
+  });
+};
+
+const displayScheduleTime = (item) => {
+  const schedule = isServicePackage.value
+    ? item.schedules?.[0]
+    : item;
+
+  if (!schedule?.start_time || !schedule?.end_time) {
+    return "—";
+  }
+
+  return `${schedule.start_time.slice(0, 5)} às ${schedule.end_time.slice(0, 5)}`;
+};
+
 const seeDetails = (item) => {
   if (isServicePackage.value || item.status === "accepted") {
     emit("view-details", item);
@@ -322,6 +368,30 @@ const seeDetails = (item) => {
   overflow: hidden;
 }
 
+.schedule-info {
+  display: flex;
+  flex-direction: column;
+  align-items: flex-start;
+  gap: 4px;
+  width: 100%;
+  margin: 5px 0 4px;
+  padding: 0 2px;
+  color: #475569;
+  font-size: 10px;
+  font-weight: 500;
+}
+
+.schedule-info-item {
+  display: flex;
+  align-items: center;
+  gap: 5px;
+  white-space: nowrap;
+
+  .q-icon {
+    color: #64748b;
+  }
+}
+
 .progress-fill {
   position: relative;
   height: 100%;

+ 57 - 14
src/components/dashboard/DashboardTodaySchedules.vue

@@ -3,7 +3,7 @@
     <div class="scroll-wrapper">
       <div class="scroll-track">
         <q-card
-          v-for="item in data"
+          v-for="item in visibleItems"
           :key="item.id"
           :flat="false"
           class="today-card card-border shadow-card bg-surface"
@@ -218,36 +218,69 @@
 import { avatarColors } from "src/helpers/avatarColors";
 import { getFirstName } from "src/helpers/utils";
 import { useQuasar } from "quasar";
+import { ref, onMounted, onBeforeUnmount, computed } from "vue";
 
 import ProfileHelpDialog from "src/components/profile/ProfileHelpDialog.vue";
 
 
-defineProps({ data: { type: Array, default: () => [] } });
+const props = defineProps({
+  data: {
+    type: Array,
+    default: () => [],
+  },
+});
+
+
 
 const emit = defineEmits(["rate"]);
 
 const $q = useQuasar();
 
+const now = ref(Date.now());
+
+let timer = null;
+
 const cardState = (item) => {
-  switch (item.status) {
-    case "finished":
-      return "finished";
+  if (item.status === "cancelled") {
+    return "cancelled";
+  }
 
-    case "started":
-      return "in_progress";
+  if (item.client_reviewed) {
+    return "finished";
+  }
 
-    case "accepted":
-    case "paid":
-      return "awaiting_code";
+  if (
+    item.status === "accepted" ||
+    item.status === "paid"
+  ) {
+    return "awaiting_code";
+  }
 
-    case "cancelled":
-      return "cancelled";
+  if (
+    item.status === "started" ||
+    item.status === "finished"
+  ) {
+    const [hours, minutes] = (item.end_time || "23:59")
+      .slice(0, 5)
+      .split(":")
+      .map(Number);
 
-    default:
-      return "awaiting_code";
+    const endTime = new Date();
+
+    endTime.setHours(hours, minutes, 0, 0);
+
+    return now.value >= endTime.getTime()
+      ? "finished"
+      : "in_progress";
   }
+
+  return "awaiting_code";
 };
 
+const visibleItems = computed(() => {
+  return props.data.filter((item) => !item.client_reviewed);
+});
+
 const progressByState = (item) => {
   const state = cardState(item);
 
@@ -262,6 +295,16 @@ const progressByState = (item) => {
 const openHelp = () => {
   $q.dialog({ component: ProfileHelpDialog });
 };
+
+onMounted(() => {
+  timer = setInterval(() => {
+    now.value = Date.now();
+  }, 1000);
+});
+
+onBeforeUnmount(() => {
+  clearInterval(timer);
+});
 </script>
 
 <style scoped lang="scss">

+ 1 - 1
src/i18n/locales/en.json

@@ -438,7 +438,7 @@
     },
     "today_schedules": {
       "start_with": "Service starting with",
-      "started_by": "Service started by",
+      "started_by": "Service in progress",
       "finished_by": "Service completed by",
       "code_label": "Code",
       "in_progress": "in progress",

+ 1 - 1
src/i18n/locales/es.json

@@ -438,7 +438,7 @@
     },
     "today_schedules": {
       "start_with": "Servicio iniciado con",
-      "started_by": "Servicio iniciado por",
+      "started_by": "Servicio en curso",
       "finished_by": "Servicio concluido por",
       "code_label": "Código",
       "in_progress": "en progreso",

+ 1 - 1
src/i18n/locales/pt.json

@@ -438,7 +438,7 @@
     },
     "today_schedules": {
       "start_with": "Início do serviço com",
-      "started_by": "Serviço iniciado por",
+      "started_by": "Seriço serviço em andamento",
       "finished_by": "Serviço concluído por",
       "code_label": "Código",
       "in_progress": "em andamento",