ソースを参照

feat: adiciona dialog de alunos

ebagabee 1 ヶ月 前
コミット
fec81331e6

+ 34 - 6
src/components/charts/DashboardStatCard.vue

@@ -1,12 +1,12 @@
 <template>
-  <q-card class="stat-card">
+  <q-card class="stat-card" :class="{ 'stat-card--clickable': clickable }" @click="clickable && emit('click')">
     <div class="flex justify-between items-start no-wrap">
-      <span class="text-subtitle2 text-dark">{{ title }}</span>
-      <q-icon :name="icon" size="22px" color="dark" />
+      <span class="text-subtitle2 card-title">{{ title }}</span>
+      <q-icon :name="icon" size="22px" class="card-icon" />
     </div>
 
     <div class="value-area">
-      <span class="text-h5 text-primary value-text">{{ value }}</span>
+      <span class="text-h5 value-text card-value">{{ value }}</span>
 
       <q-badge
         v-if="badge"
@@ -15,7 +15,7 @@
         :style="customStyle"
         class="stat-badge"
       />
-      <span v-else-if="subtitle" class="text-caption text-foreground">{{
+      <span v-else-if="subtitle" class="text-caption text-foreground card-subtitle">{{
         subtitle
       }}</span>
     </div>
@@ -31,7 +31,10 @@ defineProps({
   badge: { type: String, default: "" },
   badgeColor: { type: String, default: "accent-1" },
   customStyle: { type: String, default: "padding: 4px" },
+  clickable: { type: Boolean, default: false },
 });
+
+const emit = defineEmits(['click']);
 </script>
 
 <style scoped lang="scss">
@@ -45,6 +48,31 @@ defineProps({
   display: flex;
   flex-direction: column;
   justify-content: space-between;
+  transition: background-color 0.2s, color 0.2s;
+
+  .card-title { color: #1a1a1a; transition: color 0.2s; }
+  .card-icon { color: #1a1a1a; transition: color 0.2s; }
+  .card-value { color: $primary; transition: color 0.2s; }
+  .card-subtitle { transition: color 0.2s; }
+}
+
+.stat-card--clickable {
+  cursor: pointer;
+
+  &:hover {
+    background-color: $primary !important;
+    box-shadow: 0 0 0 1px $primary !important;
+
+    .card-title { color: white; }
+    .card-icon { color: white; }
+    .card-value { color: white; }
+    .card-subtitle { color: rgba(255, 255, 255, 0.85); }
+
+    .stat-badge {
+      background-color: white !important;
+      color: $primary !important;
+    }
+  }
 }
 
 .value-area {
@@ -60,9 +88,9 @@ defineProps({
 
 .stat-badge {
   font-size: 12px;
-
   border-radius: 8px;
   width: fit-content;
   color: $primary;
+  transition: background-color 0.2s, color 0.2s;
 }
 </style>

+ 2 - 0
src/css/quasar.variables.scss

@@ -57,6 +57,8 @@ $colors: (
   "accent-1": #E38B37,
 
   "foreground": #505050,
+
+  "btn-badge": #554EF4,
 );
 
 @each $name, $color in $colors {

+ 10 - 0
src/pages/dashboard/DashboardPage.vue

@@ -166,6 +166,8 @@
           icon="mdi-account-multiple-outline"
           value="4.527"
           badge="3.200 ativos"
+          clickable
+          @click="openAlunosDialog"
         />
         <DashboardStatCard
           title="Contratos Congelados"
@@ -247,21 +249,29 @@
     <div v-else class="flex flex-center full-width q-pa-xl">
       <q-spinner color="primary" size="50px" />
     </div>
+
   </div>
 </template>
 
 <script setup>
 import { onMounted, ref, watch } from "vue";
+import { useQuasar } from "quasar";
 import { useI18n } from "vue-i18n";
 import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
 import DashboardStatCard from "src/components/charts/DashboardStatCard.vue";
 import DashboardChartCard from "src/components/charts/DashboardChartCard.vue";
 import GroupedBarChart from "src/components/charts/normal/GroupedBarChart.vue";
 import AniversariantesCard from "src/components/charts/AniversariantesCard.vue";
+import AlunosAtivosDialog from "src/pages/dashboard/components/AlunosAtivosDialog.vue";
 
 const { t } = useI18n();
 
+const $q = useQuasar();
 const isLoading = ref(true);
+
+const openAlunosDialog = () => {
+  $q.dialog({ component: AlunosAtivosDialog });
+};
 const selectedUnit = ref(null);
 const defaultPeriod = ref("month");
 const defaultEventId = ref(1);

+ 182 - 0
src/pages/dashboard/components/AlunosAtivosDialog.vue

@@ -0,0 +1,182 @@
+<template>
+  <q-dialog ref="dialogRef" @hide="onDialogHide">
+    <q-card style="width: 580px; max-width: 95vw; border-radius: 12px">
+      <q-bar class="bg-transparent q-px-md" style="height: 55px">
+        <span class="text-h6 text-dark" style="font-weight: 600"
+          >Alunos Ativos</span
+        >
+        <q-space />
+        <q-btn dense flat icon="mdi-close" @click="onDialogCancel" />
+      </q-bar>
+
+      <q-card-section class="q-pt-none q-pb-md q-px-md">
+        <q-card flat bordered style="border-radius: 8px">
+          <q-card-section class="q-pb-xs">
+            <div class="text-subtitle2 text-dark">Lista de alunos</div>
+            <div class="text-caption text-grey-6">
+              {{ alunos.length }} Alunos Cadastrados
+            </div>
+          </q-card-section>
+
+          <q-card-section class="q-pt-xs q-pb-sm">
+            <q-input
+              v-model="search"
+              dense
+              borderless
+              placeholder="Busque por status, nome, tel/whats"
+            >
+              <template #prepend>
+                <q-icon name="mdi-magnify" color="grey-6" />
+              </template>
+            </q-input>
+          </q-card-section>
+
+          <q-separator />
+
+          <div class="list-header q-px-md q-py-xs">
+            <span class="text-caption text-grey-7">Nome</span>
+            <span class="text-caption text-grey-7">Contato/Unidade</span>
+            <span class="text-caption text-grey-7">Contrato</span>
+          </div>
+
+          <q-separator />
+
+          <div style="max-height: 320px; overflow-y: auto">
+            <template v-for="(aluno, index) in filteredAlunos" :key="aluno.id">
+              <div
+                class="list-row q-px-md q-py-sm"
+                :class="{ 'row-selected': index === selectedIndex }"
+                @click="selectedIndex = index"
+              >
+                <span class="text-body2 text-dark">{{ aluno.nome }}</span>
+                <div class="column" style="gap: 2px">
+                  <span class="text-caption text-dark">{{
+                    aluno.telefone
+                  }}</span>
+                  <span class="text-caption text-grey-6">{{
+                    aluno.unidade
+                  }}</span>
+                </div>
+                <q-badge
+                  :label="aluno.status"
+                  :color="aluno.status === 'Ativo' ? 'btn-badge' : 'grey'"
+                  style="
+                    border-radius: 8px;
+                    font-size: 11px;
+                    padding: 4px;
+                    width: max-content;
+                    margin-left: 10px;
+                  "
+                />
+              </div>
+              <q-separator v-if="index < filteredAlunos.length - 1" />
+            </template>
+          </div>
+        </q-card>
+      </q-card-section>
+
+      <q-card-actions align="right" class="q-px-md q-pb-md q-pt-none">
+        <q-btn
+          label="EXPORTAR"
+          color="primary-2"
+          unelevated
+          style="border-radius: 8px; font-weight: 600; letter-spacing: 0.5px"
+        />
+      </q-card-actions>
+    </q-card>
+  </q-dialog>
+</template>
+
+<script setup>
+import { ref, computed } from "vue";
+import { useDialogPluginComponent } from "quasar";
+
+defineEmits([...useDialogPluginComponent.emits]);
+
+const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent();
+
+const search = ref("");
+const selectedIndex = ref(0);
+
+const alunos = [
+  {
+    id: 1,
+    nome: "Heloisa Faria",
+    telefone: "(46)99999-9999",
+    unidade: "Unidade franco",
+    status: "Ativo",
+  },
+  {
+    id: 2,
+    nome: "Carol",
+    telefone: "(45)99999-9999",
+    unidade: "Arapongas-PR",
+    status: "Ativo",
+  },
+  {
+    id: 3,
+    nome: "Marcelo Souza",
+    telefone: "(45)98888-8888",
+    unidade: "Curitiba-PR",
+    status: "Ativo",
+  },
+  {
+    id: 4,
+    nome: "Ana Lúcia",
+    telefone: "(45)97777-7777",
+    unidade: "Londrina-PR",
+    status: "Ativo",
+  },
+  {
+    id: 5,
+    nome: "Ricardo Silva",
+    telefone: "(45)96666-6666",
+    unidade: "Ponta Grossa-PR",
+    status: "Ativo",
+  },
+  {
+    id: 6,
+    nome: "Juliana Costa",
+    telefone: "(45)95555-5555",
+    unidade: "Maringá-PR",
+    status: "Ativo",
+  },
+];
+
+const filteredAlunos = computed(() => {
+  if (!search.value) return alunos;
+  const q = search.value.toLowerCase();
+  return alunos.filter(
+    (a) =>
+      a.nome.toLowerCase().includes(q) ||
+      a.telefone.includes(q) ||
+      a.unidade.toLowerCase().includes(q) ||
+      a.status.toLowerCase().includes(q),
+  );
+});
+</script>
+
+<style scoped>
+.list-header {
+  display: grid;
+  grid-template-columns: 1fr 1fr 100px;
+  align-items: center;
+}
+
+.list-row {
+  display: grid;
+  grid-template-columns: 1fr 1fr 100px;
+  align-items: center;
+  align-content: center;
+  cursor: pointer;
+  transition: background-color 0.15s;
+}
+
+.list-row:hover {
+  background-color: #f5f5f5;
+}
+
+.row-selected {
+  background-color: #b2dfdb !important;
+}
+</style>