Inpatient services contd.

inpatient_services
Haroon Amjad 3 weeks ago
parent a8ba6c9f3c
commit 4901163b7c

@ -2008,10 +2008,10 @@
"copyLink": "نسخ الوصلة:", "copyLink": "نسخ الوصلة:",
"paymentLinkCopied": "تم نسخ رابط الدفع إلى الحافظة الخاصة بك!", "paymentLinkCopied": "تم نسخ رابط الدفع إلى الحافظة الخاصة بك!",
"copyLinkTxt": "أو يمكنك نسخ رابط الدفع من الأسفل وإرساله إلى شخص يمكنه الدفع نيابة عنك:", "copyLinkTxt": "أو يمكنك نسخ رابط الدفع من الأسفل وإرساله إلى شخص يمكنه الدفع نيابة عنك:",
"proErrorMessage": "عزيزي المريض ، طاقم العمل لدينا خارج المكتب حاليًا ، يرجى ملاحظة أن ساعات العمل لدينا من 7:00 صباحًا إلى 10:00 مساءً ، ويسعدنا مساعدتك خلال هذا الوقت ، أو يمكنك الاتصال بـ <أدخل الرقم هنا>", "proErrorMessage": "عزيزي المريض ، طاقم العمل لدينا خارج المكتب حاليًا ، يرجى ملاحظة أن ساعات العمل لدينا من 7:00 صباحًا إلى 10:00 مساءً ، ويسعدنا مساعدتك خلال هذا الوقت ، أو يمكنك الاتصال",
"InPatient": "مريض منوم", "InPatient": "مريض منوم",
"admissionReq": "طلب القبول", "admissionReq": "طلب القبول",
"admissionDate": "تاريخ القبول", "admissionDate": "تاريخ القبول",
"admissionRequestDate": "تاريخ القبول المتوقع" "admissionRequestDate": "تاريخ القبول المتوقع",
"noAdvancePaymentRequestsFound": "ليس لديك أي طلبات دفع مسبق حتى الآن."
} }

@ -1998,11 +1998,12 @@
"copyLink": "COPY LINK", "copyLink": "COPY LINK",
"paymentLinkCopied": "Payment link copied to your clipboard!'", "paymentLinkCopied": "Payment link copied to your clipboard!'",
"copyLinkTxt": "Or you can copy the payment link from below & send it to someone who can pay on your behalf: ", "copyLinkTxt": "Or you can copy the payment link from below & send it to someone who can pay on your behalf: ",
"proErrorMessage": "Dear patient, Our staff is currently out of office, please note that our working hours are from 7:00 AM to 10:00 PM, and we'd love to help you during that time, or you can call <insert number here>", "proErrorMessage": "Dear patient, Our staff is currently out of office, please note that our working hours are from 7:00 AM to 10:00 PM, and we'd love to help you during that time, or you can call us.",
"InPatient": "InPatient", "InPatient": "InPatient",
"admissionReq": "Admission Request", "admissionReq": "Admission Request",
"admissionDate": "Admission Date", "admissionDate": "Admission Date",
"admissionRequestDate": "Expected Admission Date" "admissionRequestDate": "Expected Admission Date",
"noAdvancePaymentRequestsFound": "You don't have any advance payment requests yet."
} }

@ -3,16 +3,41 @@ import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_info_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_inpatient_advance_requests_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_medical_instructions_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class InpatientServicesRepo { abstract class InpatientServicesRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfIsInPatient(); Future<Either<Failure, GenericApiModel<dynamic>>> checkIfIsInPatient();
Future<Either<Failure, GenericApiModel<List<GetGeneralInstructions>>>> getGeneralInstructions({required int projectID}); Future<Either<Failure, GenericApiModel<List<GetGeneralInstructions>>>> getGeneralInstructions({required int projectID});
}
// List<GetGeneralInstructions> getGeneralInstructionsList = []; Future<Either<Failure, GenericApiModel<List<GetMedicalInstructions>>>> getMedicalInstructions({required int projectID});
Future<Either<Failure, GenericApiModel<dynamic>>> getDischargeMedicationOrder({required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel});
Future<Either<Failure, GenericApiModel<dynamic>>> insertInPatientOrder(
{required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel,
required int typeID,
required String patientName,
required String patientNameAR,
required String patientMobileNo,
required String comments});
Future<Either<Failure, GenericApiModel<dynamic>>> getInPatientAdvancePaymentRequests({
required int projectID,
required int admissionNo,
required int admissionReqNo,
});
Future<Either<Failure, GenericApiModel<dynamic>>> getInPatientAdvancePaymentPaid({
required int projectID,
required int admissionNo,
required int admissionReqNo,
});
}
class InpatientServicesRepoImp implements InpatientServicesRepo { class InpatientServicesRepoImp implements InpatientServicesRepo {
final ApiClient apiClient; final ApiClient apiClient;
@ -92,4 +117,189 @@ class InpatientServicesRepoImp implements InpatientServicesRepo {
return Left(UnknownFailure(e.toString())); return Left(UnknownFailure(e.toString()));
} }
} }
@override
Future<Either<Failure, GenericApiModel<List<GetMedicalInstructions>>>> getMedicalInstructions({required int projectID}) async {
Map<String, dynamic> mapDevice = {"ProjectID": projectID};
try {
GenericApiModel<List<GetMedicalInstructions>>? apiResponse;
Failure? failure;
await apiClient.post(
GET_MEDICAL_INSTRUCTIONS,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
List<GetMedicalInstructions> getMedicalInstructionsList = [];
response['MedicalInstruction'].forEach((v) {
getMedicalInstructionsList.add(GetMedicalInstructions.fromJson(v));
});
apiResponse = GenericApiModel<List<GetMedicalInstructions>>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: getMedicalInstructionsList,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> getDischargeMedicationOrder({required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel}) async {
Map<String, dynamic> mapDevice = {
"ProjectID": getAdmissionInfoResponseModel.projectID,
"ClinicID": getAdmissionInfoResponseModel.clinicID,
"DoctorID": getAdmissionInfoResponseModel.doctorID,
"AdmissionNo": getAdmissionInfoResponseModel.admissionNo
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(INPATIENT_DISCHARGE_MEDICATIONS, body: mapDevice, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> insertInPatientOrder(
{required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel,
required int typeID,
required String patientName,
required String patientNameAR,
required String patientMobileNo,
required String comments}) async {
Map<String, dynamic> mapDevice = {
"ProjectID": getAdmissionInfoResponseModel.projectID,
"TypeID": typeID,
"RoomNo": getAdmissionInfoResponseModel.roomID,
"GenderId": 2,
"AdmissionNo": getAdmissionInfoResponseModel.admissionNo,
"prescriptionNo": 250420,
"patientName": patientName,
"patientNameN": patientNameAR,
"PatientMobileNumber": patientMobileNo,
"comments": comments
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(INSERT_INPATIENT_ORDER, body: mapDevice, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> getInPatientAdvancePaymentRequests({required int projectID, required int admissionNo, required int admissionReqNo}) async {
Map<String, dynamic> mapDevice = {
"ProjectID": projectID,
"AdmissionReqNo": admissionReqNo,
"AdmissionNo": admissionNo,
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS, body: mapDevice, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (res, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: res,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> getInPatientAdvancePaymentPaid({required int projectID, required int admissionNo, required int admissionReqNo}) async {
Map<String, dynamic> mapDevice = {
"ProjectID": projectID,
"AdmissionReqNo": admissionReqNo,
"AdmissionNo": admissionNo,
};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(GET_INPATIENT_PAID_ADVANCE_PAYMENT, body: mapDevice, onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (res, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: res,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
} }

@ -1,10 +1,23 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.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/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_repo.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_repo.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_info_response_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_info_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_request_info_response_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/models/get_admission_request_info_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/models/get_general_instructions_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_inpatient_advance_history_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_inpatient_advance_requests_response_model.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/models/get_medical_instructions_response_model.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import '../../generated/locale_keys.g.dart';
class InpatientServicesViewModel extends ChangeNotifier { class InpatientServicesViewModel extends ChangeNotifier {
InpatientServicesRepo inpatientServicesRepo; InpatientServicesRepo inpatientServicesRepo;
@ -13,12 +26,21 @@ class InpatientServicesViewModel extends ChangeNotifier {
GetAdmissionInfoResponseModel? getAdmissionInfoResponseModel; GetAdmissionInfoResponseModel? getAdmissionInfoResponseModel;
GetAdmissionRequestInfoResponseModel? getAdmissionRequestInfoResponseModel; GetAdmissionRequestInfoResponseModel? getAdmissionRequestInfoResponseModel;
InPatientAdvanceResponseModel? inPatientAdvanceResponseModel;
InPatientAdvanceHistoryResponseModel? inPatientAdvanceHistoryResponseModel;
bool isAdmitted = false; bool isAdmitted = false;
bool hasAdmissionRequest = false; bool hasAdmissionRequest = false;
bool isGeneralInstructionsLoading = true; bool isGeneralInstructionsLoading = true;
bool isMedicalInstructionsLoading = true;
bool isAdvancePaymentHistoryLoading = true;
bool hasDischargeMedicationOrder = false;
List<GetGeneralInstructions> getGeneralInstructionsList = []; List<GetGeneralInstructions> getGeneralInstructionsList = [];
List<GetMedicalInstructions> getMedicalInstructionsList = [];
int advancePaymentSelectedTabIndex = 0;
InpatientServicesViewModel({required this.inpatientServicesRepo, required this.errorHandlerService, required this.appState}); InpatientServicesViewModel({required this.inpatientServicesRepo, required this.errorHandlerService, required this.appState});
@ -26,6 +48,21 @@ class InpatientServicesViewModel extends ChangeNotifier {
isAdmitted = false; isAdmitted = false;
hasAdmissionRequest = false; hasAdmissionRequest = false;
isGeneralInstructionsLoading = true; isGeneralInstructionsLoading = true;
isMedicalInstructionsLoading = true;
hasDischargeMedicationOrder = false;
advancePaymentSelectedTabIndex = 0;
isAdvancePaymentHistoryLoading = true;
notifyListeners();
}
void onTabChanged(int index) {
advancePaymentSelectedTabIndex = index;
if (index == 1) {
getInPatientAdvancePaymentHistory(
projectID: isAdmitted ? getAdmissionInfoResponseModel!.projectID! : getAdmissionRequestInfoResponseModel!.projectId!,
admissionNo: isAdmitted ? getAdmissionInfoResponseModel!.admissionNo! : 0,
admissionReqNo: isAdmitted ? getAdmissionInfoResponseModel!.admissionRequestNo! : getAdmissionRequestInfoResponseModel!.admissionRequestNo!);
}
notifyListeners(); notifyListeners();
} }
@ -70,7 +107,6 @@ class InpatientServicesViewModel extends ChangeNotifier {
getGeneralInstructionsList.clear(); getGeneralInstructionsList.clear();
notifyListeners(); notifyListeners();
final result = await inpatientServicesRepo.getGeneralInstructions(projectID: projectID); final result = await inpatientServicesRepo.getGeneralInstructions(projectID: projectID);
result.fold( result.fold(
@ -92,4 +128,177 @@ class InpatientServicesViewModel extends ChangeNotifier {
}, },
); );
} }
Future<void> getMedicalInstructions({required int projectID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
isMedicalInstructionsLoading = true;
getMedicalInstructionsList.clear();
notifyListeners();
final result = await inpatientServicesRepo.getMedicalInstructions(projectID: projectID);
result.fold(
(failure) async {
isMedicalInstructionsLoading = false;
notifyListeners();
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
isMedicalInstructionsLoading = false;
getMedicalInstructionsList = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> checkDischargeMedications({required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
LoaderBottomSheet.showLoader();
final result = await inpatientServicesRepo.getDischargeMedicationOrder(getAdmissionInfoResponseModel: getAdmissionInfoResponseModel);
result.fold(
(failure) async {
LoaderBottomSheet.hideLoader();
if (onError != null) {
onError(failure.message.toString());
}
},
(apiResponse) async {
if (apiResponse.messageStatus == 2) {
LoaderBottomSheet.hideLoader();
if (onError != null) {
onError("You don't have any discharge medication orders yet.");
}
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data["PatientHasDischargeMedicineList"].length != 0) {
hasDischargeMedicationOrder = true;
await insertInPatientOrder(
getAdmissionInfoResponseModel: getAdmissionInfoResponseModel,
typeID: 1,
patientName: "${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}",
patientNameAR: "${appState.getAuthenticatedUser()!.firstNameN!} ${appState.getAuthenticatedUser()!.lastNameN!}",
patientMobileNo: appState.getAuthenticatedUser()!.mobileNumber!,
comments: "I need my medicines",
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getSuccessWidget(loadingText: LocaleKeys.requestSubmittedSuccessfully.tr()).paddingSymmetrical(0.h, 24.h),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: false,
isAutoDismiss: true);
});
}
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> insertInPatientOrder(
{required GetAdmissionInfoResponseModel getAdmissionInfoResponseModel,
required int typeID,
required String patientName,
required String patientNameAR,
required String patientMobileNo,
required String comments,
Function(dynamic)? onSuccess,
Function(String)? onError}) async {
final result = await inpatientServicesRepo.insertInPatientOrder(
getAdmissionInfoResponseModel: getAdmissionInfoResponseModel, typeID: typeID, patientName: patientName, patientNameAR: patientNameAR, patientMobileNo: patientMobileNo, comments: comments);
result.fold(
(failure) async {
if (onError != null) {
onError(failure.message.toString());
}
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> getInPatientAdvancePaymentRequests({required int projectID, required int admissionNo, required int admissionReqNo, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await inpatientServicesRepo.getInPatientAdvancePaymentRequests(projectID: projectID, admissionNo: admissionNo, admissionReqNo: admissionReqNo);
result.fold(
(failure) async {
notifyListeners();
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['responseInpatient'] != null &&
apiResponse.data['responseInpatient']['responseInpatientAdvanceInfo'] != null &&
apiResponse.data['responseInpatient']['responseInpatientAdvanceInfo'].length != 0) {
inPatientAdvanceResponseModel = InPatientAdvanceResponseModel.fromJson(apiResponse.data["responseInpatient"]);
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
if (onSuccess != null) {
onSuccess(apiResponse);
}
// if (onError != null) {
// onError(LocaleKeys.noAdvancePaymentRequestsFound.tr());
// }
}
notifyListeners();
}
},
);
}
Future<void> getInPatientAdvancePaymentHistory({required int projectID, required int admissionNo, required int admissionReqNo, Function(dynamic)? onSuccess, Function(String)? onError}) async {
isAdvancePaymentHistoryLoading = true;
notifyListeners();
final result = await inpatientServicesRepo.getInPatientAdvancePaymentPaid(projectID: projectID, admissionNo: admissionNo, admissionReqNo: admissionReqNo);
result.fold(
(failure) async {
isAdvancePaymentHistoryLoading = false;
notifyListeners();
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
isAdvancePaymentHistoryLoading = false;
if (apiResponse.data['responseInpatient'] != null &&
apiResponse.data['responseInpatient']['responseInpatientAdvanceInfo'] != null &&
apiResponse.data['responseInpatient']['responseInpatientAdvanceInfo'].length != 0) {
inPatientAdvanceHistoryResponseModel = InPatientAdvanceHistoryResponseModel.fromJson(apiResponse.data["responseInpatient"]);
if (onSuccess != null) {
onSuccess(apiResponse);
}
} else {
if (onError != null) {
onError(LocaleKeys.noAdvancePaymentRequestsFound.tr());
}
}
notifyListeners();
}
},
);
}
} }

@ -0,0 +1,71 @@
class InPatientAdvanceHistoryResponseModel {
int? advanceNumber;
int? errorCode;
String? message;
List<ResponseInpatientAdvanceInfo>? responseInpatientAdvanceInfo;
int? statusCode;
InPatientAdvanceHistoryResponseModel({this.advanceNumber, this.errorCode, this.message, this.responseInpatientAdvanceInfo, this.statusCode});
InPatientAdvanceHistoryResponseModel.fromJson(Map<String, dynamic> json) {
advanceNumber = json['advanceNumber'];
errorCode = json['errorCode'];
message = json['message'];
if (json['responseInpatientAdvanceInfo'] != null) {
responseInpatientAdvanceInfo = <ResponseInpatientAdvanceInfo>[];
json['responseInpatientAdvanceInfo'].forEach((v) {
responseInpatientAdvanceInfo!.add(new ResponseInpatientAdvanceInfo.fromJson(v));
});
}
statusCode = json['statusCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['advanceNumber'] = this.advanceNumber;
data['errorCode'] = this.errorCode;
data['message'] = this.message;
if (this.responseInpatientAdvanceInfo != null) {
data['responseInpatientAdvanceInfo'] = this.responseInpatientAdvanceInfo!.map((v) => v.toJson()).toList();
}
data['statusCode'] = this.statusCode;
return data;
}
}
class ResponseInpatientAdvanceInfo {
int? admissionNo;
int? admissionReqNo;
String? createdOn;
int? patientId;
int? projectId;
num? requestedAmount;
String? setupId;
int? status;
ResponseInpatientAdvanceInfo({this.admissionNo, this.admissionReqNo, this.createdOn, this.patientId, this.projectId, this.requestedAmount, this.setupId, this.status});
ResponseInpatientAdvanceInfo.fromJson(Map<String, dynamic> json) {
admissionNo = json['admissionNo'];
admissionReqNo = json['admissionReqNo'];
createdOn = json['createdOn'];
patientId = json['patientId'];
projectId = json['projectId'];
requestedAmount = json['requestedAmount'];
setupId = json['setupId'];
status = json['status'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['admissionNo'] = this.admissionNo;
data['admissionReqNo'] = this.admissionReqNo;
data['createdOn'] = this.createdOn;
data['patientId'] = this.patientId;
data['projectId'] = this.projectId;
data['requestedAmount'] = this.requestedAmount;
data['setupId'] = this.setupId;
data['status'] = this.status;
return data;
}
}

@ -0,0 +1,74 @@
class InPatientAdvanceResponseModel {
int? advanceNumber;
Null errorCode;
String? message;
List<ResponseInpatientAdvanceInfo>? responseInpatientAdvanceInfo;
int? statusCode;
InPatientAdvanceResponseModel({this.advanceNumber, this.errorCode, this.message, this.responseInpatientAdvanceInfo, this.statusCode});
InPatientAdvanceResponseModel.fromJson(Map<String, dynamic> json) {
advanceNumber = json['advanceNumber'];
errorCode = json['errorCode'];
message = json['message'];
if (json['responseInpatientAdvanceInfo'] != null) {
responseInpatientAdvanceInfo = <ResponseInpatientAdvanceInfo>[];
json['responseInpatientAdvanceInfo'].forEach((v) {
responseInpatientAdvanceInfo!.add(new ResponseInpatientAdvanceInfo.fromJson(v));
});
}
statusCode = json['statusCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['advanceNumber'] = this.advanceNumber;
data['errorCode'] = this.errorCode;
data['message'] = this.message;
if (this.responseInpatientAdvanceInfo != null) {
data['responseInpatientAdvanceInfo'] = this.responseInpatientAdvanceInfo!.map((v) => v.toJson()).toList();
}
data['statusCode'] = this.statusCode;
return data;
}
}
class ResponseInpatientAdvanceInfo {
int? admissionNo;
int? admissionReqNo;
String? createdOn;
int? patientId;
int? projectId;
num? requestedAmount;
String? setupId;
int? status;
int? paymentRequestID;
ResponseInpatientAdvanceInfo({this.admissionNo, this.admissionReqNo, this.createdOn, this.patientId, this.projectId, this.requestedAmount, this.setupId, this.status, this.paymentRequestID});
ResponseInpatientAdvanceInfo.fromJson(Map<String, dynamic> json) {
admissionNo = json['admissionNo'];
admissionReqNo = json['admissionReqNo'];
createdOn = json['createdOn'];
patientId = json['patientId'];
projectId = json['projectId'];
requestedAmount = json['requestedAmount'];
setupId = json['setupId'];
status = json['status'];
paymentRequestID = json['PaymentRequestId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['admissionNo'] = this.admissionNo;
data['admissionReqNo'] = this.admissionReqNo;
data['createdOn'] = this.createdOn;
data['patientId'] = this.patientId;
data['projectId'] = this.projectId;
data['requestedAmount'] = this.requestedAmount;
data['setupId'] = this.setupId;
data['status'] = this.status;
data['PaymentRequestId'] = this.paymentRequestID;
return data;
}
}

@ -0,0 +1,85 @@
class GetMedicalInstructions {
dynamic propertyChanged;
int? admissionRequestNoField;
String? clinicNameField;
String? doctorNameField;
String? expectedAdmissionDateField;
List<MedicaLInstructionsField>? medicaLInstructionsField;
dynamic medicalInstructionsXMLField;
String? medicalRemarksField;
int? projectIdField;
String? projectNameField;
String? setupIdField;
GetMedicalInstructions(
{this.propertyChanged,
this.admissionRequestNoField,
this.clinicNameField,
this.doctorNameField,
this.expectedAdmissionDateField,
this.medicaLInstructionsField,
this.medicalInstructionsXMLField,
this.medicalRemarksField,
this.projectIdField,
this.projectNameField,
this.setupIdField});
GetMedicalInstructions.fromJson(Map<String, dynamic> json) {
propertyChanged = json['PropertyChanged'];
admissionRequestNoField = json['admissionRequestNoField'];
clinicNameField = json['clinicNameField'];
doctorNameField = json['doctorNameField'];
expectedAdmissionDateField = json['expectedAdmissionDateField'];
if (json['medicaLInstructions'] != null) {
medicaLInstructionsField = <MedicaLInstructionsField>[];
json['medicaLInstructions'].forEach((v) {
medicaLInstructionsField!.add(new MedicaLInstructionsField.fromJson(v));
});
}
medicalInstructionsXMLField = json['medicalInstructionsXMLField'];
medicalRemarksField = json['medicalRemarksField'];
projectIdField = json['projectIdField'];
projectNameField = json['projectNameField'];
setupIdField = json['setupIdField'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PropertyChanged'] = this.propertyChanged;
data['admissionRequestNoField'] = this.admissionRequestNoField;
data['clinicNameField'] = this.clinicNameField;
data['doctorNameField'] = this.doctorNameField;
data['expectedAdmissionDateField'] = this.expectedAdmissionDateField;
if (this.medicaLInstructionsField != null) {
data['medicaLInstructionsField'] = this.medicaLInstructionsField!.map((v) => v.toJson()).toList();
}
data['medicalInstructionsXMLField'] = this.medicalInstructionsXMLField;
data['medicalRemarksField'] = this.medicalRemarksField;
data['projectIdField'] = this.projectIdField;
data['projectNameField'] = this.projectNameField;
data['setupIdField'] = this.setupIdField;
return data;
}
}
class MedicaLInstructionsField {
Null propertyChanged;
String? descriptionField;
int? parameterCodeField;
MedicaLInstructionsField({this.propertyChanged, this.descriptionField, this.parameterCodeField});
MedicaLInstructionsField.fromJson(Map<String, dynamic> json) {
propertyChanged = json['PropertyChanged'];
descriptionField = json['description'];
parameterCodeField = json['parameterCodeField'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PropertyChanged'] = this.propertyChanged;
data['descriptionField'] = this.descriptionField;
data['parameterCodeField'] = this.parameterCodeField;
return data;
}
}

@ -1993,5 +1993,6 @@ abstract class LocaleKeys {
static const admissionReq = 'admissionReq'; static const admissionReq = 'admissionReq';
static const admissionDate = 'admissionDate'; static const admissionDate = 'admissionDate';
static const admissionRequestDate = 'admissionRequestDate'; static const admissionRequestDate = 'admissionRequestDate';
static const noAdvancePaymentRequestsFound = 'noAdvancePaymentRequestsFound';
} }

@ -213,6 +213,7 @@ class _LandingPageState extends State<LandingPage> {
color: AppColors.primaryRedColor, color: AppColors.primaryRedColor,
onRefresh: () async { onRefresh: () async {
if (appState.isAuthenticated) { if (appState.isAuthenticated) {
getIt.get<InpatientServicesViewModel>().checkIfIsInPatient();
// Refresh Appointments Data // Refresh Appointments Data
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel(); myAppointmentsViewModel.initAppointmentsViewModel();

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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/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/inpatient_services/inpatient_services_view_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
@ -41,15 +42,17 @@ class GeneralInstructionsPage extends StatelessWidget {
).paddingSymmetrical(24.h, 16.h); ).paddingSymmetrical(24.h, 16.h);
}, },
) )
: ListView.builder( : inpatientServicesVM.getGeneralInstructionsList.isNotEmpty
padding: EdgeInsets.zero, ? ListView.builder(
shrinkWrap: true, padding: EdgeInsets.zero,
itemCount: inpatientServicesVM.getGeneralInstructionsList.length, shrinkWrap: true,
itemBuilder: (context, index) { itemCount: inpatientServicesVM.getGeneralInstructionsList.length,
final instruction = inpatientServicesVM.getGeneralInstructionsList[index]; itemBuilder: (context, index) {
return "${instruction.text}".toText16(weight: FontWeight.w500).paddingSymmetrical(24.h, 16.h); final instruction = inpatientServicesVM.getGeneralInstructionsList[index];
}, return "${instruction.text}".toText16(weight: FontWeight.w500).paddingSymmetrical(24.h, 16.h);
); },
)
: Utils.getNoDataWidget(context);
}), }),
), ),
), ),

@ -0,0 +1,45 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
import 'package:hmg_patient_app_new/generated/codegen_loader.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/custom_tab_bar.dart';
import 'package:provider/provider.dart';
class InpatientAdvancePaymentPage extends StatelessWidget {
const InpatientAdvancePaymentPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView(
title: LocaleKeys.advancePayment.tr(),
child: Consumer<InpatientServicesViewModel>(builder: (context, inpatientServicesVM, child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16.h),
CustomTabBar(
activeTextColor: Color(0xffED1C2B),
activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1),
initialIndex: 0,
tabs: [
CustomTabBarModel(null, LocaleKeys.requests.tr(context: context)),
CustomTabBarModel(null, LocaleKeys.history.tr(context: context)),
],
onTabChange: (index) {
inpatientServicesVM.onTabChanged(index);
},
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 24.h),
],
);
}),
),
);
}
}

@ -9,10 +9,16 @@ 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/inpatient_services/inpatient_services_view_model.dart'; import 'package:hmg_patient_app_new/features/inpatient_services/inpatient_services_view_model.dart';
import 'package:hmg_patient_app_new/presentation/inpatient_services/general_instructions_page.dart'; import 'package:hmg_patient_app_new/presentation/inpatient_services/general_instructions_page.dart';
import 'package:hmg_patient_app_new/presentation/inpatient_services/inpatient_advance_payment_page.dart';
import 'package:hmg_patient_app_new/presentation/inpatient_services/medical_instructions_page.dart';
import 'package:hmg_patient_app_new/presentation/inpatient_services/widgets/patient_relation_office_widget.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/common_bottom_sheet.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:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../generated/locale_keys.g.dart'; import '../../generated/locale_keys.g.dart';
@ -64,7 +70,17 @@ class InpatientServicesHomepage extends StatelessWidget {
icon: AppAssets.bloodSugarOnlyIcon, icon: AppAssets.bloodSugarOnlyIcon,
title: LocaleKeys.medicalInstructions.tr(context: context), title: LocaleKeys.medicalInstructions.tr(context: context),
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context), description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
onTap: () {}, onTap: () {
inPatientServicesViewModel.getMedicalInstructions(
projectID: inPatientServicesViewModel.isAdmitted
? inPatientServicesViewModel.getAdmissionInfoResponseModel!.projectID!
: inPatientServicesViewModel.getAdmissionRequestInfoResponseModel!.projectId!);
Navigator.of(context).push(
CustomPageRoute(
page: MedicalInstructionsPage(),
),
);
},
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
buildInpatientServicesCard( buildInpatientServicesCard(
@ -88,23 +104,77 @@ class InpatientServicesHomepage extends StatelessWidget {
icon: AppAssets.bloodSugarOnlyIcon, icon: AppAssets.bloodSugarOnlyIcon,
title: LocaleKeys.advancePayment.tr(context: context), title: LocaleKeys.advancePayment.tr(context: context),
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context), description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
onTap: () {}, onTap: () {
), LoaderBottomSheet.showLoader();
SizedBox(height: 16.h), inPatientServicesViewModel.getInPatientAdvancePaymentRequests(
buildInpatientServicesCard( projectID: inPatientServicesViewModel.isAdmitted
iconBgColor: AppColors.primaryRedColor, ? inPatientServicesViewModel.getAdmissionInfoResponseModel!.projectID!
icon: AppAssets.bloodSugarOnlyIcon, : inPatientServicesViewModel.getAdmissionRequestInfoResponseModel!.projectId!,
title: LocaleKeys.admissionNoticeTitle.tr(context: context), admissionNo: inPatientServicesViewModel.isAdmitted ? inPatientServicesViewModel.getAdmissionInfoResponseModel!.admissionNo! : 0,
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context), admissionReqNo: inPatientServicesViewModel.isAdmitted
onTap: () {}, ? inPatientServicesViewModel.getAdmissionInfoResponseModel!.admissionRequestNo!
: inPatientServicesViewModel.getAdmissionRequestInfoResponseModel!.admissionRequestNo!,
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: InpatientAdvancePaymentPage(),
),
);
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(
loadingText: err.toString(),
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
},
), ),
// SizedBox(height: 16.h),
// buildInpatientServicesCard(
// iconBgColor: AppColors.primaryRedColor,
// icon: AppAssets.bloodSugarOnlyIcon,
// title: LocaleKeys.admissionNoticeTitle.tr(context: context),
// description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
// onTap: () {},
// ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
buildInpatientServicesCard( buildInpatientServicesCard(
iconBgColor: AppColors.primaryRedColor, iconBgColor: AppColors.primaryRedColor,
icon: AppAssets.bloodSugarOnlyIcon, icon: AppAssets.bloodSugarOnlyIcon,
title: LocaleKeys.prescriptions.tr(context: context), title: LocaleKeys.prescriptions.tr(context: context),
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context), description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
onTap: () {}, onTap: () {
inPatientServicesViewModel.isAdmitted
? inPatientServicesViewModel.checkDischargeMedications(
getAdmissionInfoResponseModel: inPatientServicesViewModel.getAdmissionInfoResponseModel!,
onError: (err) {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(
loadingText: err.toString(),
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
})
: showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(
loadingText: LocaleKeys.onlyAdmitted.tr(context: context),
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
},
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
buildInpatientServicesCard( buildInpatientServicesCard(
@ -112,7 +182,35 @@ class InpatientServicesHomepage extends StatelessWidget {
icon: AppAssets.bloodSugarOnlyIcon, icon: AppAssets.bloodSugarOnlyIcon,
title: LocaleKeys.patientRelationOffice.tr(context: context), title: LocaleKeys.patientRelationOffice.tr(context: context),
description: LocaleKeys.trackYourGlucoseLevels.tr(context: context), description: LocaleKeys.trackYourGlucoseLevels.tr(context: context),
onTap: () {}, onTap: () {
if (DateTime.now().hour >= 7 && DateTime.now().hour <= 22) {
showCommonBottomSheetWithoutHeight(context,
child: PatientRelationOfficeWidget(
inPatientServicesViewModel: inPatientServicesViewModel,
),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
title: LocaleKeys.patientRelationOffice.tr(context: context));
} else {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getWarningWidget(
loadingText: LocaleKeys.proErrorMessage.tr(),
isShowActionButtons: true,
confirmText: LocaleKeys.callNow.tr(context: context),
onCancelTap: () {
Navigator.of(context).pop();
},
onConfirmTap: () async {
launchUrl(Uri.parse("tel://" + "011 525 9553"));
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
},
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
], ],

@ -0,0 +1,62 @@
import 'package:flutter/material.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/inpatient_services/inpatient_services_view_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:provider/provider.dart';
class MedicalInstructionsPage extends StatelessWidget {
const MedicalInstructionsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView(
title: "Medical Instructions",
child: Padding(
padding: EdgeInsets.all(24.h),
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.r,
hasShadow: true,
),
child: Consumer<InpatientServicesViewModel>(builder: (context, inpatientServicesVM, child) {
return inpatientServicesVM.isMedicalInstructionsLoading
? ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: 5,
itemBuilder: (context, index) {
return Column(
children: [
"Lorem <i>ipsum dolor sit</i> amet, consectetur <b>adipiscing elit</b>".toText16().toShimmer2(),
SizedBox(
height: 16.h,
),
],
).paddingSymmetrical(24.h, 16.h);
},
)
: inpatientServicesVM.getMedicalInstructionsList.first.medicaLInstructionsField!.isNotEmpty
? ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: inpatientServicesVM.getMedicalInstructionsList.first.medicaLInstructionsField!.length,
itemBuilder: (context, index) {
final instruction = inpatientServicesVM.getMedicalInstructionsList.first.medicaLInstructionsField![index];
return "${instruction.descriptionField}".toText16(weight: FontWeight.w500).paddingSymmetrical(24.h, 16.h);
},
)
: Utils.getNoDataWidget(context);
}),
),
),
),
);
}
}

@ -0,0 +1,103 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.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/dependencies.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/inpatient_services/inpatient_services_view_model.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.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/input_widget.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import '../../../generated/locale_keys.g.dart';
class PatientRelationOfficeWidget extends StatelessWidget {
PatientRelationOfficeWidget({super.key, required this.inPatientServicesViewModel});
InpatientServicesViewModel inPatientServicesViewModel;
final TextEditingController notesTextController = TextEditingController();
late AppState appState;
@override
Widget build(BuildContext context) {
appState = getIt.get<AppState>();
return Padding(
padding: EdgeInsets.all(16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"How we may assist you?".toText16(isBold: true),
SizedBox(
height: 16.h,
),
TextInputWidget(
padding: EdgeInsets.all(8.h),
labelText: LocaleKeys.details.tr(context: context),
hintText: "",
controller: notesTextController,
keyboardType: TextInputType.text,
isEnable: true,
prefix: null,
autoFocus: true,
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
leadingIcon: AppAssets.notes_icon,
hasError: false,
errorMessage: "",
),
SizedBox(
height: 24.h,
),
CustomButton(
text: LocaleKeys.send.tr(context: context),
onPressed: () {
LoaderBottomSheet.showLoader();
inPatientServicesViewModel.insertInPatientOrder(
getAdmissionInfoResponseModel: inPatientServicesViewModel.getAdmissionInfoResponseModel!,
typeID: 1,
patientName: "${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}",
patientNameAR: "${appState.getAuthenticatedUser()!.firstNameN!} ${appState.getAuthenticatedUser()!.lastNameN!}",
patientMobileNo: appState.getAuthenticatedUser()!.mobileNumber!,
comments: notesTextController.text,
onError: (String errorMessage) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getErrorWidget(loadingText: errorMessage).paddingSymmetrical(0.h, 24.h),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: false,
isAutoDismiss: true);
},
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getSuccessWidget(loadingText: LocaleKeys.requestSubmittedSuccessfully.tr()).paddingSymmetrical(0.h, 24.h), callBackFunc: () {
Navigator.of(context).pop();
}, isFullScreen: false, isCloseButtonVisible: false, isAutoDismiss: true);
});
},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w600,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 50.h,
icon: AppAssets.sendEmailIcon,
iconColor: Colors.white,
iconSize: 18.h,
),
],
),
);
}
}
Loading…
Cancel
Save