diff --git a/apps/ops/src/pages/EvaluationsPage.vue b/apps/ops/src/pages/EvaluationsPage.vue index 2b3d88d..5ec098c 100644 --- a/apps/ops/src/pages/EvaluationsPage.vue +++ b/apps/ops/src/pages/EvaluationsPage.vue @@ -10,6 +10,10 @@ Rafraîchir + + +

@@ -69,6 +73,7 @@ import { useQuasar } from 'quasar' import { HUB_URL } from 'src/config/hub' import { formatDateTime } from 'src/composables/useFormatters' import { useConversations } from 'src/composables/useConversations' +import DynamicFilter from 'src/components/shared/DynamicFilter.vue' const router = useRouter() const $q = useQuasar() @@ -83,9 +88,14 @@ const sortOptions = [ { label: 'Étoiles ↓ (hautes d\'abord)', value: 'stars_desc' }, ] const dateOf = (r) => String(r.stars_ts || r.comment_ts || r.created || '') -// Tout afficher (plus de distinction « à traiter ») + tri par date ou par nombre d'étoiles. +// Filtre dynamique (client) : recherche client/commentaire + chips note (5★ / 3–4★ / ≤2★). +const filterState = ref({ search: '', chips: {} }) +const chipGroups = [{ key: 'note', label: 'Note', icon: 'star', color: 'amber-7', options: [{ value: '5', label: '5★' }, { value: '34', label: '3–4★' }, { value: '12', label: '≤2★' }] }] +function matchNote (r) { const n = filterState.value.chips.note; if (!n) return true; const s = r.stars; if (n === '5') return s >= 5; if (n === '34') return s === 3 || s === 4; if (n === '12') return s != null && s <= 2; return true } +// Tout afficher + FILTRE (recherche/note) puis tri (date ou étoiles). const sorted = computed(() => { - const arr = [...ratings.value] + const q = (filterState.value.search || '').toLowerCase().trim() + const arr = ratings.value.filter(r => matchNote(r) && (!q || String(r.name || r.customerName || r.customer || r.email || '').toLowerCase().includes(q) || String(r.comment || '').toLowerCase().includes(q))) if (sortKey.value === 'stars_asc') arr.sort((a, b) => (a.stars ?? 99) - (b.stars ?? 99) || dateOf(b).localeCompare(dateOf(a))) else if (sortKey.value === 'stars_desc') arr.sort((a, b) => (b.stars ?? -1) - (a.stars ?? -1) || dateOf(b).localeCompare(dateOf(a))) else arr.sort((a, b) => dateOf(b).localeCompare(dateOf(a)))