Ver Fonte

refactor(ActiveStudentsDialog): rename dialog title and update student status display
refactor(student API): unify active student retrieval function name
refactor(DashboardPage): reorder student status badges for clarity

alvesantos há 3 dias atrás
pai
commit
08fad5e9af

+ 2 - 2
src/api/student.js

@@ -12,8 +12,8 @@ export const getStudentSummaryFranchisor = async (unitIds = []) => {
   return data.payload;
   return data.payload;
 };
 };
 
 
-export const getFranchisorActiveStudents = async (unitIds = []) => {
-  const { data } = await api.get("/student/franchisor/active", {
+export const getFranchisorStudents = async (unitIds = []) => {
+  const { data } = await api.get("/student/franchisor/students", {
     params: unitIds.length ? { unit_ids: unitIds } : {},
     params: unitIds.length ? { unit_ids: unitIds } : {},
   });
   });
   return data.payload;
   return data.payload;

+ 3 - 3
src/pages/dashboard/DashboardPage.vue

@@ -341,10 +341,10 @@ const receivablesPeriodLabel = computed(() => {
  * - Nothing selected → [] (no filter = all units)
  * - Nothing selected → [] (no filter = all units)
  */
  */
 const studentsStatusBadges = computed(() => [
 const studentsStatusBadges = computed(() => [
-  { color: "info", label: `${studentsByStatus.value.lead} Lead` },
   { color: "positive", label: `${studentsByStatus.value.active} Ativo` },
   { color: "positive", label: `${studentsByStatus.value.active} Ativo` },
-  { color: "grey", label: `${studentsByStatus.value.ex_student} Ex-aluno` },
-  { color: "warning", label: `${studentsByStatus.value.locked} Trancado` },
+  { color: "orange", label: `${studentsByStatus.value.locked} Trancado` },
+  { color: "grey-7", label: `${studentsByStatus.value.ex_student} Ex-aluno` },
+  { color: "blue", label: `${studentsByStatus.value.lead} Lead` },
 ]);
 ]);
 
 
 const activeUnitIds = computed(() => {
 const activeUnitIds = computed(() => {

+ 22 - 7
src/pages/dashboard/components/ActiveStudentsDialog.vue

@@ -2,7 +2,7 @@
   <q-dialog ref="dialogRef" @hide="onDialogHide">
   <q-dialog ref="dialogRef" @hide="onDialogHide">
     <q-card style="width: 800px; max-width: 95vw; border-radius: 12px">
     <q-card style="width: 800px; max-width: 95vw; border-radius: 12px">
       <q-bar class="bg-transparent q-px-md" style="height: 55px">
       <q-bar class="bg-transparent q-px-md" style="height: 55px">
-        <span class="text-h6 text-dark" style="font-weight: 600">Alunos Ativos</span>
+        <span class="text-h6 text-dark" style="font-weight: 600">Alunos</span>
         <q-space />
         <q-space />
         <q-btn dense flat icon="mdi-close" @click="onDialogCancel" />
         <q-btn dense flat icon="mdi-close" @click="onDialogCancel" />
       </q-bar>
       </q-bar>
@@ -10,9 +10,9 @@
       <q-card-section class="q-pt-none q-pb-md q-px-md">
       <q-card-section class="q-pt-none q-pb-md q-px-md">
         <q-card flat bordered style="border-radius: 8px">
         <q-card flat bordered style="border-radius: 8px">
           <q-card-section class="q-pb-xs">
           <q-card-section class="q-pb-xs">
-            <div class="text-subtitle2 text-dark">Lista de alunos ativos</div>
+            <div class="text-subtitle2 text-dark">Lista de alunos</div>
             <div class="text-caption text-grey-6">
             <div class="text-caption text-grey-6">
-              {{ students.length }} Alunos Ativos
+              {{ students.length }} Alunos
               <q-spinner v-if="loading" size="16px" color="primary" class="q-ml-sm" />
               <q-spinner v-if="loading" size="16px" color="primary" class="q-ml-sm" />
             </div>
             </div>
           </q-card-section>
           </q-card-section>
@@ -52,8 +52,8 @@
                   <span class="text-caption text-grey-6">{{ student.unit }}</span>
                   <span class="text-caption text-grey-6">{{ student.unit }}</span>
                 </div>
                 </div>
                 <q-badge
                 <q-badge
-                  label="Ativo"
-                  color="btn-badge"
+                  :label="statusLabel(student.status)"
+                  :color="statusColor(student.status)"
                   style="
                   style="
                     border-radius: 8px;
                     border-radius: 8px;
                     font-size: 11px;
                     font-size: 11px;
@@ -85,7 +85,7 @@
 import { ref, computed, onMounted } from "vue";
 import { ref, computed, onMounted } from "vue";
 import { useDialogPluginComponent } from "quasar";
 import { useDialogPluginComponent } from "quasar";
 import { useRouter } from "vue-router";
 import { useRouter } from "vue-router";
-import { getFranchisorActiveStudents } from "src/api/student";
+import { getFranchisorStudents } from "src/api/student";
 import { formatUnitName } from "src/helpers/utils";
 import { formatUnitName } from "src/helpers/utils";
 
 
 const props = defineProps({
 const props = defineProps({
@@ -105,11 +105,12 @@ const students = ref([]);
 onMounted(async () => {
 onMounted(async () => {
   loading.value = true;
   loading.value = true;
   try {
   try {
-    const data = await getFranchisorActiveStudents(props.unitIds);
+    const data = await getFranchisorStudents(props.unitIds);
     students.value = data.map((s) => ({
     students.value = data.map((s) => ({
       id: s.id,
       id: s.id,
       name: s.name,
       name: s.name,
       phone: s.phone ?? "—",
       phone: s.phone ?? "—",
+      status: s.status,
       unit: formatUnitName(s.unit),
       unit: formatUnitName(s.unit),
     }));
     }));
   } catch {
   } catch {
@@ -134,6 +135,20 @@ const goToDetail = (student) => {
   onDialogOK();
   onDialogOK();
   router.push({ name: "StudentDetailPage", params: { id: student.id } });
   router.push({ name: "StudentDetailPage", params: { id: student.id } });
 };
 };
+
+const statusLabel = (status) => {
+  if (status === "active") return "Ativo";
+  if (status === "locked") return "Trancado";
+  if (status === "ex_student") return "Ex-aluno";
+  return "Lead";
+};
+
+const statusColor = (status) => {
+  if (status === "active") return "positive";
+  if (status === "locked") return "orange";
+  if (status === "ex_student") return "grey-7";
+  return "blue";
+};
 </script>
 </script>
 
 
 <style scoped>
 <style scoped>