numero de solicitudes

This commit is contained in:
Felipe
2024-04-25 23:52:16 -05:00
parent 171b3fd926
commit 8b34e7d12d
5 changed files with 215 additions and 81 deletions
+18
View File
@@ -37,6 +37,8 @@ class ServiceBloc extends Bloc<ServiceEvent, ServiceState> {
_onLoadPendingServicesForProfessional);
on<UpdateProfessionalScored>(_onUpdateProfessionalScored);
on<UpdateUserScored>(_onUpdateUserScored);
on<CountPendingServicesForProfessional>(
_onCountPendingServicesForProfessional);
}
void _onCreateService(CreateService event, Emitter<ServiceState> emit) async {
@@ -297,6 +299,22 @@ class ServiceBloc extends Bloc<ServiceEvent, ServiceState> {
emit(CreateServiceFailure());
}
}
void _onCountPendingServicesForProfessional(
CountPendingServicesForProfessional event,
Emitter<ServiceState> emit) async {
try {
final count = await _serviceRepository
.countPendingServicesForProfessional(event.professionalId);
emit(PendingServicesCountedLoaded(count));
} catch (e) {
log(e.toString());
emit(CreateServiceFailure());
}
}
}
class ServiceInfoUI {
@@ -98,6 +98,15 @@ class UpdateUserScored extends ServiceEvent {
List<Object> get props => [serviceId];
}
class CountPendingServicesForProfessional extends ServiceEvent {
final String professionalId;
const CountPendingServicesForProfessional(this.professionalId);
@override
List<Object?> get props => [professionalId];
}
class CreateService extends ServiceEvent {
final String professionalId;
final bool? professionalScored;
+10 -1
View File
@@ -1,6 +1,6 @@
part of 'service_bloc.dart';
abstract class ServiceState extends Equatable {
class ServiceState extends Equatable {
const ServiceState();
@override
@@ -49,4 +49,13 @@ class ServiceStatusUpdated extends ServiceState {
List<Object> get props => [newStatus];
}
class PendingServicesCountedLoaded extends ServiceState {
final int count;
const PendingServicesCountedLoaded(this.count);
@override
List<Object> get props => [count];
}
class ScoredUpdated extends ServiceState {}