update report list on submit

This commit is contained in:
2025-11-20 11:08:57 -05:00
parent aaec72af7e
commit 23ebbe7a85

View File

@@ -44,8 +44,12 @@ function createTrainingReport() {
sidePanel.value = sidePanelState.create; sidePanel.value = sidePanelState.create;
} }
onMounted(async () => { async function loadTrainingReports() {
trainingReports.value = await getTrainingReports(); trainingReports.value = await getTrainingReports();
}
onMounted(async () => {
loadTrainingReports();
loaded.value = true; loaded.value = true;
}) })
</script> </script>
@@ -78,7 +82,7 @@ onMounted(async () => {
<TableCell>{{ report.date }}</TableCell> <TableCell>{{ report.date }}</TableCell>
<TableCell class="text-right">{{ report.created_by_name === null ? "Unknown User" : <TableCell class="text-right">{{ report.created_by_name === null ? "Unknown User" :
report.created_by_name report.created_by_name
}}</TableCell> }}</TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
</Table> </Table>
@@ -92,7 +96,7 @@ onMounted(async () => {
<p class="text-muted-foreground">{{ focusedTrainingReport.event_date }}</p> <p class="text-muted-foreground">{{ focusedTrainingReport.event_date }}</p>
<p class="">Created by {{ focusedTrainingReport.created_by_name === null ? "Unknown User" : <p class="">Created by {{ focusedTrainingReport.created_by_name === null ? "Unknown User" :
focusedTrainingReport.created_by_name focusedTrainingReport.created_by_name
}}</p> }}</p>
</div> </div>
<button @click="closeTrainingReport" class="cursor-pointer"> <button @click="closeTrainingReport" class="cursor-pointer">
<X></X> <X></X>
@@ -132,7 +136,7 @@ onMounted(async () => {
</button> </button>
</div> </div>
<div class="overflow-y-auto max-h-[70vh] mt-5 scrollbar-themed"> <div class="overflow-y-auto max-h-[70vh] mt-5 scrollbar-themed">
<TrainingReportForm class="w-full" @submit="(newID) => viewTrainingReport(newID)"></TrainingReportForm> <TrainingReportForm class="w-full" @submit="(newID) => {viewTrainingReport(newID); loadTrainingReports()}"></TrainingReportForm>
</div> </div>
</div> </div>
</div> </div>