avance en el dashboard
This commit is contained in:
parent
8079470f22
commit
ea4b709ec9
@ -1,24 +1,21 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
|
import { api } from '@Services/Api';
|
||||||
|
import { apiTo } from './Module';
|
||||||
|
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
import VueApexCharts from 'vue3-apexcharts';
|
import VueApexCharts from 'vue3-apexcharts';
|
||||||
|
|
||||||
// Props
|
// Propiedades
|
||||||
const props = defineProps({
|
const vacations = ref([]);
|
||||||
adminInfo: {
|
const vacationsRequests = ref([]);
|
||||||
type: Object,
|
const adminInfo = ref({});
|
||||||
default: () => ({})
|
const charts = ref({});
|
||||||
},
|
|
||||||
charts: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Datos procesados para los charts
|
// Datos procesados para los charts
|
||||||
const chartData = computed(() => {
|
const chartData = computed(() => {
|
||||||
// Datos para el gráfico de línea (Solicitudes por Mes)
|
// Datos para el gráfico de línea (Solicitudes por Mes)
|
||||||
const monthlyData = props.charts.requests_by_month || [];
|
const monthlyData = charts.requests_by_month || [];
|
||||||
const lineChartCategories = monthlyData.map(item => item.month_name);
|
const lineChartCategories = monthlyData.map(item => item.month_name);
|
||||||
const lineChartSeries = [{
|
const lineChartSeries = [{
|
||||||
name: 'Solicitudes',
|
name: 'Solicitudes',
|
||||||
@ -26,7 +23,7 @@ const chartData = computed(() => {
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
// Datos para el gráfico de dona (Solicitudes por Departamento)
|
// Datos para el gráfico de dona (Solicitudes por Departamento)
|
||||||
const departmentData = props.charts.requests_by_department || [];
|
const departmentData = charts.requests_by_department || [];
|
||||||
const donutChartLabels = departmentData.map(item => item.department_name);
|
const donutChartLabels = departmentData.map(item => item.department_name);
|
||||||
const donutChartSeries = departmentData.map(item => item.total_requests);
|
const donutChartSeries = departmentData.map(item => item.total_requests);
|
||||||
|
|
||||||
@ -142,6 +139,18 @@ const donutChartOptions = computed(() => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const donutChartSeries = computed(() => chartData.value.donutChartSeries);
|
const donutChartSeries = computed(() => chartData.value.donutChartSeries);
|
||||||
|
|
||||||
|
/** Ciclos */
|
||||||
|
onMounted(() => {
|
||||||
|
api.get(apiTo('admin'), {
|
||||||
|
onSuccess: (r) => {
|
||||||
|
vacations.value = r.vacations;
|
||||||
|
vacationsRequests.value = r.vacation_requests;
|
||||||
|
adminInfo.value = r.admin_info;
|
||||||
|
charts.value = r.admin_info?.charts || {};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@ -1,31 +1,29 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { api } from '@Services/Api';
|
||||||
|
import { apiTo } from './Module';
|
||||||
|
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
// Props
|
// Propiedades
|
||||||
const props = defineProps({
|
const vacations = ref({});
|
||||||
vacations: {
|
const vacationsRequests = ref([]);
|
||||||
type: Object,
|
const coordinatorInfo = ref({});
|
||||||
default: () => ({})
|
const lastVacationRequests = ref([]);
|
||||||
},
|
const employeeStatusDepartment = ref([]);
|
||||||
vacationsRequests: {
|
|
||||||
type: Array,
|
/** Ciclos */
|
||||||
default: () => []
|
onMounted(() => {
|
||||||
},
|
api.get(apiTo('coordinator'), {
|
||||||
coordinatorInfo: {
|
onSuccess: (r) => {
|
||||||
type: Object,
|
vacations.value = r.vacations;
|
||||||
default: () => ({})
|
vacationsRequests.value = r.vacation_requests;
|
||||||
},
|
coordinatorInfo.value = r.coordinator_info;
|
||||||
lastVacationRequests: {
|
lastVacationRequests.value = r.coordinator_info?.last_vacation_requests;
|
||||||
type: Array,
|
employeeStatusDepartment.value = r.coordinator_info?.employee_status_department;
|
||||||
default: () => []
|
|
||||||
},
|
|
||||||
employeeStatusDepartment: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@ -1,21 +1,25 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { api } from '@Services/Api';
|
||||||
|
import { apiTo } from './Module';
|
||||||
|
|
||||||
import PrimaryButton from '@Holos/Button/Primary.vue';
|
import PrimaryButton from '@Holos/Button/Primary.vue';
|
||||||
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
import GoogleIcon from '@Shared/GoogleIcon.vue';
|
||||||
|
|
||||||
// Props
|
// Propiedades
|
||||||
const props = defineProps({
|
const vacations = ref({});
|
||||||
vacations: {
|
const vacationsRequests = ref([]);
|
||||||
type: Object,
|
|
||||||
default: () => ({})
|
/** Ciclos */
|
||||||
},
|
onMounted(() => {
|
||||||
vacationsRequests: {
|
api.get(apiTo('employee'), {
|
||||||
type: Array,
|
onSuccess: (r) => {
|
||||||
default: () => []
|
vacations.value = r.vacations;
|
||||||
|
vacationsRequests.value = r.vacation_requests;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user