mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-06 01:20:31 +00:00
improve UI log
This commit is contained in:
parent
b9a2abd281
commit
f790ad065b
3 changed files with 11 additions and 4 deletions
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
const value = computed(() => {
|
const value = computed(() => {
|
||||||
if (!props.amount || props.amount === "0") {
|
if (!props.amount || props.amount === "0") {
|
||||||
return "";
|
return fmt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt(props.amount);
|
return fmt(props.amount);
|
||||||
|
|
|
@ -23,5 +23,6 @@
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
type: "number",
|
type: "number",
|
||||||
|
subtitle: undefined,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
{
|
{
|
||||||
id: "total",
|
id: "total",
|
||||||
title: "Total Cost",
|
title: "Total Cost",
|
||||||
value: log.value.costTotal,
|
value: log.value.costTotal || 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "average",
|
id: "average",
|
||||||
title: "Monthly Average",
|
title: "Monthly Average",
|
||||||
value: log.value.costAverage,
|
value: log.value.costAverage || 0,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
@ -61,14 +61,20 @@
|
||||||
refreshLog();
|
refreshLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const confirm = useConfirm();
|
||||||
|
|
||||||
async function deleteEntry(id: string) {
|
async function deleteEntry(id: string) {
|
||||||
|
const result = await confirm.open("Are you sure you want to delete this entry?");
|
||||||
|
if (result.isCanceled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { error } = await api.items.maintenance.delete(props.item.id, id);
|
const { error } = await api.items.maintenance.delete(props.item.id, id);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
toast.error("Failed to delete entry");
|
toast.error("Failed to delete entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshLog();
|
refreshLog();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue