refactor dashboard store ticket list
This commit is contained in:
@@ -75,7 +75,9 @@ class TicketRepository {
|
||||
}
|
||||
|
||||
// --- RECUPERO PAGINATO CON FILTRI E JOIN DEI TICKET DI TUTTA L'AZIENDA ---
|
||||
Future<List<TicketModel>> fetchCompanyTickets({
|
||||
Future<List<TicketModel>> fetchTickets({
|
||||
required String? companyId,
|
||||
String? storeId,
|
||||
required int offset,
|
||||
int limit = 50,
|
||||
String? searchTerm,
|
||||
@@ -96,7 +98,7 @@ class TicketRepository {
|
||||
target_model:${Tables.models}!ticket_model_id_1_fkey (*),
|
||||
source_model:${Tables.models}!ticket_model_id_2_fkey (*)
|
||||
''')
|
||||
.eq('company_id', GetIt.I.get<SessionCubit>().state.company!.id!);
|
||||
.eq('company_id', companyId!);
|
||||
|
||||
// Filtro Range Date
|
||||
if (dateRange != null) {
|
||||
@@ -105,6 +107,10 @@ class TicketRepository {
|
||||
.lte('created_at', dateRange.end.toIso8601String());
|
||||
}
|
||||
|
||||
if (storeId != null) {
|
||||
query = query.or('store_id.eq.$storeId,store_id.is.null');
|
||||
}
|
||||
|
||||
if (ticketStatusFilter != null) {
|
||||
query = query.eq('status', ticketStatusFilter.value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user