Ask doctor implemented
parent
21b7b32013
commit
c600b0ee7a
@ -0,0 +1,92 @@
|
|||||||
|
class AskDocRequestType {
|
||||||
|
String? setupID;
|
||||||
|
int? parameterGroup;
|
||||||
|
int? parameterType;
|
||||||
|
int? parameterCode;
|
||||||
|
String? description;
|
||||||
|
String? descriptionN;
|
||||||
|
String? alias;
|
||||||
|
String? aliasN;
|
||||||
|
String? prefix;
|
||||||
|
String? suffix;
|
||||||
|
String? isColorCodingRequired;
|
||||||
|
String? backColor;
|
||||||
|
String? foreColor;
|
||||||
|
bool? isBuiltIn;
|
||||||
|
bool? isActive;
|
||||||
|
int? createdBy;
|
||||||
|
String? createdOn;
|
||||||
|
String? editedBy;
|
||||||
|
String? editedOn;
|
||||||
|
String? rowVer;
|
||||||
|
|
||||||
|
AskDocRequestType(
|
||||||
|
{this.setupID,
|
||||||
|
this.parameterGroup,
|
||||||
|
this.parameterType,
|
||||||
|
this.parameterCode,
|
||||||
|
this.description,
|
||||||
|
this.descriptionN,
|
||||||
|
this.alias,
|
||||||
|
this.aliasN,
|
||||||
|
this.prefix,
|
||||||
|
this.suffix,
|
||||||
|
this.isColorCodingRequired,
|
||||||
|
this.backColor,
|
||||||
|
this.foreColor,
|
||||||
|
this.isBuiltIn,
|
||||||
|
this.isActive,
|
||||||
|
this.createdBy,
|
||||||
|
this.createdOn,
|
||||||
|
this.editedBy,
|
||||||
|
this.editedOn,
|
||||||
|
this.rowVer});
|
||||||
|
|
||||||
|
AskDocRequestType.fromJson(Map<String, dynamic> json) {
|
||||||
|
setupID = json['SetupID'];
|
||||||
|
parameterGroup = json['ParameterGroup'];
|
||||||
|
parameterType = json['ParameterType'];
|
||||||
|
parameterCode = json['ParameterCode'];
|
||||||
|
description = json['Description'];
|
||||||
|
descriptionN = json['DescriptionN'];
|
||||||
|
alias = json['Alias'];
|
||||||
|
aliasN = json['AliasN'];
|
||||||
|
prefix = json['Prefix'];
|
||||||
|
suffix = json['Suffix'];
|
||||||
|
isColorCodingRequired = json['IsColorCodingRequired'];
|
||||||
|
backColor = json['BackColor'];
|
||||||
|
foreColor = json['ForeColor'];
|
||||||
|
isBuiltIn = json['IsBuiltIn'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
createdBy = json['CreatedBy'];
|
||||||
|
createdOn = json['CreatedOn'];
|
||||||
|
editedBy = json['EditedBy'];
|
||||||
|
editedOn = json['EditedOn'];
|
||||||
|
rowVer = json['RowVer'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['SetupID'] = this.setupID;
|
||||||
|
data['ParameterGroup'] = this.parameterGroup;
|
||||||
|
data['ParameterType'] = this.parameterType;
|
||||||
|
data['ParameterCode'] = this.parameterCode;
|
||||||
|
data['Description'] = this.description;
|
||||||
|
data['DescriptionN'] = this.descriptionN;
|
||||||
|
data['Alias'] = this.alias;
|
||||||
|
data['AliasN'] = this.aliasN;
|
||||||
|
data['Prefix'] = this.prefix;
|
||||||
|
data['Suffix'] = this.suffix;
|
||||||
|
data['IsColorCodingRequired'] = this.isColorCodingRequired;
|
||||||
|
data['BackColor'] = this.backColor;
|
||||||
|
data['ForeColor'] = this.foreColor;
|
||||||
|
data['IsBuiltIn'] = this.isBuiltIn;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['CreatedBy'] = this.createdBy;
|
||||||
|
data['CreatedOn'] = this.createdOn;
|
||||||
|
data['EditedBy'] = this.editedBy;
|
||||||
|
data['EditedOn'] = this.editedOn;
|
||||||
|
data['RowVer'] = this.rowVer;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
||||||
|
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/extensions/string_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_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/widgets/buttons/custom_button.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
||||||
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
||||||
|
|
||||||
|
class AskDoctorRequestTypeSelect extends StatelessWidget {
|
||||||
|
AskDoctorRequestTypeSelect({super.key, required this.askDoctorRequestTypeList, required this.myAppointmentsViewModel, required this.patientAppointmentHistoryResponseModel});
|
||||||
|
|
||||||
|
final MyAppointmentsViewModel myAppointmentsViewModel;
|
||||||
|
final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
|
||||||
|
List<AskDocRequestType> askDoctorRequestTypeList = [];
|
||||||
|
int selectedParameterCodeValue = 2;
|
||||||
|
int selectedParameterCode = 0;
|
||||||
|
|
||||||
|
final ValueNotifier<int> requestTypeSelectNotifier = ValueNotifier<int>(0);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: askDoctorRequestTypeList.length,
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
padding: EdgeInsets.only(top: 8, bottom: 8),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ValueListenableBuilder<int>(
|
||||||
|
valueListenable: requestTypeSelectNotifier,
|
||||||
|
builder: (context, duration, child) {
|
||||||
|
return Theme(
|
||||||
|
data: Theme.of(context).copyWith(
|
||||||
|
listTileTheme: ListTileThemeData(horizontalTitleGap: 4),
|
||||||
|
),
|
||||||
|
child: RadioListTile<int>(
|
||||||
|
title: (askDoctorRequestTypeList[index].description ?? '').toText14(weight: FontWeight.w500),
|
||||||
|
value: index,
|
||||||
|
fillColor: WidgetStateProperty.resolveWith((states) {
|
||||||
|
if (states.contains(WidgetState.selected)) {
|
||||||
|
return AppColors.primaryRedColor;
|
||||||
|
}
|
||||||
|
return Color(0xffEEEEEE);
|
||||||
|
}),
|
||||||
|
contentPadding: EdgeInsets.only(left: 12.h, right: 12.h),
|
||||||
|
groupValue: selectedParameterCode,
|
||||||
|
onChanged: (int? newValue) {
|
||||||
|
selectedParameterCode = newValue!;
|
||||||
|
selectedParameterCodeValue = askDoctorRequestTypeList[index].parameterCode!;
|
||||||
|
requestTypeSelectNotifier.value = selectedParameterCode;
|
||||||
|
debugPrint(selectedParameterCodeValue.toString());
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
text: LocaleKeys.cancel.tr(),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
backgroundColor: AppColors.primaryRedColor,
|
||||||
|
borderColor: AppColors.primaryRedColor,
|
||||||
|
textColor: AppColors.whiteColor,
|
||||||
|
icon: AppAssets.cancel,
|
||||||
|
iconColor: AppColors.whiteColor,
|
||||||
|
borderRadius: 12.r,
|
||||||
|
iconSize: 14.h,
|
||||||
|
fontSize: 14.f,
|
||||||
|
height: 40.h,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 8.h),
|
||||||
|
Expanded(
|
||||||
|
child: CustomButton(
|
||||||
|
text: LocaleKeys.confirm.tr(),
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.pop(context);
|
||||||
|
LoaderBottomSheet.showLoader(loadingText: "Sending Request...");
|
||||||
|
await myAppointmentsViewModel.sendAskDocCallRequest(
|
||||||
|
patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel,
|
||||||
|
requestType: selectedParameterCodeValue.toString(),
|
||||||
|
remarks: "",
|
||||||
|
userMobileNumber: myAppointmentsViewModel.appState.getAuthenticatedUser()!.mobileNumber!,
|
||||||
|
onSuccess: (val) {
|
||||||
|
LoaderBottomSheet.hideLoader();
|
||||||
|
showCommonBottomSheetWithoutHeight(
|
||||||
|
context,
|
||||||
|
child: Utils.getSuccessWidget(loadingText: "Request has been sent successfully, you will be contacted soon.".needTranslation),
|
||||||
|
callBackFunc: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
title: "",
|
||||||
|
isCloseButtonVisible: true,
|
||||||
|
isDismissible: false,
|
||||||
|
isFullScreen: false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onError: (errMessage) {
|
||||||
|
LoaderBottomSheet.hideLoader();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
backgroundColor: AppColors.bgGreenColor,
|
||||||
|
borderColor: AppColors.bgGreenColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
icon: AppAssets.confirm,
|
||||||
|
iconSize: 14.h,
|
||||||
|
borderRadius: 12.r,
|
||||||
|
fontSize: 14.f,
|
||||||
|
height: 40.h,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue