|
|
@@ -186,7 +186,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, onMounted } from "vue";
|
|
|
+import { ref, computed, onMounted, watch } from "vue";
|
|
|
import { Doughnut } from "vue-chartjs";
|
|
|
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from "chart.js";
|
|
|
import { useQuasar } from "quasar";
|
|
|
@@ -199,10 +199,12 @@ import FeriadosDialog from "./components/FeriadosDialog.vue";
|
|
|
import FeriadosEditDialog from "./components/FeriadosEditDialog.vue";
|
|
|
import { getHolidays } from "src/api/holiday";
|
|
|
import { getStudents } from "src/api/student";
|
|
|
+import { userStore } from "src/stores/user";
|
|
|
|
|
|
ChartJS.register(ArcElement, Tooltip, Legend);
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
+const store = userStore();
|
|
|
|
|
|
const faturamentoChart = {
|
|
|
labels: [
|
|
|
@@ -392,6 +394,17 @@ function openEditFromDashboard(feriado) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// Recarrega dados do dashboard quando a unidade ativa mudar
|
|
|
+watch(
|
|
|
+ () => store.selectedUnit?.id,
|
|
|
+ (newId, oldId) => {
|
|
|
+ if (newId && newId !== oldId) {
|
|
|
+ fetchAlunos();
|
|
|
+ fetchHolidays();
|
|
|
+ }
|
|
|
+ },
|
|
|
+);
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchHolidays();
|
|
|
fetchAlunos();
|