
Introduces a dedicated search page for reception operations. Enables navigation to this new page from the 'Reception' quick action component, providing a dedicated interface for searching reception records. Registers the `ReceptionSearchRoute` to integrate it into the application's secure routing system. Also updates the empty state message on the reception list for improved localization and user experience.
72 lines
2.5 KiB
Dart
72 lines
2.5 KiB
Dart
import 'package:e_scan/backend/objectbox/entities/stock_picking/stock_picking_record_entity.dart';
|
|
import 'package:e_scan/components/components.dart';
|
|
import 'package:e_scan/pages/operation/reception/reception_search_page_model.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:e_scan/components/main_appbar_component.dart';
|
|
import 'package:e_scan/themes/app_theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ReceptionSearchPage extends ConsumerStatefulWidget {
|
|
const ReceptionSearchPage({super.key});
|
|
|
|
@override
|
|
ConsumerState<ReceptionSearchPage> createState() =>
|
|
_ReceptionSearchPageState();
|
|
}
|
|
|
|
class _ReceptionSearchPageState extends ConsumerState<ReceptionSearchPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final state = ref.watch(receptionSearchPageModelProvider);
|
|
final receptions = state.valueOrNull ?? <StockPickingRecordEntity>[];
|
|
return Scaffold(
|
|
backgroundColor: AppTheme.of(context).primaryBackground,
|
|
appBar: MainAppbarComponent(
|
|
leading: BackButton(color: AppTheme.of(context).white),
|
|
title: "Rechercher une réception",
|
|
subTitle: "Opérations d'Entrepôt",
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: TextFormField(
|
|
autofocus: true,
|
|
decoration: InputDecoration(
|
|
hintText: "Nom de la réception",
|
|
filled: true,
|
|
fillColor: AppTheme.of(context).secondaryBackground,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(12),
|
|
borderSide: BorderSide.none,
|
|
),
|
|
),
|
|
onChanged: (value) {
|
|
ref
|
|
.read(receptionSearchPageModelProvider.notifier)
|
|
.allByName(name: value);
|
|
},
|
|
),
|
|
),
|
|
Expanded(
|
|
child: state.isLoading
|
|
? Center(child: LoadingProgressComponent())
|
|
: receptions.isEmpty
|
|
? Center(child: Text('Aucun résultat trouvé'))
|
|
: SingleChildScrollView(
|
|
child: Column(
|
|
children: receptions
|
|
.map(
|
|
(reception) =>
|
|
ListTile(title: Text(reception.name ?? '')),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|