finish new e-referral except calling the service

merge-update-with-lab-changes
Elham Rababah 5 years ago
parent f582eee991
commit 1e3ff89dbd

@ -207,6 +207,7 @@ const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshi
const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral';
const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral';
const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities';
const CREATE_E_REFERRAL = 'Services/Patients.svc/REST/CreateEReferral';
const TIMER_MIN = 10;

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/check_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_cities_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
@ -65,6 +66,8 @@ class EReferralService extends BaseService {
}, body: sendActivationCodeForEReferralRequestModel.toJson());
}
Future checkActivationCodeForEReferral(
CheckActivationCodeForEReferralResponseModel
checkActivationCodeForEReferralRequestModel) async {
@ -79,4 +82,19 @@ class EReferralService extends BaseService {
super.error = error;
}, body: checkActivationCodeForEReferralRequestModel.toJson());
}
Future createEReferral(
CreateEReferralRequestModel createEReferralRequestModel
) async {
hasError = false;
await baseAppClient.post(CREATE_E_REFERRAL,
onSuccess: (dynamic response, int statusCode) {
print("EEEEEE");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: createEReferralRequestModel.toJson());
}
}

@ -3,6 +3,7 @@ import 'dart:core';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/all_habib_medical_services/e_referral_service.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/check_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_cities_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
@ -62,4 +63,16 @@ class EReferralViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
}
void createEReferral(CreateEReferralRequestModel createEReferralRequestModel) async {
setState(ViewState.BusyLocal);
await _eReferralService.createEReferral(createEReferralRequestModel);
if (_eReferralService.hasError) {
error = _eReferralService.error;
setState(ViewState.ErrorLocal);
} else{
setState(ViewState.Idle);
}
}
}

@ -0,0 +1,151 @@
class CreateEReferralRequestModel {
bool isInsuredPatient;
String cityCode;
String cityName;
String requesterName;
String requesterContactNo;
int requesterRelationship;
String otherRelationship;
String fullName;
int identificationNo;
String patientMobileNumber;
int preferredBranchCode;
String preferredBranchName;
List<EReferralAttachment> medicalReportAttachment;
EReferralAttachment insuranceCardAttachment;
double versionID;
int channel;
int languageID;
String iPAdress;
String generalid;
int patientOutSA;
String sessionID;
bool isDentalAllowedBackend;
int deviceTypeID;
int patientID;
String tokenID;
int patientTypeID;
int patientType;
CreateEReferralRequestModel(
{this.isInsuredPatient,
this.cityCode,
this.cityName,
this.requesterName,
this.requesterContactNo,
this.requesterRelationship,
this.otherRelationship,
this.fullName,
this.identificationNo,
this.patientMobileNumber,
this.preferredBranchCode,
this.preferredBranchName,
this.medicalReportAttachment,
this.insuranceCardAttachment,
this.versionID,
this.channel,
this.languageID,
this.iPAdress,
this.generalid,
this.patientOutSA,
this.sessionID,
this.isDentalAllowedBackend,
this.deviceTypeID,
this.patientID,
this.tokenID,
this.patientTypeID,
this.patientType});
CreateEReferralRequestModel.fromJson(Map<String, dynamic> json) {
isInsuredPatient = json['IsInsuredPatient'];
cityCode = json['CityCode'];
cityName = json['CityName'];
requesterName = json['RequesterName'];
requesterContactNo = json['RequesterContactNo'];
requesterRelationship = json['RequesterRelationship'];
otherRelationship = json['OtherRelationship'];
fullName = json['FullName'];
identificationNo = json['IdentificationNo'];
patientMobileNumber = json['PatientMobileNumber'];
preferredBranchCode = json['PreferredBranchCode'];
preferredBranchName = json['PreferredBranchName'];
if (json['MedicalReportAttachment'] != null) {
medicalReportAttachment = new List<EReferralAttachment>();
json['MedicalReportAttachment'].forEach((v) {
medicalReportAttachment.add(new EReferralAttachment.fromJson(v));
});
}
insuranceCardAttachment = json['InsuranceCardAttachment'] != null
? new EReferralAttachment.fromJson(json['InsuranceCardAttachment'])
: null;
versionID = json['VersionID'];
channel = json['Channel'];
languageID = json['LanguageID'];
iPAdress = json['IPAdress'];
generalid = json['generalid'];
patientOutSA = json['PatientOutSA'];
sessionID = json['SessionID'];
isDentalAllowedBackend = json['isDentalAllowedBackend'];
deviceTypeID = json['DeviceTypeID'];
patientID = json['PatientID'];
tokenID = json['TokenID'];
patientTypeID = json['PatientTypeID'];
patientType = json['PatientType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['IsInsuredPatient'] = this.isInsuredPatient;
data['CityCode'] = this.cityCode;
data['CityName'] = this.cityName;
data['RequesterName'] = this.requesterName;
data['RequesterContactNo'] = this.requesterContactNo;
data['RequesterRelationship'] = this.requesterRelationship;
data['OtherRelationship'] = this.otherRelationship;
data['FullName'] = this.fullName;
data['IdentificationNo'] = this.identificationNo;
data['PatientMobileNumber'] = this.patientMobileNumber;
data['PreferredBranchCode'] = this.preferredBranchCode;
data['PreferredBranchName'] = this.preferredBranchName;
if (this.medicalReportAttachment != null) {
data['MedicalReportAttachment'] =
this.medicalReportAttachment.map((v) => v.toJson()).toList();
}
if (this.insuranceCardAttachment != null) {
data['InsuranceCardAttachment'] = this.insuranceCardAttachment.toJson();
}
data['VersionID'] = this.versionID;
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['PatientID'] = this.patientID;
data['TokenID'] = this.tokenID;
data['PatientTypeID'] = this.patientTypeID;
data['PatientType'] = this.patientType;
return data;
}
}
class EReferralAttachment {
String fileName;
String base64String;
EReferralAttachment({this.fileName, this.base64String});
EReferralAttachment.fromJson(Map<String, dynamic> json) {
fileName = json['FileName'];
base64String = json['Base64String'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['FileName'] = this.fileName;
data['Base64String'] = this.base64String;
return data;
}
}

@ -1,8 +1,10 @@
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart';
import 'package:flutter/material.dart';
import 'new_e_referral_step_three_page.dart';
import 'new_e_referral_step_two_page.dart';
class StartIndexForNewEReferral extends StatefulWidget {
@ -19,7 +21,9 @@ class _StartIndexForNewEReferralState extends State<StartIndexForNewEReferral>
PageController _controller;
int _currentIndex = 1;
int pageSelected = 2;
List<dynamic> attachments;
CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel();
@override
void initState() {
@ -55,9 +59,17 @@ class _StartIndexForNewEReferralState extends State<StartIndexForNewEReferral>
children: <Widget>[
NewEReferralStepOnePage(
changePageViewIndex: changePageViewIndex,
createEReferralRequestModel: createEReferralRequestModel,
),
NewEReferralStepTowPage(
changePageViewIndex: changePageViewIndex,
createEReferralRequestModel: createEReferralRequestModel,
),
NewEReferralStepThreePage(
changePageViewIndex: changePageViewIndex,
createEReferralRequestModel: createEReferralRequestModel,
),
],
),

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
@ -20,10 +21,10 @@ import 'package:flutter/material.dart';
class NewEReferralStepOnePage extends StatefulWidget {
final EReferralViewModel eReferralViewModel;
final CreateEReferralRequestModel createEReferralRequestModel;
final Function changePageViewIndex;
const NewEReferralStepOnePage({Key key, this.eReferralViewModel, this.changePageViewIndex}) : super(key: key);
const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key);
@override
_NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState();
@ -64,8 +65,16 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
barrierDismissible: false,
child: EReferralConfirmSMSDialog(
phoneNumber: _selectedCountry['code']+_mobileTextController.text,
onSucces: ()=>
widget.changePageViewIndex(1)
onSucces: (){
Navigator.of(context).pop();
widget.changePageViewIndex(1);
widget.createEReferralRequestModel.requesterName=_nameTextController.text;
widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code']+_mobileTextController.text;
widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD;
}
),
).then((value) {
@ -191,7 +200,7 @@ class _NewEReferralStepOnePageState extends State<NewEReferralStepOnePage> {
child: SecondaryButton(
textColor: Colors.white,
label: "Next",
onTap: () async {
onTap: () async {
SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel =
SendActivationCodeForEReferralRequestModel(
zipCode: _selectedCountry['code'],

@ -0,0 +1,438 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_cities_response_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.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:flutter/cupertino.dart';
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;
const NewEReferralStepThreePage(
{Key key, this.createEReferralRequestModel, this.changePageViewIndex})
: super(key: key);
@override
_NewEReferralStepThreePageState createState() =>
_NewEReferralStepThreePageState();
}
class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
TextEditingController _nameTextController = TextEditingController();
TextEditingController _mobileTextController = TextEditingController();
GetAllCitiesResponseModel _selectedCity;
GetAllSharedRecordsByStatusList selectedPatientFamily;
List<EReferralAttachment> medicalReportImages = [];
List<EReferralAttachment> insuredPatientImages = [];
bool isPatientInsured = false;
// todo create a model for Country
// todo use country from the json
dynamic _selectedCountry = {
"name": "Saudi Arabia",
"name_ar": "المملكة العربية السعودية",
"code": "+966",
"countryCode": "SA",
"pattern": "5xxxxxxxx",
"maxLength": 9
};
AppSharedPreferences sharedPref = AppSharedPreferences();
AuthenticatedUser authUser;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return BaseView<EReferralViewModel>(
builder: (_, model, widget) => AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Container(
margin: EdgeInsets.all(12),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.94,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
),
Center(
child: Texts(
// TranslationBase.of(context).advancePaymentLabel,
"Other details",
textAlign: TextAlign.center,
),
),
SizedBox(
height: 12,
),
Container(
padding: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 9),
child: Texts(
"Medical Report",
color: Colors.grey,
fontSize: 17,
),
),
],
),
InkWell(
onTap: () {
ImageOptions.showImageOptions(context,
(String image) {
setState(() {
EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image );
medicalReportImages.add(eReferralAttachment);
});
});
},
child: Container(
margin: EdgeInsets.only(
left: 10, right: 10, top: 15),
height: 50,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(7),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: Center(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.attach_file),
Texts(
'selected attachment',
variant: 'bodyText',
textAlign: TextAlign.center,
),
],
),
),
),
),
SizedBox(
height: 12,
),
...List.generate(
medicalReportImages.length,
(index) => Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Icon(
FontAwesomeIcons.paperclip),
SizedBox(
width: 8,
),
Texts(
medicalReportImages[index].fileName,
),
],
),
InkWell(
onTap: () {
setState(() {
medicalReportImages
.remove(medicalReportImages[index]);
});
},
child: Icon(
FontAwesomeIcons.trashAlt,
color: Colors.red[300],
))
],
),
)),
],
),
),
SizedBox(
height: 12,
),
Container(
padding: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
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),
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,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [
Checkbox(
value: isPatientInsured,
activeColor: Colors.black38,
onChanged: (bool newValue) {
setState(() {
isPatientInsured = newValue;
});
}),
Padding(
padding: const EdgeInsets.all(20.0),
child: Texts(
"Insured Patient",
fontSize: 17,
),
),
],
),
],
),
],
),
),
SizedBox(
height: 12,
),
Opacity(
opacity: isPatientInsured?1:0,
child: Container(
padding: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white,
),
child: Column(
children: [
InkWell(
onTap: () {
ImageOptions.showImageOptions(context,
(String image) {
setState(() {
EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image );
insuredPatientImages=[eReferralAttachment];
});
});
},
child: Container(
margin: EdgeInsets.only(
left: 10, right: 10, top: 15),
height: 50,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(7),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: Center(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.attach_file),
Texts(
'selected attachment',
variant: 'bodyText',
textAlign: TextAlign.center,
),
],
),
),
),
),
SizedBox(
height: 12,
),
...List.generate(
insuredPatientImages.length,
(index) => Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Icon(
FontAwesomeIcons.paperclip),
SizedBox(
width: 8,
),
Texts(
'image ${index + 1}.png',
),
],
),
InkWell(
onTap: () {
setState(() {
insuredPatientImages
.remove(insuredPatientImages[index]);
});
},
child: Icon(
FontAwesomeIcons.trashAlt,
color: Colors.red[300],
))
],
),
)),
],
),
),
),
SizedBox(
height: 12,
),
],
),
),
),
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.1,
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[0];
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.fullName= "";
this.widget.createEReferralRequestModel.otherRelationship= "";
// this.widget.createEReferralRequestModel.;
// this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital";
// this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital";
await model.createEReferral(this.widget.createEReferralRequestModel);
},
loading: model.state == ViewState.BusyLocal,
disabled: medicalReportImages.length == 0 ,
),
)));
}
void confirmSelectCityDialog(List<GetAllCitiesResponseModel> cities) {
showDialog(
context: context,
child: SelectCityDialog(
cities: cities,
selectedCity: _selectedCity,
onValueSelected: (value) {
setState(() {
_selectedCity = value;
});
},
),
);
}
String getRelationName() {
if (_selectedCity != null)
return _selectedCity.description;
else
return "Select Relationship" /*TranslationBase.of(context).selectHospital*/;
}
}

@ -1,19 +1,13 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_cities_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/create_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_cities_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/send_activation_code_for_e_referral_request_model.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart';
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/bottom_options/BottomSheet.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -26,21 +20,21 @@ import '../dialogs/select_city_dialog.dart';
class NewEReferralStepTowPage extends StatefulWidget {
final EReferralViewModel eReferralViewModel;
final CreateEReferralRequestModel createEReferralRequestModel;
final Function changePageViewIndex;
const NewEReferralStepTowPage({Key key, this.eReferralViewModel, this.changePageViewIndex}) : super(key: key);
const NewEReferralStepTowPage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key);
@override
_NewEReferralStepTowPageState createState() => _NewEReferralStepTowPageState();
}
class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
TextEditingController _nameTextController = TextEditingController();
TextEditingController _patientNameTextController = TextEditingController();
TextEditingController _patientIdentificationTextController = TextEditingController();
TextEditingController _mobileTextController = TextEditingController();
GetAllCitiesResponseModel _selectedCity ;
GetAllSharedRecordsByStatusList selectedPatientFamily;
List<String> images = [];
// todo create a model for Country
// todo use country from the json
@ -91,14 +85,15 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
),
NewTextFields(
hintText: "Enter Identification Number",
controller: _nameTextController,
controller: _patientIdentificationTextController,
keyboardType:TextInputType.number ,
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: "Enter Patient Name",
controller: _nameTextController,
controller: _patientNameTextController,
),
SizedBox(
height: 12,
@ -166,72 +161,6 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
height: 12,
),
InkWell(
onTap: () {
ImageOptions.showImageOptions(context, (String image) {
setState(() {
images.add(image);
});
});
},
child: Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
height: 50,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(7),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.attach_file),
Texts(
'selected attachment',
variant: 'bodyText',
textAlign: TextAlign.center,
),
],
),
),
),
),
...List.generate(
images.length,
(index) => Container(
margin: EdgeInsets.all(10),
padding: EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(FontAwesomeIcons.paperclip),
SizedBox(
width: 8,
),
Texts(
'image ${index + 1}.png',
),
],
),
InkWell(
onTap: () {
setState(() {
images.remove(images[index]);
});
},
child: Icon(
FontAwesomeIcons.trashAlt,
color: Colors.red[300],
))
],
),
)),
SizedBox(
height: 12,
),
@ -252,11 +181,17 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
textColor: Colors.white,
label: "Next",
onTap: () async {
print(images.toString());
this.widget.changePageViewIndex(2);
this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text);
this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code']+_mobileTextController.text;
this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString();
this.widget.createEReferralRequestModel.cityName = _selectedCity.description;
},
loading: model.state == ViewState.BusyLocal,
disabled:
_nameTextController.text.isEmpty ||
_patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty||
_selectedCity == null ||
_mobileTextController.text.isEmpty,
),
@ -299,7 +234,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
if (_selectedCity != null)
return _selectedCity.description;
else
return "Select Relationship" /*TranslationBase.of(context).selectHospital*/;
return "Select City" /*TranslationBase.of(context).selectHospital*/;
}
String getCountryName() {

@ -63,7 +63,7 @@ class _AllHabibMedicalServiceState extends State<AllHabibMedicalService> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Texts(
"EReferralPage",
"E-Referral",
fontSize: 16,
)
],

@ -139,7 +139,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
onTapCancel: () {
_animationController.forward();
},
onTap: Feedback.wrapForTap(widget.onTap, context),
onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context),
behavior: HitTestBehavior.opaque,
child: Transform.scale(
scale: _buttonSize,

Loading…
Cancel
Save