fix for patient share

pull/271/head
haroon amjad 8 hours ago
parent 78cf05c0e5
commit fe82f12b33

@ -1003,6 +1003,8 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
Future<Either<Failure, GenericApiModel<PatientAppointmentShareResponseModel>>> getPatientShareWalkInAppointment({required int projectID, required int clinicID, required int doctorID}) async {
Map<String, dynamic> mapRequest = {"ProjectID": projectID, "ClinicID": clinicID, "DoctorID": doctorID};
late PatientAppointmentShareResponseModel patientShareObj;
try {
GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse;
Failure? failure;
@ -1015,14 +1017,18 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['OnlineCheckInAppointmentsWalkInModel'];
if (list == null || list.isEmpty) {
throw Exception("patient share list is empty");
}
final patientShareObj = PatientAppointmentShareResponseModel.fromJson(list);
patientShareObj = (list == null || list.isEmpty) ? PatientAppointmentShareResponseModel() : PatientAppointmentShareResponseModel.fromJson(list);
patientShareObj.isCash = response["IsCash"];
patientShareObj.isEligible = response["IsEligible"];
patientShareObj.isInsured = response["IsInsured"];
// if (list == null || list.isEmpty) {
// throw Exception("patient share list is empty");
// }
// final patientShareObj = PatientAppointmentShareResponseModel.fromJson(list);
// patientShareObj.isCash = response["IsCash"];
// patientShareObj.isEligible = response["IsEligible"];
// patientShareObj.isInsured = response["IsInsured"];
apiResponse = GenericApiModel<PatientAppointmentShareResponseModel>(
messageStatus: messageStatus,

@ -151,6 +151,8 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
{required int projectID, required int clinicID, required String appointmentNo, required bool isLiveCareAppointment}) async {
Map<String, dynamic> mapRequest = {"ProjectID": projectID, "ClinicID": clinicID, "AppointmentNo": appointmentNo, "IsActiveAppointment": true, "IsForLiveCare": isLiveCareAppointment};
late PatientAppointmentShareResponseModel patientShareObj;
try {
GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse;
Failure? failure;
@ -163,15 +165,20 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final list = response['OnlineCheckInAppointments'];
if (list == null || list.isEmpty) {
throw Exception("patient share list is empty");
}
final patientShareObj = PatientAppointmentShareResponseModel.fromJson(list[0]);
patientShareObj = (list == null || list.isEmpty) ? PatientAppointmentShareResponseModel() : PatientAppointmentShareResponseModel.fromJson(list[0]);
patientShareObj.isCash = response["IsCash"];
patientShareObj.isEligible = response["IsEligible"];
patientShareObj.isInsured = response["IsInsured"];
// if (list == null || list.isEmpty) {
// throw Exception("patient share list is empty");
// }
// final patientShareObj = PatientAppointmentShareResponseModel.fromJson(list[0]);
// patientShareObj.isCash = response["IsCash"];
// patientShareObj.isEligible = response["IsEligible"];
// patientShareObj.isInsured = response["IsInsured"];
apiResponse = GenericApiModel<PatientAppointmentShareResponseModel>(
messageStatus: messageStatus,
statusCode: statusCode,

@ -281,9 +281,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true),
Utils.getPaymentAmountWithSymbol(
myAppointmentsVM.patientAppointmentShareResponseModel!.patientShare!.toString().toText16(isBold: true),
AppColors.blackColor,
Utils.getPaymentAmountWithSymbol((myAppointmentsVM.patientAppointmentShareResponseModel!.patientShare ?? 0).toString().toText16(isBold: true), AppColors.blackColor,
13,
isSaudiCurrency: true),
],
@ -293,8 +291,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
children: [
"VAT 15%".toText14(isBold: true, color: AppColors.greyTextColor),
Utils.getPaymentAmountWithSymbol(
myAppointmentsVM.patientAppointmentShareResponseModel!.patientTaxAmount!
.toString()
(myAppointmentsVM.patientAppointmentShareResponseModel!.patientTaxAmount ?? 0).toString()
.toText14(isBold: true, color: AppColors.greyTextColor),
AppColors.greyTextColor,
13,
@ -307,8 +304,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
children: [
"".toText14(isBold: true),
Utils.getPaymentAmountWithSymbol(
myAppointmentsVM.patientAppointmentShareResponseModel!.patientShareWithTax!.toString().toText24(isBold: true),
AppColors.blackColor,
(myAppointmentsVM.patientAppointmentShareResponseModel!.patientShareWithTax ?? 0).toString().toText24(isBold: true), AppColors.blackColor,
17,
isSaudiCurrency: true),
],

Loading…
Cancel
Save