fix
This commit is contained in:
@@ -80,10 +80,10 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
}
|
||||
|
||||
Future<void> _onRefresh() async {
|
||||
await ref.read(productDetailProvider(_providerKey).notifier).refreshProductDetail(
|
||||
widget.warehouseId,
|
||||
widget.productId,
|
||||
);
|
||||
// await ref.read(productDetailProvider(_providerKey).notifier).refreshProductDetail(
|
||||
// widget.warehouseId,
|
||||
// widget.productId,
|
||||
// );
|
||||
}
|
||||
|
||||
void _clearControllers() {
|
||||
@@ -114,7 +114,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
final productName = stages.isNotEmpty ? stages.first.productName : 'Product';
|
||||
|
||||
// Capitalize first letter of operation type
|
||||
final operationTitle = widget.operationType == 'import' ? 'Import' : 'Export';
|
||||
final operationTitle = widget.operationType == 'import' ? 'Nhập' : 'Xuất';
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -137,7 +137,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: _onRefresh,
|
||||
tooltip: 'Refresh',
|
||||
tooltip: 'Làm mới',
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -215,7 +215,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No stages found',
|
||||
'Không tìm thấy công đoạn',
|
||||
style: theme.textTheme.titleLarge,
|
||||
),
|
||||
],
|
||||
@@ -244,14 +244,14 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Stage Not Found',
|
||||
'Không tìm thấy công đoạn',
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Stage with ID ${widget.stageId} was not found in this product.',
|
||||
'Công đoạn với ID ${widget.stageId} không được tìm thấy trong sản phẩm này.',
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
@@ -293,8 +293,8 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
children: [
|
||||
Text(
|
||||
widget.stageId != null
|
||||
? 'Selected Stage'
|
||||
: 'Production Stages (${displayStages.length})',
|
||||
? 'Công đoạn'
|
||||
: 'Công đoạn (${displayStages.length})',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -383,32 +383,32 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
|
||||
_buildSectionCard(
|
||||
theme: theme,
|
||||
title: 'Stage Information',
|
||||
title: 'Thông tin công đoạn',
|
||||
icon: Icons.info_outlined,
|
||||
children: [
|
||||
_buildInfoRow('Product ID', '${stageToShow.productId}'),
|
||||
_buildInfoRow('Mã sản phẩm', '${stageToShow.productId}'),
|
||||
if (stageToShow.productStageId != null)
|
||||
_buildInfoRow('Stage ID', '${stageToShow.productStageId}'),
|
||||
_buildInfoRow('Mã công đoạn', '${stageToShow.productStageId}'),
|
||||
if (stageToShow.actionTypeId != null)
|
||||
_buildInfoRow('Action Type ID', '${stageToShow.actionTypeId}'),
|
||||
_buildInfoRow('Stage Name', stageToShow.displayName),
|
||||
_buildInfoRow('Mã loại thao tác', '${stageToShow.actionTypeId}'),
|
||||
_buildInfoRow('Tên công đoạn', stageToShow.displayName),
|
||||
],
|
||||
),
|
||||
|
||||
// Current Quantity information
|
||||
_buildSectionCard(
|
||||
theme: theme,
|
||||
title: 'Current Quantities',
|
||||
title: 'Số lượng hiện tại',
|
||||
icon: Icons.info_outlined,
|
||||
children: [
|
||||
_buildInfoRow('Passed Quantity', '${stageToShow.passedQuantity}'),
|
||||
_buildInfoRow('Số lượng đạt', '${stageToShow.passedQuantity}'),
|
||||
_buildInfoRow(
|
||||
'Passed Weight',
|
||||
'Khối lượng đạt',
|
||||
'${stageToShow.passedQuantityWeight.toStringAsFixed(2)} kg',
|
||||
),
|
||||
_buildInfoRow('Issued Quantity', '${stageToShow.issuedQuantity}'),
|
||||
_buildInfoRow('Số lượng lỗi', '${stageToShow.issuedQuantity}'),
|
||||
_buildInfoRow(
|
||||
'Issued Weight',
|
||||
'Khối lượng lỗi',
|
||||
'${stageToShow.issuedQuantityWeight.toStringAsFixed(2)} kg',
|
||||
),
|
||||
],
|
||||
@@ -417,29 +417,29 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
// Add New Quantities section
|
||||
_buildSectionCard(
|
||||
theme: theme,
|
||||
title: 'Add New Quantities',
|
||||
title: 'Thêm số lượng mới',
|
||||
icon: Icons.add_circle_outline,
|
||||
children: [
|
||||
_buildTextField(
|
||||
label: 'Passed Quantity',
|
||||
label: 'Số lượng đạt',
|
||||
controller: _passedQuantityController,
|
||||
keyboardType: TextInputType.number,
|
||||
theme: theme,
|
||||
),
|
||||
_buildTextField(
|
||||
label: 'Passed Weight (kg)',
|
||||
label: 'Khối lượng đạt (kg)',
|
||||
controller: _passedWeightController,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
theme: theme,
|
||||
),
|
||||
_buildTextField(
|
||||
label: 'Issued Quantity',
|
||||
label: 'Số lượng lỗi',
|
||||
controller: _issuedQuantityController,
|
||||
keyboardType: TextInputType.number,
|
||||
theme: theme,
|
||||
),
|
||||
_buildTextField(
|
||||
label: 'Issued Weight (kg)',
|
||||
label: 'Khối lượng lỗi (kg)',
|
||||
controller: _issuedWeightController,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
theme: theme,
|
||||
@@ -450,7 +450,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
_buildSectionCard(theme: theme, title: "Nhân viên", icon: Icons.people, children: [
|
||||
// Warehouse User Dropdown
|
||||
_buildUserDropdown(
|
||||
label: 'Warehouse User',
|
||||
label: 'Người dùng kho',
|
||||
value: _selectedWarehouseUser,
|
||||
users: ref.watch(usersListProvider)
|
||||
.where((user) => user.isWareHouseUser)
|
||||
@@ -464,7 +464,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
),
|
||||
// All Employees Dropdown
|
||||
_buildUserDropdown(
|
||||
label: 'Employee',
|
||||
label: 'Nhân viên',
|
||||
value: _selectedEmployee,
|
||||
users: ref.watch(usersListProvider),
|
||||
onChanged: (user) {
|
||||
@@ -686,7 +686,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Product ID: ${stage.productId}',
|
||||
'Sản phẩm ID: ${stage.productId}',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
|
||||
@@ -45,7 +45,7 @@ class ProductListItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Code: ${product.code}',
|
||||
'Mã: ${product.code}',
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
@@ -65,7 +65,7 @@ class ProductListItem extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
'Active',
|
||||
'Hoạt động',
|
||||
style: textTheme.labelSmall?.copyWith(
|
||||
color: Colors.green,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -84,7 +84,7 @@ class ProductListItem extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: _InfoItem(
|
||||
label: 'Weight',
|
||||
label: 'Khối lượng',
|
||||
value: '${product.weight.toStringAsFixed(2)} kg',
|
||||
icon: Icons.fitness_center,
|
||||
),
|
||||
@@ -92,7 +92,7 @@ class ProductListItem extends StatelessWidget {
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _InfoItem(
|
||||
label: 'Pieces',
|
||||
label: 'Số lượng',
|
||||
value: product.pieces.toString(),
|
||||
icon: Icons.inventory_2,
|
||||
),
|
||||
@@ -107,7 +107,7 @@ class ProductListItem extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: _InfoItem(
|
||||
label: 'In Stock (Pieces)',
|
||||
label: 'Tồn kho (SL)',
|
||||
value: product.piecesInStock.toString(),
|
||||
icon: Icons.warehouse,
|
||||
color: product.piecesInStock > 0
|
||||
@@ -118,7 +118,7 @@ class ProductListItem extends StatelessWidget {
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _InfoItem(
|
||||
label: 'In Stock (Weight)',
|
||||
label: 'Tồn kho (KL)',
|
||||
value: '${product.weightInStock.toStringAsFixed(2)} kg',
|
||||
icon: Icons.scale,
|
||||
color: product.weightInStock > 0
|
||||
@@ -142,7 +142,7 @@ class ProductListItem extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Conversion Rate',
|
||||
'Tỷ lệ chuyển đổi',
|
||||
style: textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -170,7 +170,7 @@ class ProductListItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Barcode: ${product.barcode}',
|
||||
'Mã vạch: ${product.barcode}',
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user