feat: Enhance admin user management with search, filtering, and sorting capabilities
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-11 09:22:19 +02:00
parent 84ccabe2fe
commit 8e6e0e96b8
3 changed files with 278 additions and 22 deletions
@@ -104,7 +104,7 @@ class _AdminDatabasePanelState extends ConsumerState<AdminDatabasePanel> {
),
),
const SizedBox(height: 12),
child,
Expanded(child: child),
],
);
}
@@ -124,6 +124,18 @@ class _AdminDatabasePanelState extends ConsumerState<AdminDatabasePanel> {
};
}
String tabSummary(_DatabaseTab tab) {
return switch (tab) {
_DatabaseTab.inventory => 'Användarnas inventory med filtrering, redigering, merge och flytt till baslager.',
_DatabaseTab.pantry => 'Användarnas baslager med flytt till inventarie och borttagning av poster.',
_DatabaseTab.products => 'Global produktkatalog med kategorisering, merge, återställning och AI-stöd.',
_DatabaseTab.privateProducts => 'Privata produkter som kan promoveras till global produktkatalog.',
_DatabaseTab.pending => 'Nya produkter som väntar på godkännande eller avslag.',
_DatabaseTab.aliases => 'Globala receipt-alias för fallback-matchning i importen.',
_DatabaseTab.ai => 'Översikt av AI-modeller, accessnivåer och triggers i systemet.',
};
}
Widget activeSection;
switch (_activeTab) {
case _DatabaseTab.inventory:
@@ -187,14 +199,26 @@ class _AdminDatabasePanelState extends ConsumerState<AdminDatabasePanel> {
style: theme.textTheme.bodyMedium,
),
const SizedBox(height: 8),
const Wrap(
Wrap(
spacing: 8,
runSpacing: 8,
children: [
Chip(label: Text('User-scope')),
Chip(label: Text('Global scope')),
Chip(label: Text('Private products')),
Chip(label: Text('Alias')),
ActionChip(
label: const Text('User-scope'),
onPressed: () => setState(() => _activeTab = _DatabaseTab.inventory),
),
ActionChip(
label: const Text('Global scope'),
onPressed: () => setState(() => _activeTab = _DatabaseTab.products),
),
ActionChip(
label: const Text('Private products'),
onPressed: () => setState(() => _activeTab = _DatabaseTab.privateProducts),
),
ActionChip(
label: const Text('Alias'),
onPressed: () => setState(() => _activeTab = _DatabaseTab.aliases),
),
],
),
],
@@ -231,6 +255,8 @@ class _AdminDatabasePanelState extends ConsumerState<AdminDatabasePanel> {
),
),
const SizedBox(height: 12),
Text('Välj område att arbeta med', style: theme.textTheme.labelLarge),
const SizedBox(height: 8),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
@@ -248,6 +274,15 @@ class _AdminDatabasePanelState extends ConsumerState<AdminDatabasePanel> {
.toList(),
),
),
const SizedBox(height: 8),
Card(
child: ListTile(
leading: const Icon(Icons.tune),
title: Text('Aktiv panel: ${tabLabel(_activeTab)}'),
subtitle: Text(tabSummary(_activeTab)),
dense: true,
),
),
],
),
);