|
|
@@ -59,21 +59,16 @@
|
|
|
|
|
|
<div class="row q-col-gutter-md q-mb-md">
|
|
|
<div class="col-12 col-md-5">
|
|
|
- <q-card flat bordered style="height: 280px">
|
|
|
- <q-card-section class="row justify-between items-center q-pb-xs">
|
|
|
- <span class="text-subtitle2 text-weight-medium"
|
|
|
- >Faturamento Serviço / Materiais</span
|
|
|
- >
|
|
|
- <q-icon name="mdi-book-open-outline" color="grey-5" />
|
|
|
- </q-card-section>
|
|
|
- <q-separator />
|
|
|
- <q-card-section
|
|
|
- style="height: calc(100% - 57px)"
|
|
|
- class="q-pt-sm q-px-sm"
|
|
|
- >
|
|
|
- <Bar :data="faturamentoData" :options="faturamentoOptions" />
|
|
|
- </q-card-section>
|
|
|
- </q-card>
|
|
|
+ <DashboardChartCard title="Faturamento Serviço / Materiais">
|
|
|
+ <GroupedBarChart
|
|
|
+ :labels="faturamentoChart.labels"
|
|
|
+ :datasets="faturamentoChart.datasets"
|
|
|
+ label-y="R$"
|
|
|
+ :tick-formatter="formatCurrencyTick"
|
|
|
+ :tooltip-formatter="formatCurrencyTooltip"
|
|
|
+ class="full-width full-height"
|
|
|
+ />
|
|
|
+ </DashboardChartCard>
|
|
|
</div>
|
|
|
|
|
|
<div class="col-12 col-md-4">
|
|
|
@@ -285,6 +280,8 @@ import {
|
|
|
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
|
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";
|
|
|
|
|
|
ChartJS.register(
|
|
|
Title,
|
|
|
@@ -296,52 +293,35 @@ ChartJS.register(
|
|
|
ArcElement,
|
|
|
);
|
|
|
|
|
|
-const faturamentoData = ref({
|
|
|
+const faturamentoChart = {
|
|
|
labels: [
|
|
|
- "17/02",
|
|
|
- "18/02",
|
|
|
- "19/02",
|
|
|
- "20/02",
|
|
|
- "21/02",
|
|
|
- "22/02",
|
|
|
- "23/02",
|
|
|
- "24/02",
|
|
|
- "25/02",
|
|
|
- "26/02",
|
|
|
- "27/02",
|
|
|
- "28/02",
|
|
|
+ "17/02", "18/02", "19/02", "20/02", "21/02",
|
|
|
+ "22/02", "23/02", "24/02", "25/02", "26/02",
|
|
|
+ "27/02", "28/02",
|
|
|
],
|
|
|
datasets: [
|
|
|
{
|
|
|
- label: "Serviços",
|
|
|
+ label: "Serviço",
|
|
|
data: [120, 185, 95, 210, 155, 200, 170, 130, 195, 160, 145, 180],
|
|
|
- backgroundColor: "rgba(99, 102, 241, 0.75)",
|
|
|
- borderColor: "rgba(99, 102, 241, 1)",
|
|
|
- borderWidth: 1,
|
|
|
+ color: "#a274f1",
|
|
|
},
|
|
|
{
|
|
|
label: "Materiais",
|
|
|
data: [75, 115, 60, 140, 95, 125, 105, 85, 135, 100, 90, 115],
|
|
|
- backgroundColor: "rgba(236, 72, 153, 0.75)",
|
|
|
- borderColor: "rgba(236, 72, 153, 1)",
|
|
|
- borderWidth: 1,
|
|
|
+ color: "#ff9999",
|
|
|
},
|
|
|
],
|
|
|
-});
|
|
|
+};
|
|
|
|
|
|
-const faturamentoOptions = ref({
|
|
|
- responsive: true,
|
|
|
- maintainAspectRatio: false,
|
|
|
- plugins: {
|
|
|
- legend: { display: true, position: "top", labels: { font: { size: 11 } } },
|
|
|
- tooltip: { mode: "index", intersect: false },
|
|
|
- datalabels: { display: false },
|
|
|
- },
|
|
|
- scales: {
|
|
|
- x: { ticks: { font: { size: 9 } }, grid: { display: false } },
|
|
|
- y: { ticks: { font: { size: 10 } }, suggestedMin: 0 },
|
|
|
- },
|
|
|
-});
|
|
|
+const formatCurrencyTick = (value) => {
|
|
|
+ if (value >= 1000) return `R$ ${(value / 1000).toFixed(0)}k`;
|
|
|
+ return `R$ ${value}`;
|
|
|
+};
|
|
|
+
|
|
|
+const formatCurrencyTooltip = (context) => {
|
|
|
+ const value = context.parsed.y;
|
|
|
+ return ` ${context.dataset.label}: R$ ${value.toLocaleString("pt-BR", { minimumFractionDigits: 2 })}`;
|
|
|
+};
|
|
|
|
|
|
const gaugeData = ref({
|
|
|
datasets: [
|