EReferral fixes

merge-update-with-lab-changes
Haroon Amjad 4 years ago
parent abcb71e86e
commit 062ca5c11c

@ -1077,6 +1077,7 @@ const Map localizedValues = {
"referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"},
"patientName": {"en": "Patient Name", "ar": "اسم المريض"},
"referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"},
"referralDetails": {"en": "Referral Details", "ar": "تفاصيل الإحالة"},
"requestID": {"en": "Req ID", "ar": " رقم الطلب"},
"OrderStatus": {"en": "Status", "ar": "الحاله"},
"pickupDate": {"en": "Pickup Date", "ar": "التاريخ"},
@ -1519,4 +1520,10 @@ const Map localizedValues = {
"callDuration": { "en": "Call Duration", "ar": "مدة الاتصال" },
"alreadyRated": { "en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً" },
"insuranceCompany": { "en": "Insurance Company", "ar": "شركة تأمين" },
"preferredBranch": {"en": "Preferred Branch", "ar": "الفرع المفضل"},
"selectPreferredBranch": {"en": "Select Preferred Branch", "ar": "اختر الفرع المفضل"},
"patientLocated": {"en": "Where the patient located", "ar": "اين موقع المريض"},
"otherInfo": {"en": "Other details", "ar": "تفاصيل أخرى"},
"medicalReport": {"en": "Medical Report", "ar": "تقرير طبي"},
"insuredPatient": {"en": "Insured Patient", "ar": "هل لدى المريض تامين؟"},
};

@ -1,60 +1,131 @@
class SearchEReferralResponseModel {
String patientMobileNumber;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
Null sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
dynamic acceptedBrachCode;
dynamic acceptedBranchName;
dynamic acceptedBranchNameAr;
dynamic channel;
dynamic identityCardAttachment;
String identityNumber;
dynamic insuranceCardAttachment;
bool isInsuredPatient;
List<dynamic> medicalReportAttachment;
String otherRelationship;
String patientContactNo;
int patientId;
String patientName;
int preferredBranchCode;
String preferredBranchName;
String referralDate;
int referralNumber;
String identificationNo;
RelationshipType relationshipType;
String requesterContactNo;
String requesterName;
String status;
String statusAr;
SearchEReferralResponseModel(
{this.patientMobileNumber,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.referralNumber,
this.identificationNo});
{this.acceptedBrachCode,
this.acceptedBranchName,
this.acceptedBranchNameAr,
this.channel,
this.identityCardAttachment,
this.identityNumber,
this.insuranceCardAttachment,
this.isInsuredPatient,
this.medicalReportAttachment,
this.otherRelationship,
this.patientContactNo,
this.patientId,
this.patientName,
this.preferredBranchCode,
this.preferredBranchName,
this.referralDate,
this.referralNumber,
this.relationshipType,
this.requesterContactNo,
this.requesterName,
this.status,
this.statusAr});
SearchEReferralResponseModel.fromJson(Map<String, dynamic> json) {
patientMobileNumber = json['PatientMobileNumber'];
versionID = json['VersionID'];
acceptedBrachCode = json['AcceptedBrachCode'];
acceptedBranchName = json['AcceptedBranchName'];
acceptedBranchNameAr = json['AcceptedBranchNameAr'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
identityCardAttachment = json['IdentityCardAttachment'];
identityNumber = json['IdentityNumber'];
insuranceCardAttachment = json['InsuranceCardAttachment'];
isInsuredPatient = json['IsInsuredPatient'];
otherRelationship = json['OtherRelationship'];
patientContactNo = json['PatientContactNo'];
patientId = json['PatientId'];
patientName = json['PatientName'];
preferredBranchCode = json['PreferredBranchCode'];
preferredBranchName = json['PreferredBranchName'];
referralDate = json['ReferralDate'];
referralNumber = json['ReferralNumber'];
identificationNo = json['IdentificationNo'];
relationshipType = json['RelationshipType'] != null
? new RelationshipType.fromJson(json['RelationshipType'])
: null;
requesterContactNo = json['RequesterContactNo'];
requesterName = json['RequesterName'];
status = json['Status'];
statusAr = json['StatusAr'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMobileNumber'] = this.patientMobileNumber;
data['VersionID'] = this.versionID;
data['AcceptedBrachCode'] = this.acceptedBrachCode;
data['AcceptedBranchName'] = this.acceptedBranchName;
data['AcceptedBranchNameAr'] = this.acceptedBranchNameAr;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['IPAdress'] = this.iPAdress;
data['generalid'] = this.generalid;
data['PatientOutSA'] = this.patientOutSA;
data['SessionID'] = this.sessionID;
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
data['DeviceTypeID'] = this.deviceTypeID;
data['IdentityCardAttachment'] = this.identityCardAttachment;
data['IdentityNumber'] = this.identityNumber;
data['InsuranceCardAttachment'] = this.insuranceCardAttachment;
data['IsInsuredPatient'] = this.isInsuredPatient;
if (this.medicalReportAttachment != null) {
data['MedicalReportAttachment'] =
this.medicalReportAttachment.map((v) => v.toJson()).toList();
}
data['OtherRelationship'] = this.otherRelationship;
data['PatientContactNo'] = this.patientContactNo;
data['PatientId'] = this.patientId;
data['PatientName'] = this.patientName;
data['PreferredBranchCode'] = this.preferredBranchCode;
data['PreferredBranchName'] = this.preferredBranchName;
data['ReferralDate'] = this.referralDate;
data['ReferralNumber'] = this.referralNumber;
data['IdentificationNo'] = this.identificationNo;
if (this.relationshipType != dynamic) {
data['RelationshipType'] = this.relationshipType.toJson();
}
data['RequesterContactNo'] = this.requesterContactNo;
data['RequesterName'] = this.requesterName;
data['Status'] = this.status;
data['StatusAr'] = this.statusAr;
return data;
}
}
class RelationshipType {
int iD;
String text;
String textAr;
String textEn;
RelationshipType({this.iD, this.text, this.textAr, this.textEn});
RelationshipType.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
text = json['Text'];
textAr = json['Text_Ar'];
textEn = json['Text_En'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ID'] = this.iD;
data['Text'] = this.text;
data['Text_Ar'] = this.textAr;
data['Text_En'] = this.textEn;
return data;
}
}

@ -7,14 +7,18 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:flutter/material.dart';
class EReferralService extends BaseService {
List<GetAllRelationshipTypeResponseModel> _relationTypes = List();
List<GetAllRelationshipTypeResponseModel> get relationTypes => _relationTypes;
List<GetAllCitiesResponseModel> _allCities = List();
List<GetAllCitiesResponseModel> get allCities => _allCities;
List<SearchEReferralResponseModel> _allReferral = List();
List<SearchEReferralResponseModel> get allReferral => _allReferral;
String _activationCode;
String _logInTokenID;
@ -39,22 +43,34 @@ class EReferralService extends BaseService {
}, body: {});
}
Future<Map> getProjectsList(context) async {
Map<String, dynamic> request;
request = {};
dynamic localRes;
await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future getAllCities() async {
await baseAppClient.post(GET_ALL_CITIES,
onSuccess: (dynamic response, int statusCode) {
_allCities.clear();
response['ListCities'].forEach((city) {
_allCities
.add(GetAllCitiesResponseModel.fromJson(city));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {});
_allCities.clear();
response['ListCities'].forEach((city) {
_allCities.add(GetAllCitiesResponseModel.fromJson(city));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {});
}
Future sendActivationCodeForEReferral(
SendActivationCodeForEReferralRequestModel
sendActivationCodeForEReferralRequestModel) async {
hasError = false;
@ -62,24 +78,21 @@ class EReferralService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_activationCode = response["VerificationCode"];
_logInTokenID = response["LogInTokenID"];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: sendActivationCodeForEReferralRequestModel.toJson());
}
Future checkActivationCodeForEReferral(
CheckActivationCodeForEReferralResponseModel
checkActivationCodeForEReferralRequestModel) async {
checkActivationCodeForEReferralRequestModel.isDentalAllowedBackend = false;
checkActivationCodeForEReferralRequestModel.logInTokenID= _logInTokenID;
hasError =false;
checkActivationCodeForEReferralRequestModel.logInTokenID = _logInTokenID;
hasError = false;
await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL,
onSuccess: (dynamic response, int statusCode) {
_isActivationCodeValid = true;
_isActivationCodeValid = true;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -87,39 +100,33 @@ class EReferralService extends BaseService {
}
Future createEReferral(
CreateEReferralRequestModel createEReferralRequestModel
) async {
hasError = false;
await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/,
CreateEReferralRequestModel createEReferralRequestModel) async {
hasError = false;
await baseAppClient.post(
CREATE_E_REFERRAL /*'Services/Patients.svc/REST/CreateEReferral'*/,
onSuccess: (dynamic response, int statusCode) {
// TODO Waiting for fix service
var asd= ("EEEEEE");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: createEReferralRequestModel.toJson());
// TODO Waiting for fix service
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: createEReferralRequestModel.toJson());
}
Future getEReferrals(
SearchEReferralRequestModel searchEReferralRequestModel
) async {
SearchEReferralRequestModel searchEReferralRequestModel) async {
_allReferral.clear();
hasError = false;
// TODO return this code when the fix the server
// await baseAppClient.post(GET_E_REFERRALS,
// onSuccess: (dynamic response, int statusCode) {
// print("EEEEEE");
// // TODO Waiting for fix service
// // ToDo change this one when you have data
// _allReferral.clear();
// // response['ListCities'].forEach((city) {
// // _allReferral
// // .add(SearchEReferralResponseModel.fromJson(city));
// // });
//
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: searchEReferralRequestModel.toJson());
await baseAppClient.post(GET_E_REFERRALS,
onSuccess: (dynamic response, int statusCode) {
_allReferral.clear();
response['List_EReferrals'].forEach((referral) {
_allReferral
.add(SearchEReferralResponseModel.fromJson(referral));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: searchEReferralRequestModel.toJson());
}
}

@ -44,6 +44,10 @@ class EReferralViewModel extends BaseViewModel {
}
}
void getAllProjects() async {
}
void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async {
setState(ViewState.BusyLocal);
await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel);

@ -43,7 +43,7 @@ class _StartIndexForNewEReferralState extends State<StartIndexForNewEReferral>
body: SafeArea(
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 0.9,
height: MediaQuery.of(context).size.height * 0.78,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart';
@ -14,22 +15,26 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class NewEReferralStepOnePage extends StatefulWidget {
final CreateEReferralRequestModel createEReferralRequestModel;
final Function changePageViewIndex;
const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key);
const NewEReferralStepOnePage(
{Key key, this.createEReferralRequestModel, this.changePageViewIndex})
: super(key: key);
@override
_NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState();
_NewEReferralStepOnePageState createState() =>
_NewEReferralStepOnePageState();
}
class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
@ -47,7 +52,7 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
dynamic _selectedCountry = {
"name": "Saudi Arabia",
"name_ar": "المملكة العربية السعودية",
"code": "+966",
"code": "966",
"countryCode": "SA",
"pattern": "5xxxxxxxx",
"maxLength": 9
@ -63,32 +68,41 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
void showSMSDialog() {
showDialog(
context: context,
barrierDismissible: false,
child: EReferralConfirmSMSDialog(
phoneNumber: _selectedCountry['code']+_mobileTextController.text,
onSucces: (){
Navigator.of(context).pop();
widget.changePageViewIndex(1);
widget.createEReferralRequestModel.requesterName=_nameTextController.text;
widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text;
widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD;
}
),
).then((value) {
print("dialog dismissed");
print(value);
if (value != null && value) {
}
});
void showSMSDialog(EReferralViewModel model) {
SMSOTP(
context,
1,
_selectedCountry['code'] + _mobileTextController.text,
(value) {
submit(model, value);
},
() => {
Navigator.pop(context),
},
).displayDialog(context);
// showDialog(
// context: context,
// barrierDismissible: false,
// child: EReferralConfirmSMSDialog(
// phoneNumber: _selectedCountry['code'] + _mobileTextController.text,
// onSucces: () {
// Navigator.of(context).pop();
// widget.changePageViewIndex(1);
// widget.createEReferralRequestModel.requesterName =
// _nameTextController.text;
// widget.createEReferralRequestModel.requesterContactNo =
// _selectedCountry['code'].toString().substring(1) +
// _mobileTextController.text;
// widget.createEReferralRequestModel.requesterRelationship =
// _selectedRelation.iD;
// }),
// ).then((value) {
// print("dialog dismissed");
// print(value);
// if (value != null && value) {}
// });
}
return BaseView<EReferralViewModel>(
onModelReady: (model) => model.getRelationTypes(),
builder: (_, model, widget) => AppScaffold(
@ -98,126 +112,142 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
child: Container(
margin: EdgeInsets.all(12),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 20,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 20,
),
Center(
child: Texts(
TranslationBase.of(context)
.referralRequesterInformation,
),
Center(
child: Texts(
TranslationBase.of(context)
.referralRequesterInformation,
textAlign: TextAlign.center,
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context)
.enterReferralRequesterName,
controller: _nameTextController,
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectCountryTypeDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getCountryName()),
Icon(Icons.arrow_drop_down)
],
),
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase
.of(context)
.enterReferralRequesterName,
controller: _nameTextController,
),
SizedBox(
height: 12,
),
SizedBox(
height: 12,
),
MobileNumberTextFiled(
controller: _mobileTextController,
code: _selectedCountry == null
? "11"
: _selectedCountry["code"],
),
SizedBox(
height: 12,
),
Center(
child: Texts(
TranslationBase.of(context).requesterRelationship,
textAlign: TextAlign.center,
),
InkWell(
onTap: () => confirmSelectCountryTypeDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getCountryName()),
Icon(Icons.arrow_drop_down)
],
),
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectRelationTypeDialog(
model.relationTypes),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getRelationName()),
Icon(Icons.arrow_drop_down)
],
),
),
SizedBox(
height: 12,
),
MobileNumberTextFiled(
controller: _mobileTextController,
code: _selectedCountry == null
? "11"
: _selectedCountry["code"],
),
SizedBox(
height: 12,
),
Center(
child: Texts(
TranslationBase.of(context).requesterRelationship,
textAlign: TextAlign.center,
),
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectRelationTypeDialog(
model.relationTypes),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getRelationName()),
Icon(Icons.arrow_drop_down)
],
),
),
),
],
),
),
],
),
),
),
),
bottomSheet: Container(
height: MediaQuery
.of(context)
.size
.height * 0.1,
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(9),
child: SecondaryButton(
textColor: Colors.white,
label: "Next",
onTap: () async {
SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel =
SendActivationCodeForEReferralRequestModel(
zipCode: _selectedCountry['code'],
patientMobileNumber: int.parse(
_mobileTextController.text),);
await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel);
child: DefaultButton(
TranslationBase.of(context).next,
(_nameTextController.text.isEmpty ||
_selectedRelation == null ||
_mobileTextController.text.isEmpty)
? null
: () async {
SendActivationCodeForEReferralRequestModel
sendActivationCodeForEReferralRequestModel =
SendActivationCodeForEReferralRequestModel(
zipCode: _selectedCountry['code'],
patientMobileNumber:
int.parse(_mobileTextController.text),
);
await model.sendActivationCodeForEReferral(
sendActivationCodeForEReferralRequestModel);
showSMSDialog();
},
loading: model.state == ViewState.BusyLocal,
disabled:
_nameTextController.text.isEmpty ||
_selectedRelation == null ||
_mobileTextController.text.isEmpty,
showSMSDialog(model);
},
disabledColor: Colors.grey,
),
)));
}
void submit(EReferralViewModel model, code) async {
final activationCode = code;
// ToDo call service
CheckActivationCodeForEReferralResponseModel
checkActivationCodeForEReferralRequestModel =
new CheckActivationCodeForEReferralResponseModel(
activationCode: activationCode);
await model.checkActivationCodeForEReferral(
checkActivationCodeForEReferralRequestModel);
if (model.state == ViewState.ErrorLocal) {
// Utils.showErrorToast(model.error);
} else {
Navigator.of(context).pop();
widget.changePageViewIndex(1);
widget.createEReferralRequestModel.requesterName =
_nameTextController.text;
widget.createEReferralRequestModel.requesterContactNo =
_selectedCountry['code'].toString().substring(1) +
_mobileTextController.text;
widget.createEReferralRequestModel.requesterRelationship =
_selectedRelation.iD;
}
}
void confirmSelectRelationTypeDialog(
@ -252,36 +282,29 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
String getRelationName() {
if (_selectedRelation != null) {
if(projectViewModel.isArabic) {
if (projectViewModel.isArabic) {
return _selectedRelation.textAr;
}
return _selectedRelation.textEn;
}
else
return TranslationBase.of(context).selectRelationship;
} else
return TranslationBase.of(context).selectRelationship;
}
String getCountryName() {
if (_selectedCountry != null) {
if(projectViewModel.isArabic) {
if (projectViewModel.isArabic) {
return _selectedCountry["name_ar"];
}
return _selectedCountry["name"];
}
else
} else
return "Country";
}
}
class MobileNumberTextFiled extends StatelessWidget {
const MobileNumberTextFiled({
Key key,
this.controller,
this.code, this.onChange
}) : super(key: key);
const MobileNumberTextFiled(
{Key key, this.controller, this.code, this.onChange})
: super(key: key);
final TextEditingController controller;
final String code;
@ -293,9 +316,7 @@ class MobileNumberTextFiled extends StatelessWidget {
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), color: Colors.white),
child: Row(
textDirection: TextDirection.ltr,
children: <Widget>[
child: Row(textDirection: TextDirection.ltr, children: <Widget>[
Expanded(
flex: 1,
child: Icon(

@ -3,14 +3,19 @@ import 'dart:io';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -19,6 +24,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../dialogs/select_city_dialog.dart';
class NewEReferralStepThreePage extends StatefulWidget {
final CreateEReferralRequestModel createEReferralRequestModel;
final Function changePageViewIndex;
@ -41,10 +47,15 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
List<EReferralAttachment> medicalReportImages = [];
List<EReferralAttachment> insuredPatientImages = [];
List<HospitalsModel> projectsList = [];
bool isPatientInsured = false;
AppSharedPreferences sharedPref = AppSharedPreferences();
AuthenticatedUser authUser;
final GlobalKey projectDropdownKey = GlobalKey();
String projectDropdownValue;
@override
void initState() {
super.initState();
@ -53,6 +64,9 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
@override
Widget build(BuildContext context) {
return BaseView<EReferralViewModel>(
onModelReady: (model) {
getAllProjects();
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
@ -71,8 +85,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
),
Center(
child: Texts(
// TranslationBase.of(context).advancePaymentLabel,
"Other details",
TranslationBase.of(context).otherInfo,
textAlign: TextAlign.center,
),
),
@ -94,7 +107,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
padding: const EdgeInsets.symmetric(
horizontal: 9),
child: Texts(
"Medical Report",
TranslationBase.of(context).medicalReport,
color: Colors.grey,
fontSize: 17,
),
@ -103,18 +116,21 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
),
InkWell(
onTap: () {
ImageOptions.showImageOptions(context,
(String image,File file) {
setState(() {
EReferralAttachment eReferralAttachment =
new EReferralAttachment(
fileName:
'image ${medicalReportImages.length + 1}.png',
base64String: image);
medicalReportImages
.add(eReferralAttachment);
});
}, );
ImageOptions.showImageOptions(
context,
(String image, File file) {
setState(() {
EReferralAttachment
eReferralAttachment =
new EReferralAttachment(
fileName:
'image ${medicalReportImages.length + 1}.png',
base64String: image);
medicalReportImages
.add(eReferralAttachment);
});
},
);
},
child: Container(
margin: EdgeInsets.only(
@ -135,7 +151,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
children: <Widget>[
Icon(Icons.attach_file),
Texts(
'selected attachment',
TranslationBase.of(context).selectAttachment,
variant: 'bodyText',
textAlign: TextAlign.center,
),
@ -199,40 +215,73 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
color: Colors.white),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 9),
child: Texts(
"Preferred Branch",
color: Colors.grey,
fontSize: 17,
),
),
],
),
InkWell(
onTap: () =>
confirmSelectCityDialog(model.allCities),
child: Container(
padding: EdgeInsets.all(12),
Container(
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
decoration: containerRadius(Colors.white, 12),
margin: EdgeInsets.only(left: 20, right: 20),
padding: EdgeInsets.only(
left: 10, right: 10, top: 12, bottom: 12),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(getRelationName()),
Icon(Icons.arrow_drop_down)
Flexible(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context)
.preferredBranch,
style: TextStyle(
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container(
height: 18,
child:
DropdownButtonHideUnderline(
child: DropdownButton<String>(
key: projectDropdownKey,
hint: Text(TranslationBase.of(
context)
.selectPreferredBranch),
value: projectDropdownValue,
iconSize: 0,
isExpanded: true,
style: TextStyle(
fontSize: 14,
letterSpacing: -0.56,
color: Colors.black),
items:
projectsList.map((item) {
return new DropdownMenuItem<
String>(
value: item.mainProjectID
.toString() +
"," +
item.name.toString(),
child:
new Text(item.name),
);
}).toList(),
onChanged: (newValue) {
setState(() {
projectDropdownValue =
newValue;
print(
projectDropdownValue);
});
},
),
),
),
],
),
),
Icon(Icons.keyboard_arrow_down),
],
),
),
),
)),
],
),
),
@ -261,7 +310,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
Padding(
padding: const EdgeInsets.all(20.0),
child: Texts(
"Insured Patient",
TranslationBase.of(context).insuredPatientReferral,
fontSize: 17,
),
),
@ -289,7 +338,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
InkWell(
onTap: () {
ImageOptions.showImageOptions(context,
(String image,File file) {
(String image, File file) {
setState(() {
EReferralAttachment
eReferralAttachment =
@ -387,49 +436,116 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.1,
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(9),
child: SecondaryButton(
textColor: Colors.white,
label: "Submit",
onTap: () async {
this
.widget
.createEReferralRequestModel
.medicalReportAttachment = medicalReportImages;
this
.widget
.createEReferralRequestModel
.insuranceCardAttachment =
insuredPatientImages.length != 0
? insuredPatientImages[0]
: null;
this.widget.createEReferralRequestModel.isInsuredPatient =
isPatientInsured;
// ToDo make the preferred Branch info dynamic
this.widget.createEReferralRequestModel.preferredBranchCode =
15;
this.widget.createEReferralRequestModel.preferredBranchName =
"Arryan Hospital";
this.widget.createEReferralRequestModel.otherRelationship =
"";
await model
.createEReferral(this.widget.createEReferralRequestModel);
if(model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else{
AppToast.showSuccessToast(message: "Referral sent successfully");
}
},
loading: model.state == ViewState.BusyLocal,
disabled: medicalReportImages.length == 0,
child: DefaultButton(
TranslationBase.of(context).submit,
medicalReportImages.length == 0
? null
: () async {
this
.widget
.createEReferralRequestModel
.medicalReportAttachment = medicalReportImages;
this
.widget
.createEReferralRequestModel
.insuranceCardAttachment =
insuredPatientImages.length != 0
? insuredPatientImages[0]
: null;
this
.widget
.createEReferralRequestModel
.isInsuredPatient = isPatientInsured;
// ToDo make the preferred Branch info dynamic
this
.widget
.createEReferralRequestModel
.preferredBranchCode =
num.tryParse(projectDropdownValue.split(",")[0]);
this
.widget
.createEReferralRequestModel
.preferredBranchName =
projectDropdownValue.split(",")[1];
this
.widget
.createEReferralRequestModel
.otherRelationship = "";
await model.createEReferral(
this.widget.createEReferralRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(
message: "Referral sent successfully");
}
},
disabledColor: Colors.grey,
color: Color(0xff359846),
),
// SecondaryButton(
// textColor: Colors.white,
// label: "Submit",
// onTap: () async {
// this
// .widget
// .createEReferralRequestModel
// .medicalReportAttachment = medicalReportImages;
// this
// .widget
// .createEReferralRequestModel
// .insuranceCardAttachment =
// insuredPatientImages.length != 0
// ? insuredPatientImages[0]
// : null;
// this.widget.createEReferralRequestModel.isInsuredPatient =
// isPatientInsured;
// // ToDo make the preferred Branch info dynamic
// this.widget.createEReferralRequestModel.preferredBranchCode =
// 15;
// this.widget.createEReferralRequestModel.preferredBranchName =
// "Arryan Hospital";
// this.widget.createEReferralRequestModel.otherRelationship =
// "";
//
// await model
// .createEReferral(this.widget.createEReferralRequestModel);
// if(model.state == ViewState.ErrorLocal) {
// Utils.showErrorToast(model.error);
// } else{
// AppToast.showSuccessToast(message: "Referral sent successfully");
// }
// },
// loading: model.state == ViewState.BusyLocal,
// disabled: medicalReportImages.length == 0,
// ),
)));
}
void getAllProjects() {
ClinicListService service = new ClinicListService();
List<HospitalsModel> projectsListLocal = [];
service.getProjectsList(context).then((res) {
if (res['MessageStatus'] == 1) {
setState(() {
res['ListProject'].forEach((v) {
projectsListLocal.add(new HospitalsModel.fromJson(v));
});
projectsList = projectsListLocal;
});
// isProjectLoaded = true;
} else {
// isProjectLoaded = false;
}
}).catchError((err) {
print(err);
});
}
void confirmSelectCityDialog(List<GetAllCitiesResponseModel> cities) {
showDialog(
context: context,

@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dial
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -73,8 +75,8 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
),
Center(
child: Texts(
// TranslationBase.of(context).advancePaymentLabel,
"Patient information",
TranslationBase.of(context).patientInfo,
// "Patient information",
textAlign: TextAlign.center,
),
),
@ -82,7 +84,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
height: 12,
),
NewTextFields(
hintText: "Enter Identification Number",
hintText: TranslationBase.of(context).enterIdentificationNumber,
controller: _patientIdentificationTextController,
keyboardType:TextInputType.number ,
),
@ -90,7 +92,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
height: 12,
),
NewTextFields(
hintText: "Enter Patient Name",
hintText: TranslationBase.of(context).patientName,
controller: _patientNameTextController,
),
SizedBox(
@ -128,8 +130,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
),
Center(
child: Texts(
// TranslationBase.of(context).advancePaymentLabel,
"Where the patient located",
TranslationBase.of(context).patientLocated,
textAlign: TextAlign.center,
),
),
@ -169,30 +170,22 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
),
),
bottomSheet: Container(
height: MediaQuery
.of(context)
.size
.height * 0.1,
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(9),
child: SecondaryButton(
textColor: Colors.white,
label: "Next",
onTap: () async {
this.widget.changePageViewIndex(2);
this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text);
this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text;
this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text;
this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString();
this.widget.createEReferralRequestModel.cityName = _selectedCity.description;
},
loading: model.state == ViewState.BusyLocal,
disabled:
_patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty||
_selectedCity == null ||
_mobileTextController.text.isEmpty,
child: DefaultButton(
TranslationBase.of(context).next,
(_patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty||
_selectedCity == null ||
_mobileTextController.text.isEmpty) ? null : () {
this.widget.changePageViewIndex(2);
this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text);
this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text;
this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text;
this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString();
this.widget.createEReferralRequestModel.cityName = _selectedCity.description;
},
disabledColor: Colors.grey,
),
)));
@ -233,7 +226,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
if (_selectedCity != null)
return _selectedCity.description;
else
return "Select City" /*TranslationBase.of(context).selectHospital*/;
return TranslationBase.of(context).selectCity /*TranslationBase.of(context).selectHospital*/;
}
String getCountryName() {
@ -282,7 +275,7 @@ class MobileNumberTextFiled extends StatelessWidget {
controller: controller,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
border: InputBorder.none, hintText: 'Mobile No'),
border: InputBorder.none, hintText: TranslationBase.of(context).mobileNumber),
),
),
)

@ -333,8 +333,6 @@ class _EReferralConfirmSMSDialogState extends State<EReferralConfirmSMSDialog> {
if (verifyAccountForm.currentState.validate()) {
final activationCode =
digit1.text + digit2.text + digit3.text + digit4.text;
// ToDo call service
CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel= new CheckActivationCodeForEReferralResponseModel(activationCode: activationCode);
await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel);

@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class EReferralPage extends StatefulWidget {
@override
@ -34,9 +36,13 @@ class _EReferralPageState extends State<EReferralPage>
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<EReferralViewModel>(
onModelReady: (model) => model.getAllCities(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).ereferral,
description: TranslationBase.of(context).eReferralInfo,
imagesInfo: [
@ -47,90 +53,45 @@ class _EReferralPageState extends State<EReferralPage>
'https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png',
)
],
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0),
child: Stack(
children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
),
),
),
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.7),
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
indicatorColor: Colors.red[800],
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child: Texts(
TranslationBase.of(context).newReferral,
textAlign: TextAlign.center,
),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.37,
child: Center(
child: Texts(
TranslationBase.of(context).searchForReferrals,
textAlign: TextAlign.center,
),
),
),
],
),
),
),
),
body: Column(
children: [
TabBar(
isScrollable: false,
controller: _tabController,
indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Color(0xff2B353E),
unselectedLabelColor: Color(0xff575757),
labelPadding:
EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
tabs: [
Text(TranslationBase.of(context).newReferral),
Text(TranslationBase.of(context).searchForReferrals),
],
),
),
body: Column(
children: <Widget>[
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
StartIndexForNewEReferral(),
SearchForReferralsPage()
],
),
)
],
),
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
StartIndexForNewEReferral(),
SearchForReferralsPage()
],
),
)
],
),
),
);

@ -0,0 +1,164 @@
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ReferralDetails extends StatefulWidget {
final SearchEReferralResponseModel referral;
const ReferralDetails({Key key, @required this.referral}) : super(key: key);
@override
_ReferralDetailsState createState() => _ReferralDetailsState();
}
class _ReferralDetailsState extends State<ReferralDetails> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).ereferral,
body: Column(
children: [
Container(
width: double.infinity,
child: Card(
elevation: 3.0,
shape: cardRadius(12),
margin:
EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(bottom: 10.0),
child: Text(
TranslationBase.of(context).referralDetails,
style: TextStyle(
letterSpacing: -0.64,
color: Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.bold)),
),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 5),
child: Row(
children: [
Expanded(
child: _getNormalText(
TranslationBase.of(context).referralStatus),
),
Expanded(
child: _getNormalText(
projectViewModel.isArabic
? widget.referral.statusAr
: widget.referral.status,
isBold: true),
)
],
),
),
mDivider(Colors.grey[600]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 5),
child: Row(
children: [
Expanded(
child: _getNormalText(
TranslationBase.of(context).patientName),
),
Expanded(
child: _getNormalText(
widget.referral.patientName,
isBold: true),
)
],
),
),
mDivider(Colors.grey[600]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 5),
child: Row(
children: [
Expanded(
child: _getNormalText(
TranslationBase.of(context).referralNumber),
),
Expanded(
child: _getNormalText(
widget.referral.referralNumber.toString(),
isBold: true),
)
],
),
),
mDivider(Colors.grey[600]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 5),
child: Row(
children: [
Expanded(
child: _getNormalText(
TranslationBase.of(context).referralDate),
),
Expanded(
child: _getNormalText(
DateUtil.getMonthDayYearDateFormatted(
DateUtil.convertStringToDateNoTimeZone(
widget.referral.referralDate)),
isBold: true),
)
],
),
),
mDivider(Colors.grey[600]),
Container(
width: double.infinity,
padding: EdgeInsets.only(top: 10, bottom: 5),
child: Row(
children: [
Expanded(
child: _getNormalText(
TranslationBase.of(context).hospital),
),
Expanded(
child: _getNormalText(
widget.referral.preferredBranchName,
isBold: true),
)
],
),
),
],
),
),
)),
],
));
}
_getNormalText(text, {bool isBold = false}) {
return Text(
text,
style: TextStyle(
fontSize: isBold ? 14 : 12,
letterSpacing: -0.5,
color: isBold ? Colors.black : Colors.grey[700],
fontWeight: FontWeight.w600,
),
);
}
}

@ -2,15 +2,25 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/referral_details.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'New_E_Referral/new_e_referral_step_one_page.dart';
import 'dialogs/select_country_ingo_Dialog.dart';
@ -43,8 +53,31 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<EReferralViewModel>(
onModelReady: (model) => model.getAllCities(),
onModelReady: (model) async {
if (projectViewModel.isLogin) {
SearchEReferralRequestModel searchEReferralRequestModel =
new SearchEReferralRequestModel(
patientMobileNumber: (projectViewModel.user.outSA == 0
? "966"
: "971") +
projectViewModel.user.mobileNumber
.substring(1, projectViewModel.user.mobileNumber.length),
);
if (selectedCriteria.value == 1) {
searchEReferralRequestModel.identificationNo =
_searchTextController.text;
searchEReferralRequestModel.referralNumber = 0;
} else {
searchEReferralRequestModel.referralNumber =
int.parse(_searchTextController.text);
searchEReferralRequestModel.identificationNo =
projectViewModel.user.patientIdentificationNo;
}
await model.getEReferrals(searchEReferralRequestModel);
}
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: false,
baseViewModel: model,
@ -53,147 +86,230 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
child: Container(
margin: EdgeInsets.all(12),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.94,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 77,
),
InkWell(
onTap: () => selectSearchCriteriaDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getSearchCriteriaName()),
Icon(Icons.arrow_drop_down)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
InkWell(
onTap: () => selectSearchCriteriaDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getSearchCriteriaName()),
Icon(Icons.arrow_drop_down)
],
),
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: selectedCriteria.value == 1
? "Enter Patient Identification No"
: "Enter Referral Number",
controller: _searchTextController,
onChanged: (_){
setState(() {
});
},
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectCountryTypeDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getCountryName()),
Icon(Icons.arrow_drop_down)
],
),
),
),
SizedBox(
height: 12,
),
MobileNumberTextFiled(
controller: _mobileTextController,
onChange: (_){
setState(() {
});
},
code: _selectedCountry == null
? "11"
: _selectedCountry["code"],
),
SizedBox(
height: 12,
),
if ((model.state == ViewState.Idle &&
model.allReferral.length == 0))
Text("There's No Referral To deliver"),
if ((
model.state == ViewState.ErrorLocal))
AppEmbeddedError( error:model.error),
NetworkBaseView(
baseViewModel: model,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: model.allReferral == null
? 0
: model.allReferral.length < 3
? model.allReferral.length
: 3,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 0.2),
child: Container(
child: Texts("TODO add referral info"),
),
);
},
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: selectedCriteria.value == 1
? "Enter Patient Identification No"
: "Enter Referral Number",
controller: _searchTextController,
onChanged: (_) {
setState(() {});
},
),
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectCountryTypeDialog(),
child: Container(
padding: EdgeInsets.all(12),
width: double.infinity,
height: 65,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(getCountryName()),
Icon(Icons.arrow_drop_down)
],
),
),
],
),
),
SizedBox(
height: 12,
),
MobileNumberTextFiled(
controller: _mobileTextController,
onChange: (_) {
setState(() {});
},
code: _selectedCountry == null
? "11"
: _selectedCountry["code"],
),
SizedBox(
height: 12,
),
if ((model.state == ViewState.Idle &&
model.allReferral.length == 0))
Center(
child: Text(
TranslationBase.of(context).noSearchResult)),
if ((model.state == ViewState.ErrorLocal))
AppEmbeddedError(error: model.error),
model.allReferral.length > 0
? NetworkBaseView(
baseViewModel: model,
child: ListView.separated(
separatorBuilder: (context, index) =>
SizedBox(height: 0),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: model.allReferral == null
? 0
: model.allReferral.length,
itemBuilder: (BuildContext context, int index) {
return Container(
width: double.infinity,
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: ReferralDetails(
referral:
model.allReferral[index]),
),
);
},
child: Card(
shape: cardRadius(12),
margin: EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
projectViewModel.isArabic
? model
.allReferral[
index]
.statusAr
: model
.allReferral[
index]
.status,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
fontWeight:
FontWeight.bold)),
Container(
margin: EdgeInsets.only(
top: 5.0),
child: myRichText(
TranslationBase.of(
context)
.patientName +
": ",
model
.allReferral[
index]
.patientName,
projectViewModel
.isArabic)),
myRichText(
TranslationBase.of(
context)
.hospital +
": ",
model.allReferral[index]
.preferredBranchName,
projectViewModel
.isArabic),
myRichText(
TranslationBase.of(
context)
.referralDate +
": ",
DateUtil.getMonthDayYearDateFormatted(
DateUtil.convertStringToDateNoTimeZone(
model
.allReferral[
index]
.referralDate)),
projectViewModel
.isArabic),
],
),
Icon(projectViewModel.isArabic
? Icons
.arrow_back_ios_outlined
: Icons
.arrow_forward_ios_outlined),
],
),
),
),
),
);
},
),
)
: Container(),
SizedBox(
height: 80.0,
)
],
),
),
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.1,
color: Theme.of(context).scaffoldBackgroundColor,
width: double.infinity,
padding: EdgeInsets.all(9),
child: SecondaryButton(
textColor: Colors.white,
label: "Search",
onTap: () async {
SearchEReferralRequestModel searchEReferralRequestModel =
new SearchEReferralRequestModel(
patientMobileNumber:
_selectedCountry['code'] + _mobileTextController.text,
);
if (selectedCriteria.value == 1) {
searchEReferralRequestModel.identificationNo =
_searchTextController.text;
searchEReferralRequestModel.referralNumber = 0;
} else {
searchEReferralRequestModel.referralNumber =
int.parse(_searchTextController.text);
searchEReferralRequestModel.identificationNo = '';
}
await model.getEReferrals(searchEReferralRequestModel);
setState(() {
_isSubmitted = true;
});
},
loading: model.state == ViewState.BusyLocal,
disabled: _searchTextController.text.isEmpty ||
_mobileTextController.text.isEmpty,
padding: EdgeInsets.all(14),
child: DefaultButton(
TranslationBase.of(context).search,
(_searchTextController.text.isEmpty ||
_mobileTextController.text.isEmpty)
? null
: () async {
SearchEReferralRequestModel
searchEReferralRequestModel =
new SearchEReferralRequestModel(
patientMobileNumber: _selectedCountry['code'] +
_mobileTextController.text,
);
if (selectedCriteria.value == 1) {
searchEReferralRequestModel.identificationNo =
_searchTextController.text;
searchEReferralRequestModel.referralNumber = 0;
} else {
searchEReferralRequestModel.referralNumber =
int.parse(_searchTextController.text);
searchEReferralRequestModel.identificationNo = '';
}
await model.getEReferrals(searchEReferralRequestModel);
setState(() {
_isSubmitted = true;
});
},
disabledColor: Colors.grey,
),
)));
}

@ -37,6 +37,8 @@ class NotificationsDetailsPage extends StatelessWidget {
return BaseView<NotificationViewModel>(
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).notificationDetails,
body: SingleChildScrollView(
child: Center(

@ -51,6 +51,8 @@ class NotificationsPage extends StatelessWidget {
},
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).notifications,
baseViewModel: model,
body: ListView(

@ -233,14 +233,14 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
_firebaseMessaging.setAutoInitEnabled(true);
// signalRUtil = new SignalRUtil(hubName: "http://192.168.8.101:5001/chatHub", context: context);
signalRUtil = new SignalRUtil(hubName: "https://api.cssynapses.com/chatsocket", context: context);
// signalRUtil = new SignalRUtil(hubName: "https://api.cssynapses.com/chatsocket", context: context);
locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (projectViewModel.isLogin && !projectViewModel.isLoginChild) {
familyFileProvider.getSharedRecordByStatus();
}
signalRUtil.startSignalRConnection();
// signalRUtil.startSignalRConnection();
});
// HMG (Guest/Internet) Wifi Access [Zohaib Kambrani]
//for now commented to reduce this call will enable it when needed

@ -342,9 +342,6 @@ class _InvoiceDetailState extends State<InvoiceDetail> {
],
),
);
// widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation
// .forEach((lab) {
for (int i = 0;
i <
widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0]

@ -59,7 +59,7 @@ class PaymentService extends StatelessWidget {
medical.add(
InkWell(
onTap: () {
navigateToToDoPage(context);
Navigator.push(context, FadePage(page: AdvancePaymentPage()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context).payment,
@ -75,7 +75,7 @@ class PaymentService extends StatelessWidget {
medical.add(
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: AdvancePaymentPage()));
navigateToToDoPage(context);
},
child: MedicalProfileItem(
title: TranslationBase.of(context).onlineCheckIn,

@ -20,6 +20,22 @@ class DateUtil {
return DateTime.now();
}
static DateTime convertStringToDateNoTimeZone(String date) {
// /Date(1585774800000+0300)/
if (date != null) {
const start = "/Date(";
const end = ")";
final startIndex = date.indexOf(start);
final endIndex = date.indexOf(end, startIndex + start.length);
return DateTime.fromMillisecondsSinceEpoch(
int.parse(
date.substring(startIndex + start.length, endIndex),
),
);
} else
return DateTime.now();
}
static DateTime convertStringToDateTime(String date) {
if (date != null) {
try {

@ -2308,6 +2308,20 @@ class TranslationBase {
String get insuranceCompany => localizedValues["insuranceCompany"][locale.languageCode];
String get referralDetails => localizedValues["referralDetails"][locale.languageCode];
String get preferredBranch => localizedValues["preferredBranch"][locale.languageCode];
String get selectPreferredBranch => localizedValues["selectPreferredBranch"][locale.languageCode];
String get patientLocated => localizedValues["patientLocated"][locale.languageCode];
String get otherInfo => localizedValues["otherInfo"][locale.languageCode];
String get medicalReport => localizedValues["medicalReport"][locale.languageCode];
String get insuredPatientReferral => localizedValues["insuredPatient"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save