improve UI log

This commit is contained in:
Hayden 2022-12-22 18:53:04 -09:00
parent b9a2abd281
commit f790ad065b
No known key found for this signature in database
GPG key ID: 17CF79474E257545
3 changed files with 11 additions and 4 deletions

View file

@ -13,7 +13,7 @@
const value = computed(() => {
if (!props.amount || props.amount === "0") {
return "";
return fmt(0);
}
return fmt(props.amount);

View file

@ -23,5 +23,6 @@
withDefaults(defineProps<Props>(), {
type: "number",
subtitle: undefined,
});
</script>

View file

@ -21,12 +21,12 @@
{
id: "total",
title: "Total Cost",
value: log.value.costTotal,
value: log.value.costTotal || 0,
},
{
id: "average",
title: "Monthly Average",
value: log.value.costAverage,
value: log.value.costAverage || 0,
},
];
});
@ -61,14 +61,20 @@
refreshLog();
}
const confirm = useConfirm();
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);
if (error) {
toast.error("Failed to delete entry");
return;
}
refreshLog();
}
</script>