Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/@iconify/icons-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/pages/CRUDExpertise.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const recentDevicesHeaders = [
async function fetchData() {
const response = await api.get('/expertise');

console.log("fetchData -> ", response.data);
// console.log("fetchData -> ", response.data);

return response.data;
}
Expand Down
162 changes: 77 additions & 85 deletions src/views/dashboard/AnalyticsFinanceTab.vue
Original file line number Diff line number Diff line change
@@ -1,102 +1,93 @@
<script setup>
import VueApexCharts from 'vue3-apexcharts'
import { useTheme } from 'vuetify'
import axios from 'axios'
import statsVerticalChart from '@images/cards/chart-success.png'
import statsVerticalPaypal from '@images/cards/paypal-error.png'
import statsVerticalWallet from '@images/cards/wallet-primary.png'
import { hexToRgb } from '@layouts/utils'
import { ref } from 'vue';

const vuetifyTheme = useTheme()

const series = {
const data = ref({
income: {
avatar: statsVerticalWallet,
title: 'Total Parceiros',
stats: 0,
profitLoss: 0,
profitLossAmount: 0,
compareToLastWeek: 0,
},
expenses: {
avatar: statsVerticalPaypal,
title: 'Expertises Iniciadas',
stats: 0,
profitLoss: 0,
profitLossAmount: 0,
compareToLastWeek: 0,
},
profit: {
avatar: statsVerticalChart,
title: 'Total De Abandonos',
stats: 0,
profitLoss: 0,
profitLossAmount: 0,
compareToLastWeek: 0,
},
})

const currentTab = ref('income')

// const tabData = ref(data.value[currentTab.value])

const series = ref({
income: [{
data: [
24,
21,
30,
22,
42,
26,
35,
29,
50,
100,
31,
50,
100,

],
data: [],
}],
expenses: [{
data: [
24,
21,
30,
25,
42,
26,
35,
29,
50,
100,
31,
50,
100,

],
data: [],
}],
profit: [{
data: [
24,
21,
30,
22,
42,
26,
35,
35,
45,
100,
31,
50,
100,

],
data: [],
}],
})

async function refreshData(tabName){
const dataFromDatabase = (await axios.get("http://localhost:8080/dash/finance-"+tabName)).data;

let stats = 0
let profitLossAmount = 0

console.log("Teste axios")

for(let i = 0; i < dataFromDatabase.length; i++){
let actualYear = dataFromDatabase[i][1];
let previousYear = dataFromDatabase[i][2];
stats += actualYear;
profitLossAmount += previousYear;
// data.value[tabName]["series"].push(actualYear)
series.value[tabName][0]["data"].push(actualYear)
}
data.value[tabName]["stats"] = stats;
data.value[tabName]["profitLoss"] = Math.round(((stats - profitLossAmount) / profitLossAmount) * 100)
data.value[tabName]["profitLossAmount"] = profitLossAmount;

console.log(series.value)

console.log("Fim do teste do axios")
}

const currentTab = ref('income')
refreshData('income')
refreshData('expenses')
refreshData('profit')


const tabData = computed(() => {
const data = {
income: {
avatar: statsVerticalWallet,
title: 'Total Parceiros',
stats: '308',
profitLoss: 65,
profitLossAmount: '18',
compareToLastWeek: '290',
},
expenses: {
avatar: statsVerticalPaypal,
title: 'Expertises Iniciadas',
stats: '367',
profitLoss: 27.8,
profitLossAmount: '5',
compareToLastWeek: '230',
},
profit: {
avatar: statsVerticalChart,
title: 'Total De Abandonos',
stats: '147',
profitLoss: -35.1,
profitLossAmount: '4',
compareToLastWeek: '176',
},
}

return data[currentTab.value]
return data.value[currentTab.value]
})


const chartConfig = computed(() => {
const currentTheme = vuetifyTheme.current.value.colors
const variableTheme = vuetifyTheme.current.value.variables
Expand Down Expand Up @@ -160,7 +151,7 @@ const chartConfig = computed(() => {
axisTicks: { show: false },
axisBorder: { show: false },
categories: [
'',
// '',
'Jan',
'Feb',
'Mar',
Expand Down Expand Up @@ -209,12 +200,13 @@ const chartConfig = computed(() => {
seriesIndex: 0,
fillColor: '#fff',
strokeColor: currentTheme.primary,
dataPointIndex: series[currentTab.value][0].data.length - 1,
dataPointIndex: series.value[currentTab.value][0].data.length - 1,
}],
},
}
})


</script>

<template>
Expand Down Expand Up @@ -275,19 +267,19 @@ const chartConfig = computed(() => {
</VCardText>

<VCardText class="d-flex align-center justify-center gap-3">
<VProgressCircular
<!-- <VProgressCircular
size="45"
:model-value="tabData.profitLoss"
>
<span class="text-xs text-medium-emphasis">{{ tabData.profitLossAmount }}</span>
</VProgressCircular>
</VProgressCircular> -->

<div>
<h6 class="text-base font-weight-regular">
<!-- <h6 class="text-base font-weight-regular">
<span class="text-capitalize">Somente</span>
<span> essa semana</span>
</h6>
<span class="text-sm text-disabled">{{ tabData.compareToLastWeek }} Ano Passado</span>
</h6> -->
<span class="text-sm text-disabled"> Total ano passado: {{ tabData.profitLossAmount }}</span>
</div>
</VCardText>
</VCard>
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/AnalyticsTransactionsTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ onMounted(async () => {
const response = await api.get("/dash")
const data = response.data

console.log(data)
// console.log(data)

growth.value = data.qtygrowth;

Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/BestStates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ onMounted(async () => {
const response = await api.get("/dash/state-per-company")
const data = response.data

console.log(data)
// console.log(data)

const topThree = data.sort((a, b) => b.companyCount - a.companyCount).slice(0, 3)
const others = data.slice(3)
Expand Down