Merge branch 'development' into 'master'

Development

See merge request Cloud_Solution/doctor_app_flutter!118
merge-requests/119/head
Mohammad Aljammal 4 years ago
commit 5ced4990b9

@ -24,7 +24,7 @@ const GET_PATIENT_LAB_OREDERS =
const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList';
const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult';
var selectedPatientType = 0; var selectedPatientType = 1;
//*********change value to decode json from Dropdown ************ //*********change value to decode json from Dropdown ************
var SERVICES_PATIANT = [ var SERVICES_PATIANT = [

@ -41,5 +41,19 @@ const Map<String, Map<String, String>> localizedValues = {
'inPatient': {'en': 'In-Patient', 'ar': 'االمريض الداخلي'}, 'inPatient': {'en': 'In-Patient', 'ar': 'االمريض الداخلي'},
'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'},
'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'},
'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'} 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'},
'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'},
'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'},
'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'},
'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'},
'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'},
'phoneNumber': {'en': 'Phone Number ', 'ar': 'رقم الجوال'},
'patientID': {'en': 'Patient ID', 'ar': 'رقم المريض'},
'patientFile': {'en': 'Patient File', 'ar': 'ملف المريض'},
'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'},
'search': {'en': 'Search', 'ar': 'بحث'},
'onlyArrivedPatient': {
'en': 'Only Arrived Patient',
'ar': 'المريض الذي حضر للموعد'
},
}; };

@ -11,6 +11,7 @@ import './providers/auth_provider.dart';
import './providers/patients_provider.dart'; import './providers/patients_provider.dart';
import './providers/hospital_provider.dart'; import './providers/hospital_provider.dart';
import './routes.dart'; import './routes.dart';
import 'config/config.dart';
void main() => runApp(MyApp()); void main() => runApp(MyApp());
@ -18,6 +19,7 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
return LayoutBuilder( return LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
return OrientationBuilder(builder: (context, orientation) { return OrientationBuilder(builder: (context, orientation) {

@ -1,4 +1,6 @@
import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../models/user_model.dart'; import '../models/user_model.dart';
@ -14,8 +16,41 @@ const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
const MEMBER_CHECK_ACTIVATION_CODE_NEW = const MEMBER_CHECK_ACTIVATION_CODE_NEW =
'Sentry.svc/REST/MemberCheckActivationCode_New'; 'Sentry.svc/REST/MemberCheckActivationCode_New';
const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
class AuthProvider with ChangeNotifier { class AuthProvider with ChangeNotifier {
bool isLogin= false;
bool isLoading = true;
AuthProvider(){
getUserAuthentication();
}
void getUserAuthentication() async{
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if(profile != null)
{
isLoading = false;
isLogin = true;
} else {
isLoading = false;
isLogin = false;
}
notifyListeners();
}
APP_STATUS get stutas {
if (isLoading) {
return APP_STATUS.LOADING;
} else{
if ( this.isLogin) {
return APP_STATUS.AUTHENTICATED;
} else {
return APP_STATUS.UNAUTHENTICATED;
}
}
}
Future<dynamic> login(UserModel userInfo) async { Future<dynamic> login(UserModel userInfo) async {
try { try {
dynamic localRes; dynamic localRes;
@ -131,4 +166,6 @@ class AuthProvider with ChangeNotifier {
throw error; throw error;
} }
} }
} }

@ -63,7 +63,7 @@ class PatientsProvider with ChangeNotifier {
STPReferralFrequencyRequest(); STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest(); ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest(); ReferToDoctorRequest _referToDoctorRequest;
PatiantInformtion _selectedPatient; PatiantInformtion _selectedPatient;
@ -486,7 +486,7 @@ class PatientsProvider with ChangeNotifier {
*@Date:3/6/2020 *@Date:3/6/2020
*@desc: referToDoctor *@desc: referToDoctor
*/ */
referToDoctor(context, referToDoctor(context,
{String selectedDoctorID, {String selectedDoctorID,
String selectedClinicID, String selectedClinicID,
int admissionNo, int admissionNo,
@ -500,56 +500,42 @@ class PatientsProvider with ChangeNotifier {
int projectID}) async { int projectID}) async {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { String token = await sharedPref.getString(TOKEN);
String token = await sharedPref.getString(TOKEN); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile =
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
new DoctorProfileModel.fromJson(profile); int doctorID = doctorProfile.doctorID;
int doctorID = doctorProfile.doctorID; int clinicId = doctorProfile.clinicID;
int clinicId = doctorProfile.clinicID; _referToDoctorRequest = ReferToDoctorRequest(
_referToDoctorRequest = ReferToDoctorRequest( projectID: projectID,
projectID: projectID, admissionNo: admissionNo,
admissionNo: admissionNo, roomID: roomID,
roomID: roomID, referralClinic: selectedClinicID.toString(),
referralClinic: selectedClinicID.toString(), referralDoctor: selectedDoctorID.toString(),
referralDoctor: selectedDoctorID.toString(), createdBy: doctorID,
createdBy: doctorID, editedBy: doctorID,
editedBy: doctorID, patientID: patientID,
patientID: patientID, patientTypeID: patientTypeID,
patientTypeID: patientTypeID, referringClinic: clinicId,
referringClinic: clinicId, referringDoctor: doctorID,
referringDoctor: doctorID, referringDoctorRemarks: referringDoctorRemarks,
referringDoctorRemarks: referringDoctorRemarks, priority: priority,
priority: priority, frequency: frequency,
frequency: frequency, extension: extension,
extension: extension, tokenID: token);
tokenID: token); await BaseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL,
onSuccess: (dynamic response, int statusCode) {
final response = await AppClient.post(PATIENT_REFER_TO_DOCTOR_URL, // print('Done : \n $res');
body: json.encode(_referToDoctorRequest));
final int statusCode = response.statusCode;
isLoading = false;
if (statusCode < 200 || statusCode >= 400 || json == null) {
isError = true;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
print('Done : \n $res');
Navigator.pop(context); Navigator.pop(context);
} else { },
onFailure: (String error, int statusCode) {
isLoading = false;
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} },
} body: _referToDoctorRequest.toJson());
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
} }

@ -0,0 +1,38 @@
import 'package:doctor_app_flutter/providers/auth_provider.dart';
import 'package:doctor_app_flutter/screens/auth/login_screen.dart';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'config/config.dart';
import 'landing_page.dart';
class RootPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
AuthProvider authProvider = Provider.of(context);
Widget buildRoot() {
switch (authProvider.stutas) {
case APP_STATUS.LOADING:
return Scaffold(
body: Center(
child: DrAppCircularProgressIndeicator(),
),
);
break;
case APP_STATUS.UNAUTHENTICATED:
return Loginsreen();
break;
case APP_STATUS.AUTHENTICATED:
return LandingPage();
break;
}
}
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: buildRoot(),
);
}
}

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/root_page.dart';
import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart';
@ -38,7 +39,8 @@ import './screens/settings/settings_screen.dart';
import 'landing_page.dart'; import 'landing_page.dart';
import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/doctor/doctor_reply_screen.dart';
const String INIT_ROUTE = LOGIN; const String INIT_ROUTE = ROOT;
const String ROOT = 'root';
const String HOME = '/'; const String HOME = '/';
const String LOGIN = 'login'; const String LOGIN = 'login';
const String PROFILE = 'profile'; const String PROFILE = 'profile';
@ -71,6 +73,7 @@ const String BODY_MEASUREMENTS = 'patients/body-measurements';
const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details';
var routes = { var routes = {
ROOT: (_) => RootPage(),
HOME: (_) => LandingPage(), HOME: (_) => LandingPage(),
LOGIN: (_) => Loginsreen(), LOGIN: (_) => Loginsreen(),
PROFILE: (_) => ProfileScreen(), PROFILE: (_) => ProfileScreen(),

@ -307,7 +307,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: DashboardItemIconText( child: DashboardItemIconText(
widget.iconURL + 'search_patient.svg', widget.iconURL + 'search_patient.svg',
"", "",
"Search Medicine", TranslationBase.of(context).searchMedicine,
showBorder: true, showBorder: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
valueFontColor: Colors.black, valueFontColor: Colors.black,
@ -345,7 +345,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: DashboardItemIconText( child: DashboardItemIconText(
widget.iconURL + 'referral.svg', widget.iconURL + 'referral.svg',
"", "",
"My Referral Patient", TranslationBase.of(context).myReferralPatient,
showBorder: true, showBorder: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
valueFontColor: Colors.black, valueFontColor: Colors.black,
@ -380,7 +380,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: DashboardItemIconText( child: DashboardItemIconText(
widget.iconURL + 'referral.svg', widget.iconURL + 'referral.svg',
"", "",
"My Referred Patient", TranslationBase.of(context).myReferredPatient,
showBorder: true, showBorder: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
valueFontColor: Colors.black, valueFontColor: Colors.black,

@ -18,6 +18,7 @@ import '../../lookups/patient_lookup.dart';
import '../../widgets/patients/dynamic_elements.dart'; import '../../widgets/patients/dynamic_elements.dart';
import '../../config/config.dart'; import '../../config/config.dart';
import '../../models/doctor_profile_model.dart'; import '../../models/doctor_profile_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = Helpers(); Helpers helpers = Helpers();
@ -112,7 +113,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: "SEARCH FOR PATIENT", appBarTitle: TranslationBase.of(context).searchPatient,
body: ListView( body: ListView(
children: <Widget>[ children: <Widget>[
RoundedContainer( RoundedContainer(
@ -209,7 +210,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
hintText: 'First Name', hintText: TranslationBase.of(context).firstName,
onSaved: (value) { onSaved: (value) {
value == null value == null
? _patientSearchFormValues.setFirstName = ? _patientSearchFormValues.setFirstName =
@ -229,7 +230,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
hintText: 'Middle Name', hintText: TranslationBase.of(context).middleName,
onSaved: (value) { onSaved: (value) {
value == null value == null
? _patientSearchFormValues.setMiddleName = ? _patientSearchFormValues.setMiddleName =
@ -248,7 +249,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
hintText: 'Last Name', hintText: TranslationBase.of(context).lastName,
onSaved: (value) { onSaved: (value) {
value == null value == null
? _patientSearchFormValues.setLastName = "0" ? _patientSearchFormValues.setLastName = "0"
@ -264,7 +265,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'Phone Number', hintText: TranslationBase.of(context).phoneNumber,
// validator: (value) { // validator: (value) {
// return TextValidator().validateMobile(value); // return TextValidator().validateMobile(value);
// }, // },
@ -287,7 +288,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'Patient ID', hintText: TranslationBase.of(context).patientID,
// //
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
onSaved: (value) { onSaved: (value) {
@ -306,7 +307,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'Patient File', hintText: TranslationBase.of(context).patientFile,
// validator: (value) { // validator: (value) {
// return TextValidator().validateIdNumber(value); // return TextValidator().validateIdNumber(value);
// }, // },
@ -400,7 +401,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
value: true, value: true,
activeColor: Color(0xffFFDDD9), activeColor: Color(0xffFFDDD9),
onChanged: (bool newValue) {}), onChanged: (bool newValue) {}),
AppText('Only Arrived Patient', AppText(
TranslationBase.of(context)
.onlyArrivedPatient,
fontSize: SizeConfig.textMultiplier * 2), fontSize: SizeConfig.textMultiplier * 2),
])), ])),
SizedBox( SizedBox(
@ -419,7 +422,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
title: "Search", title: TranslationBase.of(context).search,
color: Color(0xff58434F), color: Color(0xff58434F),
onPressed: () { onPressed: () {
_validateInputs(); _validateInputs();

@ -102,8 +102,10 @@ class _PatientsScreenState extends State<PatientsScreen> {
} }
}); });
}).catchError((error) { }).catchError((error) {
print(error);
setState(() { setState(() {
_isError = true; _isError = true;
_isLoading = false;
this.error = helpers.generateContactAdminMsg(error); this.error = helpers.generateContactAdminMsg(error);
}); });
}); });

@ -15,6 +15,7 @@ import '../../../util/dr_app_shared_pref.dart';
import '../../../widgets/shared/app_scaffold_widget.dart'; import '../../../widgets/shared/app_scaffold_widget.dart';
import '../../../widgets/shared/app_texts_widget.dart'; import '../../../widgets/shared/app_texts_widget.dart';
import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
import '../../../util/extenstions.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -37,6 +38,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
final _remarksController = TextEditingController(); final _remarksController = TextEditingController();
final _extController = TextEditingController(); final _extController = TextEditingController();
var _isInit = true; var _isInit = true;
bool isValid;
var clinicId; var clinicId;
var doctorId; var doctorId;
@ -49,14 +51,17 @@ class _ReferPatientState extends State<ReferPatientScreen> {
List<String> _priorities = ['Very Urgent', 'Urgent', 'Routine']; List<String> _priorities = ['Very Urgent', 'Urgent', 'Routine'];
int _activePriority = 2; int _activePriority = 2;
FocusNode myFocusNode;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
myFocusNode = FocusNode();
doctorsList = null; doctorsList = null;
patientsProv = Provider.of<PatientsProvider>(context); patientsProv = Provider.of<PatientsProvider>(context);
patientsProv.getClinicsList(); patientsProv.getClinicsList();
patientsProv.getReferralFrequancyList(); patientsProv.getReferralFrequancyList();
} }
_isInit = false; _isInit = false;
} }
@ -70,10 +75,9 @@ class _ReferPatientState extends State<ReferPatientScreen> {
: patientsProv.isError : patientsProv.isError
? DrAppEmbeddedError(error: patientsProv.error) ? DrAppEmbeddedError(error: patientsProv.error)
: patientsProv.clinicsList == null : patientsProv.clinicsList == null
? DrAppEmbeddedError( ? DrAppEmbeddedError(error: 'Something Wrong!')
error: 'Something Wrong!')
: SingleChildScrollView( : SingleChildScrollView(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -128,13 +132,17 @@ class _ReferPatientState extends State<ReferPatientScreen> {
setState(() { setState(() {
_selectedDoctor = null; _selectedDoctor = null;
_selectedClinic = newValue; _selectedClinic = newValue;
var clinicInfo = patientsProv.clinicsList.where((i) => var clinicInfo = patientsProv
.clinicsList
.where((i) =>
i['ClinicDescription'] i['ClinicDescription']
.toString() .toString()
.contains(_selectedClinic)).toList(); .contains(
_selectedClinic))
clinicId = .toList();
clinicInfo[0]['ClinicID'].toString();
clinicId = clinicInfo[0]['ClinicID']
.toString();
patientsProv.getDoctorsList(clinicId); patientsProv.getDoctorsList(clinicId);
}) })
@ -208,15 +216,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
onChanged: (newValue) => { onChanged: (newValue) => {
setState(() { setState(() {
_selectedDoctor = newValue; _selectedDoctor = newValue;
doctorsList = patientsProv.doctorsList; doctorsList =
patientsProv.doctorsList;
var doctorInfo =
doctorsList.where((i) => var doctorInfo = doctorsList
i['DoctorName'] .where((i) => i['DoctorName']
.toString() .toString()
.contains(_selectedDoctor)).toList(); .contains(_selectedDoctor))
doctorId = doctorInfo[0]['DoctorID'].toString(); .toList();
doctorId = doctorInfo[0]['DoctorID']
.toString();
}) })
}, },
items: patientsProv items: patientsProv
@ -320,13 +329,16 @@ class _ReferPatientState extends State<ReferPatientScreen> {
onChanged: (newValue) => { onChanged: (newValue) => {
setState(() { setState(() {
_selectedReferralFrequancy = newValue; _selectedReferralFrequancy = newValue;
var freqInfo = var freqInfo = patientsProv
patientsProv.referalFrequancyList.singleWhere((i) => .referalFrequancyList
i['Description'] .singleWhere((i) => i[
.toString() 'Description']
.contains(_selectedReferralFrequancy)); .toString()
freqId = .contains(
freqInfo['ParameterCode'].toString(); _selectedReferralFrequancy));
freqId = freqInfo['ParameterCode']
.toString();
myFocusNode.requestFocus();
}) })
}, },
items: patientsProv items: patientsProv
@ -357,6 +369,7 @@ class _ReferPatientState extends State<ReferPatientScreen> {
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: AppTextFormField( child: AppTextFormField(
hintText: "Remarks", hintText: "Remarks",
focusNode: myFocusNode,
controller: _remarksController, controller: _remarksController,
inputFormatter: ONLY_LETTERS, inputFormatter: ONLY_LETTERS,
textInputType: TextInputType.text, textInputType: TextInputType.text,
@ -364,14 +377,27 @@ class _ReferPatientState extends State<ReferPatientScreen> {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: AppButton(title: "Send", color: Color(PRIMARY_COLOR),onPressed: ()=>{ child: Column(
referToDoctor(context) children: <Widget>[
},), AppText(
) "Please fill all fields..!",
color: Colors.red,
fontWeight: FontWeight.bold,
margin: 10,
visibility:
isValid == null ? false : !isValid,
),
AppButton(
title: "Send",
color: Color(PRIMARY_COLOR),
onPressed: () => {referToDoctor(context)},
)
],
))
], ],
), ),
), ),
); );
} }
@ -456,21 +482,35 @@ class _ReferPatientState extends State<ReferPatientScreen> {
return time; return time;
} }
void referToDoctor(context){ void referToDoctor(context) {
if (!validation()) {
return;
}
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
patientsProv.referToDoctor(context, patientsProv.referToDoctor(context,
extension: _extController.value.text, extension: _extController.value.text,
admissionNo:int.parse( patient.admissionNo), admissionNo: int.parse(patient.admissionNo),
referringDoctorRemarks: _remarksController.value.text, referringDoctorRemarks: _remarksController.value.text,
frequency: freqId, frequency: freqId,
patientID: patient.patientId, patientID: patient.patientId,
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
priority: (_activePriority + 1).toString(), priority: (_activePriority + 1).toString(),
roomID: patient.roomId, roomID: patient.roomId,
selectedClinicID: clinicId.toString(), selectedClinicID: clinicId.toString(),
selectedDoctorID: doctorId.toString(), selectedDoctorID: doctorId.toString(),
projectID: patient.projectId projectID: patient.projectId);
); }
bool validation() {
setState(() {
isValid = !_extController.value.text.isNullOrEmpty() &&
!_remarksController.value.text.isNullOrEmpty() &&
freqId != null &&
clinicId != null &&
doctorId != null;
});
return isValid;
} }
} }

@ -335,7 +335,7 @@ class Helpers {
return localMsg; return localMsg;
} }
clearSharedPref() async { static clearSharedPref() async {
await sharedPref.clear(); await sharedPref.clear();
} }

@ -71,6 +71,21 @@ class TranslationBase {
String get operations => localizedValues['inPatient'][locale.languageCode]; String get operations => localizedValues['inPatient'][locale.languageCode];
String get patientServices => String get patientServices =>
localizedValues['patientServices'][locale.languageCode]; localizedValues['patientServices'][locale.languageCode];
String get searchMedicine =>
localizedValues['searchMedicine'][locale.languageCode];
String get myReferralPatient =>
localizedValues['myReferralPatient'][locale.languageCode];
String get myReferredPatient =>
localizedValues['myReferredPatient'][locale.languageCode];
String get firstName => localizedValues['firstName'][locale.languageCode];
String get middleName => localizedValues['middleName'][locale.languageCode];
String get lastName => localizedValues['lastName'][locale.languageCode];
String get phoneNumber => localizedValues['phoneNumber'][locale.languageCode];
String get patientID => localizedValues['patientID'][locale.languageCode];
String get patientFile => localizedValues['patientFile'][locale.languageCode];
String get search => localizedValues['search'][locale.languageCode];
String get onlyArrivedPatient =>
localizedValues['onlyArrivedPatient'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -37,8 +37,8 @@ class _LoginFormState extends State<LoginForm> {
String uniqueId = "Unknown"; String uniqueId = "Unknown";
var projectsList = []; var projectsList = [];
bool _isInit = true; bool _isInit = true;
FocusNode focusPass; FocusNode focusPass = FocusNode();
FocusNode focusProject; FocusNode focusProject = FocusNode();
var userInfo = UserModel( var userInfo = UserModel(
UserID: '', UserID: '',
@ -72,8 +72,7 @@ class _LoginFormState extends State<LoginForm> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final focusPass = FocusNode();
final focusProject = FocusNode();
AuthProvider authProv = Provider.of<AuthProvider>(context); AuthProvider authProv = Provider.of<AuthProvider>(context);
@ -100,7 +99,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value.trim(); userInfo.UserID = value.trim();
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).nextFocus(); focusPass.nextFocus();
}, },
autofocus: false, autofocus: false,
), ),
@ -121,7 +120,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.Password = value; userInfo.Password = value;
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).nextFocus(); focusPass.nextFocus();
helpers.showCupertinoPicker( helpers.showCupertinoPicker(
context, projectsList, 'Name', onSelectProject); context, projectsList, 'Name', onSelectProject);
}, },

@ -29,9 +29,28 @@ class _DynamicElementsState extends State<DynamicElements> {
var selectedDate = DateFormat.yMd().format(pickedDate); var selectedDate = DateFormat.yMd().format(pickedDate);
if (id == '_selectedFromDate') { if (id == '_selectedFromDate') {
_fromDateController.text = selectedDate; // _fromDateController.text = selectedDate;
selectedDate = pickedDate.year.toString() +
"-" +
pickedDate.month.toString().padLeft(2, '0') +
"-" +
pickedDate.day.toString().padLeft(2, '0');
_fromDateController.text = selectedDate;
} else { } else {
selectedDate = pickedDate.year.toString() +
"-" +
pickedDate.month.toString().padLeft(2, '0') +
"-" +
pickedDate.day.toString().padLeft(2, '0');
_toDateController.text = selectedDate; _toDateController.text = selectedDate;
// _toDateController.text = selectedDate;
} }
}); });
}); });
@ -72,8 +91,11 @@ class _DynamicElementsState extends State<DynamicElements> {
if (_fromDateController.text.toString().trim().isEmpty) { if (_fromDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.From = "0"; widget._patientSearchFormValues.From = "0";
} else { } else {
widget._patientSearchFormValues.From = widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-");
_fromDateController.text;
// _fromDateController.text;
} }
}, },
), ),
@ -103,7 +125,7 @@ class _DynamicElementsState extends State<DynamicElements> {
if (_toDateController.text.toString().trim().isEmpty) { if (_toDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.To = "0"; widget._patientSearchFormValues.To = "0";
} else { } else {
widget._patientSearchFormValues.To = _toDateController.text; widget._patientSearchFormValues.To = _toDateController.text.replaceAll("/", "-");
} }
}, },
), ),

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -105,7 +106,8 @@ class _AppDrawerState extends State<AppDrawer> {
), ),
InkWell( InkWell(
child: DrawerItem("lOGOUT", Icons.exit_to_app), child: DrawerItem("lOGOUT", Icons.exit_to_app),
onTap: () { onTap: () async {
await Helpers.clearSharedPref();
Navigator.pop(context); Navigator.pop(context);
Navigator.of(context).pushNamed(LOGIN); Navigator.of(context).pushNamed(LOGIN);
}, },

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -13,6 +14,7 @@ class AppScaffold extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
return Scaffold( return Scaffold(
backgroundColor: Hexcolor('#F5F5F5'), backgroundColor: Hexcolor('#F5F5F5'),
appBar: appBarTitle != '' appBar: appBarTitle != ''
@ -35,7 +37,7 @@ class AppScaffold extends StatelessWidget {
IconButton( IconButton(
icon: Icon(DoctorApp.home_icon_active), icon: Icon(DoctorApp.home_icon_active),
color: Colors.white, //Colors.black, color: Colors.white, //Colors.black,
onPressed: () => Navigator.pushReplacementNamed(context, HOME), onPressed: () => Navigator.pushNamedAndRemoveUntil(context, HOME,(r) => false ),
), ),
], ],
) )

@ -18,7 +18,8 @@ class AppTextFormField extends FormField<String> {
TextEditingController controller, TextEditingController controller,
bool autovalidate = true, bool autovalidate = true,
TextInputType textInputType, TextInputType textInputType,
String hintText String hintText,
FocusNode focusNode
}) : super( }) : super(
onSaved: onSaved, onSaved: onSaved,
validator: validator, validator: validator,
@ -27,6 +28,7 @@ class AppTextFormField extends FormField<String> {
return Column( return Column(
children: <Widget>[ children: <Widget>[
TextFormField( TextFormField(
focusNode: focusNode,
keyboardType: textInputType, keyboardType: textInputType,
inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)),], inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)),],
onChanged: onChanged?? (value){ onChanged: onChanged?? (value){

Loading…
Cancel
Save