Ancillary Orders Flow Completed

pull/94/head
faizatflutter 4 months ago
parent 100d4bda9f
commit 16b5ff1b62

@ -76,6 +76,8 @@ class AncillaryOrderItem {
bool? isQueued; bool? isQueued;
DateTime? orderDate; DateTime? orderDate;
int? orderNo; int? orderNo;
String? projectName; // Added from parent AncillaryOrderGroup
int? projectID; // Added from parent AncillaryOrderGroup
AncillaryOrderItem({ AncillaryOrderItem({
this.ancillaryProcedureListModels, this.ancillaryProcedureListModels,
@ -90,9 +92,11 @@ class AncillaryOrderItem {
this.isQueued, this.isQueued,
this.orderDate, this.orderDate,
this.orderNo, this.orderNo,
this.projectName,
this.projectID,
}); });
factory AncillaryOrderItem.fromJson(Map<String, dynamic> json) => AncillaryOrderItem( factory AncillaryOrderItem.fromJson(Map<String, dynamic> json, {String? projectName, int? projectID}) => AncillaryOrderItem(
ancillaryProcedureListModels: json['AncillaryProcedureListModels'], ancillaryProcedureListModels: json['AncillaryProcedureListModels'],
appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']), appointmentDate: DateUtil.convertStringToDate(json['AppointmentDate']),
appointmentNo: json['AppointmentNo'] as int?, appointmentNo: json['AppointmentNo'] as int?,
@ -105,5 +109,7 @@ class AncillaryOrderItem {
isQueued: json['IsQueued'] as bool?, isQueued: json['IsQueued'] as bool?,
orderDate: DateUtil.convertStringToDate(json['OrderDate']), orderDate: DateUtil.convertStringToDate(json['OrderDate']),
orderNo: json['OrderNo'] as int?, orderNo: json['OrderNo'] as int?,
projectName: projectName,
projectID: projectID,
); );
} }

@ -81,11 +81,13 @@ class TodoSectionRepoImp implements TodoSectionRepo {
for (var group in groupsList) { for (var group in groupsList) {
if (group is Map<String, dynamic> && group['AncillaryOrderList'] != null) { if (group is Map<String, dynamic> && group['AncillaryOrderList'] != null) {
final ordersList = group['AncillaryOrderList'] as List; final ordersList = group['AncillaryOrderList'] as List;
final projectName = group['ProjectName'] as String?;
final projectID = group['ProjectID'] as int?;
// Parse each order item in the group // Parse each order item in the group
for (var orderJson in ordersList) { for (var orderJson in ordersList) {
if (orderJson is Map<String, dynamic>) { if (orderJson is Map<String, dynamic>) {
ancillaryOrders.add(AncillaryOrderItem.fromJson(orderJson)); ancillaryOrders.add(AncillaryOrderItem.fromJson(orderJson, projectName: projectName, projectID: projectID));
} }
} }
} }

@ -223,9 +223,7 @@ class TodoSectionViewModel extends ChangeNotifier {
Function(dynamic)? onSuccess, Function(dynamic)? onSuccess,
Function(String)? onError, Function(String)? onError,
}) async { }) async {
final result = await todoSectionRepo.applePayInsertRequest( final result = await todoSectionRepo.applePayInsertRequest(applePayInsertRequest: applePayInsertRequest);
applePayInsertRequest: applePayInsertRequest,
);
result.fold( result.fold(
(failure) async { (failure) async {

@ -13,15 +13,13 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.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/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_item_view.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_item_view.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_reminder_view.dart';
import 'package:hmg_patient_app_new/theme/colors.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/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.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:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart';
import 'package:open_filex/open_filex.dart'; import 'package:open_filex/open_filex.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -127,7 +125,8 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
children: [ children: [
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.doctor_calendar_icon, icon: AppAssets.doctor_calendar_icon,
labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false), labelText: DateUtil.formatDateToDate(
DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false),
labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h), labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h),
), ),
AppCustomChipWidget( AppCustomChipWidget(
@ -214,18 +213,22 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
hasShadow: true, hasShadow: true,
), ),
child: CustomButton( child: CustomButton(
text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? LocaleKeys.resendOrder.tr(context: context) : LocaleKeys.prescriptionDeliveryError.tr(context: context), text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported!
? LocaleKeys.resendOrder.tr(context: context)
: LocaleKeys.prescriptionDeliveryError.tr(context: context),
onPressed: () {}, onPressed: () {},
backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color, backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color,
borderColor: AppColors.successColor.withOpacity(0.01), borderColor: AppColors.successColor.withOpacity(0.01),
textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), textColor:
widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35),
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50.h, height: 50.h,
icon: AppAssets.prescription_refill_icon, icon: AppAssets.prescription_refill_icon,
iconColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35), iconColor:
widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.whiteColor : AppColors.textColor.withOpacity(0.35),
iconSize: 20.h, iconSize: 20.h,
).paddingSymmetrical(24.h, 24.h), ).paddingSymmetrical(24.h, 24.h),
), ),

@ -2,25 +2,35 @@ import 'dart:async';
import 'dart:developer'; import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.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/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/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/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/payfort/models/apple_pay_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/models/resp_models/ancillary_order_procedures_detail_response_model.dart';
import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/theme/colors.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/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/in_app_browser/InAppBrowser.dart'; import 'package:hmg_patient_app_new/widgets/in_app_browser/InAppBrowser.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class AncillaryOrderPaymentPage extends StatefulWidget { class AncillaryOrderPaymentPage extends StatefulWidget {
final DateTime? appointmentDate;
final int appointmentNoVida; final int appointmentNoVida;
final int orderNo; final int orderNo;
final int projectID; final int projectID;
@ -29,6 +39,7 @@ class AncillaryOrderPaymentPage extends StatefulWidget {
const AncillaryOrderPaymentPage({ const AncillaryOrderPaymentPage({
super.key, super.key,
required this.appointmentDate,
required this.appointmentNoVida, required this.appointmentNoVida,
required this.orderNo, required this.orderNo,
required this.projectID, required this.projectID,
@ -171,7 +182,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
), ),
// Payment Summary Footer // Payment Summary Footer
todoVM.isProcessingPayment ? SizedBox.shrink() : _buildPaymentSummary(), todoVM.isProcessingPayment ? SizedBox.shrink() : _buildPaymentSummary()
], ],
); );
}, },
@ -256,7 +267,7 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
fit: BoxFit.contain, fit: BoxFit.contain,
).paddingSymmetrical(24.h, 0.h).onPress(() { ).paddingSymmetrical(24.h, 0.h).onPress(() {
if (!todoSectionViewModel.isProcessingPayment) { if (!todoSectionViewModel.isProcessingPayment) {
_openPaymentURL("ApplePay"); _startApplePay();
} }
}) })
: SizedBox(height: 12.h), : SizedBox(height: 12.h),
@ -474,11 +485,160 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
// Show success message and navigate // Show success message and navigate
Utils.showToast("Payment successful! Invoice #: $invoiceNo"); Utils.showToast("Payment successful! Invoice #: $invoiceNo");
// Navigate back to home after a short delay // Navigate back to home after a short delay
Future.delayed(Duration(seconds: 2), () { Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop(); // Close payment page showCommonBottomSheetWithoutHeight(
Navigator.of(context).pop(); // Close details page context,
child: Column(
children: [
Row(
children: [
"Here is your invoice #: ".needTranslation.toText14(
color: AppColors.textColorLight,
weight: FontWeight.w500,
),
SizedBox(width: 4.w),
("12345").toText16(isBold: true),
],
),
SizedBox(height: 24.h),
Row(
children: [
Expanded(
child: CustomButton(
height: 56.h,
text: LocaleKeys.ok.tr(),
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
),
),
],
),
],
),
// title: "Payment Completed Successfully".needTranslation,
titleWidget: Utils.getSuccessWidget(loadingText: "Payment Completed Successfully".needTranslation),
isCloseButtonVisible: false,
isDismissible: false,
isFullScreen: false,
);
}); });
} }
_startApplePay() async {
showCommonBottomSheet(
context,
child: Utils.getLoadingWidget(),
callBackFunc: (str) {},
title: "",
height: ResponsiveExtension.screenHeight * 0.3,
isCloseButtonVisible: false,
isDismissible: false,
isFullScreen: false,
);
final user = appState.getAuthenticatedUser();
transID = Utils.getAdvancePaymentTransID(widget.projectID, user!.patientId!);
ApplePayInsertRequest applePayInsertRequest = ApplePayInsertRequest();
await payfortViewModel.getPayfortConfigurations(
serviceId: ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum(),
projectId: widget.projectID,
integrationId: 2,
);
applePayInsertRequest.clientRequestID = transID;
applePayInsertRequest.clinicID = 0;
applePayInsertRequest.currency = appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED";
applePayInsertRequest.customerEmail = "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com";
applePayInsertRequest.customerID = appState.getAuthenticatedUser()!.patientId.toString();
applePayInsertRequest.customerName = "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}";
applePayInsertRequest.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
applePayInsertRequest.voipToken = await Utils.getStringFromPrefs(CacheConst.voipToken);
applePayInsertRequest.doctorID = 0;
applePayInsertRequest.projectID = widget.projectID.toString();
applePayInsertRequest.serviceID = ServiceTypeEnum.ancillaryOrder.getIdFromServiceEnum().toString();
applePayInsertRequest.channelID = 3;
applePayInsertRequest.patientID = appState.getAuthenticatedUser()!.patientId.toString();
applePayInsertRequest.patientTypeID = appState.getAuthenticatedUser()!.patientType;
applePayInsertRequest.patientOutSA = appState.getAuthenticatedUser()!.outSa;
applePayInsertRequest.appointmentDate = DateUtil.convertDateToString(widget.appointmentDate ?? DateTime.now());
applePayInsertRequest.appointmentNo = widget.appointmentNoVida;
applePayInsertRequest.orderDescription = "Ancillary Order Payment";
applePayInsertRequest.liveServiceID = "0";
applePayInsertRequest.latitude = "0.0";
applePayInsertRequest.longitude = "0.0";
applePayInsertRequest.amount = widget.totalAmount.toString();
applePayInsertRequest.isSchedule = "0";
applePayInsertRequest.language = appState.isArabic() ? 'ar' : 'en';
applePayInsertRequest.languageID = appState.isArabic() ? 1 : 2;
applePayInsertRequest.userName = appState.getAuthenticatedUser()!.patientId;
applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html";
applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html";
applePayInsertRequest.paymentOption = "ApplePay";
applePayInsertRequest.isMobSDK = true;
applePayInsertRequest.merchantReference = transID;
applePayInsertRequest.merchantIdentifier = payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier;
applePayInsertRequest.commandType = "PURCHASE";
applePayInsertRequest.signature = payfortViewModel.payfortProjectDetailsRespModel!.signature;
applePayInsertRequest.accessCode = payfortViewModel.payfortProjectDetailsRespModel!.accessCode;
applePayInsertRequest.shaRequestPhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaRequest;
applePayInsertRequest.shaResponsePhrase = payfortViewModel.payfortProjectDetailsRespModel!.shaResponse;
applePayInsertRequest.returnURL = "";
try {
await payfortViewModel.applePayRequestInsert(applePayInsertRequest: applePayInsertRequest);
} catch (error) {
log("Apple Pay Insert Request Failed: $error");
Navigator.of(context).pop();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: "Failed to initialize Apple Pay. Please try again.".needTranslation),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
return;
}
// Only proceed with Apple Pay if insert was successful
payfortViewModel.paymentWithApplePay(
customerName: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}",
customerEmail: "CustID_${appState.getAuthenticatedUser()!.patientId.toString()}@HMG.com",
orderDescription: "Ancillary Order Payment",
orderAmount: widget.totalAmount,
merchantReference: transID,
merchantIdentifier: payfortViewModel.payfortProjectDetailsRespModel!.merchantIdentifier,
applePayAccessCode: payfortViewModel.payfortProjectDetailsRespModel!.accessCode,
applePayShaRequestPhrase: payfortViewModel.payfortProjectDetailsRespModel!.shaRequest,
currency: appState.getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED",
onFailed: (failureResult) async {
log("failureResult: ${failureResult.message.toString()}");
Navigator.of(context).pop();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: failureResult.message.toString()),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
onSucceeded: (successResult) async {
Navigator.of(context).pop();
log("successResult: ${successResult.responseMessage.toString()}");
selectedPaymentMethod = successResult.paymentOption ?? "VISA";
_checkPaymentStatus();
},
);
}
} }

@ -23,23 +23,25 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class AncillaryProceduresDetailsList extends StatefulWidget { class AncillaryOrderDetailsList extends StatefulWidget {
final int appointmentNoVida; final int appointmentNoVida;
final int orderNo; final int orderNo;
final int projectID; final int projectID;
final String projectName;
const AncillaryProceduresDetailsList({ const AncillaryOrderDetailsList({
super.key, super.key,
required this.appointmentNoVida, required this.appointmentNoVida,
required this.orderNo, required this.orderNo,
required this.projectID, required this.projectID,
required this.projectName,
}); });
@override @override
State<AncillaryProceduresDetailsList> createState() => _AncillaryProceduresDetailsListState(); State<AncillaryOrderDetailsList> createState() => _AncillaryOrderDetailsListState();
} }
class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDetailsList> { class _AncillaryOrderDetailsListState extends State<AncillaryOrderDetailsList> {
late TodoSectionViewModel todoSectionViewModel; late TodoSectionViewModel todoSectionViewModel;
late AppState appState; late AppState appState;
List<AncillaryOrderProcDetail> selectedProcedures = []; List<AncillaryOrderProcDetail> selectedProcedures = [];
@ -77,6 +79,7 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
} }
bool _isProcedureDisabled(AncillaryOrderProcDetail procedure) { bool _isProcedureDisabled(AncillaryOrderProcDetail procedure) {
// return true;
return (procedure.isApprovalRequired == true && procedure.isApprovalCreated == false) || return (procedure.isApprovalRequired == true && procedure.isApprovalCreated == false) ||
(procedure.isApprovalCreated == true && procedure.approvalNo == 0) || (procedure.isApprovalCreated == true && procedure.approvalNo == 0) ||
(procedure.isApprovalRequired == true && procedure.isApprovalCreated == true && procedure.approvalNo == 0); (procedure.isApprovalRequired == true && procedure.isApprovalCreated == true && procedure.approvalNo == 0);
@ -304,7 +307,10 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
AppCustomChipWidget( AppCustomChipWidget(
labelText: "Doctor: ${orderData.doctorName ?? "N/A"}", labelText: "Doctor: ${orderData.doctorName ?? "N/A"}",
), ),
if (widget.projectName.isNotEmpty)
AppCustomChipWidget(
labelText: widget.projectName,
),
if (orderData.clinicName != null && orderData.clinicName!.isNotEmpty) if (orderData.clinicName != null && orderData.clinicName!.isNotEmpty)
AppCustomChipWidget( AppCustomChipWidget(
labelText: "Clinic: ${orderData.clinicName!}", labelText: "Clinic: ${orderData.clinicName!}",
@ -385,13 +391,24 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
), ),
Row( Row(
children: [ children: [
_getTotalAmount().toStringAsFixed(2).toText14( Utils.getPaymentAmountWithSymbol(
isBold: true, _getTotalAmount().toStringAsFixed(2).toText14(
weight: FontWeight.bold, isBold: true,
color: AppColors.primaryRedColor, weight: FontWeight.bold,
), color: AppColors.primaryRedColor,
SizedBox(width: 4.w), ),
"SAR".toText12(color: AppColors.textColorLight), AppColors.textColorLight,
13,
isSaudiCurrency: true,
),
//
// _getTotalAmount().toStringAsFixed(2).toText14(
// isBold: true,
// weight: FontWeight.bold,
// color: AppColors.primaryRedColor,
// ),
// SizedBox(width: 4.w),
// "SAR".toText12(color: AppColors.textColorLight),
], ],
), ),
], ],
@ -449,6 +466,7 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
Widget _buildProcedureCard(AncillaryOrderProcDetail procedure) { Widget _buildProcedureCard(AncillaryOrderProcDetail procedure) {
final isDisabled = _isProcedureDisabled(procedure); final isDisabled = _isProcedureDisabled(procedure);
// final isDisabled = _isProcedureDisabled(procedure);
final isSelected = _isProcedureSelected(procedure); final isSelected = _isProcedureSelected(procedure);
return AnimationConfiguration.staggeredList( return AnimationConfiguration.staggeredList(
@ -509,12 +527,12 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
children: [ children: [
AppCustomChipWidget( AppCustomChipWidget(
labelText: _getApprovalStatusText(procedure), labelText: _getApprovalStatusText(procedure),
// backgroundColor: statusColor, // backgroundColor: ,
), ),
if (procedure.procedureID != null) // if (procedure.procedureID != null)
AppCustomChipWidget( // AppCustomChipWidget(
labelText: "ID: ${procedure.procedureID}", // labelText: "ID: ${procedure.procedureID}",
), // ),
if (procedure.isCovered == true) if (procedure.isCovered == true)
AppCustomChipWidget( AppCustomChipWidget(
labelText: "Covered".needTranslation, labelText: "Covered".needTranslation,
@ -537,9 +555,12 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
SizedBox(height: 4.h), SizedBox(height: 4.h),
Row( Row(
children: [ children: [
(procedure.patientShare ?? 0).toStringAsFixed(2).toText13(weight: FontWeight.w600), Utils.getPaymentAmountWithSymbol(
SizedBox(width: 4.w), (procedure.patientShare ?? 0).toStringAsFixed(2).toText13(weight: FontWeight.w600),
"SAR".toText10(color: AppColors.textColorLight), AppColors.textColorLight,
13,
isSaudiCurrency: true,
),
], ],
), ),
], ],
@ -553,9 +574,12 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
SizedBox(height: 4.h), SizedBox(height: 4.h),
Row( Row(
children: [ children: [
(procedure.patientTaxAmount ?? 0).toStringAsFixed(2).toText13(weight: FontWeight.w600), Utils.getPaymentAmountWithSymbol(
SizedBox(width: 4.w), (procedure.patientTaxAmount ?? 0).toStringAsFixed(2).toText13(weight: FontWeight.w600),
"SAR".toText10(color: AppColors.textColorLight), AppColors.textColorLight,
13,
isSaudiCurrency: true,
),
], ],
), ),
], ],
@ -569,12 +593,12 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
SizedBox(height: 4.h), SizedBox(height: 4.h),
Row( Row(
children: [ children: [
(procedure.patientShareWithTax ?? 0).toStringAsFixed(2).toText13( Utils.getPaymentAmountWithSymbol(
isBold: true, (procedure.patientShareWithTax ?? 0).toStringAsFixed(2).toText13(weight: FontWeight.w600),
weight: FontWeight.bold, AppColors.textColorLight,
), 13,
SizedBox(width: 4.w), isSaudiCurrency: true,
"SAR".toText10(color: AppColors.textColorLight), ),
], ],
), ),
], ],
@ -614,6 +638,7 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
projectID: widget.projectID, projectID: widget.projectID,
selectedProcedures: selectedProcedures, selectedProcedures: selectedProcedures,
totalAmount: _getTotalAmount(), totalAmount: _getTotalAmount(),
appointmentDate: orderData.appointmentDate,
), ),
), ),
); );
@ -621,6 +646,7 @@ class _AncillaryProceduresDetailsListState extends State<AncillaryProceduresDeta
isDisabled: !isButtonEnabled, isDisabled: !isButtonEnabled,
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
borderRadius: 12.r, borderRadius: 12.r,
borderColor: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 16.h), padding: EdgeInsets.symmetric(vertical: 16.h),
), ),
SizedBox(height: 22.h), SizedBox(height: 22.h),

@ -69,11 +69,11 @@ class _ToDoPageState extends State<ToDoPage> {
onCheckIn: (order) => log("Check-in for order: ${order.orderNo}"), onCheckIn: (order) => log("Check-in for order: ${order.orderNo}"),
onViewDetails: (order) async { onViewDetails: (order) async {
Navigator.of(context).push(CustomPageRoute( Navigator.of(context).push(CustomPageRoute(
page: AncillaryProceduresDetailsList( page: AncillaryOrderDetailsList(
appointmentNoVida: order.appointmentNo ?? 0, appointmentNoVida: order.appointmentNo ?? 0,
orderNo: order.orderNo ?? 0, orderNo: order.orderNo ?? 0,
projectID: 15, projectID: order.projectID ?? 0,
// TODO: NEED to Confirm about projectID projectName: order.projectName ?? "",
))); )));
log("View details for order: ${order.orderNo}"); log("View details for order: ${order.orderNo}");
}, },

@ -114,33 +114,42 @@ class AncillaryOrderCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Header Row with Order Number and Date // Header Row with Order Number and Date
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
Row( // Row(
children: [ // children: [
if (!isLoading) // if (!isLoading)
"Order #".needTranslation.toText14( // "Order #".needTranslation.toText14(
color: AppColors.textColorLight, // color: AppColors.textColorLight,
weight: FontWeight.w500, // weight: FontWeight.w500,
), // ),
SizedBox(width: 4.w), // SizedBox(width: 4.w),
(isLoading ? "12345" : "${order.orderNo ?? '-'}").toText16(isBold: true).toShimmer2(isShow: isLoading), // (isLoading ? "12345" : "${order.orderNo ?? '-'}").toText16(isBold: true).toShimmer2(isShow: isLoading),
], // ],
), // ),
if (order.orderDate != null || isLoading) // if (order.orderDate != null || isLoading)
(isLoading ? "Jan 15, 2024" : DateFormat('MMM dd, yyyy').format(order.orderDate!)) // (isLoading ? "Jan 15, 2024" : DateFormat('MMM dd, yyyy').format(order.orderDate!))
.toText12(color: AppColors.textColorLight) // .toText12(color: AppColors.textColorLight)
.toShimmer2(isShow: isLoading), // .toShimmer2(isShow: isLoading),
], // ],
), // ),
SizedBox(height: 12.h), SizedBox(height: 12.h),
// Doctor and Clinic Info // Doctor and Clinic Info
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
if (!isLoading) ...[
Image.network(
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
width: 40.w,
height: 40.h,
fit: BoxFit.cover,
).circle(100.r),
SizedBox(width: 12.w),
],
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -153,17 +162,6 @@ class AncillaryOrderCard extends StatelessWidget {
.toShimmer2(isShow: isLoading), .toShimmer2(isShow: isLoading),
SizedBox(height: 4.h), SizedBox(height: 4.h),
// Clinic Name
if (order.clinicName != null || isLoading)
(isLoading ? "Cardiology Clinic" : order.clinicName!)
.toString()
.toText12(
fontWeight: FontWeight.w500,
color: AppColors.greyTextColor,
maxLine: 2,
)
.toShimmer2(isShow: isLoading),
], ],
), ),
), ),
@ -178,6 +176,18 @@ class AncillaryOrderCard extends StatelessWidget {
spacing: 3.h, spacing: 3.h,
runSpacing: 4.h, runSpacing: 4.h,
children: [ children: [
// projectName
if (order.projectName != null || isLoading)
AppCustomChipWidget(
labelText: order.projectName ?? '-',
).toShimmer2(isShow: isLoading),
// orderNo
if (order.orderNo != null || isLoading)
AppCustomChipWidget(
// icon: AppAssets.calendar,
labelText: "${"Order# :".needTranslation}${order.orderNo ?? '-'}",
).toShimmer2(isShow: isLoading),
// Appointment Date // Appointment Date
if (order.appointmentDate != null || isLoading) if (order.appointmentDate != null || isLoading)
AppCustomChipWidget( AppCustomChipWidget(
@ -189,7 +199,7 @@ class AncillaryOrderCard extends StatelessWidget {
// Appointment Number // Appointment Number
if (order.appointmentNo != null || isLoading) if (order.appointmentNo != null || isLoading)
AppCustomChipWidget( AppCustomChipWidget(
labelText: isLoading ? "Appt #: 98765" : "Appt #: ${order.appointmentNo}".needTranslation, labelText: isLoading ? "Appt# : 98765" : "Appt #: ${order.appointmentNo}".needTranslation,
).toShimmer2(isShow: isLoading), ).toShimmer2(isShow: isLoading),
// Invoice Number // Invoice Number
@ -261,8 +271,6 @@ class AncillaryOrderCard extends StatelessWidget {
borderRadius: 10.r, borderRadius: 10.r,
padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0), padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0),
height: 40.h, height: 40.h,
icon: AppAssets.arrow_forward,
iconColor: AppColors.primaryRedColor,
iconSize: 15.h, iconSize: 15.h,
).toShimmer2(isShow: isLoading), ).toShimmer2(isShow: isLoading),
), ),

@ -67,7 +67,7 @@ class CustomButton extends StatelessWidget {
color: isDisabled ? backgroundColor.withValues(alpha: .5) : backgroundColor, color: isDisabled ? backgroundColor.withValues(alpha: .5) : backgroundColor,
borderRadius: radius, borderRadius: radius,
customBorder: BorderRadius.circular(radius), customBorder: BorderRadius.circular(radius),
side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? borderColor.withValues(alpha: 0.5) : borderColor)), side: borderSide ?? BorderSide(width: borderWidth.h, color: borderColor)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

@ -105,15 +105,15 @@ class ButtonSheetContent extends StatelessWidget {
} }
void showCommonBottomSheetWithoutHeight( void showCommonBottomSheetWithoutHeight(
BuildContext context, { BuildContext context, {
required Widget child, required Widget child,
required VoidCallback callBackFunc, VoidCallback? callBackFunc,
String title = "", String title = "",
bool isCloseButtonVisible = true, bool isCloseButtonVisible = true,
bool isFullScreen = true, bool isFullScreen = true,
bool isDismissible = true, bool isDismissible = true,
Widget? titleWidget, Widget? titleWidget,
bool useSafeArea = false, bool useSafeArea = false,
bool hasBottomPadding = true, bool hasBottomPadding = true,
Color backgroundColor = AppColors.bottomSheetBgColor, Color backgroundColor = AppColors.bottomSheetBgColor,
}) { }) {
@ -143,13 +143,12 @@ void showCommonBottomSheetWithoutHeight(
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
physics: ClampingScrollPhysics(), physics: ClampingScrollPhysics(),
child: isCloseButtonVisible child: Container(
? Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 24, left: 24.w,
top: 24, top: 24.h,
right: 24, right: 24.w,
bottom: 12, bottom: 12.h,
), ),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.bottomSheetBgColor, color: AppColors.bottomSheetBgColor,
@ -157,6 +156,7 @@ void showCommonBottomSheetWithoutHeight(
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -166,26 +166,29 @@ void showCommonBottomSheetWithoutHeight(
Expanded( Expanded(
child: title.toText20(weight: FontWeight.w600), child: title.toText20(weight: FontWeight.w600),
), ),
Utils.buildSvgWithAssets( if (isCloseButtonVisible) ...[
icon: AppAssets.close_bottom_sheet_icon, Utils.buildSvgWithAssets(
iconColor: Color(0xff2B353E), icon: AppAssets.close_bottom_sheet_icon,
).onPress(() { iconColor: Color(0xff2B353E),
Navigator.of(context).pop(); ).onPress(() {
}), Navigator.of(context).pop();
}),
],
], ],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
child, child,
], ],
), ),
) ),
: child,
), ),
), ),
); );
}, },
).then((value) { ).then((value) {
callBackFunc(); if (callBackFunc != null) {
callBackFunc();
}
}); });
} }

Loading…
Cancel
Save