|
|
|
|
@ -1,15 +1,19 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/date_util.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/prescriptions/prescriptions_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/RequestStatus.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.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/chip/app_custom_chip_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class PrescriptionDeliveryOrdersListPage extends StatelessWidget {
|
|
|
|
|
@ -26,10 +30,10 @@ class PrescriptionDeliveryOrdersListPage extends StatelessWidget {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView.builder(
|
|
|
|
|
itemCount: model.isPrescriptionsOrdersLoading
|
|
|
|
|
itemCount: model.isPrescriptionsDeliveryOrdersLoading
|
|
|
|
|
? 4
|
|
|
|
|
: model.patientPrescriptionOrders.isNotEmpty
|
|
|
|
|
? model.patientPrescriptionOrdersViewList.length
|
|
|
|
|
: model.prescriptionsOrderList.isNotEmpty
|
|
|
|
|
? model.prescriptionsOrderList.length
|
|
|
|
|
: 1,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
@ -56,9 +60,6 @@ class PrescriptionDeliveryOrdersListPage extends StatelessWidget {
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// expandedIndex = isExpanded ? null : index;
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
@ -67,177 +68,20 @@ class PrescriptionDeliveryOrdersListPage extends StatelessWidget {
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 8.h,
|
|
|
|
|
children: [
|
|
|
|
|
RequestStatus(status: model.prescriptionsOrderList[index].statusId ?? 0),
|
|
|
|
|
"Req ID: ${model.prescriptionsOrderList[index].iD}".toText16(color: AppColors.textColor, weight: FontWeight.w600),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
spacing: 4.w,
|
|
|
|
|
children: [
|
|
|
|
|
// CustomButton(
|
|
|
|
|
// text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available",
|
|
|
|
|
// onPressed: () {},
|
|
|
|
|
// backgroundColor: AppColors.greyColor,
|
|
|
|
|
// borderColor: AppColors.greyColor,
|
|
|
|
|
// textColor: AppColors.blackColor,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// borderRadius: 8,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
// height: 30.h,
|
|
|
|
|
// ),
|
|
|
|
|
// Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
|
|
|
|
|
chip(Utils.getDayMonthYearDateFormatted(DateTime.tryParse(model.prescriptionsOrderList[index].created!)), AppAssets.calendar,
|
|
|
|
|
AppColors.blackBgColor),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
// model.patientPrescriptionOrdersViewList[index].filterName!.toText16(isBold: true)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// AnimatedSwitcher(
|
|
|
|
|
// duration: Duration(milliseconds: 500),
|
|
|
|
|
// switchInCurve: Curves.easeIn,
|
|
|
|
|
// switchOutCurve: Curves.easeOut,
|
|
|
|
|
// transitionBuilder: (Widget child, Animation<double> animation) {
|
|
|
|
|
// return FadeTransition(
|
|
|
|
|
// opacity: animation,
|
|
|
|
|
// child: SizeTransition(
|
|
|
|
|
// sizeFactor: animation,
|
|
|
|
|
// axisAlignment: 0.0,
|
|
|
|
|
// child: child,
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// child: isExpanded
|
|
|
|
|
// ? Container(
|
|
|
|
|
// key: ValueKey<int>(index),
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) {
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// Image.network(
|
|
|
|
|
// prescription.doctorImageURL!,
|
|
|
|
|
// width: 24.h,
|
|
|
|
|
// height: 24.h,
|
|
|
|
|
// fit: BoxFit.fill,
|
|
|
|
|
// ).circle(100),
|
|
|
|
|
// SizedBox(width: 8.h),
|
|
|
|
|
// Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 8.h),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// CustomButton(
|
|
|
|
|
// text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false),
|
|
|
|
|
// onPressed: () {},
|
|
|
|
|
// backgroundColor: AppColors.greyColor,
|
|
|
|
|
// borderColor: AppColors.greyColor,
|
|
|
|
|
// textColor: AppColors.blackColor,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// borderRadius: 8,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
// height: 24.h,
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(width: 8.h),
|
|
|
|
|
// CustomButton(
|
|
|
|
|
// text: model.isSortByClinic ? prescription.name! : prescription.clinicDescription!,
|
|
|
|
|
// onPressed: () {},
|
|
|
|
|
// backgroundColor: AppColors.greyColor,
|
|
|
|
|
// borderColor: AppColors.greyColor,
|
|
|
|
|
// textColor: AppColors.blackColor,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// borderRadius: 8,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
// height: 24.h,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 8.h),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 6,
|
|
|
|
|
// child: CustomButton(
|
|
|
|
|
// text: prescription.isHomeMedicineDeliverySupported!
|
|
|
|
|
// ? LocaleKeys.resendOrder.tr(context: context)
|
|
|
|
|
// : LocaleKeys.prescriptionDeliveryError.tr(context: context),
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// if (prescription.isHomeMedicineDeliverySupported!) {
|
|
|
|
|
// LoaderBottomSheet.showLoader(loadingText: "Fetching prescription details...".needTranslation);
|
|
|
|
|
// await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index],
|
|
|
|
|
// onSuccess: (val) {
|
|
|
|
|
// LoaderBottomSheet.hideLoader();
|
|
|
|
|
// prescriptionsViewModel.initiatePrescriptionDelivery();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// backgroundColor:
|
|
|
|
|
// prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color,
|
|
|
|
|
// borderColor: AppColors.successColor.withOpacity(0.01),
|
|
|
|
|
// textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
|
|
|
|
|
// fontSize: prescription.isHomeMedicineDeliverySupported! ? 14 : 12,
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// borderRadius: 12,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
// height: 40.h,
|
|
|
|
|
// icon: AppAssets.prescription_refill_icon,
|
|
|
|
|
// iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
|
|
|
|
|
// iconSize: 14.h,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(width: 8.h),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: Container(
|
|
|
|
|
// height: 40.h,
|
|
|
|
|
// width: 40.w,
|
|
|
|
|
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
// color: AppColors.textColor,
|
|
|
|
|
// borderRadius: 12,
|
|
|
|
|
// ),
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: EdgeInsets.all(12.h),
|
|
|
|
|
// child: Transform.flip(
|
|
|
|
|
// flipX: appState.isArabic(),
|
|
|
|
|
// child: Utils.buildSvgWithAssets(
|
|
|
|
|
// icon: AppAssets.forward_arrow_icon_small,
|
|
|
|
|
// iconColor: AppColors.whiteColor,
|
|
|
|
|
// fit: BoxFit.contain,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ).onPress(() {
|
|
|
|
|
// model.setPrescriptionsDetailsLoading();
|
|
|
|
|
// Navigator.of(context).push(
|
|
|
|
|
// CustomPageRoute(
|
|
|
|
|
// page: PrescriptionDetailPage(
|
|
|
|
|
// prescriptionsResponseModel: prescription,
|
|
|
|
|
// isFromAppointments: false,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 12.h),
|
|
|
|
|
// Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
|
|
|
|
|
// SizedBox(height: 12.h),
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }).toList(),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// : SizedBox.shrink(),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -255,4 +99,13 @@ class PrescriptionDeliveryOrdersListPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chip(String title, String iconString, Color iconColor) {
|
|
|
|
|
return AppCustomChipWidget(
|
|
|
|
|
labelText: title,
|
|
|
|
|
icon: iconString,
|
|
|
|
|
iconColor: iconColor,
|
|
|
|
|
iconSize: 12.h,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|