fix for patient share

pull/271/head
haroon amjad 14 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 { 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}; Map<String, dynamic> mapRequest = {"ProjectID": projectID, "ClinicID": clinicID, "DoctorID": doctorID};
late PatientAppointmentShareResponseModel patientShareObj;
try { try {
GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse; GenericApiModel<PatientAppointmentShareResponseModel>? apiResponse;
Failure? failure; Failure? failure;
@ -1015,14 +1017,18 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) { onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try { try {
final list = response['OnlineCheckInAppointmentsWalkInModel']; final list = response['OnlineCheckInAppointmentsWalkInModel'];
if (list == null || list.isEmpty) { patientShareObj = (list == null || list.isEmpty) ? PatientAppointmentShareResponseModel() : PatientAppointmentShareResponseModel.fromJson(list);
throw Exception("patient share list is empty");
}
final patientShareObj = PatientAppointmentShareResponseModel.fromJson(list);
patientShareObj.isCash = response["IsCash"]; patientShareObj.isCash = response["IsCash"];
patientShareObj.isEligible = response["IsEligible"]; patientShareObj.isEligible = response["IsEligible"];
patientShareObj.isInsured = response["IsInsured"]; 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>( apiResponse = GenericApiModel<PatientAppointmentShareResponseModel>(
messageStatus: messageStatus, messageStatus: messageStatus,

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

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

Loading…
Cancel
Save