You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
274 lines
10 KiB
Dart
274 lines
10 KiB
Dart
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
|
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart';
|
|
import 'package:diplomaticquarterapp/models/AlHabibMedicalServices/EReferral/get_all_relationship_types_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/select_country_ingo_Dialog.dart';
|
|
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/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/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';
|
|
|
|
enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
|
|
|
|
class NewEReferralPage extends StatefulWidget {
|
|
final EReferralViewModel eReferralViewModel;
|
|
|
|
const NewEReferralPage({Key key, this.eReferralViewModel}) : super(key: key);
|
|
|
|
@override
|
|
_NewEReferralPageState createState() => _NewEReferralPageState();
|
|
}
|
|
|
|
class _NewEReferralPageState extends State<NewEReferralPage> {
|
|
TextEditingController _fileTextController = TextEditingController();
|
|
TextEditingController _notesTextController = TextEditingController();
|
|
TextEditingController _mobileTextController = TextEditingController();
|
|
BeneficiaryType beneficiaryType = BeneficiaryType.NON;
|
|
GetAllRelationshipTypeResponseModel _selectedRelation;
|
|
String amount = "";
|
|
String email;
|
|
PatientInfo _selectedPatientInfo;
|
|
AuthenticatedUser authenticatedUser;
|
|
GetAllSharedRecordsByStatusList selectedPatientFamily;
|
|
AdvanceModel advanceModel = AdvanceModel();
|
|
dynamic _selectedCountry;
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
AuthenticatedUser authUser;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<EReferralViewModel>(
|
|
onModelReady: (model) => model.getRelationTypes(),
|
|
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: 75,
|
|
),
|
|
Center(
|
|
child: Texts(
|
|
// TranslationBase.of(context).advancePaymentLabel,
|
|
"Referral requester information",
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
NewTextFields(
|
|
hintText: TranslationBase.of(context).fileNumber,
|
|
controller: _fileTextController,
|
|
),
|
|
InkWell(
|
|
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("getPatientName"),
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
NewTextFields(
|
|
hintText: TranslationBase.of(context).notes,
|
|
controller: _notesTextController,
|
|
),
|
|
SizedBox(
|
|
height: MediaQuery.of(context).size.height * 0.15,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
bottomSheet: Container(
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
width: double.infinity,
|
|
padding: EdgeInsets.all(12),
|
|
child: SecondaryButton(
|
|
textColor: Colors.white,
|
|
label: TranslationBase.of(context).submit,
|
|
disabled: amount.isEmpty ||
|
|
_fileTextController.text.isEmpty ||
|
|
_selectedRelation == null,
|
|
),
|
|
)));
|
|
}
|
|
|
|
void confirmSelectRelationTypeDialog(
|
|
List<GetAllRelationshipTypeResponseModel> relations) {
|
|
showDialog(
|
|
context: context,
|
|
child: SelectRelationTypeDialog(
|
|
relationTypes: relations,
|
|
selectedRelation: _selectedRelation,
|
|
onValueSelected: (value) {
|
|
setState(() {
|
|
_selectedRelation = value;
|
|
});
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
void confirmSelectCountryTypeDialog() {
|
|
showDialog(
|
|
context: context,
|
|
child: SelectCountryDialog(
|
|
selectedCountry: _selectedCountry,
|
|
onValueSelected: (value) {
|
|
setState(() {
|
|
_selectedCountry = value;
|
|
});
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
String getRelationName() {
|
|
if (_selectedRelation != null)
|
|
return _selectedRelation.text;
|
|
else
|
|
return TranslationBase.of(context).selectHospital;
|
|
}
|
|
|
|
String getCountryName() {
|
|
if (_selectedCountry != null)
|
|
return _selectedCountry["name"];
|
|
else
|
|
return "Country";
|
|
}
|
|
}
|
|
|
|
class MobileNumberTextFiled extends StatelessWidget {
|
|
const MobileNumberTextFiled({
|
|
Key key,
|
|
this.controller,
|
|
this.code
|
|
}) : super(key: key);
|
|
|
|
|
|
final TextEditingController controller;
|
|
final String code;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: EdgeInsets.all(5),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(15), color: Colors.white),
|
|
child: Row(children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: Icon(
|
|
Icons.phone,
|
|
color: Colors.red,
|
|
)),
|
|
Expanded(
|
|
flex: 1,
|
|
child: Text(
|
|
code.toString(),
|
|
overflow: TextOverflow.clip,
|
|
)),
|
|
Expanded(
|
|
flex: 4,
|
|
child: Container(
|
|
margin: EdgeInsets.all(5),
|
|
child: TextField(
|
|
keyboardType: TextInputType.phone,
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none, hintText: '5xxxxxxxx'),
|
|
),
|
|
),
|
|
)
|
|
]),
|
|
);
|
|
}
|
|
}
|