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.
PatientApp-KKUMC/lib/core/viewModels/pharmacyModule/lacum-registration-viewMode...

56 lines
1.8 KiB
Dart

5 years ago
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/lacum-registration-service.dart';
import '../../../locator.dart';
import 'lacum-viewmodel.dart';
class LacumRegistrationViewModel extends LacumViewModel {
LacumRegistrationService _lacumService = locator<LacumRegistrationService>();
ListUserAgreement get listUserAgreement => _lacumService.listUserAgreement;
Future checkLacumAccountActivation(String patientIdentificationNo) async {
setState(ViewState.Busy);
await _lacumService.getLacumAccountInformationById(patientIdentificationNo);
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
} else {
if(_lacumService.lacumInformation != null){
if(_lacumService.lacumInformation.yahalaAccountNo == 0){
error = _lacumService.lacumInformation.errorEndUserMessage;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
5 years ago
}
}
}
Future getUserTermsAndConditionsForEPharmcy() async {
setState(ViewState.Busy);
await _lacumService.getUserTermsAndConditionsForEPharmcy();
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
Future<int> createNewLakumAccount(String name, String phone, String identificationNo, int languageId) async {
setState(ViewState.Busy);
await _lacumService.createLakumAccount(name, phone, 0, identificationNo, languageId);
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
return 404;
} else {
setState(ViewState.Idle);
return 200;
}
}
}