MelissaMenu: busca tambem casa pelo nome da categoria
Se o termo bate com o label da categoria (ex: "financeiro"), inclui todos os sub-itens dessa categoria nos resultados. Antes so casava por label do sub-item. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -196,11 +196,15 @@ const searchResults = computed(() => {
|
|||||||
if (!q) return [];
|
if (!q) return [];
|
||||||
const out = [];
|
const out = [];
|
||||||
for (const cat of CATEGORIAS) {
|
for (const cat of CATEGORIAS) {
|
||||||
|
const catLabel = (cat.label || '').toLowerCase();
|
||||||
|
const catMatches = catLabel.includes(q);
|
||||||
for (const group of cat.groups) {
|
for (const group of cat.groups) {
|
||||||
for (const item of group.items) {
|
for (const item of group.items) {
|
||||||
if (item.tipo === 'link-cadastro') continue;
|
if (item.tipo === 'link-cadastro') continue;
|
||||||
const label = (item.label || '').toLowerCase();
|
const label = (item.label || '').toLowerCase();
|
||||||
if (label.includes(q)) {
|
// Casa por label do sub-item OU pelo label da categoria
|
||||||
|
// (ex: "financeiro" lista todos os itens da categoria Financeiro)
|
||||||
|
if (label.includes(q) || catMatches) {
|
||||||
out.push({ catLabel: cat.label, item });
|
out.push({ catLabel: cat.label, item });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user