improvements.

merge-requests/439/merge
Sikander Saleem 4 years ago
parent ad98dfce67
commit 21863cfe06

@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_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/today_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/medical/medical_profile_page_new.dart';
import 'package:diplomaticquarterapp/routes.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/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';

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

Loading…
Cancel
Save