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.
68 lines
1.9 KiB
Dart
68 lines
1.9 KiB
Dart
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/models/doctor/statstics_for_certain_doctor_request.dart';
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
Helpers helpers = Helpers();
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
StatsticsForCertainDoctorRequest _statsticsForCertainDoctorRequest = StatsticsForCertainDoctorRequest();
|
|
|
|
|
|
var certainDoctorsStasticsList = [];
|
|
|
|
/*@author: ibrahem albitar
|
|
*@Date:22/6/2020
|
|
*@desc: Doctor Provider
|
|
*/
|
|
|
|
class DoctorsProvider with ChangeNotifier {
|
|
|
|
bool isLoading = false;
|
|
bool isError = false;
|
|
String error = '';
|
|
|
|
resetDefaultValues() {
|
|
isLoading = true;
|
|
isError = false;
|
|
error = '';
|
|
notifyListeners();
|
|
}
|
|
|
|
|
|
/*@author: ibrahem albitar
|
|
*@Date:22/6/2020
|
|
*@desc: StatsticsForCertainDoctor
|
|
*/
|
|
getStatsticsForCertainDoctor(String generalId) async {
|
|
resetDefaultValues();
|
|
try {
|
|
_statsticsForCertainDoctorRequest.generalid = generalId;
|
|
await BaseAppClient.post(LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
certainDoctorsStasticsList = response['List_LiveCareCertainDoctorsStastics'];
|
|
isLoading = false;
|
|
isError = false;
|
|
this.error = '';
|
|
}, onFailure: (String error, int statusCode) {
|
|
isLoading = false;
|
|
isError = true;
|
|
this.error = error;
|
|
}, body: _statsticsForCertainDoctorRequest.toJson());
|
|
notifyListeners();
|
|
} catch (err) {
|
|
handelCatchErrorCase(err);
|
|
}
|
|
}
|
|
|
|
handelCatchErrorCase(err) {
|
|
isLoading = false;
|
|
isError = true;
|
|
error = helpers.generateContactAdminMsg(err);
|
|
notifyListeners();
|
|
throw err;
|
|
}
|
|
|
|
} |