improvements.

merge-update-with-lab-changes
Sikander Saleem 5 years ago
parent ad98dfce67
commit 21863cfe06

@ -1,5 +1,6 @@
import 'dart:ui'; import 'dart:ui';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -8,8 +9,12 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';

@ -67,70 +67,38 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
return BaseView<MyBalanceViewModel>( return BaseView<MyBalanceViewModel>(
onModelReady: (model) => model.getHospitals(), onModelReady: (model) => model.getHospitals(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
appBarTitle: TranslationBase.of(context).advancePayment, appBarTitle: TranslationBase.of(context).advancePayment,
description: TranslationBase.of(context).infoAdvancePayment, description: TranslationBase.of(context).infoAdvancePayment,
showNewAppBarTitle: true, showNewAppBarTitle: true,
showNewAppBar: true, showNewAppBar: true,
backgroundColor: CustomColors.appBackgroudGreyColor, backgroundColor: CustomColors.appBackgroudGreyColor,
body: SingleChildScrollView( body: Column(
physics: ScrollPhysics(), children: [
child: Container( Expanded(
margin: EdgeInsets.all(12), child: SingleChildScrollView(
child: Column( padding: EdgeInsets.all(21),
crossAxisAlignment: CrossAxisAlignment.start, physics: BouncingScrollPhysics(),
children: [ child: Column(
Text( crossAxisAlignment: CrossAxisAlignment.start,
TranslationBase.of(context).advancePaymentLabel, mainAxisSize: MainAxisSize.min,
textAlign: TextAlign.center, children: [
style: TextStyle( Text(
fontSize: 14, TranslationBase.of(context).advancePaymentLabel,
fontWeight: FontWeight.w600, style: TextStyle(
letterSpacing: -0.46, fontSize: 14,
), fontWeight: FontWeight.w600,
), letterSpacing: -0.46,
SizedBox(
height: 12,
),
InkWell(
onTap: () => confirmSelectBeneficiaryDialog(model),
child: Container(
padding: EdgeInsets.all(8),
width: double.infinity,
height: 65,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
getBeneficiaryType(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
Icon(Icons.arrow_drop_down)
],
), ),
), ),
),
if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
InkWell( InkWell(
onTap: () { onTap: () => confirmSelectBeneficiaryDialog(model),
GifLoaderDialogUtils.showMyDialog(context);
model.getFamilyFiles().then((value) {
GifLoaderDialogUtils.hideDialog(context);
confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList);
});
},
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(8),
width: double.infinity, width: double.infinity,
height: 65, height: 65,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
@ -138,42 +106,102 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
getFamilyMembersName(), getBeneficiaryType(),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.46, letterSpacing: -0.46,
), ),
), ),
Icon(Icons.arrow_drop_down), Icon(Icons.arrow_drop_down)
], ],
), ),
), ),
), ),
SizedBox( if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
height: 12, SizedBox(
), height: 12,
NewTextFields( ),
hintText: TranslationBase.of(context).fileNumber, if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
controller: _fileTextController, InkWell(
readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, onTap: () {
), GifLoaderDialogUtils.showMyDialog(context);
if (beneficiaryType == BeneficiaryType.OtherAccount) model.getFamilyFiles().then((value) {
GifLoaderDialogUtils.hideDialog(context);
confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList);
});
},
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: [
Text(
getFamilyMembersName(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
Icon(Icons.arrow_drop_down),
],
),
),
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context).fileNumber,
controller: _fileTextController,
readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true,
),
if (beneficiaryType == BeneficiaryType.OtherAccount)
SizedBox(
height: 12,
),
if (beneficiaryType == BeneficiaryType.OtherAccount)
InkWell(
onTap: () {
if (_fileTextController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) {
GifLoaderDialogUtils.hideDialog(context);
confirmSelectPatientDialog(model.patientInfoList);
});
} else
AppToast.showErrorToast(message: 'Please Enter The File Number');
},
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: [
Text(
getPatientName(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
Icon(Icons.arrow_drop_down),
],
),
),
),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
if (beneficiaryType == BeneficiaryType.OtherAccount)
InkWell( InkWell(
onTap: () { onTap: () => confirmSelectHospitalDialog(model.hospitals),
if (_fileTextController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) {
GifLoaderDialogUtils.hideDialog(context);
confirmSelectPatientDialog(model.patientInfoList);
});
} else
AppToast.showErrorToast(message: 'Please Enter The File Number');
},
child: Container( child: Container(
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
width: double.infinity, width: double.infinity,
@ -183,7 +211,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
getPatientName(), getHospitalName(),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -195,132 +223,114 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
), ),
), ),
), ),
SizedBox( SizedBox(
height: 12, height: 12,
),
InkWell(
onTap: () => confirmSelectHospitalDialog(model.hospitals),
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: [
Text(
getHospitalName(),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
),
),
Icon(Icons.arrow_drop_down),
],
),
), ),
),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context).amount,
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
onChanged: (value) {
setState(() {
amount = value;
});
},
),
SizedBox(
height: 12,
),
if (model.user != null)
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).depositorEmail, hintText: TranslationBase.of(context).amount,
initialValue: model.user.emailAddress, keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
onChanged: (value) { onChanged: (value) {
email = value; setState(() {
amount = value;
});
}, },
), ),
SizedBox( SizedBox(
height: 12, height: 12,
), ),
NewTextFields( if (model.user != null)
hintText: TranslationBase.of(context).notes, NewTextFields(
controller: _notesTextController, hintText: TranslationBase.of(context).depositorEmail,
), initialValue: model.user.emailAddress,
SizedBox( onChanged: (value) {
height: MediaQuery.of(context).size.height * 0.15, email = value;
) },
], ),
SizedBox(
height: 12,
),
NewTextFields(
hintText: TranslationBase.of(context).notes,
controller: _notesTextController,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.15,
)
],
),
), ),
), ),
), Container(
bottomSheet: Container( color: Colors.white,
width: double.infinity, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
color: Theme.of(context).scaffoldBackgroundColor, child: DefaultButton(
padding: EdgeInsets.all(12), TranslationBase.of(context).submit,
child: DefaultButton( (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null)
TranslationBase.of(context).submit, ? null
(amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) ? null : : () {
() { var mobileNum;
var mobileNum; var patientName;
var patientName;
if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { if (beneficiaryType == BeneficiaryType.MyFamilyFiles) {
mobileNum = selectedPatientFamily.mobileNumber; mobileNum = selectedPatientFamily.mobileNumber;
patientName = selectedPatientFamily.patientName; patientName = selectedPatientFamily.patientName;
} }
if (beneficiaryType == BeneficiaryType.MyAccount) {
mobileNum = model.user.mobileNumber;
patientName = model.user.firstName;
}
if (beneficiaryType == BeneficiaryType.OtherAccount) { if (beneficiaryType == BeneficiaryType.MyAccount) {
mobileNum = _selectedPatientInfo.mobileNumber; mobileNum = model.user.mobileNumber;
patientName = _selectedPatientInfo.fullName; patientName = model.user.firstName;
} }
advanceModel.fileNumber = _fileTextController.text; if (beneficiaryType == BeneficiaryType.OtherAccount) {
advanceModel.hospitalsModel = _selectedHospital; mobileNum = _selectedPatientInfo.mobileNumber;
advanceModel.note = _notesTextController.text; patientName = _selectedPatientInfo.fullName;
advanceModel.email = email ?? model.user.emailAddress;
advanceModel.amount = amount;
advanceModel.mobileNumber = mobileNum;
advanceModel.patientName = patientName;
GifLoaderDialogUtils.showMyDialog(context);
model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) {
Utils.hideKeyboard(context);
Navigator.push(context, FadePage(page: PaymentMethod(
onSelectedMethod: (String metohd) {
setState(() {});
} }
))).then(
(value) { advanceModel.fileNumber = _fileTextController.text;
Navigator.push( advanceModel.hospitalsModel = _selectedHospital;
context, advanceModel.note = _notesTextController.text;
FadePage( advanceModel.email = email ?? model.user.emailAddress;
page: ConfirmPaymentPage( advanceModel.amount = amount;
advanceModel: advanceModel, advanceModel.mobileNumber = mobileNum;
selectedPaymentMethod: value, advanceModel.patientName = patientName;
patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, GifLoaderDialogUtils.showMyDialog(context);
authenticatedUser: authUser, model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) {
), GifLoaderDialogUtils.hideDialog(context);
), if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) {
); Utils.hideKeyboard(context);
Navigator.push(
context,
FadePage(
page: PaymentMethod(onSelectedMethod: (String metohd) {
setState(() {});
}),
),
).then(
(value) {
Navigator.push(
context,
FadePage(
page: ConfirmPaymentPage(
advanceModel: advanceModel,
selectedPaymentMethod: value,
patientInfoAndMobileNumber: model.patientInfoAndMobileNumber,
authenticatedUser: authUser,
),
),
);
},
);
}
});
}, },
); color: Color(0xffD02127),
} textColor: Colors.white,
}); disabledColor: Color(0xffEAEAEA),
}, ),
disabledColor: Colors.grey,
), ),
)), ],
),
),
); );
} }

Loading…
Cancel
Save