change profile based on change clinic

merge-requests/120/head
Elham Rababah 6 years ago
parent ef8dfc5b5f
commit 5779fb9ad7

@ -41,7 +41,7 @@ class BaseAppClient {
body['DoctorID'] = doctorProfile?.doctorID;
body['EditedBy'] = doctorProfile?.doctorID;
body['ProjectID'] = doctorProfile?.projectID;
// if (!body.containsKey('ClinicID'))
if (body['ClinicID'] == null)
body['ClinicID'] = doctorProfile?.clinicID;
}
body['TokenID'] = token ?? '';

@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:platform_action_sheet/platform_action_sheet.dart';
import 'package:provider/provider.dart';
import '../routes.dart';
@ -433,21 +432,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
}
List<ActionSheetAction> buildActionSheetAction(
{List<ClinicModel> actionList, List defaultActionList}) {
List<ActionSheetAction> AList = [];
actionList.forEach((element) {
print(element.clinicID);
AList.add(ActionSheetAction(
text: element.clinicName,
onPressed: () => Navigator.pop(context),
isCancel: true,
defaultAction: true,
));
});
return AList;
}
showCupertinoPicker(
{context, List<ClinicModel> actionList, decKey, onSelectFun}) {
@ -497,7 +482,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
children: actionList
.map((e) => Container(
child: InkWell(
onTap: changeClinic(e.clinicID),
onTap: ()=>changeClinic(e.clinicID,context),
child: Text(
e.clinicName,
style: TextStyle(fontSize: 15),
@ -511,7 +496,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
});
}
changeClinic(clinicId) async{
changeClinic(clinicId , BuildContext context) async{
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
new DoctorProfileModel.fromJson(profile);
@ -526,15 +511,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
// authProvider.getDocProfiles(docInfo)
authProvider.getDocProfiles(docInfo.toJson()).then((res)async {
if (res['MessageStatus'] == 1) {
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
Map profile1 = await sharedPref.getObj(DOCTOR_PROFILE);
print(1);
} else {
// changeLoadingStata(false);
// helpers.showErrorToast(res['ErrorEndUserMessage']);
}
Navigator.pop(context);
}).catchError((err) {
// changeLoadingStata(false);

Loading…
Cancel
Save