You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.4 KiB
Dart
60 lines
2.4 KiB
Dart
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckActivationCodeModel.dart';
|
|
import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart';
|
|
import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart';
|
|
import 'package:doctor_app_flutter/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart';
|
|
import 'package:doctor_app_flutter/core/service/PatientRegistrationService.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
|
|
|
import '../../locator.dart';
|
|
|
|
class PatientRegistrationViewModel extends BaseViewModel {
|
|
PatientRegistrationService _patientRegistrationService =
|
|
locator<PatientRegistrationService>();
|
|
|
|
Future checkPatientForRegistration(
|
|
CheckPatientForRegistrationModel registrationModel) async {
|
|
setState(ViewState.Busy);
|
|
await _patientRegistrationService
|
|
.checkPatientForRegistration(registrationModel);
|
|
if (_patientRegistrationService.hasError) {
|
|
error = _patientRegistrationService.error;
|
|
setState(ViewState.Error);
|
|
} else
|
|
setState(ViewState.Idle);
|
|
}
|
|
|
|
Future sendActivationCodeByOTPNotificationType(
|
|
SendActivationCodeByOTPNotificationTypeForRegistrationModel
|
|
registrationModel) async {
|
|
setState(ViewState.Busy);
|
|
await _patientRegistrationService
|
|
.sendActivationCodeByOTPNotificationType(registrationModel);
|
|
if (_patientRegistrationService.hasError) {
|
|
error = _patientRegistrationService.error;
|
|
setState(ViewState.Error);
|
|
} else
|
|
setState(ViewState.Idle);
|
|
}
|
|
|
|
Future checkActivationCode(CheckActivationCodeModel registrationModel) async {
|
|
setState(ViewState.Busy);
|
|
await _patientRegistrationService.checkActivationCode(registrationModel);
|
|
if (_patientRegistrationService.hasError) {
|
|
error = _patientRegistrationService.error;
|
|
setState(ViewState.Error);
|
|
} else
|
|
setState(ViewState.Idle);
|
|
}
|
|
|
|
Future registrationPatient(PatientRegistrationModel registrationModel) async {
|
|
setState(ViewState.Busy);
|
|
await _patientRegistrationService.registrationPatient(registrationModel);
|
|
if (_patientRegistrationService.hasError) {
|
|
error = _patientRegistrationService.error;
|
|
setState(ViewState.Error);
|
|
} else
|
|
setState(ViewState.Idle);
|
|
}
|
|
}
|