asdasda
This commit is contained in:
@@ -141,6 +141,13 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _clearUserSelections() {
|
||||||
|
setState(() {
|
||||||
|
_selectedWarehouseUser = null;
|
||||||
|
_selectedEmployee = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void _showBarcodeScanner() {
|
void _showBarcodeScanner() {
|
||||||
final controller = MobileScannerController(
|
final controller = MobileScannerController(
|
||||||
formats: const [BarcodeFormat.code128],
|
formats: const [BarcodeFormat.code128],
|
||||||
@@ -354,7 +361,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('${operationTitle} ${productName}'),
|
title: Text('$operationTitle: $productName'),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.qr_code_scanner),
|
icon: const Icon(Icons.qr_code_scanner),
|
||||||
@@ -841,7 +848,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(_) {
|
(_) async {
|
||||||
// Success - show success message
|
// Success - show success message
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@@ -852,14 +859,24 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Clear the text fields after successful add
|
|
||||||
_clearControllers();
|
|
||||||
|
|
||||||
// Refresh the product detail to show updated quantities
|
// Refresh the product detail to show updated quantities
|
||||||
ref.read(productDetailProvider(_providerKey).notifier).refreshProductDetail(
|
await ref.read(productDetailProvider(_providerKey).notifier).refreshProductDetail(
|
||||||
widget.warehouseId,
|
widget.warehouseId,
|
||||||
widget.productId,
|
widget.productId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Get updated stage data
|
||||||
|
final updatedStages = ref.read(productDetailProvider(_providerKey)).stages;
|
||||||
|
final updatedStage = updatedStages.firstWhere(
|
||||||
|
(s) => s.productStageId == stage.productStageId,
|
||||||
|
orElse: () => stage,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Automatically print after successful save
|
||||||
|
await _printQuantities(updatedStage);
|
||||||
|
|
||||||
|
// Do NOT clear quantity/weight fields - keep them for reference
|
||||||
|
// User can manually clear them if needed using the 'C' button
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user