feat: Add functionality to move inventory items to pantry and enhance pantry management
Test Suite / test (24.15.0) (push) Has been cancelled

- Implemented moveInventoryItemToPantry method in InventoryRepository to facilitate moving items from inventory to pantry.
- Enhanced InventoryScreen with a new header section providing context about the inventory.
- Added a button in SwipeableInventoryTile to move items to pantry with appropriate error handling.
- Introduced movePantryItemToInventory method in PantryRepository to support moving items back to inventory.
- Refactored PantryScreen to rename _addToInventory to _moveToInventory for clarity and updated UI to reflect changes.
- Added AdminPantryItem model to represent pantry items in the admin panel.
- Created AdminPantryPanel for managing pantry items, including moving items to inventory and listing users.
- Developed AdminPrivateProductsPanel for managing private products, allowing promotion to global products.
This commit is contained in:
Nils-Johan Gynther
2026-05-11 09:06:30 +02:00
parent edf9c74e75
commit 84ccabe2fe
27 changed files with 1851 additions and 376 deletions
@@ -1,12 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/l10n/l10n.dart';
import 'admin_ai_panel.dart';
import 'admin_aliases_panel.dart';
import 'admin_database_panel.dart';
import 'admin_inventory_panel.dart';
import 'admin_pending_products_panel.dart';
import 'admin_products_panel.dart';
import 'admin_users_panel.dart';
class AdminScreen extends ConsumerStatefulWidget {
@@ -19,10 +14,40 @@ class AdminScreen extends ConsumerStatefulWidget {
class _AdminScreenState extends ConsumerState<AdminScreen> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return DefaultTabController(
length: 7,
length: 2,
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
child: Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Admin', style: theme.textTheme.titleMedium),
const SizedBox(height: 8),
Text(
'Användare är för konton och roller. Databas är arbetsytan för inventarie, baslager, produkter, alias och importflöden.',
style: theme.textTheme.bodyMedium,
),
const SizedBox(height: 8),
const Wrap(
spacing: 8,
runSpacing: 8,
children: [
Chip(label: Text('Konton')),
Chip(label: Text('Databas')),
Chip(label: Text('Privat + globalt')),
],
),
],
),
),
),
),
Material(
color: Theme.of(context).colorScheme.surface,
child: TabBar(
@@ -30,11 +55,6 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
tabs: [
Tab(text: context.l10n.profileUsersTab, icon: const Icon(Icons.people_outline)),
const Tab(text: 'Databas', icon: Icon(Icons.storage_outlined)),
const Tab(text: 'Inventory', icon: Icon(Icons.inventory_outlined)),
const Tab(text: 'Produkter', icon: Icon(Icons.inventory_2_outlined)),
Tab(text: context.l10n.profilePendingTab, icon: const Icon(Icons.pending_actions_outlined)),
const Tab(text: 'Alias', icon: Icon(Icons.link_outlined)),
const Tab(text: 'AI', icon: Icon(Icons.auto_awesome_outlined)),
],
),
),
@@ -49,26 +69,6 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminDatabasePanel(embedded: true),
),
Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminInventoryPanel(embedded: true),
),
Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminProductsPanel(embedded: true),
),
Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminPendingProductsPanel(embedded: true),
),
Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminAliasesPanel(embedded: true),
),
Padding(
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
child: AdminAiPanel(embedded: true),
),
],
),
),