added navigation and selection of workspaces

This commit is contained in:
2026-06-23 00:22:30 +02:00
parent ae2705363a
commit e89c711d00
11 changed files with 118 additions and 107 deletions

View File

@@ -108,11 +108,11 @@ class HistoryController extends ChangeNotifier {
Future<void> searchTransactions(
String workspaceId, {
String? search,
String? billName,
String? status,
String? type,
}) async {
model.searchQuery = search ?? '';
model.searchQuery = billName ?? '';
model.statusFilter = status;
model.typeFilter = type;
final params = <String, String>{
@@ -121,13 +121,8 @@ class HistoryController extends ChangeNotifier {
'size': '20',
'sort': 'createdAt,desc',
};
if (search != null && search.isNotEmpty) {
params['creditAccount'] = search;
params['creditEmail'] = search;
params['creditPhone'] = search;
params['creditName'] = search;
params['billName'] = search;
params['amount'] = search;
if (billName != null && billName.isNotEmpty) {
params['billName'] = billName;
}
if (status != null && status.isNotEmpty) {
params['status'] = status;
@@ -149,12 +144,7 @@ class HistoryController extends ChangeNotifier {
'sort': 'createdAt,desc',
};
if (model.searchQuery.isNotEmpty) {
params['creditAccount'] = model.searchQuery;
params['creditEmail'] = model.searchQuery;
params['creditPhone'] = model.searchQuery;
params['creditName'] = model.searchQuery;
params['billName'] = model.searchQuery;
params['amount'] = model.searchQuery;
}
if (model.statusFilter != null && model.statusFilter!.isNotEmpty) {
params['status'] = model.statusFilter!;

View File

@@ -231,7 +231,7 @@ class _HistoryScreenState extends State<HistoryScreen>
prefs.getString("workspaceId") ?? '';
controller.searchTransactions(
workspaceId,
search: _searchController.text.isNotEmpty
billName: _searchController.text.isNotEmpty
? _searchController.text
: null,
status: controller.model.statusFilter,
@@ -356,7 +356,7 @@ class _HistoryScreenState extends State<HistoryScreen>
final workspaceId = prefs.getString("workspaceId") ?? '';
controller.searchTransactions(
workspaceId,
search: value.isNotEmpty ? value : null,
billName: value.isNotEmpty ? value : null,
status: controller.model.statusFilter,
type: controller.model.typeFilter,
);
@@ -501,7 +501,7 @@ class _HistoryScreenState extends State<HistoryScreen>
final workspaceId = prefs.getString("workspaceId") ?? '';
controller.searchTransactions(
workspaceId,
search: _searchController.text.isNotEmpty
billName: _searchController.text.isNotEmpty
? _searchController.text
: null,
type: controller.model.typeFilter,
@@ -514,7 +514,7 @@ class _HistoryScreenState extends State<HistoryScreen>
final workspaceId = prefs.getString("workspaceId") ?? '';
controller.searchTransactions(
workspaceId,
search: _searchController.text.isNotEmpty
billName: _searchController.text.isNotEmpty
? _searchController.text
: null,
status: controller.model.statusFilter,