first step from search referrals
parent
1e3ff89dbd
commit
ae147b5988
@ -0,0 +1,21 @@
|
||||
class SearchCriteriaModel {
|
||||
String name;
|
||||
String nameAr;
|
||||
int value;
|
||||
|
||||
SearchCriteriaModel({this.name, this.nameAr, this.value});
|
||||
|
||||
SearchCriteriaModel.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
nameAr = json['name_ar'];
|
||||
value = json['value'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['name'] = this.name;
|
||||
data['name_ar'] = this.nameAr;
|
||||
data['value'] = this.value;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
class SearchEReferralRequestModel {
|
||||
String patientMobileNumber;
|
||||
double versionID;
|
||||
int channel;
|
||||
int languageID;
|
||||
String iPAdress;
|
||||
String generalid;
|
||||
int patientOutSA;
|
||||
Null sessionID;
|
||||
bool isDentalAllowedBackend;
|
||||
int deviceTypeID;
|
||||
int referralNumber;
|
||||
String identificationNo;
|
||||
|
||||
SearchEReferralRequestModel(
|
||||
{this.patientMobileNumber,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.referralNumber,
|
||||
this.identificationNo});
|
||||
|
||||
SearchEReferralRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
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'];
|
||||
referralNumber = json['ReferralNumber'];
|
||||
identificationNo = json['IdentificationNo'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
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['ReferralNumber'] = this.referralNumber;
|
||||
data['IdentificationNo'] = this.identificationNo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
class SearchEReferralResponseModel {
|
||||
String patientMobileNumber;
|
||||
double versionID;
|
||||
int channel;
|
||||
int languageID;
|
||||
String iPAdress;
|
||||
String generalid;
|
||||
int patientOutSA;
|
||||
Null sessionID;
|
||||
bool isDentalAllowedBackend;
|
||||
int deviceTypeID;
|
||||
int referralNumber;
|
||||
String identificationNo;
|
||||
|
||||
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});
|
||||
|
||||
SearchEReferralResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
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'];
|
||||
referralNumber = json['ReferralNumber'];
|
||||
identificationNo = json['IdentificationNo'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
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['ReferralNumber'] = this.referralNumber;
|
||||
data['IdentificationNo'] = this.identificationNo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_response_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/search_criteria_model.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class SelectSearchCriteriaDialog extends StatefulWidget {
|
||||
List<SearchCriteriaModel> searchCriteria = [
|
||||
SearchCriteriaModel(name: "Identification Number",nameAr:"رقم المحول",value: 1),
|
||||
SearchCriteriaModel(name: "Referral Number",nameAr:"رقم المحول",value: 2),
|
||||
];
|
||||
final Function(SearchCriteriaModel) onValueSelected;
|
||||
SearchCriteriaModel selectedCriteria;
|
||||
|
||||
SelectSearchCriteriaDialog(
|
||||
{Key key, this.onValueSelected, this.selectedCriteria});
|
||||
|
||||
@override
|
||||
_SelectSearchCriteriaDialogState createState() => _SelectSearchCriteriaDialogState();
|
||||
}
|
||||
|
||||
class _SelectSearchCriteriaDialogState extends State<SelectSearchCriteriaDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.selectedCriteria = widget.selectedCriteria ?? widget.searchCriteria[0];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Texts(" Select Search Criteria", fontSize: 20,),
|
||||
Divider(),
|
||||
...List.generate(
|
||||
widget.searchCriteria.length,
|
||||
(index) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
widget.selectedCriteria = widget.searchCriteria[index];
|
||||
});
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text(widget.searchCriteria[index].name),
|
||||
leading: Radio(
|
||||
value: widget.searchCriteria[index],
|
||||
groupValue: widget.selectedCriteria,
|
||||
activeColor: Colors.red[800],
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.selectedCriteria = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).cancel.toUpperCase(),
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 1,
|
||||
height: 30,
|
||||
color: Colors.grey[500],
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
widget.onValueSelected(widget.selectedCriteria);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).ok,
|
||||
fontWeight: FontWeight.w400,
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,21 +1,227 @@
|
||||
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
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/search_criteria_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/search_e_referral_request_model.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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/transitions/fade_page.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SearchForReferralsPage extends StatelessWidget {
|
||||
import 'New_E_Referral/new_e_referral_step_one_page.dart';
|
||||
import 'dialogs/select_country_ingo_Dialog.dart';
|
||||
import 'dialogs/select_search_criteria_dialog.dart';
|
||||
|
||||
class SearchForReferralsPage extends StatefulWidget {
|
||||
SearchForReferralsPage({Key key});
|
||||
|
||||
@override
|
||||
_SearchForReferralsPageState createState() => _SearchForReferralsPageState();
|
||||
}
|
||||
|
||||
class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
|
||||
TextEditingController _searchTextController = TextEditingController();
|
||||
|
||||
TextEditingController _mobileTextController = TextEditingController();
|
||||
bool _isSubmitted = false;
|
||||
|
||||
dynamic _selectedCountry = {
|
||||
"name": "Saudi Arabia",
|
||||
"name_ar": "المملكة العربية السعودية",
|
||||
"code": "+966",
|
||||
"countryCode": "SA",
|
||||
"pattern": "5xxxxxxxx",
|
||||
"maxLength": 9
|
||||
};
|
||||
|
||||
SearchCriteriaModel selectedCriteria = SearchCriteriaModel(
|
||||
name: "Identification Number", nameAr: "رقم المحول", value: 1);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
body: Container(),
|
||||
return BaseView<EReferralViewModel>(
|
||||
onModelReady: (model) => model.getAllCities(),
|
||||
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(
|
||||
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)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
NewTextFields(
|
||||
hintText: selectedCriteria.value == 1
|
||||
? "Enter Patient Identification No"
|
||||
: "Enter Referral Number",
|
||||
controller: _searchTextController,
|
||||
),
|
||||
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,
|
||||
code: _selectedCountry == null
|
||||
? "11"
|
||||
: _selectedCountry["code"],
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
if ((model.state == ViewState.Idle &&
|
||||
model.allReferral.length == 0))
|
||||
Text("There's No allReferral 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"),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.1,
|
||||
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,
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
void confirmSelectCountryTypeDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: SelectCountryDialog(
|
||||
selectedCountry: _selectedCountry,
|
||||
onValueSelected: (value) {
|
||||
setState(() {
|
||||
_selectedCountry = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getCountryName() {
|
||||
if (_selectedCountry != null)
|
||||
return _selectedCountry["name"];
|
||||
else
|
||||
return "Country";
|
||||
}
|
||||
|
||||
void selectSearchCriteriaDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: SelectSearchCriteriaDialog(
|
||||
selectedCriteria: selectedCriteria,
|
||||
onValueSelected: (value) {
|
||||
setState(() {
|
||||
selectedCriteria = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getSearchCriteriaName() {
|
||||
return selectedCriteria.name;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue