Skip to content

Commit 3fc0824

Browse files
authored
feat(admin): enhance report generator with descriptions (#1298)
- Add `w-180` class to main container for consistent width - Display selected report description below report selector - Use `input.description` as placeholder for a more contextual input - Compute selected report object to fetch and display description - Fetch and include report description in available reports data
1 parent cc80955 commit 3fc0824

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/pages/admin/AdminReportGenerator.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="items-center flex justify-center w-full">
3-
<div>
3+
<div class="w-180">
44
<div class="report-generator p-6 bg-white mb-10">
55
<h2 class="text-2xl font-semibold mb-4">
66
{{ $t('adminDashboard.admin_reports') }}
@@ -16,6 +16,9 @@
1616
label="label"
1717
@update:model-value="onReportChange"
1818
/>
19+
<div class="text-sm text-crisiscleanup-dark-300">
20+
{{ selectedReportObject.description }}
21+
</div>
1922
</div>
2023
<div
2124
v-if="reportInputs && reportInputs.length > 0"
@@ -41,12 +44,12 @@
4144
select-classes="bg-white w-full h-10"
4245
item-key="id"
4346
label="name"
44-
:placeholder="$t('actions.select_incident')"
47+
:placeholder="input.description"
4548
/>
4649
<base-input
4750
v-else
4851
v-model="inputValues[input.name]"
49-
:placeholder="input.name"
52+
:placeholder="input.description"
5053
size="large"
5154
/>
5255
</div>
@@ -96,6 +99,12 @@ const { emitter } = useEmitter();
9699
// State variables
97100
const availableReports = ref([]);
98101
const selectedReport = ref(null);
102+
const selectedReportObject = computed(() => {
103+
const selected = availableReports.value.find(
104+
(report) => report.value === selectedReport.value,
105+
);
106+
return selected || {};
107+
});
99108
const reportInputs = ref([]);
100109
const inputValues = ref({});
101110
@@ -136,6 +145,7 @@ onMounted(async () => {
136145
label: report.name,
137146
value: report.name,
138147
inputs: report.inputs || [],
148+
description: report.description,
139149
}));
140150
} catch (error) {
141151
console.error('Error fetching report:', error);

0 commit comments

Comments
 (0)