sick leave

merge-requests/197/head
Sultan Khan 5 years ago
parent 76e10459e0
commit 900264bc26

@ -310,7 +310,6 @@ class PatientService extends BaseService {
); );
} }
Future getClinicsList() async { Future getClinicsList() async {
hasError = false; hasError = false;
@ -328,7 +327,6 @@ class PatientService extends BaseService {
); );
} }
Future getReferralFrequancyList() async { Future getReferralFrequancyList() async {
hasError = false; hasError = false;
@ -363,9 +361,9 @@ class PatientService extends BaseService {
); );
} }
// TODO send the total model insted of each parameter // TODO send the total model insted of each parameter
Future referToDoctor({String selectedDoctorID, Future referToDoctor(
{String selectedDoctorID,
String selectedClinicID, String selectedClinicID,
int admissionNo, int admissionNo,
String extension, String extension,
@ -409,4 +407,22 @@ class PatientService extends BaseService {
body: _referToDoctorRequest.toJson(), body: _referToDoctorRequest.toJson(),
); );
} }
Future<dynamic> getDashboard() async {
try {
dynamic localRes;
hasError = false;
await baseAppClient.post(GET_DASHBOARD,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {});
// notifyListeners();
return Future.value(localRes);
} catch (error) {
hasError = true;
super.error = error;
}
}
} }

@ -167,21 +167,4 @@ class AuthViewModel with ChangeNotifier {
throw error; throw error;
} }
} }
Future<dynamic> getDashboard(docInfo) async {
try {
dynamic localRes;
await baseAppClient.post(GET_DASHBOARD,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {"DoctorID": docInfo.doctorID});
notifyListeners();
return Future.value(localRes);
} catch (error) {
print(error);
throw error;
}
}
} }

@ -48,7 +48,7 @@ class PatientViewModel extends BaseViewModel {
get referalFrequancyList => _patientService.referalFrequancyList; get referalFrequancyList => _patientService.referalFrequancyList;
Future getPatientList(PatientModel patient, patientType, Future getPatientList(PatientModel patient, patientType,
{bool isBusyLocal = false}) async { {bool isBusyLocal = false}) async {
if(isBusyLocal) { if (isBusyLocal) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -56,11 +56,23 @@ class PatientViewModel extends BaseViewModel {
return _patientService.getPatientList(patient, patientType); return _patientService.getPatientList(patient, patientType);
if (_patientService.hasError) { if (_patientService.hasError) {
error = _patientService.error; error = _patientService.error;
if(isBusyLocal) { if (isBusyLocal) {
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
setState(ViewState.Error); setState(ViewState.Error);
} } else }
} else
setState(ViewState.Idle);
}
Future getDashboard() async {
setState(ViewState.Busy);
await _patientService.getDashboard();
if (_patientService.hasError) {
error = _patientService.error;
setState(ViewState.Idle);
//setState(ViewState.Error);
} else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
@ -167,6 +179,7 @@ class PatientViewModel extends BaseViewModel {
} }
} }
} }
Future getDoctorsList(String clinicId) async { Future getDoctorsList(String clinicId) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _patientService.getDoctorsList(clinicId); await _patientService.getDoctorsList(clinicId);
@ -182,8 +195,9 @@ class PatientViewModel extends BaseViewModel {
} }
List getDoctorNameList() { List getDoctorNameList() {
var doctorNamelist = var doctorNamelist = _patientService.doctorsList
_patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); .map((value) => value['DoctorName'].toString())
.toList();
return doctorNamelist; return doctorNamelist;
} }
@ -193,6 +207,7 @@ class PatientViewModel extends BaseViewModel {
.toList(); .toList();
return clinicsNameslist; return clinicsNameslist;
} }
Future getReferralFrequancyList() async { Future getReferralFrequancyList() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _patientService.getReferralFrequancyList(); await _patientService.getReferralFrequancyList();

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
@ -7,6 +8,7 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -69,9 +71,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
if (!currentFocus.hasPrimaryFocus) { if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); currentFocus.unfocus();
} }
return SafeArea( return BaseView<PatientViewModel>(
bottom: true, onModelReady: (model) => model.getDashboard(),
child: AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
isLoading: isLoading, isLoading: isLoading,
body: ListView(children: [ body: ListView(children: [
@ -96,9 +99,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Row( Row(
children: <Widget>[ children: <Widget>[
AppText( AppText(
TranslationBase TranslationBase.of(context).welcome,
.of(context)
.welcome,
fontSize: SizeConfig.textMultiplier * 1.7, fontSize: SizeConfig.textMultiplier * 1.7,
color: Colors.white, color: Colors.white,
) )
@ -123,8 +124,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
showCupertinoPicker( showCupertinoPicker(
decKey: '', decKey: '',
context: context, context: context,
actionList: projectsProvider actionList:
.doctorClinicsList); projectsProvider.doctorClinicsList);
}, },
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
@ -134,7 +135,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: AppText( child: AppText(
authProvider.selectedClinicName != authProvider.selectedClinicName !=
null null
? authProvider.selectedClinicName ? authProvider
.selectedClinicName
: authProvider.doctorProfile : authProvider.doctorProfile
.clinicDescription, .clinicDescription,
fontSize: fontSize:
@ -154,18 +156,20 @@ class _DashboardScreenState extends State<DashboardScreen> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
InkWell( InkWell(
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5, left: 5,
top: projectsProvider top: projectsProvider
.isArabic ? 0 : 5, .isArabic
? 0
: 5,
right: 10, right: 10,
bottom: projectsProvider bottom: projectsProvider
.isArabic ? 15 : 7), .isArabic
? 15
: 7),
child: Icon( child: Icon(
DoctorApp.sync_icon, DoctorApp.sync_icon,
color: Colors.white, color: Colors.white,
size: SizeConfig size: SizeConfig
.textMultiplier * .textMultiplier *
@ -176,20 +180,16 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
]), ]),
), ),
], ],
), ),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme color: Theme.of(context).backgroundColor,
.of(context)
.backgroundColor,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
), ),
@ -197,8 +197,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
height: 50, height: 50,
width: 60, width: 60,
child: Image.network( child: Image.network(
authProvider.doctorProfile authProvider.doctorProfile.doctorImageURL,
.doctorImageURL,
// fit: BoxFit.fill, // fit: BoxFit.fill,
), ),
), ),
@ -246,14 +245,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
center: Column( center: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
AppText("38", AppText(
fontSize: "38",
SizeConfig.textMultiplier * 3.7, fontSize: SizeConfig.textMultiplier * 3.7,
color: HexColor('#5D4C35'), color: HexColor('#5D4C35'),
fontWeight: FontWeight.bold,), fontWeight: FontWeight.bold,
AppText(TranslationBase ),
.of(context) AppText(
.outPatients, TranslationBase.of(context).outPatients,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.4, fontSize: SizeConfig.textMultiplier * 1.4,
color: HexColor('#5D4C35'), color: HexColor('#5D4C35'),
@ -418,15 +417,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).labResult,
.of(context)
.labResult,
color: Colors.white, color: Colors.white,
) )
], ],
), ),
), ),
], ],
), ),
imageName: '1.png', imageName: '1.png',
@ -446,7 +442,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
Container( Container(
margin: EdgeInsets.only(bottom: 10), margin: EdgeInsets.only(bottom: 10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
AppText( AppText(
@ -455,15 +450,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).radiology,
.of(context)
.radiology,
color: Colors.white, color: Colors.white,
) )
], ],
), ),
), ),
], ],
), ),
imageName: '2.png', imageName: '2.png',
@ -481,10 +473,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
), ),
Container( Container(
margin: EdgeInsets.only(bottom: 10), margin: EdgeInsets.only(bottom: 10),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
AppText( AppText(
@ -493,20 +483,16 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).referral,
.of(context)
.referral,
color: Colors.white, color: Colors.white,
) )
], ],
), ),
), ),
], ],
), ),
imageName: '3.png', imageName: '3.png',
opacity: 0.9, opacity: 0.9,
), ),
], ],
), ),
@ -542,9 +528,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).inPatient,
.of(context)
.inPatient,
color: Colors.white, color: Colors.white,
) )
], ],
@ -555,21 +539,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
imageName: '4.png', imageName: '4.png',
color: HexColor('#B8382C'), color: HexColor('#B8382C'),
hasBorder: false, hasBorder: false,
width: MediaQuery width: MediaQuery.of(context).size.width * 0.44,
.of(context) height: MediaQuery.of(context).orientation ==
.size Orientation.portrait
.width * 0.44, ? MediaQuery.of(context).size.height * 0.13
height: MediaQuery : MediaQuery.of(context).size.height * 0.25,
.of(context)
.orientation == Orientation.portrait
? MediaQuery
.of(context)
.size
.height * 0.13:
MediaQuery
.of(context)
.size
.height * 0.25,
), ),
DashboardItem( DashboardItem(
child: Padding( child: Padding(
@ -596,9 +570,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.white, color: Colors.white,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).operations,
.of(context)
.operations,
color: Colors.white, color: Colors.white,
) )
], ],
@ -609,21 +581,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
imageName: '5.png', imageName: '5.png',
color: HexColor('#B8382C'), color: HexColor('#B8382C'),
hasBorder: false, hasBorder: false,
width: MediaQuery width: MediaQuery.of(context).size.width * 0.44,
.of(context) height: MediaQuery.of(context).orientation ==
.size Orientation.portrait
.width * 0.44, ? MediaQuery.of(context).size.height * 0.13
height: MediaQuery : MediaQuery.of(context).size.height * 0.25,
.of(context)
.orientation == Orientation.portrait
? MediaQuery
.of(context)
.size
.height * 0.13:
MediaQuery
.of(context)
.size
.height * 0.25,
), ),
], ],
), ),
@ -633,9 +595,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Row( Row(
children: <Widget>[ children: <Widget>[
AppText( AppText(
TranslationBase TranslationBase.of(context).patientServices,
.of(context)
.patientServices,
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier * 3,
), ),
], ],
@ -691,16 +651,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
Column( Column(
children: [ children: [
AppText( AppText(
TranslationBase TranslationBase.of(context).theDoctor,
.of(context)
.theDoctor,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).reply,
.of(context)
.reply,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Colors.black, color: Colors.black,
), ),
@ -713,8 +669,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => DoctorReplyScreen(),
DoctorReplyScreen(),
), ),
); );
}, },
@ -729,9 +684,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).searchMedicine,
.of(context)
.searchMedicine,
color: Colors.black, color: Colors.black,
textAlign: TextAlign.center, textAlign: TextAlign.center,
) )
@ -742,8 +695,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => MedicineSearchScreen(),
MedicineSearchScreen(),
), ),
); );
}, },
@ -777,12 +729,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
AppText( AppText(
projectsProvider.isArabic projectsProvider.isArabic
? TranslationBase ? TranslationBase.of(context).qr
.of(context) : TranslationBase.of(context).reader,
.qr
: TranslationBase
.of(context)
.reader,
color: Colors.black, color: Colors.black,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -806,9 +754,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).myReferralPatient,
.of(context)
.myReferralPatient,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Colors.black, color: Colors.black,
) )
@ -819,8 +765,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => MyReferralPatient(),
MyReferralPatient(),
), ),
); );
}, },
@ -835,9 +780,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Colors.black, color: Colors.black,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).myReferredPatient,
.of(context)
.myReferredPatient,
color: Colors.black, color: Colors.black,
textAlign: TextAlign.center, textAlign: TextAlign.center,
) )
@ -848,8 +791,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => MyReferredPatient(),
MyReferredPatient(),
), ),
); );
}, },
@ -890,9 +832,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: AppText(TranslationBase child: AppText(TranslationBase.of(context).cancel
.of(context)
.cancel
// style: TextStyle(context) // style: TextStyle(context)
), ),
onPressed: () { onPressed: () {
@ -900,9 +840,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
}, },
), ),
CupertinoButton( CupertinoButton(
child: AppText(TranslationBase child: AppText(TranslationBase.of(context).done
.of(context)
.done
// style: textStyle(context), // style: textStyle(context),
), ),
onPressed: () { onPressed: () {
@ -927,8 +865,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: AppText( child: AppText(
e.clinicName, e.clinicName,
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier * 1.9,
1.9,
)), )),
), ),
)) ))
@ -969,10 +906,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
}); });
} }
} }
// TODO Move to it file // TODO Move to it file
class DashboardItem extends StatelessWidget { class DashboardItem extends StatelessWidget {
const DashboardItem({ const DashboardItem(
this.hasBorder = false, {this.hasBorder = false,
this.imageName, this.imageName,
@required this.child, @required this.child,
this.onTap, this.onTap,
@ -980,8 +918,8 @@ class DashboardItem extends StatelessWidget {
this.width, this.width,
this.height, this.height,
this.color, this.color,
this.opacity = 0.4 this.opacity = 0.4})
}) : super(key: key); : super(key: key);
final bool hasBorder; final bool hasBorder;
final String imageName; final String imageName;
final Widget child; final Widget child;
@ -996,38 +934,34 @@ class DashboardItem extends StatelessWidget {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
child: Container( child: Container(
width: width != null ? width : MediaQuery width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
.of(context) height: height != null
.size ? height
.width * 0.29, : MediaQuery.of(context).orientation == Orientation.portrait
height: height != null ? height : MediaQuery ? MediaQuery.of(context).size.height * 0.19
.of(context) : MediaQuery.of(context).size.height * 0.35,
.orientation == Orientation.portrait ? MediaQuery
.of(context)
.size
.height * 0.19 : MediaQuery
.of(context)
.size
.height * 0.35,
decoration: BoxDecoration( decoration: BoxDecoration(
color: !hasBorder ? color != null ? color : HexColor('#050705') color: !hasBorder
.withOpacity(opacity) : Colors ? color != null
.white, ? color
: HexColor('#050705').withOpacity(opacity)
: Colors.white,
borderRadius: BorderRadius.circular(6.0), borderRadius: BorderRadius.circular(6.0),
border: hasBorder ? Border.all( border: hasBorder
width: 1.0, color: const Color(0xffcccccc)) : Border.all( ? Border.all(width: 1.0, color: const Color(0xffcccccc))
width: 0.0, color: Colors.transparent), : Border.all(width: 0.0, color: Colors.transparent),
image: imageName != null ? DecorationImage( image: imageName != null
? DecorationImage(
image: AssetImage('assets/images/dashboard/${imageName}'), image: AssetImage('assets/images/dashboard/${imageName}'),
fit: BoxFit.cover, fit: BoxFit.cover,
colorFilter: new ColorFilter.mode( colorFilter: new ColorFilter.mode(
Colors.black.withOpacity(0.2), BlendMode.dstIn), Colors.black.withOpacity(0.2), BlendMode.dstIn),
)
) : null, : null,
),
child: Center(
child: child,
), ),
child: Center(child: child,),
), ),
); );
} }

Loading…
Cancel
Save