|
|
|
|
@ -1,12 +1,17 @@
|
|
|
|
|
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/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/theme/colors.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/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget {
|
|
|
|
|
@ -23,7 +28,7 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: CollapsingListView(
|
|
|
|
|
title: LocaleKeys.deliveryLocation.tr(context: context),
|
|
|
|
|
title: LocaleKeys.orderSummary.tr(context: context),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -39,39 +44,63 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.orderSummary.tr(context: context).toText16(isBold: true),
|
|
|
|
|
LocaleKeys.orderDetail.tr(context: context).toText16(isBold: true),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
...List.generate(
|
|
|
|
|
prescriptionsViewModel.prescriptionDetailsList.length,
|
|
|
|
|
(index) => Container(
|
|
|
|
|
margin: EdgeInsets.all(0.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(5.r),
|
|
|
|
|
),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
prescriptionsViewModel.prescriptionDetailsList[index].imageSRCUrl!,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
width: 60.w,
|
|
|
|
|
height: 70.h,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10.w,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.h),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: prescriptionsViewModel.prescriptionDetailsList[index].itemDescription!.toText12(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
prescriptionsViewModel.prescriptionDetailsList.length,
|
|
|
|
|
(index) => Container(
|
|
|
|
|
margin: EdgeInsets.all(0.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(5.r),
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
child: Image.network(
|
|
|
|
|
prescriptionsViewModel.prescriptionDetailsList[index].imageSRCUrl!,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
width: 60.w,
|
|
|
|
|
height: 70.h,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.h),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: prescriptionsViewModel.prescriptionDetailsList[index].itemDescription!.trim().toText12(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 20.r,
|
|
|
|
|
hasShadow: true,
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.deliveryLocation.tr(context: context).toText16(isBold: true),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
ClipRRect(
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
"https://maps.googleapis.com/maps/api/staticmap?center=${prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lat},${prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lng}&zoom=15&size=350x165&maptype=roadmap&markers=color:red%7C${prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lat},${prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lng}&key=AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -80,7 +109,64 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget {
|
|
|
|
|
).paddingSymmetrical(24.w, 0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container()
|
|
|
|
|
Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 24.h,
|
|
|
|
|
hasShadow: true,
|
|
|
|
|
),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: LocaleKeys.submit.tr(context: context),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Submitting your request...");
|
|
|
|
|
await prescriptionsViewModel.submitPrescriptionDeliveryRequest(
|
|
|
|
|
latitude: prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lat.toString(),
|
|
|
|
|
longitude: prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lng.toString(),
|
|
|
|
|
appointmentNo: prescriptionsViewModel.prescriptionDetailsList.first.appointmentNo.toString(),
|
|
|
|
|
dischargeID: "0",
|
|
|
|
|
projectID: prescriptionsViewModel.prescriptionDetailsList.first.projectID.toString(),
|
|
|
|
|
onSuccess: (val) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getSuccessWidget(loadingText: "Request sent successfully.".needTranslation),
|
|
|
|
|
callBackFunc: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
title: "",
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
onError: (err) {
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
child: Utils.getErrorWidget(loadingText: err),
|
|
|
|
|
callBackFunc: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
title: "",
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.successColor,
|
|
|
|
|
borderColor: AppColors.successColor.withOpacity(0.01),
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
height: 50.h,
|
|
|
|
|
icon: AppAssets.prescription_refill_icon,
|
|
|
|
|
iconColor: AppColors.whiteColor,
|
|
|
|
|
iconSize: 20.h,
|
|
|
|
|
).paddingSymmetrical(24.h, 24.h),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|