e-referral work in progress

pull/104/head
Sultan khan 4 months ago
parent 8e132e964f
commit c43f96c619

@ -14,8 +14,8 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/'; // var BASE_URL = 'http://10.50.100.198:2018/';
var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/'; var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';
@ -719,7 +719,7 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb
class ApiConsts { class ApiConsts {
static const maxSmallScreen = 660; static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -0,0 +1,150 @@
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;
dynamic 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 = <EReferralAttachment>[];
json['MedicalReportAttachment'].forEach((v) {
medicalReportAttachment!.add(EReferralAttachment.fromJson(v));
});
}
insuranceCardAttachment = json['InsuranceCardAttachment'] != null ? 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'] = {};
} else
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,15 +1,19 @@
import 'dart:ui'; import 'dart:ui';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/e_referral/new_referral.dart'; import 'package:hmg_patient_app_new/presentation/e_referral/new_referral.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class EReferralPage extends StatefulWidget { class EReferralPage extends StatefulWidget {
@ -19,10 +23,7 @@ class EReferralPage extends StatefulWidget {
_EReferralPageState createState() => _EReferralPageState(); _EReferralPageState createState() => _EReferralPageState();
} }
class _EReferralPageState extends State<EReferralPage> class _EReferralPageState extends State<EReferralPage> {
{
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -32,66 +33,52 @@ class _EReferralPageState extends State<EReferralPage>
void dispose() { void dispose() {
super.dispose(); super.dispose();
} }
bool isNewReferral = true; bool isNewReferral = true;
VoidCallback? onNextStep;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
title:"E Referral".needTranslation, title: "E Referral".needTranslation,
child: SingleChildScrollView( child: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
child: Consumer<PrescriptionsViewModel>(builder: (context, model, child) { return Column(
return Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ SizedBox(height: 16.h),
SizedBox(height: 16.h), contactUsVM.isHMGLocationsListLoading
Row( ? SizedBox.shrink()
children: [ : CustomTabBar(
CustomButton( activeTextColor: AppColors.primaryRedColor,
text: "New Referral".needTranslation, activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
onPressed: () { tabs: [
isNewReferral =true; CustomTabBarModel(null, "New Referral".needTranslation),
setState(() { CustomTabBarModel(null, "Search Referral".needTranslation),
],
}); onTabChange: (index) {},
}, ).paddingSymmetrical(24.h, 0.h),
backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, SizedBox(height: 24.h),
borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), NewReferralPage(onNextStep: (nextStep) {
textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, WidgetsBinding.instance.addPostFrameCallback((_) {
fontSize: 12, setState(() {
fontWeight: FontWeight.w500, onNextStep = nextStep;
borderRadius: 10, });
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), });
height: 40.h, })
), ],
SizedBox(width: 8.h), );
CustomButton( }),
text: "Search Referral".needTranslation, ),
onPressed: () { bottomNavigationBar: Padding(
isNewReferral =false; padding: EdgeInsets.all(16.h),
}, child: CustomButton(
backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, text: LocaleKeys.next.tr(),
borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor, onPressed:onNextStep ?? () {},
textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
fontSize: 12, borderColor: AppColors.primaryRedColor,
fontWeight: FontWeight.w500, textColor: AppColors.whiteColor,
borderRadius: 10, )),
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), );
height: 40.h,
),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 20.h),
isNewReferral ? NewEReferral() : SizedBox(),
],
);
}),
),
),
);
} }
} }

@ -1,172 +1,432 @@
// dart
// File: lib/presentation/e_referral/new_referral_page.dart
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/hmg_services/models/create_e_referral_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
import 'package:hmg_patient_app_new/widgets/image_picker.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:provider/provider.dart';
class NewEReferral extends StatefulWidget { class NewReferralPage extends StatefulWidget {
NewEReferral(); final Function(VoidCallback) onNextStep;
const NewReferralPage({super.key, required this.onNextStep});
@override @override
_NewEReferralState createState() => _NewEReferralState(); State<NewReferralPage> createState() => NewReferralPageState();
} }
class _NewEReferralState extends State<NewEReferral> with TickerProviderStateMixin { class NewReferralPageState extends State<NewReferralPage> {
late PageController _controller; final PageController _pageController = PageController();
int _currentIndex = 0; int pageIndex = 0;
int pageSelected = 2; int _tabIndex = 0;
bool isPatientInsured =false;
// CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel(); final TextEditingController _nameController = TextEditingController();
final TextEditingController _phoneController = TextEditingController();
String _country = 'Saudi Arabia';
String? _relationship;
List<EReferralAttachment> medicalReportImages = [];
List<EReferralAttachment> insuredPatientImages = [];
void nextPressed() {
if (pageIndex < 2) {
_pageController.nextPage(duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
} else {
// submit logic
}
}
@override @override
void initState() { initState() {
super.initState(); super.initState();
_controller = new PageController(); widget.onNextStep((){
nextPressed();
});
} }
@override Widget _progressStep({required String title, required bool active, bool showDivider = true}) {
void dispose() { final Color activeColor = active ? AppColors.primaryRedColor : Colors.grey.shade400;
super.dispose(); return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
CircleAvatar(
radius: 13,
backgroundColor: active ? activeColor : Colors.grey.shade300,
child: Icon(Icons.check, size: 14, color: Colors.white),
),
if (showDivider)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Divider(thickness: 1),
),
],
),
const SizedBox(height: 6),
Text(title, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600)),
const SizedBox(height: 6),
Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
decoration: BoxDecoration(
color: active ? activeColor.withOpacity(0.15) : Colors.grey.shade100,
borderRadius: BorderRadius.circular(6),
),
child: Text(active ? 'Active' : 'Inactive',
style: TextStyle(fontSize: 9, color: active ? activeColor : Colors.grey)),
),
],
),
);
}
Widget _requesterForm() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
const SizedBox(height: 12),
const Text('Referral requester information',
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16)).paddingSymmetrical(4.h, 0.h),
const SizedBox(height: 12),
TextInputWidget(
controller: _nameController,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
hintText: 'Enter Referral Requester Name*', labelText: 'Requester Name',
).paddingSymmetrical(0.h, 4.h),
Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) {
final appState = getIt.get<AppState>();
return (
countriesList: authViewModel.countriesList,
selectedCountry: authViewModel.pickedCountryByUAEUser,
isArabic: appState.isArabic(),
);
},
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
builder: (context, data, child) {
final authVM = context.read<AuthenticationViewModel>();
return DropdownWidget(
labelText: LocaleKeys.country.tr(),
hintText:_country,
isEnable: true,
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: data.selectedCountry != null
? data.isArabic
? data.selectedCountry!.nameN ?? ""
: data.selectedCountry!.name ?? ""
: "",
onChange: authVM.onUAEUserCountrySelection,
hasSelectionCustomIcon: true,
labelColor: AppColors.textColor,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.globe,
).withVerticalPadding(8);
},
).paddingSymmetrical(0.h, 4.h),
TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(),
hintText: LocaleKeys.mobileNumber.tr(),
controller: null,
isEnable: true,
prefix: null,
isAllowLeadingIcon: true,
labelColor: AppColors.textColor, padding: const EdgeInsets.symmetric(horizontal: 16.0),
isReadOnly: true,
leadingIcon: AppAssets.call).paddingSymmetrical(0.h, 4.h),
Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) {
final appState = getIt.get<AppState>();
return (
countriesList: authViewModel.countriesList,
selectedCountry: authViewModel.pickedCountryByUAEUser,
isArabic: appState.isArabic(),
);
},
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
builder: (context, data, child) {
final authVM = context.read<AuthenticationViewModel>();
return DropdownWidget(
labelText: "Relationship",
hintText: "Relationship*".needTranslation,
isEnable: true,
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: data.selectedCountry != null
? data.isArabic
? data.selectedCountry!.nameN ?? ""
: data.selectedCountry!.name ?? ""
: "",
onChange: authVM.onUAEUserCountrySelection,
hasSelectionCustomIcon: true,
labelColor: AppColors.textColor,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.globe,
).withVerticalPadding(8);
},
).paddingSymmetrical(0.h, 4.h),
const SizedBox(height: 120),
],
),
);
} }
changePageViewIndex(pageIndex) { Widget _patientInformation(){
_controller.jumpToPage(pageIndex); return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
const SizedBox(height: 12),
'Patient information'.toText16(weight: FontWeight.bold).paddingSymmetrical(4.h, 0.h),
const SizedBox(height: 12),
TextInputWidget(
controller: _nameController,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
hintText: 'Enter Identification Number*', labelText: 'Identification Number ',
).paddingSymmetrical(0.h, 4.h),
TextInputWidget(
controller: _nameController,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
hintText: 'Patient Name*', labelText: 'Name',
).paddingSymmetrical(0.h, 4.h),
Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) {
final appState = getIt.get<AppState>();
return (
countriesList: authViewModel.countriesList,
selectedCountry: authViewModel.pickedCountryByUAEUser,
isArabic: appState.isArabic(),
);
},
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
builder: (context, data, child) {
final authVM = context.read<AuthenticationViewModel>();
return DropdownWidget(
labelText: LocaleKeys.country.tr(),
hintText:_country,
isEnable: true,
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: data.selectedCountry != null
? data.isArabic
? data.selectedCountry!.nameN ?? ""
: data.selectedCountry!.name ?? ""
: "",
onChange: authVM.onUAEUserCountrySelection,
hasSelectionCustomIcon: true,
labelColor: AppColors.textColor,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.globe,
).withVerticalPadding(8);
},
).paddingSymmetrical(0.h, 4.h),
'Where the patient located'.needTranslation.toText16(weight: FontWeight.bold).paddingSymmetrical(4.h, 0.h),
Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) {
final appState = getIt.get<AppState>();
return (
countriesList: authViewModel.countriesList,
selectedCountry: authViewModel.pickedCountryByUAEUser,
isArabic: appState.isArabic(),
);
},
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
builder: (context, data, child) {
final authVM = context.read<AuthenticationViewModel>();
return DropdownWidget(
labelText: LocaleKeys.country.tr(),
hintText:_country,
isEnable: true,
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: data.selectedCountry != null
? data.isArabic
? data.selectedCountry!.nameN ?? ""
: data.selectedCountry!.name ?? ""
: "",
onChange: authVM.onUAEUserCountrySelection,
hasSelectionCustomIcon: true,
labelColor: AppColors.textColor,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.globe,
).withVerticalPadding(8);
},
).paddingSymmetrical(0.h, 4.h),
]));
} }
@override Widget _otherDetails() {
Widget build(BuildContext context) { return Padding(
return Scaffold( padding: const EdgeInsets.symmetric(horizontal: 16.0),
body: Container( child: ListView(
height: double.infinity, physics: const BouncingScrollPhysics(),
children: [
const SizedBox(height: 12),
'Other Details'.toText16(weight: FontWeight.bold).paddingSymmetrical(4.h, 0.h),
const SizedBox(height: 12),
InkWell(child: TextInputWidget(
controller: _nameController,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
hintText: 'Medical Report', labelText: 'Select Attachment',
suffix: Icon(Icons.attachment),
isReadOnly: true,
),
onTap: (){
ImageOptions.showImageOptionsNew(
context,
true,
(String image, File file) {
setState(() {
EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${medicalReportImages.length + 1}.png', base64String: image);
medicalReportImages.add(eReferralAttachment);
});
},
);
},
).paddingSymmetrical(0.h, 4.h),
Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) {
final appState = getIt.get<AppState>();
return (
countriesList: authViewModel.countriesList,
selectedCountry: authViewModel.pickedCountryByUAEUser,
isArabic: appState.isArabic(),
);
},
shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic,
builder: (context, data, child) {
final authVM = context.read<AuthenticationViewModel>();
return DropdownWidget(
labelText: LocaleKeys.branch.tr(),
hintText:_country,
isEnable: true,
dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(),
selectedValue: data.selectedCountry != null
? data.isArabic
? data.selectedCountry!.nameN ?? ""
: data.selectedCountry!.name ?? ""
: "",
onChange: authVM.onUAEUserCountrySelection,
hasSelectionCustomIcon: true,
labelColor: AppColors.textColor,
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
selectionCustomIcon: AppAssets.arrow_down,
leadingIcon: AppAssets.hospital,
).withVerticalPadding(8);
},
).paddingSymmetrical(0.h, 4.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [
Checkbox(
value: isPatientInsured,
activeColor: AppColors.primaryRedColor,
onChanged: (bool? newValue) {
setState(() {
isPatientInsured = newValue!;
});
}),
Padding(
padding: const EdgeInsets.all(5.0),
child: Text(
"Patient is Insured".needTranslation,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),
),
),
],
),
],
).paddingSymmetrical(0.h, 4.h),
isPatientInsured? InkWell(child: TextInputWidget(
controller: _nameController,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
hintText: 'Insurance Document', labelText: 'Select Attachment',
suffix: Icon(Icons.attachment),
isReadOnly: true,
)) : SizedBox(),
]));
}
@override
Widget build(BuildContext context) {
final bool step0Active = pageIndex == 0;
final bool step1Active = pageIndex == 1;
final bool step2Active = pageIndex == 2;
return SizedBox(
height: MediaQuery
.of(context)
.size
.height, // constrain height
child: Column( child: Column(
children: [ children: [
Container( const SizedBox(height: 8),
width: double.infinity, Padding(
padding: EdgeInsets.only(left: 12,right: 12,top: 12), padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded( _progressStep(title: 'Requester Info', active: step0Active),
child: showProgress( _progressStep(title: 'Patient Information', active: step1Active),
title: "Requester Info".needTranslation, _progressStep(
status: _currentIndex == 0 title: 'Other details', active: step2Active, showDivider: false),
? "InProgress".needTranslation
: _currentIndex > 0
? "Completed".needTranslation
: "Locked".needTranslation,
color: _currentIndex == 0 ? AppColors.infoColor : AppColors.successColor,
),
),
Expanded(
child: showProgress(
title:"Patient Info".needTranslation,
status: _currentIndex == 1
? "InProgress".needTranslation
: _currentIndex > 1
? "Completed".needTranslation
: "Locked".needTranslation,
color: _currentIndex == 1
? AppColors.infoColor
: _currentIndex > 1
? AppColors.successColor
: AppColors.greyColor,
),
),
showProgress(
title: "Other Info".needTranslation,
status: _currentIndex == 2 ? "InProgress".needTranslation :"Locked".needTranslation,
color: _currentIndex == 2
? AppColors.infoColor
: _currentIndex > 3
? AppColors.successColor
: AppColors.greyColor,
isNeedBorder: false,
),
], ],
), ),
), ),
Expanded( Expanded(
child: PageView( child: PageView(
physics: NeverScrollableScrollPhysics(), controller: _pageController,
controller: _controller, physics: const NeverScrollableScrollPhysics(),
onPageChanged: (index) { onPageChanged: (i) => setState(() => pageIndex = i),
setState(() { children: [
_currentIndex = index; _requesterForm(),
}); _patientInformation(),
}, // const Center(child: Text('Patient Info - step 2 (placeholder)')),
scrollDirection: Axis.horizontal, _otherDetails(),
children: <Widget>[
// NewEReferralStepOnePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepTowPage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
// NewEReferralStepThreePage(
// changePageViewIndex: changePageViewIndex,
// createEReferralRequestModel: createEReferralRequestModel,
// ),
], ],
), ),
), ),
],
),
),
);
}
Widget showProgress({required String title, required String status, required Color color, bool isNeedBorder = true}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 26,
height: 26,
// decoration: containerRadius(color, 200),
child: Icon(
Icons.done,
color: Colors.white,
size: 16,
),
),
if (isNeedBorder)
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child:Divider(),
)),
],
),
// mHeight(8),
Text(
title,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
letterSpacing: -0.44,
),
),
// mHeight(2),
Container(
padding: EdgeInsets.all(5),
// decoration: containerRadius(color.withOpacity(0.2), 4),
child: Text(
status,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
),
),
),
], ],
) ),
], );
); }
} }
}

@ -39,54 +39,56 @@ class PickupLocation extends StatelessWidget {
return Column( return Column(
spacing: 12.h, spacing: 12.h,
children: [ children: [
RadioGroup<AmbulanceCallingPlace>( // Use a plain Row with Radios and provide required groupValue and onChanged
groupValue: value, Row(
onChanged: (value) { mainAxisAlignment: MainAxisAlignment.start,
context spacing: 24.h,
.read<EmergencyServicesViewModel>() children: [
.updateCallingPlace(value); Row(
}, children: [
child: Row( Radio<AmbulanceCallingPlace>(
mainAxisAlignment: MainAxisAlignment.start, value: AmbulanceCallingPlace.TO_HOSPITAL,
spacing: 24.h, groupValue: value,
children: [ onChanged: (AmbulanceCallingPlace? v) {
Row( if (v != null) {
children: [ context.read<EmergencyServicesViewModel>().updateCallingPlace(v);
Radio( }
value: AmbulanceCallingPlace.TO_HOSPITAL, },
groupValue: value, activeColor: AppColors.primaryRedColor,
activeColor: AppColors.primaryRedColor, fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
),
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), "To Hospital"
), .needTranslation
"To Hospital" .toText12(color: AppColors.textColor)
.needTranslation ],
.toText12(color: AppColors.textColor) ).onPress(() {
], context
).onPress((){ .read<EmergencyServicesViewModel>()
context .updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL);
.read<EmergencyServicesViewModel>() }),
.updateCallingPlace(AmbulanceCallingPlace.TO_HOSPITAL); Row(
}), children: [
Row( Radio<AmbulanceCallingPlace>(
children: [ value: AmbulanceCallingPlace.FROM_HOSPITAL,
Radio( groupValue: value,
value: AmbulanceCallingPlace.FROM_HOSPITAL, onChanged: (AmbulanceCallingPlace? v) {
activeColor: AppColors.primaryRedColor, if (v != null) {
context.read<EmergencyServicesViewModel>().updateCallingPlace(v);
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), }
), },
"From Hospital" activeColor: AppColors.primaryRedColor,
.needTranslation fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
.toText12(color: AppColors.textColor) ),
], "From Hospital"
).onPress((){ .needTranslation
context .toText12(color: AppColors.textColor)
.read<EmergencyServicesViewModel>() ],
.updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL); ).onPress(() {
}), context
], .read<EmergencyServicesViewModel>()
), .updateCallingPlace(AmbulanceCallingPlace.FROM_HOSPITAL);
}),
],
), ),
Visibility( Visibility(
visible: value == AmbulanceCallingPlace.TO_HOSPITAL, visible: value == AmbulanceCallingPlace.TO_HOSPITAL,
@ -100,53 +102,55 @@ class PickupLocation extends StatelessWidget {
"Select Way" "Select Way"
.needTranslation .needTranslation
.toText14(color: AppColors.textColor, weight: FontWeight.w600), .toText14(color: AppColors.textColor, weight: FontWeight.w600),
RadioGroup<AmbulanceDirection>( // Use a Row and assign groupValue/onChanged to each Radio
groupValue: directionValue, Row(
onChanged: (value) { mainAxisAlignment: MainAxisAlignment.start,
context spacing: 24.h,
.read<EmergencyServicesViewModel>() children: [
.updateDirection(value); Row(
}, children: [
child: Row( Radio<AmbulanceDirection>(
mainAxisAlignment: MainAxisAlignment.start, value: AmbulanceDirection.ONE_WAY,
spacing: 24.h, groupValue: directionValue,
children: [ onChanged: (AmbulanceDirection? v) {
Row( if (v != null) {
children: [ context.read<EmergencyServicesViewModel>().updateDirection(v);
Radio( }
value: AmbulanceDirection.ONE_WAY, },
activeColor: AppColors.primaryRedColor, activeColor: AppColors.primaryRedColor,
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), ),
), "One Way"
"One Way" .needTranslation
.needTranslation .toText12(color: AppColors.textColor)
.toText12(color: AppColors.textColor) ],
], ).onPress(() {
).onPress((){ context
context .read<EmergencyServicesViewModel>()
.read<EmergencyServicesViewModel>() .updateDirection(AmbulanceDirection.ONE_WAY);
.updateDirection(AmbulanceDirection.ONE_WAY); }),
}), Row(
Row( children: [
children: [ Radio<AmbulanceDirection>(
Radio( value: AmbulanceDirection.TWO_WAY,
value: AmbulanceDirection.TWO_WAY, groupValue: directionValue,
// activeColor: AppColors.primaryRedColor, onChanged: (AmbulanceDirection? v) {
if (v != null) {
fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), context.read<EmergencyServicesViewModel>().updateDirection(v);
), }
"Two Way" },
.needTranslation fillColor: MaterialStateProperty.all(AppColors.primaryRedColor),
.toText12(color: AppColors.textColor) ),
], "Two Way"
).onPress((){ .needTranslation
context .toText12(color: AppColors.textColor)
.read<EmergencyServicesViewModel>() ],
.updateDirection(AmbulanceDirection.TWO_WAY); ).onPress(() {
}), context
], .read<EmergencyServicesViewModel>()
), .updateDirection(AmbulanceDirection.TWO_WAY);
}),
],
), ),
], ],
); );

@ -10,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart';
import 'package:hmg_patient_app_new/presentation/radiology/search_radiology.dart'; import 'package:hmg_patient_app_new/presentation/radiology/search_radiology.dart';

Loading…
Cancel
Save