forked from mirrors/homebox
feat: new dashboard implementation (#168)
* wip: charts.js experimental work * update lock file * wip: frontend redesign * wip: more UI fixes for consistency across themes * cleanup * improve UI log * style updates * fix lint errors
This commit is contained in:
parent
a3954dab0f
commit
6a8a25e3f8
42 changed files with 1690 additions and 296 deletions
39
frontend/pages/home/statistics.ts
Normal file
39
frontend/pages/home/statistics.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { UserClient } from "~~/lib/api/user";
|
||||
|
||||
type StatCard = {
|
||||
label: string;
|
||||
value: number;
|
||||
type: "currency" | "number";
|
||||
};
|
||||
|
||||
export function statCardData(api: UserClient) {
|
||||
const { data: statistics } = useAsyncData(async () => {
|
||||
const { data } = await api.stats.group();
|
||||
return data;
|
||||
});
|
||||
|
||||
return computed(() => {
|
||||
return [
|
||||
{
|
||||
label: "Total Value",
|
||||
value: statistics.value?.totalItemPrice || 0,
|
||||
type: "currency",
|
||||
},
|
||||
{
|
||||
label: "Total Items",
|
||||
value: statistics.value?.totalItems || 0,
|
||||
type: "number",
|
||||
},
|
||||
{
|
||||
label: "Total Locations",
|
||||
value: statistics.value?.totalLocations || 0,
|
||||
type: "number",
|
||||
},
|
||||
{
|
||||
label: "Total Labels",
|
||||
value: statistics.value?.totalLabels || 0,
|
||||
type: "number",
|
||||
},
|
||||
] as StatCard[];
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue