2025-10-20 08:57:51 +02:00
|
|
|
<script setup lang="ts">
|
2026-02-17 10:35:03 +01:00
|
|
|
import Heading from '@/components/Heading.vue';
|
2026-02-24 16:15:21 +01:00
|
|
|
import { onMounted, ref } from "vue"
|
2025-10-20 08:57:51 +02:00
|
|
|
import AppLayout from '@/layouts/AppLayout.vue';
|
2026-02-24 16:15:21 +01:00
|
|
|
import { Trophy, UserCheck2, X, ChevronRight } from 'lucide-vue-next';
|
2025-10-20 08:57:51 +02:00
|
|
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
|
2025-11-25 13:46:45 +01:00
|
|
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'
|
|
|
|
|
import Button from '@/components/ui/crm-button/Button.vue';
|
|
|
|
|
import { invoices } from '@/routes';
|
2026-02-24 16:15:21 +01:00
|
|
|
import { toRoundedCurrency } from '@/lib/utils'
|
2025-11-25 13:46:45 +01:00
|
|
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'
|
2026-02-17 10:35:03 +01:00
|
|
|
import { Label } from '@/components/ui/label'
|
|
|
|
|
import { Switch } from '@/components/ui/switch'
|
2025-11-25 13:46:45 +01:00
|
|
|
import { Link, usePage } from '@inertiajs/vue3';
|
|
|
|
|
import axios, { AxiosError } from "axios";
|
|
|
|
|
import { toast } from "vue-sonner";
|
2026-02-24 16:15:21 +01:00
|
|
|
import { AppPageProps, Todo } from "@/types";
|
2026-02-17 10:35:03 +01:00
|
|
|
import Todos from '@/components/Todos.vue';
|
2025-10-20 08:57:51 +02:00
|
|
|
|
2025-11-25 13:46:45 +01:00
|
|
|
const salesStatistics = ref({
|
|
|
|
|
year: new Date().getFullYear(),
|
|
|
|
|
totalRevenue: 0,
|
|
|
|
|
paid: 0,
|
|
|
|
|
draft: 0,
|
|
|
|
|
issued: 0,
|
|
|
|
|
due: 0,
|
|
|
|
|
reminded: 0,
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-17 10:35:03 +01:00
|
|
|
const salesTarget = ref(60000) // TODO: aus settings
|
|
|
|
|
const todos = ref<Todo[]>([])
|
|
|
|
|
const showCompleted = ref(false)
|
2025-11-25 13:46:45 +01:00
|
|
|
const page = usePage();
|
|
|
|
|
const token = page.props.flash?.token
|
2025-10-20 08:57:51 +02:00
|
|
|
if (token) {
|
2025-11-25 13:46:45 +01:00
|
|
|
localStorage.setItem('sanctum_token', token)
|
2025-10-20 08:57:51 +02:00
|
|
|
}
|
|
|
|
|
|
2026-02-17 10:35:03 +01:00
|
|
|
|
2025-11-25 13:46:45 +01:00
|
|
|
onMounted(async () => {
|
2026-02-17 10:35:03 +01:00
|
|
|
// Load Todos
|
2025-12-02 17:32:52 +01:00
|
|
|
try {
|
|
|
|
|
let response = await axios.get('/api/todos')
|
|
|
|
|
todos.value = response.data
|
|
|
|
|
} catch (error) {
|
|
|
|
|
toast.error('Fehler beim Laden der Daten', { description: (error as AxiosError).message })
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-17 10:35:03 +01:00
|
|
|
// Load sales statistics
|
2025-11-25 13:46:45 +01:00
|
|
|
try {
|
|
|
|
|
let response = await axios.get('/api/invoices/salesStatistics')
|
|
|
|
|
salesStatistics.value = response.data
|
|
|
|
|
} catch (error) {
|
|
|
|
|
toast.error('Fehler beim Laden der Daten', { description: (error as AxiosError).message })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2025-10-20 08:57:51 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
2025-11-14 17:45:57 +01:00
|
|
|
<AppLayout title="Dashboard">
|
2026-02-17 10:35:03 +01:00
|
|
|
<Heading title="Tooloop Multimedia" description="Kundenpflege und Rechnungswesen" />
|
|
|
|
|
|
2025-11-25 13:46:45 +01:00
|
|
|
<div class="columns-1 lg:columns-2 xl:columns-3 gap-8">
|
|
|
|
|
|
|
|
|
|
|
2026-02-17 10:35:03 +01:00
|
|
|
|
2025-12-02 17:32:52 +01:00
|
|
|
<!-- Nachrichten -->
|
2026-02-17 10:35:03 +01:00
|
|
|
<Card class="break-inside-avoid mb-12">
|
2025-11-25 13:46:45 +01:00
|
|
|
<CardHeader>
|
2026-02-17 10:35:03 +01:00
|
|
|
<CardTitle>Benachrichtigungen</CardTitle>
|
2025-11-25 13:46:45 +01:00
|
|
|
<CardDescription>Card Description</CardDescription>
|
|
|
|
|
</CardHeader>
|
2026-02-17 10:35:03 +01:00
|
|
|
<CardContent class="flex flex-col gap-4">
|
|
|
|
|
|
|
|
|
|
<Alert class="bg-muted pr-8">
|
|
|
|
|
<Trophy class="h-4 w-4 stroke-amber-600" />
|
|
|
|
|
<AlertTitle>Du hast zwei neue Erfolge</AlertTitle>
|
|
|
|
|
<AlertDescription class="text-sky-600">
|
|
|
|
|
Weiter so
|
|
|
|
|
</AlertDescription>
|
|
|
|
|
|
|
|
|
|
<Button variant="ghost" class="rounded-full w-6 h-6 absolute top-0.5 right-0.5">
|
2026-02-24 16:15:21 +01:00
|
|
|
<X />
|
2026-02-17 10:35:03 +01:00
|
|
|
</Button>
|
|
|
|
|
</Alert>
|
|
|
|
|
|
|
|
|
|
<Alert class="bg-muted pr-8">
|
|
|
|
|
<UserCheck2 class="h-4 w-4 stroke-lime-600" />
|
|
|
|
|
<AlertTitle>Du hast länger keine Bestandskunden mehr kontaktiert</AlertTitle>
|
|
|
|
|
<AlertDescription class="text-sky-600">
|
|
|
|
|
<a href="">Hier sind ein paar Vorschläge für Dich
|
|
|
|
|
<ChevronRight class="inline h-4 w-4" />
|
|
|
|
|
</a>
|
|
|
|
|
</AlertDescription>
|
|
|
|
|
|
|
|
|
|
<Button variant="ghost" class="rounded-full w-6 h-6 absolute top-0.5 right-0.5">
|
2026-02-24 16:15:21 +01:00
|
|
|
<X />
|
2026-02-17 10:35:03 +01:00
|
|
|
</Button>
|
|
|
|
|
</Alert>
|
|
|
|
|
|
|
|
|
|
</CardContent>
|
|
|
|
|
<CardFooter>
|
|
|
|
|
<Button>Alles leeren</Button>
|
|
|
|
|
</CardFooter>
|
|
|
|
|
</Card>
|
2025-12-02 17:32:52 +01:00
|
|
|
|
2026-02-17 10:35:03 +01:00
|
|
|
|
|
|
|
|
<!-- Aufgaben -->
|
|
|
|
|
<Card class="break-inside-avoid mb-8">
|
|
|
|
|
<CardHeader class="flex justify-between flex-wrap">
|
|
|
|
|
<div>
|
|
|
|
|
<CardTitle class="mb-1.5">Aufgaben</CardTitle>
|
|
|
|
|
<CardDescription class="mb-3">Card Description</CardDescription>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
|
<Switch id="show-completed" v-model="showCompleted" />
|
|
|
|
|
<Label for="show-completed" class="text-muted-foreground">Erledigte</Label>
|
|
|
|
|
</div>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
2026-02-24 16:15:21 +01:00
|
|
|
<Todos :modelValue="todos" :show-completed="showCompleted" :show-todoable="true" />
|
2025-12-02 17:32:52 +01:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<!-- Rechnungen -->
|
|
|
|
|
<Card class="break-inside-avoid mb-12">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<CardTitle>Fällige Rechnungen</CardTitle>
|
|
|
|
|
<CardDescription>Card Description</CardDescription>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent>
|
|
|
|
|
|
2025-11-25 13:46:45 +01:00
|
|
|
</CardContent>
|
2025-12-02 17:32:52 +01:00
|
|
|
<CardFooter>
|
|
|
|
|
<Link :href="invoices()" prefetch><Button>Zu den Rechnungen</Button></Link>
|
|
|
|
|
</CardFooter>
|
2025-11-25 13:46:45 +01:00
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Umsatz -->
|
|
|
|
|
<Card class="break-inside-avoid mb-8 relative overflow-clip">
|
|
|
|
|
<div class="bg-image absolute -inset-6 opacity-30 blur-[2px]"
|
|
|
|
|
style="background-image: url('/storage/images/patterns/19742.jpg'); background-size: 150%;" </div>
|
2025-12-02 17:32:52 +01:00
|
|
|
<CardHeader class="z-1">
|
2025-11-25 13:46:45 +01:00
|
|
|
<CardTitle>Umsatz {{ salesStatistics?.year || '' }}</CardTitle>
|
|
|
|
|
<CardDescription>Card Description</CardDescription>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent class="relative flex flex-col gap-3">
|
|
|
|
|
|
|
|
|
|
<div class="flex items-baseline justify-between">
|
2026-02-17 10:35:03 +01:00
|
|
|
<span class="text-xl font-bold text-primary">{{
|
2025-11-25 13:46:45 +01:00
|
|
|
toRoundedCurrency(salesStatistics?.paid) || '' }}</span>
|
|
|
|
|
<span>{{ toRoundedCurrency(salesTarget) }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="w-full h-8 bg-secondary dark:bg-neutral-900 rounded-md overflow-clip relative flex">
|
|
|
|
|
<TooltipProvider :delay-duration="0" v-if="salesStatistics">
|
|
|
|
|
<!-- Paid -->
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<div :style="'width: ' + (salesStatistics.paid / salesTarget * 100) + '%'"
|
|
|
|
|
class="bg-primary-foreground transition-width duration-500 ease-out"></div>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
|
|
|
|
<strong>Bezahlt</strong>
|
|
|
|
|
<p>{{ toRoundedCurrency(salesStatistics.paid) }}</p>
|
|
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
<!-- Issued -->
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<div :style="'width: ' + (salesStatistics.issued / salesTarget * 100) + '%'"
|
|
|
|
|
class="bg-gray-500 transition-width duration-500 ease-out">
|
|
|
|
|
</div>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
|
|
|
|
<strong>Gestellt</strong>
|
|
|
|
|
<p>{{ toRoundedCurrency(salesStatistics.issued) }}</p>
|
|
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
<!-- Due -->
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<div :style="'width: ' + (salesStatistics.due / salesTarget * 100) + '%'"
|
|
|
|
|
class="bg-gray-400 transition-width duration-500 ease-out">
|
|
|
|
|
</div>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
|
|
|
|
<strong>Fällig</strong>
|
|
|
|
|
<p>{{ toRoundedCurrency(salesStatistics.due) }}</p>
|
|
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
<!-- Reminded -->
|
|
|
|
|
<Tooltip>
|
|
|
|
|
<TooltipTrigger as-child>
|
|
|
|
|
<div :style="'width: ' + (salesStatistics.reminded / salesTarget * 100) + '%'"
|
|
|
|
|
class="bg-gray-300 transition-width duration-500 ease-out">
|
|
|
|
|
</div>
|
|
|
|
|
</TooltipTrigger>
|
|
|
|
|
<TooltipContent>
|
|
|
|
|
<strong>Gemahnt</strong>
|
|
|
|
|
<p>{{ toRoundedCurrency(salesStatistics.reminded) }}</p>
|
|
|
|
|
</TooltipContent>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
<div :style="'width: ' + (salesStatistics.draft / salesTarget * 100) + '%'"
|
|
|
|
|
class="bg-muted-500 transition-width duration-500 ease-out">
|
|
|
|
|
</div>
|
|
|
|
|
</TooltipProvider>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
2025-10-20 08:57:51 +02:00
|
|
|
</div>
|
2025-11-25 13:46:45 +01:00
|
|
|
|
|
|
|
|
|
2025-10-20 08:57:51 +02:00
|
|
|
</AppLayout>
|
|
|
|
|
</template>
|