Spaces:
Sleeping
Sleeping
Download web/src/views/ExploreView.vue from Benaah/MicProtocol: direct link, hf CLI and curl.
- Browser
- Download file 7.65 kB
-
https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/web/src/views/ExploreView.vue
- Command line
-
hf download hf://spaces/Benaah/MicProtocol/web/src/views/ExploreView.vue
-
curl -L -o ExploreView.vue https://huggingface.co/spaces/Benaah/MicProtocol/resolve/main/web/src/views/ExploreView.vue
7.65 kB
| <template> | |
| <div class="explore-view"> | |
| <div class="explore-header"> | |
| <h1>Explore Reports</h1> | |
| <p>Browse and filter audit reports by fiscal year, auditee, county, and type.</p> | |
| </div> | |
| <!-- Filter Panel --> | |
| <div class="filter-panel"> | |
| <div class="filter-row"> | |
| <n-select | |
| v-model:value="filters.fy" | |
| :options="fyOptions" | |
| placeholder="Fiscal Year" | |
| clearable | |
| class="filter-select" | |
| @update:value="applyFilters" | |
| /> | |
| <n-select | |
| v-model:value="filters.report_type" | |
| :options="typeOptions" | |
| placeholder="Report Type" | |
| clearable | |
| class="filter-select" | |
| @update:value="applyFilters" | |
| /> | |
| <n-select | |
| v-model:value="filters.county" | |
| :options="countyOptions" | |
| placeholder="County" | |
| clearable | |
| class="filter-select" | |
| @update:value="applyFilters" | |
| /> | |
| <n-input | |
| v-model:value="filters.auditee" | |
| placeholder="Search auditee..." | |
| clearable | |
| class="filter-search" | |
| @keyup.enter="applyFilters" | |
| > | |
| <template #prefix> | |
| <n-icon><search-outline /></n-icon> | |
| </template> | |
| </n-input> | |
| </div> | |
| <n-button quaternary size="small" @click="clearFilters"> | |
| <template #icon><n-icon><close-outline /></n-icon></template> | |
| Clear Filters | |
| </n-button> | |
| </div> | |
| <!-- Stats Cards --> | |
| <div class="stats-grid"> | |
| <n-card class="stat-card" :bordered="false"> | |
| <div class="stat-value">{{ stats.totalReports }}</div> | |
| <div class="stat-label">Total Reports</div> | |
| </n-card> | |
| <n-card class="stat-card" :bordered="false"> | |
| <div class="stat-value">{{ stats.totalCounties }}</div> | |
| <div class="stat-label">Counties Covered</div> | |
| </n-card> | |
| <n-card class="stat-card" :bordered="false"> | |
| <div class="stat-value">{{ stats.totalMinistries }}</div> | |
| <div class="stat-label">Ministries & Agencies</div> | |
| </n-card> | |
| <n-card class="stat-card" :bordered="false"> | |
| <div class="stat-value">{{ stats.totalSpecialAudits }}</div> | |
| <div class="stat-label">Special Audits</div> | |
| </n-card> | |
| </div> | |
| <!-- Reports Table --> | |
| <n-data-table | |
| :columns="columns" | |
| :data="searchStore.reports" | |
| :loading="searchStore.isLoading" | |
| :pagination="pagination" | |
| class="reports-table" | |
| @update:page="handlePageChange" | |
| /> | |
| </div> | |
| </template> | |
| <script setup lang="ts"> | |
| import { ref, computed, onMounted } from 'vue' | |
| import { useRouter } from 'vue-router' | |
| import { useSearchStore } from '@/stores/search' | |
| import { SearchOutline, CloseOutline } from '@vicons/ionicons5' | |
| import type { DataTableColumns } from 'naive-ui' | |
| import type { Report } from '@/types' | |
| const router = useRouter() | |
| const searchStore = useSearchStore() | |
| const filters = ref({ | |
| fy: null as string | null, | |
| report_type: null as string | null, | |
| county: null as string | null, | |
| auditee: '', | |
| }) | |
| const fyOptions = computed(() => | |
| searchStore.availableFiscalYears.map(y => ({ label: `FY ${y}`, value: y })) | |
| ) | |
| const typeOptions = [ | |
| { label: 'Financial Audit', value: 'financial_audit' }, | |
| { label: 'County Audit', value: 'county_audit' }, | |
| { label: 'Special Audit', value: 'special_audit' }, | |
| { label: 'Performance Audit', value: 'performance_audit' }, | |
| { label: 'Summary Report', value: 'summary_report' }, | |
| { label: 'Public Debt', value: 'public_debt_audit' }, | |
| ] | |
| const countyOptions = computed(() => | |
| searchStore.availableCounties.map(c => ({ label: c, value: c })) | |
| ) | |
| const stats = computed(() => ({ | |
| totalReports: searchStore.reports.length, | |
| totalCounties: searchStore.availableCounties.length, | |
| totalMinistries: new Set(searchStore.reports.filter(r => r.auditee_type === 'ministry').map(r => r.auditee)).size, | |
| totalSpecialAudits: searchStore.reports.filter(r => r.report_type === 'special_audit').length, | |
| })) | |
| const columns: DataTableColumns<Report> = [ | |
| { | |
| title: 'Title', | |
| key: 'title', | |
| ellipsis: { tooltip: true }, | |
| width: 400, | |
| }, | |
| { | |
| title: 'Type', | |
| key: 'report_type', | |
| width: 140, | |
| render(row) { | |
| const typeMap: Record<string, string> = { | |
| financial_audit: 'Financial', | |
| county_audit: 'County', | |
| special_audit: 'Special', | |
| performance_audit: 'Performance', | |
| summary_report: 'Summary', | |
| } | |
| return typeMap[row.report_type] || row.report_type | |
| }, | |
| }, | |
| { | |
| title: 'Auditee', | |
| key: 'auditee', | |
| ellipsis: { tooltip: true }, | |
| width: 250, | |
| }, | |
| { | |
| title: 'FY', | |
| key: 'fiscal_year', | |
| width: 100, | |
| }, | |
| { | |
| title: 'County', | |
| key: 'county_name', | |
| width: 140, | |
| }, | |
| { | |
| title: 'Opinion', | |
| key: 'audit_opinion', | |
| width: 120, | |
| render(row) { | |
| const colors: Record<string, any> = { | |
| unqualified: 'success', | |
| qualified: 'warning', | |
| adverse: 'error', | |
| disclaimer: 'error', | |
| } | |
| return h('n-tag', { type: colors[row.audit_opinion || ''] || 'default', size: 'small' }, { | |
| default: () => row.audit_opinion || 'N/A', | |
| }) | |
| }, | |
| }, | |
| { | |
| title: 'Date', | |
| key: 'crawled_at', | |
| width: 120, | |
| render(row) { | |
| return new Date(row.crawled_at).toLocaleDateString() | |
| }, | |
| }, | |
| { | |
| title: 'Action', | |
| key: 'actions', | |
| width: 100, | |
| render(row) { | |
| return h('n-button', { | |
| size: 'small', | |
| type: 'primary', | |
| onClick: () => router.push(`/report/${row.report_id}`), | |
| }, { default: () => 'View' }) | |
| }, | |
| }, | |
| ] | |
| const pagination = ref({ | |
| page: 1, | |
| pageSize: 20, | |
| showSizePicker: true, | |
| pageSizes: [10, 20, 50], | |
| }) | |
| const applyFilters = () => { | |
| const activeFilters: any = {} | |
| if (filters.value.fy) activeFilters.fy = [filters.value.fy] | |
| if (filters.value.report_type) activeFilters.report_type = [filters.value.report_type] | |
| if (filters.value.county) activeFilters.county = [filters.value.county] | |
| if (filters.value.auditee) activeFilters.auditee = filters.value.auditee | |
| searchStore.setFilters(activeFilters) | |
| } | |
| const clearFilters = () => { | |
| filters.value = { fy: null, report_type: null, county: null, auditee: '' } | |
| searchStore.clearFilters() | |
| } | |
| const handlePageChange = (page: number) => { | |
| pagination.value.page = page | |
| } | |
| onMounted(() => { | |
| searchStore.fetchReports(true) | |
| }) | |
| </script> | |
| <style scoped lang="scss"> | |
| .explore-view { | |
| padding-bottom: 48px; | |
| } | |
| .explore-header { | |
| margin-bottom: 32px; | |
| h1 { | |
| font-size: 28px; | |
| font-weight: 700; | |
| margin-bottom: 8px; | |
| } | |
| p { | |
| color: var(--text-secondary); | |
| font-size: 15px; | |
| } | |
| } | |
| .filter-panel { | |
| display: flex; | |
| align-items: center; | |
| gap: 16px; | |
| margin-bottom: 24px; | |
| flex-wrap: wrap; | |
| } | |
| .filter-row { | |
| display: flex; | |
| gap: 12px; | |
| flex: 1; | |
| flex-wrap: wrap; | |
| } | |
| .filter-select { | |
| min-width: 160px; | |
| } | |
| .filter-search { | |
| min-width: 200px; | |
| flex: 1; | |
| } | |
| .stats-grid { | |
| display: grid; | |
| grid-template-columns: repeat(4, 1fr); | |
| gap: 16px; | |
| margin-bottom: 32px; | |
| } | |
| .stat-card { | |
| text-align: center; | |
| :deep(.n-card__content) { | |
| padding: 20px; | |
| } | |
| } | |
| .stat-value { | |
| font-size: 32px; | |
| font-weight: 700; | |
| color: var(--primary); | |
| line-height: 1; | |
| margin-bottom: 8px; | |
| } | |
| .stat-label { | |
| font-size: 13px; | |
| color: var(--text-secondary); | |
| } | |
| .reports-table { | |
| :deep(.n-data-table-th) { | |
| font-weight: 600; | |
| } | |
| } | |
| @media (max-width: 768px) { | |
| .stats-grid { | |
| grid-template-columns: repeat(2, 1fr); | |
| } | |
| .filter-row { | |
| flex-direction: column; | |
| } | |
| .filter-select, | |
| .filter-search { | |
| width: 100%; | |
| } | |
| } | |
| </style> | |