계정 정보 다이얼로그 추가 및 전체 목록 페치 개선
This commit is contained in:
@@ -18,6 +18,7 @@ import 'package:superport_v2/features/inventory/shared/widgets/customer_multi_se
|
||||
import 'package:superport_v2/features/inventory/shared/widgets/warehouse_select_field.dart';
|
||||
import 'package:superport_v2/core/config/environment.dart';
|
||||
import 'package:superport_v2/core/network/failure.dart';
|
||||
import 'package:superport_v2/core/common/utils/pagination_utils.dart';
|
||||
import 'package:superport_v2/core/permissions/permission_manager.dart';
|
||||
import 'package:superport_v2/core/permissions/permission_resources.dart';
|
||||
import 'package:superport_v2/features/inventory/outbound/presentation/controllers/outbound_controller.dart';
|
||||
@@ -163,17 +164,16 @@ class _OutboundPageState extends State<OutboundPage> {
|
||||
|
||||
try {
|
||||
final repository = getIt<CustomerRepository>();
|
||||
final result = await repository.list(
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
isActive: true,
|
||||
final customers = await fetchAllPaginatedItems<Customer>(
|
||||
request: (page, pageSize) =>
|
||||
repository.list(page: page, pageSize: pageSize, isActive: true),
|
||||
);
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
final seen = <String>{CustomerFilterOption.all.cacheKey};
|
||||
final options = <CustomerFilterOption>[CustomerFilterOption.all];
|
||||
for (final customer in result.items) {
|
||||
for (final customer in customers) {
|
||||
final option = CustomerFilterOption.fromCustomer(customer);
|
||||
if (seen.add(option.cacheKey)) {
|
||||
options.add(option);
|
||||
@@ -620,6 +620,17 @@ class _OutboundPageState extends State<OutboundPage> {
|
||||
style: theme.textTheme.small,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: currentPage <= 1
|
||||
? null
|
||||
: () => _goToPage(1),
|
||||
child: const Icon(
|
||||
lucide.LucideIcons.chevronsLeft,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: currentPage <= 1
|
||||
@@ -641,6 +652,17 @@ class _OutboundPageState extends State<OutboundPage> {
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ShadButton.ghost(
|
||||
size: ShadButtonSize.sm,
|
||||
onPressed: currentPage >= totalPages
|
||||
? null
|
||||
: () => _goToPage(totalPages),
|
||||
child: const Icon(
|
||||
lucide.LucideIcons.chevronsRight,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -1172,7 +1194,9 @@ class _OutboundPageState extends State<OutboundPage> {
|
||||
}
|
||||
|
||||
void _goToPage(int page) {
|
||||
final target = page < 1 ? 1 : page;
|
||||
final totalItems = _result?.total ?? _filteredRecords.length;
|
||||
final totalPages = _calculateTotalPages(totalItems);
|
||||
final int target = page < 1 ? 1 : (page > totalPages ? totalPages : page);
|
||||
if (target == _currentPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user