appointment prescription implemented

pull/101/head
haroon amjad 3 months ago
parent 63d844a5e9
commit 07a3052b8e

@ -711,7 +711,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.prod; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -41,12 +41,14 @@ extension EmailValidator on String {
FontWeight? weight, FontWeight? weight,
bool isBold = false, bool isBold = false,
bool isUnderLine = false, bool isUnderLine = false,
bool isCenter = false,
int? maxlines, int? maxlines,
FontStyle? fontStyle, FontStyle? fontStyle,
TextOverflow? textOverflow, TextOverflow? textOverflow,
double letterSpacing = 0}) => double letterSpacing = 0}) =>
Text( Text(
this, this,
textAlign: isCenter ? TextAlign.center : null,
maxLines: maxlines, maxLines: maxlines,
overflow: textOverflow, overflow: textOverflow,
style: TextStyle( style: TextStyle(

@ -63,10 +63,10 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
@override @override
void initState() { void initState() {
scheduleMicrotask(() { scheduleMicrotask(() {
if (AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)) { // if (AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)) {
prescriptionsViewModel.setPrescriptionsDetailsLoading(); // prescriptionsViewModel.setPrescriptionsDetailsLoading();
prescriptionsViewModel.getPrescriptionDetails(getPrescriptionRequestModel()); // prescriptionsViewModel.getPrescriptionDetails(getPrescriptionRequestModel());
} // }
}); });
super.initState(); super.initState();
} }
@ -363,7 +363,52 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
svgIcon: AppAssets.prescription_item_icon, svgIcon: AppAssets.prescription_item_icon,
isLargeText: true, isLargeText: true,
iconSize: 36.w, iconSize: 36.w,
).onPress(() { ).onPress(() async {
LoaderBottomSheet.showLoader(loadingText: "Fetching Appointment Prescriptions...".needTranslation);
await prescriptionsViewModel.getPrescriptionDetails(
getPrescriptionRequestModel(),
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
if (val.data.isNotEmpty) {
PatientPrescriptionsResponseModel patientPrescriptionsResponseModel = PatientPrescriptionsResponseModel(
doctorImageURL: widget.patientAppointmentHistoryResponseModel.doctorImageURL,
doctorName: widget.patientAppointmentHistoryResponseModel.doctorNameObj,
appointmentDate: widget.patientAppointmentHistoryResponseModel.appointmentDate,
clinicDescription: widget.patientAppointmentHistoryResponseModel.clinicName,
decimalDoctorRate: widget.patientAppointmentHistoryResponseModel.decimalDoctorRate,
name: widget.patientAppointmentHistoryResponseModel.projectName,
isHomeMedicineDeliverySupported: false,
projectID: widget.patientAppointmentHistoryResponseModel.projectID,
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
doctorID: widget.patientAppointmentHistoryResponseModel.doctorID,
setupID: widget.patientAppointmentHistoryResponseModel.setupID,
);
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionDetailPage(isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel),
),
);
} else {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: "You don't have any prescriptions for this appointment.".needTranslation),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
);
// Navigator.of(context).push( // Navigator.of(context).push(
// CustomPageRoute( // CustomPageRoute(
// page: VaccineListPage(), // page: VaccineListPage(),

@ -533,6 +533,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
page: PrescriptionDetailPage( page: PrescriptionDetailPage(
isFromAppointments: false,
prescriptionsResponseModel: prescriptionVM.patientPrescriptionOrders[index]), prescriptionsResponseModel: prescriptionVM.patientPrescriptionOrders[index]),
), ),
); );

@ -25,9 +25,10 @@ import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class PrescriptionDetailPage extends StatefulWidget { class PrescriptionDetailPage extends StatefulWidget {
PrescriptionDetailPage({super.key, required this.prescriptionsResponseModel}); PrescriptionDetailPage({super.key, required this.prescriptionsResponseModel, required this.isFromAppointments});
PatientPrescriptionsResponseModel prescriptionsResponseModel; PatientPrescriptionsResponseModel prescriptionsResponseModel;
bool isFromAppointments = false;
@override @override
State<PrescriptionDetailPage> createState() => _PrescriptionDetailPageState(); State<PrescriptionDetailPage> createState() => _PrescriptionDetailPageState();
@ -43,10 +44,12 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
checkAndRemove(false); checkAndRemove(false);
// locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); // locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
// WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); // WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation());
scheduleMicrotask(() { if (!widget.isFromAppointments) {
prescriptionsViewModel.setPrescriptionsDetailsLoading(); scheduleMicrotask(() {
prescriptionsViewModel.getPrescriptionDetails(widget.prescriptionsResponseModel); prescriptionsViewModel.setPrescriptionsDetailsLoading();
}); prescriptionsViewModel.getPrescriptionDetails(widget.prescriptionsResponseModel);
});
}
super.initState(); super.initState();
} }
@ -146,7 +149,7 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
CustomButton( CustomButton(
text: "Download Prescription".needTranslation, text: "Download Prescription".needTranslation,
onPressed: () async { onPressed: () async {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader(loadingText: "Fetching prescription PDF, Please wait...".needTranslation);
await prescriptionVM.getPrescriptionPDFBase64(widget.prescriptionsResponseModel).then((val) async { await prescriptionVM.getPrescriptionPDFBase64(widget.prescriptionsResponseModel).then((val) async {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
if (prescriptionVM.prescriptionPDFBase64Data.isNotEmpty) { if (prescriptionVM.prescriptionPDFBase64Data.isNotEmpty) {
@ -181,8 +184,10 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
), ),
), ),
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 16.h),
ListView.builder( ListView.builder(
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: prescriptionVM.isPrescriptionsDetailsLoading ? 5 : prescriptionVM.prescriptionDetailsList.length, itemCount: prescriptionVM.isPrescriptionsDetailsLoading ? 5 : prescriptionVM.prescriptionDetailsList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {

@ -278,9 +278,12 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
model.setPrescriptionsDetailsLoading(); model.setPrescriptionsDetailsLoading();
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
page: PrescriptionDetailPage(prescriptionsResponseModel: prescription), page: PrescriptionDetailPage(
), prescriptionsResponseModel: prescription,
); isFromAppointments: false,
),
),
);
}), }),
), ),
], ],

@ -100,7 +100,7 @@ class AppCustomChipWidget extends StatelessWidget {
) )
: Chip( : Chip(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor), label: richText ?? labelText!.toText10(weight: FontWeight.w500, letterSpacing: 0, color: textColor, isCenter: true),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
shape: shape ?? shape: shape ??
@ -109,7 +109,7 @@ class AppCustomChipWidget extends StatelessWidget {
smoothness: 10, smoothness: 10,
side: BorderSide(color: AppColors.transparent, width: 1.5), side: BorderSide(color: AppColors.transparent, width: 1.5),
), ),
labelPadding: labelPadding ?? EdgeInsetsDirectional.only(start: 2.w, end: deleteIcon?.isNotEmpty == true ? 2.w : 8.w), labelPadding: labelPadding ?? EdgeInsetsDirectional.only(start: 6.w, end: deleteIcon?.isNotEmpty == true ? 2.w : 8.w),
deleteIcon: deleteIcon?.isNotEmpty == true deleteIcon: deleteIcon?.isNotEmpty == true
? InkWell( ? InkWell(
onTap: onDeleteTap, onTap: onDeleteTap,

Loading…
Cancel
Save