
Refactors the product data model to primarily store `id`, `barcode`, and `displayName`. This simplifies the product structure, focusing on essential attributes for inventory and scanning operations. Optimizes API calls for stock picking to fetch more relevant product details. Unnecessary fields are removed, and specific product attributes like `barcode` and `quantity` are now explicitly requested for stock moves. Moves `StockPickingRecordModel` to its own dedicated file for improved code organization and maintainability. Updates all affected UI components and scanner logic to align with the revised product model.
78 lines
2.9 KiB
Dart
78 lines
2.9 KiB
Dart
import 'package:e_scan/backend/schema/stock_picking/stock_picking_record_model.dart';
|
|
import 'package:e_scan/components/components.dart';
|
|
import 'package:e_scan/pages/operation/reception/reception_details_page_model.dart';
|
|
import 'package:e_scan/router/go_secure_router_builder.dart';
|
|
import 'package:e_scan/themes/app_theme.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ReceptionDetailsPage extends ConsumerStatefulWidget {
|
|
const ReceptionDetailsPage({super.key, required this.receptionId});
|
|
final int receptionId;
|
|
@override
|
|
ConsumerState<ReceptionDetailsPage> createState() =>
|
|
_ReceptionDetailsPageState();
|
|
}
|
|
|
|
class _ReceptionDetailsPageState extends ConsumerState<ReceptionDetailsPage> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
|
ref
|
|
.read(receptionDetailsPageModelProvider.notifier)
|
|
.getReceptionById(id: widget.receptionId);
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final state = ref.watch(receptionDetailsPageModelProvider);
|
|
final reception = state.reception;
|
|
return Scaffold(
|
|
backgroundColor: AppTheme.of(context).primaryBackground,
|
|
appBar: MainAppbarComponent(
|
|
leading: BackButton(color: AppTheme.of(context).white),
|
|
title: "Réceptions",
|
|
subTitle: "Opérations d'Entrepôt",
|
|
),
|
|
body: state.loading
|
|
? Center(child: LoadingProgressComponent())
|
|
: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: ListView(
|
|
children: [
|
|
const SizedBox(height: 16),
|
|
if (reception?.isDone == false) ...[
|
|
QuickActionComponent(
|
|
onTapScan: () {
|
|
ScannerRoute().push(context);
|
|
},
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
StockPickingCard(
|
|
isDone: reception?.isDone == true,
|
|
margin: EdgeInsets.symmetric(horizontal: 5),
|
|
reference: reception?.name ?? '',
|
|
from: reception?.locationId?.completeName,
|
|
to: reception?.locationDestId?.completeName,
|
|
contact: reception?.partnerId?.displayName,
|
|
origin: reception?.origin,
|
|
status: reception?.state,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
floatingActionButton: reception?.isDone == false
|
|
? FloatingActionButton(
|
|
backgroundColor: AppTheme.of(context).primary,
|
|
onPressed: () {},
|
|
child: Icon(Icons.qr_code, color: AppTheme.of(context).white),
|
|
)
|
|
: null,
|
|
);
|
|
}
|
|
}
|