sick leave

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

@ -276,7 +276,7 @@ class PatientService extends BaseService {
);
}
Future getPatientInsuranceApprovals(patient) async {
Future getPatientInsuranceApprovals(patient) async {
hasError = false;
await baseAppClient.post(
@ -293,7 +293,7 @@ class PatientService extends BaseService {
);
}
Future getPatientProgressNote(patient) async {
Future getPatientProgressNote(patient) async {
hasError = false;
await baseAppClient.post(
@ -310,7 +310,6 @@ class PatientService extends BaseService {
);
}
Future getClinicsList() async {
hasError = false;
@ -328,7 +327,6 @@ class PatientService extends BaseService {
);
}
Future getReferralFrequancyList() async {
hasError = false;
@ -363,19 +361,19 @@ class PatientService extends BaseService {
);
}
// TODO send the total model insted of each parameter
Future referToDoctor({String selectedDoctorID,
String selectedClinicID,
int admissionNo,
String extension,
String priority,
String frequency,
String referringDoctorRemarks,
int patientID,
int patientTypeID,
String roomID,
int projectID}) async {
Future referToDoctor(
{String selectedDoctorID,
String selectedClinicID,
int admissionNo,
String extension,
String priority,
String frequency,
String referringDoctorRemarks,
int patientID,
int patientTypeID,
String roomID,
int projectID}) async {
hasError = false;
// TODO Change it to use it when we implement authentication user
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -409,4 +407,22 @@ class PatientService extends BaseService {
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;
}
}
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;
Future getPatientList(PatientModel patient, patientType,
{bool isBusyLocal = false}) async {
if(isBusyLocal) {
if (isBusyLocal) {
setState(ViewState.BusyLocal);
} else {
setState(ViewState.Busy);
@ -56,11 +56,23 @@ class PatientViewModel extends BaseViewModel {
return _patientService.getPatientList(patient, patientType);
if (_patientService.hasError) {
error = _patientService.error;
if(isBusyLocal) {
if (isBusyLocal) {
setState(ViewState.ErrorLocal);
} else {
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);
}
@ -167,6 +179,7 @@ class PatientViewModel extends BaseViewModel {
}
}
}
Future getDoctorsList(String clinicId) async {
setState(ViewState.BusyLocal);
await _patientService.getDoctorsList(clinicId);
@ -182,8 +195,9 @@ class PatientViewModel extends BaseViewModel {
}
List getDoctorNameList() {
var doctorNamelist =
_patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList();
var doctorNamelist = _patientService.doctorsList
.map((value) => value['DoctorName'].toString())
.toList();
return doctorNamelist;
}
@ -193,6 +207,7 @@ class PatientViewModel extends BaseViewModel {
.toList();
return clinicsNameslist;
}
Future getReferralFrequancyList() async {
setState(ViewState.Busy);
await _patientService.getReferralFrequancyList();

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

Loading…
Cancel
Save