|
|
|
@ -1,21 +1,16 @@
|
|
|
|
// widgets/requester_form_step.dart
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.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/core/utils/validation_utils.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/validation_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/hmg_services/models/ui_models/e_referral_form_model.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/e_referral/e-referral_validator.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/e_referral/e_referral_form_manager.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/e_referral/e_referral_form_manager.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/dropdown/dropdown_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
// widgets/requester_form_step.dart
|
|
|
|
|
|
|
|
// widgets/requester_form_step.dart
|
|
|
|
|
|
|
|
class RequesterFormStep extends StatefulWidget {
|
|
|
|
class RequesterFormStep extends StatefulWidget {
|
|
|
|
const RequesterFormStep({super.key});
|
|
|
|
const RequesterFormStep({super.key});
|
|
|
|
|
|
|
|
|
|
|
|
@ -72,7 +67,7 @@ class RequesterFormStepState extends State<RequesterFormStep> {
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// const SizedBox(height: 12),
|
|
|
|
// const SizedBox(height: 12),
|
|
|
|
_buildSectionTitle('Referral requester information'),
|
|
|
|
_buildSectionTitle('Referral requester information'.needTranslation),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
_buildNameField(formManager),
|
|
|
|
_buildNameField(formManager),
|
|
|
|
// _buildPhoneField(formManager),
|
|
|
|
// _buildPhoneField(formManager),
|
|
|
|
@ -98,8 +93,8 @@ class RequesterFormStepState extends State<RequesterFormStep> {
|
|
|
|
child: TextInputWidget(
|
|
|
|
child: TextInputWidget(
|
|
|
|
controller: _nameController,
|
|
|
|
controller: _nameController,
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
hintText: 'Enter Referral Requester Name*',
|
|
|
|
hintText: 'Enter Referral Requester Name*'.needTranslation,
|
|
|
|
labelText: 'Requester Name',
|
|
|
|
labelText: 'Requester Name'.needTranslation,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
errorMessage: formManager.errors.requesterName,
|
|
|
|
errorMessage: formManager.errors.requesterName,
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
@ -112,40 +107,12 @@ class RequesterFormStepState extends State<RequesterFormStep> {
|
|
|
|
).paddingSymmetrical(0, 8),
|
|
|
|
).paddingSymmetrical(0, 8),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// Widget _buildPhoneField(ReferralFormManager formManager) {
|
|
|
|
|
|
|
|
// return Focus(
|
|
|
|
|
|
|
|
// focusNode: _phoneFocusNode,
|
|
|
|
|
|
|
|
// child: TextInputWidget(
|
|
|
|
|
|
|
|
// labelText: 'Phone Number',
|
|
|
|
|
|
|
|
// hintText: "5xxxxxxxx",
|
|
|
|
|
|
|
|
// controller: _phoneController,
|
|
|
|
|
|
|
|
// padding: const EdgeInsets.all(8),
|
|
|
|
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
|
|
|
// formManager.updateRequesterPhone(value ?? '');
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// onCountryChange: (value) {
|
|
|
|
|
|
|
|
// formManager.updateCountryEnum(value);
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// prefix: '966',
|
|
|
|
|
|
|
|
// isBorderAllowed: false,
|
|
|
|
|
|
|
|
// isAllowLeadingIcon: true,
|
|
|
|
|
|
|
|
// fontSize: 13,
|
|
|
|
|
|
|
|
// isCountryDropDown: true,
|
|
|
|
|
|
|
|
// leadingIcon: AppAssets.smart_phone,
|
|
|
|
|
|
|
|
// errorMessage: formManager.errors.requesterPhone,
|
|
|
|
|
|
|
|
// hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.requesterPhone)
|
|
|
|
|
|
|
|
// ).paddingSymmetrical(0, 8),
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _buildRelationshipField(BuildContext context, ReferralFormManager formManager) {
|
|
|
|
Widget _buildRelationshipField(BuildContext context, ReferralFormManager formManager) {
|
|
|
|
return DropdownWidget(
|
|
|
|
return DropdownWidget(
|
|
|
|
labelText: "Relationship",
|
|
|
|
labelText: "Relationship".needTranslation,
|
|
|
|
hintText: formManager.formData.relationship?.textEn ?? "Select Relation",
|
|
|
|
hintText: formManager.formData.relationship?.textEn ?? "Select Relation".needTranslation,
|
|
|
|
isEnable: false,
|
|
|
|
isEnable: false,
|
|
|
|
selectedValue: formManager.formData.relationship?.textEn ?? "Select Relation",
|
|
|
|
selectedValue: formManager.formData.relationship?.textEn ?? "Select Relation".needTranslation,
|
|
|
|
errorMessage: formManager.errors.relationship,
|
|
|
|
errorMessage: formManager.errors.relationship,
|
|
|
|
hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.relationship),
|
|
|
|
hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.relationship),
|
|
|
|
hasSelectionCustomIcon: false,
|
|
|
|
hasSelectionCustomIcon: false,
|
|
|
|
@ -165,8 +132,8 @@ class RequesterFormStepState extends State<RequesterFormStep> {
|
|
|
|
controller: _otherNameController,
|
|
|
|
controller: _otherNameController,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
|
|
hintText: 'Other Name*',
|
|
|
|
hintText: 'Other Name*'.needTranslation,
|
|
|
|
labelText: 'Other Name',
|
|
|
|
labelText: 'Other Name'.needTranslation,
|
|
|
|
errorMessage: formManager.errors.otherRelationshipName,
|
|
|
|
errorMessage: formManager.errors.otherRelationshipName,
|
|
|
|
onChange: (value) {
|
|
|
|
onChange: (value) {
|
|
|
|
formManager.updateOtherRelationshipName(value ?? '');
|
|
|
|
formManager.updateOtherRelationshipName(value ?? '');
|
|
|
|
@ -185,7 +152,7 @@ class RequesterFormStepState extends State<RequesterFormStep> {
|
|
|
|
|
|
|
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
title: "Select Relation",
|
|
|
|
title: "Select Relation".needTranslation,
|
|
|
|
child: Consumer<HmgServicesViewModel>(
|
|
|
|
child: Consumer<HmgServicesViewModel>(
|
|
|
|
builder: (context, hmgServicesVM, child) {
|
|
|
|
builder: (context, hmgServicesVM, child) {
|
|
|
|
if (hmgServicesVM.relationTypes.isEmpty) {
|
|
|
|
if (hmgServicesVM.relationTypes.isEmpty) {
|
|
|
|
|