merge-requests/28/head
her_username 5 years ago
commit ae8a5740f3

@ -0,0 +1,18 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/interceptor/http_interceptor.dart';
import 'package:http/http.dart';
// OWNER : Ibrahim albitar
// DATE : 22-04-2020
// DESCRIPTION : Custom App client to pin base url for all srvices
class AppClient {
static Client client = HttpInterceptor().getClient();
static Future<Response> post(dynamic path, {dynamic body}) async {
String _fullUrl = BASE_URL + path;
final response = await client.post(_fullUrl, body: body);
return response;
}
}

@ -1,2 +1,5 @@
const MAX_SMALL_SCREEN = 660;
const BASE_URL = 'https://hmgwebservices.com/Services/';
const BASE_URL = 'https://hmgwebservices.com/Services/';
const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z]";
const ONLY_DATE = "[0-9/]";

@ -1,3 +1,9 @@
import 'dart:convert';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/providers/auth_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:http/http.dart';
import 'package:http_interceptor/http_interceptor.dart';
import '../providers/auth_provider.dart';
@ -12,8 +18,13 @@ List<String> publicUrls = [
];
class HttpInterceptor extends InterceptorContract {
Client getClient(){
return HttpClientWithInterceptor.build(interceptors: [this]);
}
Future<RequestData> interceptRequest({RequestData data}) async {
// print('RequestData ${data.body}');
print('RequestData ${data.body}');
try {
data.headers["Content-Type"] = "application/json";
data.headers["Accept"] = "application/json";

@ -1,34 +1,25 @@
import 'dart:convert';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart';
import 'package:http_interceptor/http_client_with_interceptor.dart';
import '../config/config.dart';
import '../interceptor/http_interceptor.dart';
import '../models/user_model.dart';
const LOGIN_URL = BASE_URL + 'Sentry.svc/REST/MemberLogIN_New';
const LOGIN_URL =
'Sentry.svc/REST/MemberLogIN_New';
const INSERT_DEVICE_IMEI =
BASE_URL + 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const SELECT_DEVICE_IMEI =
BASE_URL + 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = BASE_URL +
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType';
const MEMBER_CHECK_ACTIVATION_CODE_NEW =
BASE_URL + 'Sentry.svc/REST/MemberCheckActivationCode_New';
const MEMBER_CHECK_ACTIVATION_CODE_NEW ='Sentry.svc/REST/MemberCheckActivationCode_New';
class AuthProvider with ChangeNotifier {
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
Future<Map> login(UserModel userInfo) async {
const url = LOGIN_URL;
try {
final response = await client.post(url,
// headers: requestHeaders,
final response = await AppClient.post(url,
body: json.encode({
"UserID": userInfo.UserID,
"Password": userInfo.Password,
@ -50,7 +41,7 @@ class AuthProvider with ChangeNotifier {
const url = INSERT_DEVICE_IMEI;
try {
final response = await client.post(url, body: json.encode(imei));
final response = await AppClient.post(url, body: json.encode(imei));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
@ -62,7 +53,7 @@ class AuthProvider with ChangeNotifier {
const url = SELECT_DEVICE_IMEI;
try {
final response = await client.post(url, body: json.encode(imei));
final response = await AppClient.post(url, body: json.encode(imei));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
@ -75,8 +66,7 @@ class AuthProvider with ChangeNotifier {
const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE;
try {
final response =
await client.post(url, body: json.encode(activationCodeModel));
final response = await AppClient.post(url, body: json.encode(activationCodeModel));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);
@ -88,8 +78,7 @@ class AuthProvider with ChangeNotifier {
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
try {
final response =
await client.post(url, body: json.encode(activationCodeModel));
final response = await AppClient.post(url, body: json.encode(activationCodeModel));
return Future.value(json.decode(response.body));
} catch (error) {
print(error);

@ -18,7 +18,7 @@ class PatientsProvider with ChangeNotifier {
try {
final response = await client.post(url,
body: json.encode({
"ProjectID": patient.PatientID,
"ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID,
"DoctorID": patient.DoctorID,
"FirstName": patient.FirstName,

@ -1,5 +1,9 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/services.dart';
import '../../config/size_config.dart';
import '../../util/text_validator.dart';
import '../../widgets/shared/app_buttons_widget.dart';
import '../../widgets/shared/app_scaffold_widget.dart';
import '../../widgets/shared/app_text_form_field.dart';
@ -11,6 +15,9 @@ import 'package:flutter/rendering.dart';
import '../../lookups/patient_lookup.dart';
import '../../models/patient_model.dart';
import '../../widgets/patients/dynamic_elements.dart';
import '../../config/config.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
// OWNER : Ibrahim albitar
// DATE : 19-04-2020
@ -29,9 +36,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
bool _autoValidate = false;
var _patientSearchFormValues = PatientModel(
ProjectID: 12,
ClinicID: 17,
DoctorID: 98129,
ProjectID: 15,
ClinicID: 0,
DoctorID: 4709,
FirstName: "0",
MiddleName: "0",
LastName: "0",
@ -50,18 +57,31 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
IsLoginForDoctorApp: true,
PatientOutSA: false);
void _validateInputs() {
if (_formKey.currentState.validate()) {
print("####IBRAHIM TEST#####"+_patientSearchFormValues.From);
// _patientSearchFormValues.TokenID =
if (_formKey.currentState.validate()) {
// If all data are correct then save data to out variables
_formKey.currentState.save();
} else {
_formKey.currentState.save();
sharedPref.getString(TOKEN).then((token) {
print(token+"EEEEEE");
_patientSearchFormValues.TokenID = token;
_patientSearchFormValues.ProjectID= 15;
print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf");
Navigator.of(context).pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType
});
});
} else {
// If all data are not valid then start auto validation.
setState(() {
_autoValidate = true;
});
setState(() {
_autoValidate = true;
});
}
}
}
@override
Widget build(BuildContext context) {
@ -154,9 +174,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
onSaved: (value) {
_patientSearchFormValues.FirstName = value;
},
validator: (value) {
return TextValidator().validateName(value);
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS
),
SizedBox(
height: 10,
@ -166,9 +187,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
onSaved: (value) {
_patientSearchFormValues.MiddleName = value;
},
validator: (value) {
return TextValidator().validateName(value);
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS
),
SizedBox(
height: 10,
@ -178,9 +200,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
onSaved: (value) {
_patientSearchFormValues.LastName = value;
},
validator: (value) {
return TextValidator().validateName(value);
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS
),
SizedBox(
height: 10,
@ -188,9 +211,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField(
textInputType: TextInputType.number,
hintText: 'Phone Number',
validator: (value) {
return TextValidator().validateMobile(value);
},
// validator: (value) {
// return TextValidator().validateMobile(value);
// },
inputFormatter: ONLY_NUMBERS,
onSaved: (value) {
_patientSearchFormValues.PatientMobileNumber =
value;
@ -202,12 +226,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField(
textInputType: TextInputType.number,
hintText: 'Patiant ID',
validator: (value) {
return TextValidator().validateIdNumber(value);
},
//
inputFormatter: ONLY_NUMBERS,
onSaved: (value) {
_patientSearchFormValues.PatientID =
89000;
_patientSearchFormValues.PatientID = 89000;
}),
SizedBox(
height: 10,
@ -215,9 +237,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField(
textInputType: TextInputType.number,
hintText: 'Patiant File',
validator: (value) {
return TextValidator().validateIdNumber(value);
},
// validator: (value) {
// return TextValidator().validateIdNumber(value);
// },
inputFormatter: ONLY_NUMBERS,
onSaved: (value) {
//_patientSearchFormValues. = value;
},

@ -16,17 +16,21 @@ class _PatientsListScreenState extends State<PatientsListScreen> {
void didChangeDependencies() {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatientModel patient = routeArgs['patientSearchForm'];
print(patient.TokenID+"EEEEEE");
String patientType = routeArgs['selectedType'];
print(patientType);
if (_isInit) {
// setState(() {});
PatientsProvider patientsProv = Provider.of<PatientsProvider>(context);
patientsProv.getPatientList(patient, patientType).then((res) {
// print('MessageStatus${res['MessageStatus']}');
print('List_MyInPatient${(res['List_MyInPatient'][0])}');
setState(() {
_isLoading = false;
_hasError = res['ErrorEndUserMessage'];
});
print(res);
}).catchError((error) {
print(error);
});

@ -1,7 +1,7 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/models/patient_model.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:flutter/material.dart';
import '../../util/text_validator.dart';
import 'package:intl/intl.dart';
class DynamicElements extends StatefulWidget {
@ -51,14 +51,15 @@ class _DynamicElementsState extends State<DynamicElements> {
textInputType: TextInputType.number,
hintText: 'From',
controller: _fromDateController,
validator: (value) {
return TextValidator().validateDate(_fromDateController.text);
},
// validator: (value) {
// return TextValidator().validateDate(_fromDateController.text);
// },
inputFormatter: ONLY_DATE,
onTap: () {
_presentDatePicker('_selectedFromDate');
},
onSaved: (value) {
widget._patientSearchFormValues.From = value;
widget._patientSearchFormValues.From = _fromDateController.text;
},
),
@ -72,11 +73,12 @@ class _DynamicElementsState extends State<DynamicElements> {
onTap: () {
_presentDatePicker('_selectedToDate');
},
validator: (value) {
return TextValidator().validateDate(_toDateController.text);
},
// validator: (value) {
// return TextValidator().validateDate(_toDateController.text);
// },
inputFormatter: ONLY_DATE,
onSaved: (value) {
widget._patientSearchFormValues.To = value;
widget._patientSearchFormValues.To = _toDateController.text;
},
),
],

@ -1,6 +1,7 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
// OWNER : Ibrahim albitar
// DATE : 19-04-2020
@ -10,6 +11,7 @@ class AppTextFormField extends FormField<String> {
AppTextFormField({
FormFieldSetter<String> onSaved,
String inputFormatter,
FormFieldValidator<String> validator,
ValueChanged<String> onChanged,
GestureTapCallback onTap,
@ -26,6 +28,7 @@ class AppTextFormField extends FormField<String> {
children: <Widget>[
TextFormField(
keyboardType: textInputType,
inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)),],
onChanged: onChanged?? (value){
state.didChange(value);
},

Loading…
Cancel
Save